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();
photo = null;
photoBox.texture = null;
freezeButton.gameObject.SetActive(true);
resumeButton.gameObject.SetActive(false);
}

View File

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

View File

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