Merge branch 'main' of github.com:LeGall29/GGJ2024
This commit is contained in:
commit
4d0a84b6be
@ -6,7 +6,18 @@
|
|||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class Question
|
public class Question
|
||||||
{
|
{
|
||||||
|
public string id;
|
||||||
public string promptId;
|
public string promptId;
|
||||||
public Dictionary<string, Proposition> propositions;
|
public Dictionary<string, Proposition> propositions;
|
||||||
public double creationDate;
|
public double creationDate;
|
||||||
|
|
||||||
|
public Proposition GetFirstProposition()
|
||||||
|
{
|
||||||
|
return propositions["0"];
|
||||||
|
}
|
||||||
|
public Proposition GetSecondProposition()
|
||||||
|
{
|
||||||
|
return propositions["1"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class Room
|
|||||||
public string code;
|
public string code;
|
||||||
public Dictionary<string, Question> questions;
|
public Dictionary<string, Question> questions;
|
||||||
public Dictionary<string, Player> players;
|
public Dictionary<string, Player> players;
|
||||||
public int currentQuestion;
|
public string currentQuestionId;
|
||||||
public double creationDate;
|
public double creationDate;
|
||||||
public int currentState;
|
public int currentState;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public Room(string _code)
|
|||||||
creationDate = DateTime.Now.ToOADate();
|
creationDate = DateTime.Now.ToOADate();
|
||||||
players = new Dictionary<string, Player>();
|
players = new Dictionary<string, Player>();
|
||||||
questions = new Dictionary<string, Question>();
|
questions = new Dictionary<string, Question>();
|
||||||
currentQuestion = 0;
|
currentQuestionId = "";
|
||||||
currentState = 1; //default by PC
|
currentState = 1; //default by PC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +321,10 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
|||||||
}
|
}
|
||||||
case (int)GameState.WaitingForOtherPlayersToJoin:
|
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckIfIAmTheFirst(myRoom.GetPlayerList());
|
CheckIfIAmTheFirst(myRoom.GetPlayerList());
|
||||||
UpdateDisplayedListUser(myRoom.GetPlayerList());
|
UpdateDisplayedListUser(myRoom.GetPlayerList());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (int)GameState.Explanation:
|
case (int)GameState.Explanation:
|
||||||
@ -407,8 +407,8 @@ public void OnClickSubmitSignIn()
|
|||||||
public void onClickSamePlayers()
|
public void onClickSamePlayers()
|
||||||
{
|
{
|
||||||
myRoom.currentState = (int)GameState.Explanation;
|
myRoom.currentState = (int)GameState.Explanation;
|
||||||
myRoom.currentQuestion = 2;
|
|
||||||
myRoom.questions = null;
|
myRoom.questions = null;
|
||||||
|
myRoom.currentQuestionId = string.Empty;
|
||||||
string json = JsonUtility.ToJson(myRoom);
|
string json = JsonUtility.ToJson(myRoom);
|
||||||
|
|
||||||
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
|
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
|
||||||
@ -423,7 +423,7 @@ public void onClickSamePlayers()
|
|||||||
public void onClickNewPlayers()
|
public void onClickNewPlayers()
|
||||||
{
|
{
|
||||||
myRoom.currentState = (int)GameState.EnteringName;
|
myRoom.currentState = (int)GameState.EnteringName;
|
||||||
myRoom.currentQuestion = 0;
|
myRoom.currentQuestionId = string.Empty;
|
||||||
myRoom.questions = null;
|
myRoom.questions = null;
|
||||||
myRoom.players = null;
|
myRoom.players = null;
|
||||||
string json = JsonUtility.ToJson(myRoom);
|
string json = JsonUtility.ToJson(myRoom);
|
||||||
|
@ -44,11 +44,9 @@ public class RoomManager : MonoBehaviour
|
|||||||
private float votingCurrentTime = 0;
|
private float votingCurrentTime = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contain the infos about the current displayed question (during votes)
|
/// Contain all the question for this game session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Question currentQuestion;
|
private Dictionary<string, Question> questions = new Dictionary<string, Question>();
|
||||||
|
|
||||||
private List<Question> questions;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When this is equal to questions.Count, go to score page
|
/// When this is equal to questions.Count, go to score page
|
||||||
@ -323,7 +321,6 @@ public void GeneratePrompts()
|
|||||||
creationDate = DateTime.Now.ToOADate(),
|
creationDate = DateTime.Now.ToOADate(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
string JSON = JsonConvert.SerializeObject(questions);
|
string JSON = JsonConvert.SerializeObject(questions);
|
||||||
realtimeDB.Child("rooms").Child(myRoom.code).Child("questions").SetRawJsonValueAsync(JSON);
|
realtimeDB.Child("rooms").Child(myRoom.code).Child("questions").SetRawJsonValueAsync(JSON);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user