From e402e01ec482d8ad8eb1f9002d44e369061e9ff7 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 12:02:25 +0100 Subject: [PATCH 01/17] V0.2.0 --- ProjectSettings/EditorBuildSettings.asset | 5 ++++- ProjectSettings/ProjectSettings.asset | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index b3840ef..ea5da5c 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,7 +5,10 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 1 + - enabled: 0 path: Assets/Scenes/PhoneView.unity guid: a409508fe0f675b4a8e1a675d96ede3b + - enabled: 1 + path: Assets/Scenes/ComputerView.unity + guid: 9fc0d4010bbf28b4594072e72b8655ab m_configObjects: {} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 0bbfc70..985b0e3 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -139,7 +139,7 @@ PlayerSettings: loadStoreDebugModeEnabled: 0 visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 - bundleVersion: 0.1 + bundleVersion: 0.2.0 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 @@ -165,7 +165,7 @@ PlayerSettings: Standalone: fr.spnaparazzi iPhone: fr.snaparazzi buildNumber: - Standalone: 0 + Standalone: 2 VisionOS: 0 iPhone: 0 tvOS: 0 From 723edde6476f130f27035bb78923e72a7abc5d96 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 12:04:24 +0100 Subject: [PATCH 02/17] WIP restart same players --- Assets/Scripts/CameraManager.cs | 1 + Assets/Scripts/GameManager.cs | 22 ++++++++-------------- Assets/Scripts/RoomManager.cs | 5 +---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Assets/Scripts/CameraManager.cs b/Assets/Scripts/CameraManager.cs index e1efc06..982d41f 100644 --- a/Assets/Scripts/CameraManager.cs +++ b/Assets/Scripts/CameraManager.cs @@ -49,6 +49,7 @@ public void WebcamResume() wTexture.Play(); photo = null; + photoBox.texture = null; freezeButton.gameObject.SetActive(true); resumeButton.gameObject.SetActive(false); } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 0fdfada..766390b 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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 => { diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 11f476a..74c8e64 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -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() /// /// Check all the rooms in the server and give back the number already taken /// - private void WhichCodesAreAlreadyUsed(Action> 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); From 825c69fcc1615eda0a1fdc8db0649e53f3fd6c4f Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 12:23:12 +0100 Subject: [PATCH 03/17] add debug logs --- Assets/Scripts/GameManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 766390b..380f46f 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -285,7 +285,6 @@ public void StartGame() /// private void OnRoomUpdate(object sender, ValueChangedEventArgs e) { - Debug.Log("begin OnRoomUpdate"); GameState lastState = (GameState)myRoom.currentState; try @@ -294,8 +293,8 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e) if (e?.Snapshot?.GetRawJsonValue() != null) { string JSON = e.Snapshot.GetRawJsonValue(); + Debug.Log($"Room has been updated : {JSON}", this); myRoom = JsonConvert.DeserializeObject(e.Snapshot.GetRawJsonValue()); - } } catch (Exception ex) @@ -304,7 +303,7 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e) } if (myRoom == null) { - Debug.Log("myroom is null"); + Debug.LogError("Got an update for an empty room.", this); return; } @@ -347,7 +346,9 @@ private void OnNewGameState() } case (int)GameState.Explanation: { + Debug.Log("Explanation time.", this); EndGame.SetActive(false); + WaitingOtherPlayers.SetActive(false); WaitingRoom.SetActive(false); BeforeStart.SetActive(true); endOfViewDate = DateTime.Now.AddSeconds(4); From 2de1611c4d6bafcee8fdf8003b3509595eaa6d31 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 12:42:57 +0100 Subject: [PATCH 04/17] wip: reset values --- Assets/Scripts/RoomManager.cs | 2 -- Assets/Scripts/StorageManager.cs | 32 ----------------------- Assets/Scripts/VotingPage.cs | 6 ++++- Assets/Scripts/WaitForPropositionsPage.cs | 3 +++ 4 files changed, 8 insertions(+), 35 deletions(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 74c8e64..cee72ae 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -259,8 +259,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value) case (int)GameState.WaitingForOtherPlayersToJoin: UpdateConnectedPlayerList(myRoom.GetPlayerList()); break; - case (int)GameState.Explanation: - break; case (int)GameState.MakeProposition: waitForPropositionsPage.OnRoomUpdate(myRoom); break; diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 5ce5b80..5d6d451 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -65,7 +65,6 @@ public void DeleteFileOfRoom(Room _room, Action callBack_OnFinish) Debug.Log($"There is no files to delete for room {_room.code}", this); callBack_OnFinish.Invoke(); } - } private void RunDeleteTasks(List deleteTasks, Action callback_OnFinish) @@ -80,37 +79,6 @@ private void RunDeleteTasks(List deleteTasks, Action callback_OnFinish) }); } - /* - private IEnumerator RunDeleteTasks(List deleteTasks, Action callback_OnFinish) - { - int taskCount = deleteTasks.Count; - Debug.Log($"There are {taskCount} files to delete", this); - foreach (Task task in deleteTasks) - { - task.ContinueWith((completedTask) => - { - // This code will be executed when the task is completed. - taskCount--; - }); - - // Start the task - task.Start(); - } - while (taskCount > 0) - { - yield return null; - } - callback_OnFinish?.Invoke(); - } - - private Task DeletePhoto(string _gsURL) - { - string temp = _gsURL; - StorageReference imageRef = FirebaseStorage.DefaultInstance.GetReferenceFromUrl(temp); - Debug.Log($"deleting {temp}", this); - return imageRef.DeleteAsync(); - }*/ - public void UploadPhoto(string roomCode, string playerId, int question, int proposition, Action callback_OnPhotoUploaded) { Texture2D photo = cameraManager.GetPhoto(); diff --git a/Assets/Scripts/VotingPage.cs b/Assets/Scripts/VotingPage.cs index b77157b..0894796 100644 --- a/Assets/Scripts/VotingPage.cs +++ b/Assets/Scripts/VotingPage.cs @@ -94,10 +94,13 @@ private void EndCurrentQuestion() public void ShowVotingPage(DatabaseReference _roomRef, Dictionary _currentPlayers, Dictionary _questions, Action _callback_OnVoteEnded) { Debug.Log("Initializing voting page"); - this.gameObject.SetActive(true); roomRef = _roomRef; currentPlayers = _currentPlayers; OnVoteEnded = _callback_OnVoteEnded; + allPlayersHaveVotedForCurrentQuestion = false; + endOfTimer = DateTime.MinValue; + remainingQuestions.Clear(); + currentQuestion = null; Question[] _questionArray = _questions.Values.ToArray(); numberOfQuestions = _questionArray.Length; @@ -108,6 +111,7 @@ public void ShowVotingPage(DatabaseReference _roomRef, Dictionary Date: Sun, 4 Feb 2024 13:02:58 +0100 Subject: [PATCH 05/17] wip: add some security --- Assets/Scripts/GameManager.cs | 16 +++++++++++----- Assets/Scripts/QuestionHandler.cs | 15 ++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 380f46f..03acb0c 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -467,6 +467,7 @@ public void OnClickSubmitSignIn() public void onClickSamePlayers() { + Debug.Log("Play with same players !", this); Room newRoom = myRoom; newRoom.currentState = (int)GameState.Explanation; newRoom.questions.Clear(); @@ -484,11 +485,13 @@ public void onClickSamePlayers() } public void onClickNewPlayers() { - myRoom.currentState = (int)GameState.EnteringName; - myRoom.currentQuestionId = 0; - myRoom.questions = null; - myRoom.players = null; - string json = JsonConvert.SerializeObject(myRoom); + Debug.Log("Play with new players !", this); + Room newRoom = myRoom; + newRoom.currentState = (int)GameState.EnteringName; + newRoom.currentQuestionId = 0; + newRoom.questions = null; + newRoom.players = null; + string json = JsonConvert.SerializeObject(newRoom); myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task => { @@ -502,6 +505,9 @@ public void onClickNewPlayers() private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlineValue) { + if (onlineValue == null || onlineValue.Snapshot == null || onlineValue.Snapshot.Value == null) + return; + int questionId = onlineValue.Snapshot.Value.ConvertTo(); Debug.Log($"new question ! Q{(onlineValue.Snapshot.Value.ConvertTo())}"); diff --git a/Assets/Scripts/QuestionHandler.cs b/Assets/Scripts/QuestionHandler.cs index 2aeae02..27bdd7c 100644 --- a/Assets/Scripts/QuestionHandler.cs +++ b/Assets/Scripts/QuestionHandler.cs @@ -12,7 +12,7 @@ public class QuestionHandler : MonoBehaviour public PromptList promptList; private GameManager gameManager; - private List questionsToAnswer; + private List questionsToAnswer = new List(); private int activeAnsweredQuestionIndex = 0; private const int FirstQuestionIndex = 0; @@ -25,21 +25,14 @@ public class QuestionHandler : MonoBehaviour /// void OnEnable() { + activeAnsweredQuestionIndex = FirstQuestionIndex; + submitButton.interactable = true; + submitButton.GetComponent().text = "Submit"; gameManager = managers.GetComponent(); questionsToAnswer = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer); Redraw(activeAnsweredQuestionIndex); } - /// - /// Called when the script is disabled. - /// Cleans up resources and resets the activeAnsweredQuestionIndex. - /// - void OnDisable() - { - questionsToAnswer = null; - activeAnsweredQuestionIndex = FirstQuestionIndex; - } - /// /// Redraws the UI with the information from the current question. /// From 63bcb59d72e3e16a3530495e7463602f94e6de71 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:11:24 +0100 Subject: [PATCH 06/17] wip --- Assets/Scripts/GameManager.cs | 2 +- Assets/Scripts/WaitForPropositionsPage.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 03acb0c..0946c00 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -505,7 +505,7 @@ public void onClickNewPlayers() private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlineValue) { - if (onlineValue == null || onlineValue.Snapshot == null || onlineValue.Snapshot.Value == null) + if (onlineValue == null || onlineValue.Snapshot == null || onlineValue.Snapshot.Value == null || myRoom.questions == null || myRoom.questions.Count == 0) return; int questionId = onlineValue.Snapshot.Value.ConvertTo(); diff --git a/Assets/Scripts/WaitForPropositionsPage.cs b/Assets/Scripts/WaitForPropositionsPage.cs index f21206d..91d8bb9 100644 --- a/Assets/Scripts/WaitForPropositionsPage.cs +++ b/Assets/Scripts/WaitForPropositionsPage.cs @@ -26,6 +26,10 @@ public void Initialize(Room _myRoom, Action _onPropositionFinish) myRoom = _myRoom; allPlayersHasProposedTwoPictures = false; playersIdWhoHaveProposed.Clear(); + foreach(TextMeshProUGUI label in playerLabels) + { + label.color = Color.white; + } ShowPlayerLabels(); } From 211aa89485d32cefabedd2c305e3282f7a1ef94e Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:21:39 +0100 Subject: [PATCH 07/17] wip: try to know why state doesn't update on phone --- Assets/Scripts/DatabaseClasses/Room.cs | 14 ++++++++++++++ Assets/Scripts/GameManager.cs | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/DatabaseClasses/Room.cs b/Assets/Scripts/DatabaseClasses/Room.cs index 99c7496..cf2312c 100644 --- a/Assets/Scripts/DatabaseClasses/Room.cs +++ b/Assets/Scripts/DatabaseClasses/Room.cs @@ -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(this.questions), + players = new Dictionary(this.players), + currentQuestionId = this.currentQuestionId, + creationDate = this.creationDate, + currentState = this.currentState + }; + + return newRoom; + } + /// /// Return the only player with a specific ID /// diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 0946c00..98be0df 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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; From 764a39d053b16782cb9bf4b57b9ea825d3ae645f Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:32:08 +0100 Subject: [PATCH 08/17] fix: correct pages should toggle at correct time --- Assets/Scripts/GameManager.cs | 68 +++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 98be0df..fa48f50 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -340,56 +340,70 @@ private void OnNewGameState() { case (int)GameState.EnteringName: { + WaitingOtherPlayers.SetActive(false); + BeforeStart.SetActive(false); + TakePicture.SetActive(false); + VotePicture.SetActive(false); EndGame.SetActive(false); + HomeConnection.SetActive(true); break; } case (int)GameState.Explanation: { Debug.Log("Explanation time.", this); - EndGame.SetActive(false); + WaitingOtherPlayers.SetActive(false); + TakePicture.SetActive(false); WaitingRoom.SetActive(false); + VotePicture.SetActive(false); + EndGame.SetActive(false); + BeforeStart.SetActive(true); endOfViewDate = DateTime.Now.AddSeconds(4); break; } case (int)GameState.MakeProposition: { - if (BeforeStart.activeInHierarchy) - { - Debug.Log("It's photo time !", this); - BeforeStart.SetActive(false); - TakePicture.SetActive(true); - endOfViewDate = DateTime.Now.AddSeconds(60); - } + Debug.Log("It's photo time !", this); + WaitingOtherPlayers.SetActive(false); + BeforeStart.SetActive(false); + WaitingRoom.SetActive(false); + VotePicture.SetActive(false); + EndGame.SetActive(false); + + TakePicture.SetActive(true); + endOfViewDate = DateTime.Now.AddSeconds(60); break; } case (int)GameState.MakeVote: { - if (TakePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy) - { - Debug.Log("It's voting time !", this); - WaitingOtherPlayers.SetActive(false); - TakePicture.SetActive(false); - VotePicture.SetActive(true); - myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged; - } + Debug.Log("It's voting time !", this); + WaitingOtherPlayers.SetActive(false); + BeforeStart.SetActive(false); + WaitingRoom.SetActive(false); + TakePicture.SetActive(false); + EndGame.SetActive(false); + + VotePicture.SetActive(true); + myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged; break; } case (int)GameState.Score: { - if (VotePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy) - { - Debug.Log("it's scoring time !", this); - myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged; + Debug.Log("it's scoring time !", this); + myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged; - VotePicture.SetActive(false); - WaitingOtherPlayers.SetActive(false); - endGameFirstPlayer.SetActive(CheckIfIAmTheFirst(myRoom.GetPlayerList())); - endGameOtherPlayers.SetActive(!CheckIfIAmTheFirst(myRoom.GetPlayerList())); - EndGame.SetActive(true); - } + WaitingOtherPlayers.SetActive(false); + BeforeStart.SetActive(false); + WaitingRoom.SetActive(false); + TakePicture.SetActive(false); + VotePicture.SetActive(false); + + EndGame.SetActive(true); + + endGameFirstPlayer.SetActive(CheckIfIAmTheFirst(myRoom.GetPlayerList())); + endGameOtherPlayers.SetActive(!CheckIfIAmTheFirst(myRoom.GetPlayerList())); break; } @@ -514,7 +528,7 @@ private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlin Question q = myRoom.questions[questionId]; //do not vote for your question - if(myRoom.GetQuestionsByPlayer(currentPlayer).Contains(q)) + if (myRoom.GetQuestionsByPlayer(currentPlayer).Contains(q)) { WaitingOtherPlayers.SetActive(true); VotePicture.SetActive(false); From a99f7dca5cff7897098b36c72860d01252877abe Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:33:24 +0100 Subject: [PATCH 09/17] fix: only one background --- Assets/Scenes/ComputerView.unity | 375 +++++-------------------------- 1 file changed, 59 insertions(+), 316 deletions(-) diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index cba3e77..9eec57c 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -191,78 +191,6 @@ MonoBehaviour: m_Spacing: {x: 50, y: 50} m_Constraint: 0 m_ConstraintCount: 2 ---- !u!1 &9253746 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 9253747} - - component: {fileID: 9253749} - - component: {fileID: 9253748} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &9253747 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 9253746} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 581333954} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &9253748 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 9253746} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &9253749 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 9253746} - m_CullTransparentMesh: 1 --- !u!1 &45150984 GameObject: m_ObjectHideFlags: 0 @@ -291,7 +219,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 500028487} - {fileID: 619055281} - {fileID: 1798182258} - {fileID: 1350310808} @@ -720,6 +647,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (5) @@ -1489,6 +1420,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (4) @@ -1813,6 +1748,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (1) @@ -2110,78 +2049,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 411140634} m_CullTransparentMesh: 1 ---- !u!1 &427170778 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 427170779} - - component: {fileID: 427170781} - - component: {fileID: 427170780} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &427170779 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 427170778} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1117928115} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &427170780 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 427170778} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &427170781 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 427170778} - m_CullTransparentMesh: 1 --- !u!1 &440351810 GameObject: m_ObjectHideFlags: 0 @@ -2318,78 +2185,6 @@ MonoBehaviour: m_Spacing: {x: 150, y: 100} m_Constraint: 0 m_ConstraintCount: 2 ---- !u!1 &500028486 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 500028487} - - component: {fileID: 500028489} - - component: {fileID: 500028488} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &500028487 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 500028486} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 45150985} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &500028488 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 500028486} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &500028489 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 500028486} - m_CullTransparentMesh: 1 --- !u!1 &516717322 GameObject: m_ObjectHideFlags: 0 @@ -2495,7 +2290,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 9253747} - {fileID: 190388869} - {fileID: 1813019851} - {fileID: 98075281} @@ -2779,6 +2573,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1836364712} - {fileID: 1117928115} - {fileID: 45150985} - {fileID: 1730465903} @@ -3014,6 +2809,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker @@ -3261,6 +3060,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (7) @@ -4187,6 +3990,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (6) @@ -4526,6 +4333,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (3) @@ -5014,7 +4825,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 427170779} - {fileID: 2078353088} - {fileID: 1901141295} - {fileID: 1499472362} @@ -7638,7 +7448,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1542177990} - - {fileID: 1850877722} - {fileID: 1351333135} - {fileID: 1236996027} - {fileID: 1567271222} @@ -7977,7 +7786,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1803918110} - {fileID: 1165659435} - {fileID: 987875882} - {fileID: 157938956} @@ -8385,78 +8193,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1798182257} m_CullTransparentMesh: 1 ---- !u!1 &1803918109 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1803918110} - - component: {fileID: 1803918112} - - component: {fileID: 1803918111} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1803918110 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1803918109} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1730465903} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1803918111 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1803918109} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &1803918112 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1803918109} - m_CullTransparentMesh: 1 --- !u!1 &1805240025 GameObject: m_ObjectHideFlags: 0 @@ -8666,7 +8402,7 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1813019850} m_CullTransparentMesh: 1 ---- !u!1 &1850877721 +--- !u!1 &1836364711 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8674,9 +8410,9 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1850877722} - - component: {fileID: 1850877724} - - component: {fileID: 1850877723} + - component: {fileID: 1836364712} + - component: {fileID: 1836364714} + - component: {fileID: 1836364713} m_Layer: 5 m_Name: Background m_TagString: Untagged @@ -8684,35 +8420,35 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &1850877722 +--- !u!224 &1836364712 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1850877721} + m_GameObject: {fileID: 1836364711} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1660260834} + m_Father: {fileID: 610087870} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0.000030517578, y: 0} - m_SizeDelta: {x: 1920, y: 1080} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1850877723 +--- !u!114 &1836364713 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1850877721} + m_GameObject: {fileID: 1836364711} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} @@ -8723,20 +8459,23 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &1850877724 + m_Sprite: {fileID: 21300000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1836364714 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1850877721} + m_GameObject: {fileID: 1836364711} m_CullTransparentMesh: 1 --- !u!1 &1854893634 GameObject: @@ -9214,6 +8953,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} propertyPath: m_Name value: PlayerSticker (2) From 5f0704c2f11bba4ad86882ab5b98ac2d8bb73266 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:36:03 +0100 Subject: [PATCH 10/17] fix: manage if one player did not send a propositon --- Assets/Scripts/PropositionHandler.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/PropositionHandler.cs b/Assets/Scripts/PropositionHandler.cs index 5542af2..2e80919 100644 --- a/Assets/Scripts/PropositionHandler.cs +++ b/Assets/Scripts/PropositionHandler.cs @@ -16,7 +16,6 @@ public class PropositionHandler : MonoBehaviour public void ShowQuestion(Question currentQuestion) { - List props = currentQuestion.propositions.Values.ToList(); string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en; promptLabel.text = enPrompt; @@ -24,14 +23,21 @@ public void ShowQuestion(Question currentQuestion) for (int i = 0; i < 2; i++) { int index = i; // Capture la valeur de i pour cette itération - StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => + if(props[i].photoUrl == null) { - StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => + Debug.Log("One player did not send a proposition !", this); + } + else + { + StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => { - Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero); - btns[index].sprite = sprite; // Utilise l'index local au lieu de i - })); - }); + StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => + { + Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero); + btns[index].sprite = sprite; // Utilise l'index local au lieu de i + })); + }); + } } } From aa410f21e581b9bcc66db91f06c492736e616128 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:44:55 +0100 Subject: [PATCH 11/17] fix: remove a white square --- Assets/Scenes/ComputerView.unity | 76 -------------------------------- 1 file changed, 76 deletions(-) diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index 9eec57c..ab80515 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -6986,81 +6986,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1503133438} m_CullTransparentMesh: 1 ---- !u!1 &1542177989 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1542177990} - - component: {fileID: 1542177992} - - component: {fileID: 1542177991} - m_Layer: 5 - m_Name: Image - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1542177990 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1542177989} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1660260834} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -756, y: 200.00002} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1542177991 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1542177989} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 0} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &1542177992 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1542177989} - m_CullTransparentMesh: 1 --- !u!1 &1567271221 GameObject: m_ObjectHideFlags: 0 @@ -7447,7 +7372,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1542177990} - {fileID: 1351333135} - {fileID: 1236996027} - {fileID: 1567271222} From e9ac36970272a321100eda9185799058f7057783 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 13:57:13 +0100 Subject: [PATCH 12/17] fix: clearing room when new game --- Assets/Scripts/RoomManager.cs | 100 +++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index cee72ae..734f433 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -53,6 +53,11 @@ private void Awake() } private void Start() + { + InitializeFirstPage(); + } + + private void InitializeFirstPage() { explanationPage.SetActive(false); waitForPropositionsPage.gameObject.SetActive(false); @@ -98,29 +103,12 @@ private void ResetAllPlayerLabels() private bool deleteRoomFilesCompleted = false; private bool deleteRealtimeDBCompleted = false; - private IEnumerator OnApplicationQuit() + private void OnApplicationQuit() { - Debug.Log($"delete files of room {myRoom.code} from storage", this); - StorageManager.Instance.DeleteFileOfRoom(myRoom, () => + StartCoroutine(Coroutine_ClearCurrentRoom(() => { - Debug.Log($"cleaning photo files of room({myRoom.code})finish", this); - deleteRoomFilesCompleted = true; - }); - - Debug.Log($"delete realtimeDB room {myRoom.code}"); - realtimeDB.Child("rooms").Child(myRoom.code).RemoveValueAsync().ContinueWithOnMainThread(task => - { - Debug.Log($"room's({myRoom.code}) data has been deleted for database", this); - myRoom = null; - deleteRealtimeDBCompleted = true; - }); - - while (!deleteRoomFilesCompleted || !deleteRealtimeDBCompleted) - { - yield return null; // Yield until both tasks are completed - } - - Debug.Log("Everything is clean. You can go. Bye bye..."); + Debug.Log("You can go. Bye bye..."); + })); } private void Initialize() @@ -128,8 +116,51 @@ private void Initialize() FirebaseInitializer.Instance.onFirebaseReady -= Initialize; realtimeDB = FirebaseDatabase.DefaultInstance.RootReference; Debug.Log("Realtime DB initialized"); + ClearOldAndCreateNewRoom(); + } + + private void ClearOldAndCreateNewRoom() + { CleanOldRooms(); - CreateNewRoom(); + StartCoroutine(Coroutine_ClearCurrentRoom(() => + { + CreateNewRoom(); + })); + } + + private IEnumerator Coroutine_ClearCurrentRoom(Action callback_OnRoomClear = null) + { + if(myRoom == null || string.IsNullOrEmpty(myRoom.code)) + { + yield return null; + Debug.Log("There is no room to clean", this); + callback_OnRoomClear?.Invoke(); + } + else + { + Debug.Log($"delete files of room {myRoom.code} from storage", this); + StorageManager.Instance.DeleteFileOfRoom(myRoom, () => + { + Debug.Log($"cleaning photo files of room({myRoom.code})finish", this); + deleteRoomFilesCompleted = true; + }); + + Debug.Log($"delete realtimeDB room {myRoom.code}"); + realtimeDB.Child("rooms").Child(myRoom.code).RemoveValueAsync().ContinueWithOnMainThread(task => + { + Debug.Log($"room's({myRoom.code}) data has been deleted for database", this); + myRoom = null; + deleteRealtimeDBCompleted = true; + }); + + while (!deleteRoomFilesCompleted || !deleteRealtimeDBCompleted) + { + yield return null; // Yield until both tasks are completed + } + callback_OnRoomClear?.Invoke(); + + Debug.Log("Everything is clean."); + } } /// @@ -276,6 +307,10 @@ private void OnNewGameStateStarted() { switch (myRoom.currentState) { + case (int)GameState.EnteringName: //if game has been reset by a player on mobile + ClearOldAndCreateNewRoom(); + break; + case (int)GameState.WaitingForOtherPlayersToJoin: Debug.Log("New State : WaitingForOtherPlayersToJoin"); break; @@ -412,25 +447,4 @@ private void DeleteRoom(string _roomCode) Debug.Log($"Room {_roomCode} has been deleted"); }); } - - private async Task DoesPathExistAsync(StorageReference storageReference) - { - try - { - await storageReference.GetMetadataAsync(); - return true; // Path exists - } - catch (StorageException ex) - { - if (ex.ErrorCode == StorageException.ErrorObjectNotFound) - { - return false; // Path does not exist - } - else - { - Debug.LogException(ex); - return false; // Handle other errors as needed - } - } - } } From cf0a4d578cd6ea0900bd8ab1afc2017e083eb9d5 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:09:04 +0100 Subject: [PATCH 13/17] fix: display first page and unsubscribe from your old room --- Assets/Scripts/RoomManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 734f433..9dd62c9 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -62,6 +62,8 @@ private void InitializeFirstPage() explanationPage.SetActive(false); waitForPropositionsPage.gameObject.SetActive(false); votingPage.gameObject.SetActive(false); + scoringPage.gameObject.SetActive(false); + waitingForPlayersPage.SetActive(true); ResetAllPlayerLabels(); } @@ -133,11 +135,13 @@ private IEnumerator Coroutine_ClearCurrentRoom(Action callback_OnRoomClear = nul if(myRoom == null || string.IsNullOrEmpty(myRoom.code)) { yield return null; - Debug.Log("There is no room to clean", this); + Debug.Log("There is no last room to clean", this); callback_OnRoomClear?.Invoke(); } else { + realtimeDB.Child("rooms").Child(myRoom.code).ValueChanged -= OnRoomUpdate; + Debug.Log($"delete files of room {myRoom.code} from storage", this); StorageManager.Instance.DeleteFileOfRoom(myRoom, () => { @@ -309,6 +313,7 @@ private void OnNewGameStateStarted() { case (int)GameState.EnteringName: //if game has been reset by a player on mobile ClearOldAndCreateNewRoom(); + InitializeFirstPage(); break; case (int)GameState.WaitingForOtherPlayersToJoin: From 50bff13faeba541f4bb1df6dd71e6f4d4345c6b6 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:12:27 +0100 Subject: [PATCH 14/17] fix: remove unused property + disable submitstartgame at start --- Assets/Scripts/GameManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index fa48f50..3e769c7 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -20,7 +20,6 @@ public class GameManager : MonoBehaviour [Header("Other component")] public float explanationTime = 4f; - private float currentExplanationTime = 0; [Header("Home Connection Component")] public TMP_InputField roomCodeField; @@ -65,7 +64,6 @@ private void Awake() private void Start() { - currentExplanationTime = explanationTime; HomeConnection.SetActive(true); WaitingRoom.SetActive(false); BeforeStart.SetActive(false); @@ -73,6 +71,7 @@ private void Start() VotePicture.SetActive(false); WaitingOtherPlayers.SetActive(false); EndGame.SetActive(false); + submitStartGame.SetActive(false); if (PlayerPrefs.HasKey("lastplayername")) playerNameField.text = PlayerPrefs.GetString("lastplayername"); From ee6c2fa97c46b7dd9bcc497123c0298720c37bc8 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:30:11 +0100 Subject: [PATCH 15/17] fix: if there is a broken room, retry --- Assets/Scripts/GameManager.cs | 2 ++ Assets/Scripts/RoomManager.cs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 3e769c7..f3450bd 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -385,12 +385,14 @@ private void OnNewGameState() EndGame.SetActive(false); VotePicture.SetActive(true); + Debug.Log("subscribe to question ID"); myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged; break; } case (int)GameState.Score: { Debug.Log("it's scoring time !", this); + Debug.Log("unsubscribe to question ID"); myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged; WaitingOtherPlayers.SetActive(false); diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 9dd62c9..a1482d5 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -401,7 +401,7 @@ private void QueryRoomsInDatabase(Action> callback) catch (Exception e) { Debug.LogException(e); - Debug.LogError($"Room {JSON} was broken, deleting it", this); + Debug.Log($"Room {JSON} is broken, deleting it", this); snapshot.Reference.RemoveValueAsync().ContinueWithOnMainThread(task => { if (task.IsFaulted) @@ -409,8 +409,9 @@ private void QueryRoomsInDatabase(Action> callback) Debug.LogException(task.Exception); return; } - Debug.Log($"Broken room has been deleted", this); - }); ; + Debug.Log($"Broken room has been deleted. Checking again", this); + QueryRoomsInDatabase(callback); + }); } } else From 2670a870be4921bc5d3a72e26054da4390c055d8 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:32:14 +0100 Subject: [PATCH 16/17] fix: player can enter room multiple times --- Assets/Scripts/GameManager.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index f3450bd..36bdeb2 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -63,6 +63,11 @@ private void Awake() } private void Start() + { + InitializeHomePage(); + } + + private void InitializeHomePage() { HomeConnection.SetActive(true); WaitingRoom.SetActive(false); @@ -72,10 +77,10 @@ private void Start() WaitingOtherPlayers.SetActive(false); EndGame.SetActive(false); submitStartGame.SetActive(false); + submitNewPlayer.interactable = true; if (PlayerPrefs.HasKey("lastplayername")) playerNameField.text = PlayerPrefs.GetString("lastplayername"); - } private void OnApplicationQuit() @@ -339,13 +344,7 @@ private void OnNewGameState() { case (int)GameState.EnteringName: { - WaitingOtherPlayers.SetActive(false); - BeforeStart.SetActive(false); - TakePicture.SetActive(false); - VotePicture.SetActive(false); - EndGame.SetActive(false); - - HomeConnection.SetActive(true); + InitializeHomePage(); break; } case (int)GameState.Explanation: @@ -477,6 +476,7 @@ public void OnClickSubmitSignIn() { string playerName = playerNameField.text; string roomCode = roomCodeField.text; + submitNewPlayer.interactable = false; PlayerValidateNameAndServerRoom(playerName, roomCode); } From 503634db53002753bfe5c52236285b308fed3918 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:35:42 +0100 Subject: [PATCH 17/17] fix: timer for vote is same as timer for picture --- Assets/Scenes/PhoneView.unity | 46 +++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index 0de4b9d..3687fb6 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -209,6 +209,7 @@ GameObject: - component: {fileID: 105416811} - component: {fileID: 105416813} - component: {fileID: 105416812} + - component: {fileID: 105416814} m_Layer: 5 m_Name: Timer m_TagString: Untagged @@ -225,16 +226,16 @@ RectTransform: m_GameObject: {fileID: 105416810} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1.8068042, y: 1.8068042, z: 1.8068042} - m_ConstrainProportionsScale: 1 + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2103733877} m_Father: {fileID: 531335862} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -14.990967, y: -26} - m_SizeDelta: {x: 100, y: 100} + m_AnchoredPosition: {x: -43, y: -51} + m_SizeDelta: {x: 200, y: 200} m_Pivot: {x: 1, y: 1} --- !u!114 &105416812 MonoBehaviour: @@ -274,6 +275,21 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 105416810} m_CullTransparentMesh: 1 +--- !u!114 &105416814 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 105416810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5} + m_EffectDistance: {x: 10, y: -10} + m_UseGraphicAlpha: 1 --- !u!1 &123355695 GameObject: m_ObjectHideFlags: 0 @@ -1085,7 +1101,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -614.9967} + m_AnchoredPosition: {x: 540, y: -475} m_SizeDelta: {x: 700, y: 700} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &456700975 @@ -1450,7 +1466,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -1759.9951} + m_AnchoredPosition: {x: 540, y: -1550} m_SizeDelta: {x: 700, y: 700} m_Pivot: {x: 0.5, y: 0} --- !u!114 &589915590 @@ -5613,7 +5629,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -69.99838} + m_AnchoredPosition: {x: 540, y: -0} m_SizeDelta: {x: 340, y: 100} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1545657113 @@ -7766,7 +7782,7 @@ GameObject: - component: {fileID: 2103733879} - component: {fileID: 2103733878} m_Layer: 5 - m_Name: Text (TMP) + m_Name: Timer.Counter m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -7786,10 +7802,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 105416811} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -2.731, y: -2.341} - m_SizeDelta: {x: 94.539, y: 46.1} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -2.5, y: -12.5} + m_SizeDelta: {x: -5, y: -25} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2103733878 MonoBehaviour: @@ -7838,13 +7854,13 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 26.7 - m_fontSizeBase: 26.7 + m_fontSize: 52 + m_fontSizeBase: 52 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 m_fontSizeMax: 72 - m_fontStyle: 0 + m_fontStyle: 1 m_HorizontalAlignment: 2 m_VerticalAlignment: 512 m_textAlignment: 65535