diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs
index 6c1ba8f..2ecf8f9 100644
--- a/Assets/Scripts/GameManager.cs
+++ b/Assets/Scripts/GameManager.cs
@@ -131,7 +131,6 @@ private void Update()
}
-
private void Initialize()
{
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
@@ -276,50 +275,6 @@ public void StartGame()
}
}
- ///
- /// Dislay on the screen the current prompt ask to you and another player
- /// Also show all the camera stuff
- ///
- /// The prompt to display
- public void MakeAProposition(Prompt _prompt)
- {
- //currentState = GameState.MakeProposition;
- }
-
- ///
- /// Create a proposition from the picture taken and send it to server.
- /// Then go to next proposition (if any) or the page "WaitingForOtherPlayers"
- ///
- public void SubmitProposition()
- {
- Proposition temp = new Proposition();
- }
-
- ///
- /// Display the voting page
- ///
- public void StartToVote()
- {
-
- }
-
- ///
- /// Choose one result and send it to the server
- /// Then go to the next vote (if any) or to the page "WaitingForOtherPlayers"
- ///
- public void Vote()
- {
-
- }
-
- ///
- /// Display the UI of the end screen
- ///
- public void DisplayEndScreen()
- {
-
- }
-
///
/// Automatically called when something change in your room
///
@@ -390,11 +345,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
}
case (int)GameState.PropositionsSent:
{
- if (TakePicture.activeInHierarchy)
- {
- TakePicture.SetActive(false);
- WaitingOtherPlayers.SetActive(true);
- }
break;
}
case (int)GameState.MakeVote:
@@ -422,6 +372,22 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
}
}
+ ///
+ /// Call this to wait for other players
+ ///
+ public void WaitForPlayers()
+ {
+ if (TakePicture.activeInHierarchy)
+ {
+ TakePicture.SetActive(false);
+ }
+ if(VotePicture.activeInHierarchy)
+ {
+ VotePicture.SetActive(false);
+ }
+ WaitingOtherPlayers.SetActive(true);
+ }
+
private void UpdateDisplayedListUser(List players)
{
diff --git a/Assets/Scripts/QuestionHandler.cs b/Assets/Scripts/QuestionHandler.cs
index 19b9346..5ed7fbe 100644
--- a/Assets/Scripts/QuestionHandler.cs
+++ b/Assets/Scripts/QuestionHandler.cs
@@ -10,7 +10,7 @@ public class QuestionHandler : MonoBehaviour
public TextMeshProUGUI explainText;
public PromptList promptList;
private List player2questions;
- private int currentQuestion = 1;
+ private int currentQuestion = 0;
void OnEnable()
{
@@ -22,12 +22,12 @@ void OnEnable()
void OnDisable()
{
player2questions = null;
- currentQuestion = 1;
+ currentQuestion = 0;
}
void Redraw(int currentQuestion)
{
- Prompt prompt = promptList.prompts.Find(x => x.id == player2questions[currentQuestion - 1].promptId);
+ Prompt prompt = promptList.prompts.Find(x => x.id == player2questions[currentQuestion].promptId);
Debug.Log(JsonUtility.ToJson(prompt));
explainText.SetText(prompt.en);
@@ -37,23 +37,27 @@ void Redraw(int currentQuestion)
int GetPropRef(Player player)
{
- return gameManager.myRoom.questions[currentQuestion - 1].propositions.First(x => x.Value.owner.id == player.id).Key;
+ return gameManager.myRoom.questions[currentQuestion].propositions.First(x => x.Value.owner.id == player.id).Key;
}
public void OnSubmitButton()
{
- StorageManager storageManager = managers.GetComponent();
- storageManager.UploadPhoto(
+ managers.GetComponent().UploadPhoto(
gameManager.myRoom.code,
gameManager.currentPlayer.id,
- currentQuestion -1,
+ currentQuestion,
GetPropRef(gameManager.currentPlayer));
- if (currentQuestion < 2) {
+ if (currentQuestion == 1)
+ {
+ gameManager.myRoom.currentState = (int)GameState.PropositionsSent;
+ gameManager.WaitForPlayers();
+ return;
+ }
+ else
+ {
currentQuestion++;
Redraw(currentQuestion);
- } else {
- gameManager.myRoom.currentState = (int) GameState.PropositionsSent;
}
}