From 65dfe37f968803e4e5d56bfac3eec1c4f3ff01ca Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 28 Jan 2024 17:35:11 +0100 Subject: [PATCH] fix: gamemanager --- Assets/Scenes/PhoneView.unity | 14 ++++++++++++++ Assets/Scripts/PropositionHandler.cs | 12 +++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index 01a9286..3db6148 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -1262,6 +1262,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 531335862} + - component: {fileID: 531335863} m_Layer: 5 m_Name: VotePicturesState m_TagString: Untagged @@ -1292,6 +1293,19 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &531335863 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531335861} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 02c0fa5c3e6cb4ce29942d8cb857076e, type: 3} + m_Name: + m_EditorClassIdentifier: + gameManager: {fileID: 429358653} --- !u!1 &563000513 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PropositionHandler.cs b/Assets/Scripts/PropositionHandler.cs index 759adcf..40a66b1 100644 --- a/Assets/Scripts/PropositionHandler.cs +++ b/Assets/Scripts/PropositionHandler.cs @@ -12,24 +12,26 @@ public class PropositionDownload : MonoBehaviour // Start is called before the first frame update void Start() { - + } // Update is called once per frame void Update() { - + } void OnEnable() { List props = gameManager.myRoom.questions[gameManager.myRoom.currentQuestionId].propositions.Values.ToList(); - for (int i = 0; i < 2; i++) { - storageManager.DownloadImage(props[i].photoUrl, (Texture texture) => { + for (int i = 0; i < 2; i++) + { + StartCoroutine(storageManager.DownloadImage(props[i].photoUrl, (Texture texture) => + { Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero); btns[i].sprite = sprite; - }); + })); } }