fix: manage if one player did not send a propositon
This commit is contained in:
parent
a99f7dca5c
commit
5f0704c2f1
@ -16,7 +16,6 @@ public class PropositionHandler : MonoBehaviour
|
|||||||
|
|
||||||
public void ShowQuestion(Question currentQuestion)
|
public void ShowQuestion(Question currentQuestion)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<Proposition> props = currentQuestion.propositions.Values.ToList();
|
List<Proposition> props = currentQuestion.propositions.Values.ToList();
|
||||||
string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en;
|
string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en;
|
||||||
promptLabel.text = enPrompt;
|
promptLabel.text = enPrompt;
|
||||||
@ -24,14 +23,21 @@ public void ShowQuestion(Question currentQuestion)
|
|||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
int index = i; // Capture la valeur de i pour cette itération
|
int index = i; // Capture la valeur de i pour cette itération
|
||||||
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
|
if(props[i].photoUrl == null)
|
||||||
{
|
{
|
||||||
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
|
Debug.Log("One player did not send a proposition !", this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
|
||||||
{
|
{
|
||||||
Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
|
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
|
||||||
btns[index].sprite = sprite; // Utilise l'index local au lieu de i
|
{
|
||||||
}));
|
Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
|
||||||
});
|
btns[index].sprite = sprite; // Utilise l'index local au lieu de i
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user