wip: try to know why state doesn't update on phone
This commit is contained in:
parent
63bcb59d72
commit
211aa89485
@ -28,6 +28,20 @@ public Room(string _code)
|
||||
currentState = 1; //default by PC
|
||||
}
|
||||
|
||||
public Room Copy()
|
||||
{
|
||||
Room newRoom = new Room(this.code)
|
||||
{
|
||||
questions = new Dictionary<int, Question>(this.questions),
|
||||
players = new Dictionary<string, Player>(this.players),
|
||||
currentQuestionId = this.currentQuestionId,
|
||||
creationDate = this.creationDate,
|
||||
currentState = this.currentState
|
||||
};
|
||||
|
||||
return newRoom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the only player with a specific ID
|
||||
/// </summary>
|
||||
|
@ -289,7 +289,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (e?.Snapshot?.GetRawJsonValue() != null)
|
||||
{
|
||||
string JSON = e.Snapshot.GetRawJsonValue();
|
||||
@ -307,6 +306,7 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
|
||||
if (myRoom.currentState != (int)lastState)
|
||||
{
|
||||
OnNewGameState();
|
||||
@ -468,7 +468,7 @@ public void OnClickSubmitSignIn()
|
||||
public void onClickSamePlayers()
|
||||
{
|
||||
Debug.Log("Play with same players !", this);
|
||||
Room newRoom = myRoom;
|
||||
Room newRoom = myRoom.Copy();
|
||||
newRoom.currentState = (int)GameState.Explanation;
|
||||
newRoom.questions.Clear();
|
||||
newRoom.currentQuestionId = 0;
|
||||
@ -486,7 +486,7 @@ public void onClickSamePlayers()
|
||||
public void onClickNewPlayers()
|
||||
{
|
||||
Debug.Log("Play with new players !", this);
|
||||
Room newRoom = myRoom;
|
||||
Room newRoom = myRoom.Copy();
|
||||
newRoom.currentState = (int)GameState.EnteringName;
|
||||
newRoom.currentQuestionId = 0;
|
||||
newRoom.questions = null;
|
||||
|
Loading…
Reference in New Issue
Block a user