WIP restart same players

This commit is contained in:
Fangh 2024-02-04 12:04:24 +01:00
parent e402e01ec4
commit 723edde647
3 changed files with 10 additions and 18 deletions

View File

@ -49,6 +49,7 @@ public void WebcamResume()
wTexture.Play(); wTexture.Play();
photo = null; photo = null;
photoBox.texture = null;
freezeButton.gameObject.SetActive(true); freezeButton.gameObject.SetActive(true);
resumeButton.gameObject.SetActive(false); resumeButton.gameObject.SetActive(false);
} }

View File

@ -341,20 +341,13 @@ private void OnNewGameState()
{ {
case (int)GameState.EnteringName: case (int)GameState.EnteringName:
{ {
if (EndGame.activeInHierarchy) EndGame.SetActive(false);
{ HomeConnection.SetActive(true);
EndGame.SetActive(false);
HomeConnection.SetActive(true);
}
break; break;
} }
case (int)GameState.Explanation: case (int)GameState.Explanation:
{ {
if (EndGame.activeInHierarchy) EndGame.SetActive(false);
{
EndGame.SetActive(false);
}
WaitingRoom.SetActive(false); WaitingRoom.SetActive(false);
BeforeStart.SetActive(true); BeforeStart.SetActive(true);
endOfViewDate = DateTime.Now.AddSeconds(4); endOfViewDate = DateTime.Now.AddSeconds(4);
@ -473,10 +466,11 @@ public void OnClickSubmitSignIn()
public void onClickSamePlayers() public void onClickSamePlayers()
{ {
myRoom.currentState = (int)GameState.Explanation; Room newRoom = myRoom;
myRoom.questions = null; newRoom.currentState = (int)GameState.Explanation;
myRoom.currentQuestionId = 0; newRoom.questions.Clear();
string json = JsonConvert.SerializeObject(myRoom); newRoom.currentQuestionId = 0;
string json = JsonConvert.SerializeObject(newRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task => myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{ {

View File

@ -6,12 +6,9 @@
using UnityEngine; using UnityEngine;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Linq; using System.Linq;
using Google.MiniJSON;
using Firebase.Storage; using Firebase.Storage;
using System.Security.Policy;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections; using System.Collections;
using System.Security.Cryptography;
public class RoomManager : MonoBehaviour public class RoomManager : MonoBehaviour
{ {
@ -138,7 +135,6 @@ private void Initialize()
/// <summary> /// <summary>
/// Check all the rooms in the server and give back the number already taken /// Check all the rooms in the server and give back the number already taken
/// </summary> /// </summary>
private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked) private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked)
{ {
QueryRoomsInDatabase(onlineRooms => QueryRoomsInDatabase(onlineRooms =>
@ -288,6 +284,7 @@ private void OnNewGameStateStarted()
case (int)GameState.Explanation: case (int)GameState.Explanation:
Debug.Log("New State : Explanation"); Debug.Log("New State : Explanation");
scoringPage.gameObject.SetActive(false); //if we come back from a new game
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
explanationPage.SetActive(true); explanationPage.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);