Merge branch 'main' of github.com:LeGall29/GGJ2024
This commit is contained in:
commit
c84cb35bfe
@ -85,7 +85,6 @@ private void Update()
|
||||
|
||||
if (duration.TotalMilliseconds <= 0)
|
||||
{
|
||||
Debug.Log("It's time to make proposition !", this);
|
||||
SendRoomState(GameState.MakeProposition);
|
||||
}
|
||||
}
|
||||
@ -104,11 +103,21 @@ private void Update()
|
||||
{
|
||||
//check if this player has send 2 propositions
|
||||
bool playerHasAnswerBoth = true;
|
||||
foreach (Proposition p in propositionsPerPlayers[labelByID.Key])
|
||||
//Debug.Log($"trying to check if player {labelByID.Key} has send 2 propositions");
|
||||
//Debug.Log($"player {labelByID.Key} has send {propositionsPerPlayers[labelByID.Key].Length} propositions");
|
||||
if (propositionsPerPlayers[labelByID.Key].Length < 2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(p.photoUrl))
|
||||
playerHasAnswerBoth = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Proposition p in propositionsPerPlayers[labelByID.Key])
|
||||
{
|
||||
playerHasAnswerBoth = false;
|
||||
if (string.IsNullOrEmpty(p.photoUrl))
|
||||
{
|
||||
Debug.Log($"player {labelByID.Key} proposition URL : {p.photoUrl}");
|
||||
playerHasAnswerBoth = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if its the case
|
||||
@ -257,6 +266,7 @@ public void HostHasStartedGame()
|
||||
waitingForPlayersPage.SetActive(false);
|
||||
endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime);
|
||||
|
||||
|
||||
propositionLabelsByID.Clear();
|
||||
|
||||
//display only correct numbers of labels
|
||||
@ -264,6 +274,7 @@ public void HostHasStartedGame()
|
||||
{
|
||||
TextMeshProUGUI tmp = waitingForPropositionsLabels[i];
|
||||
tmp.gameObject.SetActive(i < myRoom.players.Count);
|
||||
Debug.Log($"toggling {tmp.gameObject.name} accordingly to its player connection");
|
||||
}
|
||||
|
||||
//registers the labels per player ID
|
||||
@ -271,7 +282,8 @@ public void HostHasStartedGame()
|
||||
for (int i = 0; i < orderedPlayers.Count; i++)
|
||||
{
|
||||
propositionLabelsByID.Add(orderedPlayers[i].id, waitingForPropositionsLabels[i]);
|
||||
waitingForPlayersLabels[i].text = orderedPlayers[i].name;
|
||||
waitingForPropositionsLabels[i].text = orderedPlayers[i].name;
|
||||
Debug.Log($"{waitingForPropositionsLabels[i].name} label should be {orderedPlayers[i].name}");
|
||||
}
|
||||
|
||||
//Register all propositions of each players
|
||||
@ -279,9 +291,8 @@ public void HostHasStartedGame()
|
||||
{
|
||||
List<Proposition> propositionsForPlayer = myRoom.GetPropositionsByPlayer(p);
|
||||
propositionsPerPlayers.Add(p.id, propositionsForPlayer.ToArray());
|
||||
Debug.Log($"registering propositions for player {p.name}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void GeneratePrompts()
|
||||
@ -401,6 +412,10 @@ private void OnNewGameStateStarted()
|
||||
explanationPage.SetActive(true);
|
||||
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
|
||||
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
|
||||
|
||||
//generate all the questions during the explanation
|
||||
GeneratePrompts();
|
||||
|
||||
break;
|
||||
case (int)GameState.MakeProposition:
|
||||
Debug.Log("New State : MakeProposition");
|
||||
@ -416,6 +431,7 @@ private void OnNewGameStateStarted()
|
||||
/// </summary>
|
||||
private void CheckPlayersPropositions()
|
||||
{
|
||||
Debug.Log("Check every Players Propositions");
|
||||
allPlayersHasProposedTwoPictures = true;
|
||||
|
||||
foreach (var propositionsByPlayer in propositionsPerPlayers)
|
||||
@ -423,7 +439,10 @@ private void CheckPlayersPropositions()
|
||||
foreach (Proposition p in propositionsByPlayer.Value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(p.photoUrl))
|
||||
{
|
||||
Debug.Log($"player {p.owner} has a proposition without an URL");
|
||||
allPlayersHasProposedTwoPictures = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user