Snaparazzi/Assets/Scripts/PropositionHandler.cs

46 lines
1.1 KiB
C#
Raw Normal View History

2024-01-28 16:34:11 +00:00
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class PropositionDownload : MonoBehaviour
{
public GameManager gameManager;
public StorageManager storageManager;
public Image[] btns;
// Start is called before the first frame update
void Start()
{
2024-01-28 16:35:11 +00:00
2024-01-28 16:34:11 +00:00
}
// Update is called once per frame
void Update()
{
2024-01-28 16:35:11 +00:00
2024-01-28 16:34:11 +00:00
}
void OnEnable()
{
List<Proposition> props = gameManager.myRoom.questions[gameManager.myRoom.currentQuestionId].propositions.Values.ToList();
2024-01-28 16:35:11 +00:00
for (int i = 0; i < 2; i++)
{
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
2024-01-28 16:35:11 +00:00
{
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
{
Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
btns[i].sprite = sprite;
}));
});
2024-01-28 16:34:11 +00:00
}
}
void OnDisable()
{
}
}