From e9170a96e4093de7d86143c4cc3e79db7bb99897 Mon Sep 17 00:00:00 2001 From: Marine Date: Sun, 28 Jan 2024 01:15:05 +0100 Subject: [PATCH 1/3] Test is first --- Assets/Scripts/GameManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index a4afc4c..cefaed4 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -349,9 +349,9 @@ private void CheckIfIAmTheFirst(List players) if (players.Count > 1) { - IOrderedEnumerable sortedList = players.OrderBy(x => x.creationDate); + List sortedList = players.OrderBy(x => x.creationDate).ToList(); - if (sortedList.Last().id == currentPlayer.id) + if (sortedList[0].id == currentPlayer.id) { isFirst = true; } From ecfcbbae410a1f8e3e3d3ca9e1239ba30c1f97f8 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 28 Jan 2024 01:16:53 +0100 Subject: [PATCH 2/3] refacto: move CameraManager again --- Assets/Scenes/PhoneView.unity | 43 ++++++++++++++++---------------- Assets/Scripts/GameManager.cs | 2 -- Assets/Scripts/StorageManager.cs | 4 +-- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index e529664..19891ea 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -545,7 +545,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 429358651} + - m_Target: {fileID: 1181392807} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamStop m_Mode: 1 @@ -860,7 +860,6 @@ GameObject: m_Component: - component: {fileID: 429358650} - component: {fileID: 429358649} - - component: {fileID: 429358651} - component: {fileID: 429358652} - component: {fileID: 429358653} m_Layer: 0 @@ -897,22 +896,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &429358651 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 429358648} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: efbbc7abb0db8c7e0b29ec4bb986d783, type: 3} - m_Name: - m_EditorClassIdentifier: - wTexture: {fileID: 0} - freezeButton: {fileID: 223773138} - resumeButton: {fileID: 1114535086} - photoBox: {fileID: 1316036600} --- !u!114 &429358652 MonoBehaviour: m_ObjectHideFlags: 0 @@ -925,7 +908,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3} m_Name: m_EditorClassIdentifier: - Canvas: {fileID: 1202782726} --- !u!114 &429358653 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2936,7 +2918,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 429358651} + - m_Target: {fileID: 1181392807} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamResume m_Mode: 1 @@ -3399,13 +3381,14 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1181392806} + - component: {fileID: 1181392807} m_Layer: 5 m_Name: TakePictureState m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1181392806 RectTransform: m_ObjectHideFlags: 0 @@ -3432,6 +3415,22 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1181392807 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1181392805} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: efbbc7abb0db8c7e0b29ec4bb986d783, type: 3} + m_Name: + m_EditorClassIdentifier: + wTexture: {fileID: 0} + freezeButton: {fileID: 223773138} + resumeButton: {fileID: 1114535086} + photoBox: {fileID: 1316036600} --- !u!1 &1202782726 GameObject: m_ObjectHideFlags: 0 @@ -4296,7 +4295,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 429358651} + - m_Target: {fileID: 1181392807} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamChange m_Mode: 1 diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index a1ab969..1820db3 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -371,5 +371,3 @@ public enum GameState VoteSent = 6, Score = 7 } - - diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index bb93e6a..cf1f906 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -6,7 +6,6 @@ public class StorageManager : MonoBehaviour { - public GameObject Canvas; private StorageReference storage; private DatabaseReference realtimeDB; @@ -39,7 +38,7 @@ public void UploadPhoto() Texture2D photo = gameObject.GetComponent().GetPhoto(); byte[] photoBytes = ImageConversion.EncodeToJPG(photo); - GameManager game = Canvas.GetComponent(); + GameManager game = gameObject.GetComponent(); string imageUuid = Guid.NewGuid().ToString(); StorageReference imageRef = storage.Child($"{game.myRoom.code}/{game.currentPlayer.id}/{imageUuid}.png"); @@ -55,6 +54,7 @@ public void UploadPhoto() { // Metadata contains file metadata such as size, content-type, and md5hash. StorageMetadata metadata = task.Result; + } }); From 1df95d8ecae056f4442a166914b91c9bc79a8603 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 28 Jan 2024 01:19:02 +0100 Subject: [PATCH 3/3] refacto: remove double Game Manager --- Assets/Scenes/PhoneView.unity | 46 +++++------------------------------ 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index e6855f7..d10c2e9 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -233,11 +233,13 @@ MonoBehaviour: waitingForPlayersLabels: [] promptList: {fileID: 0} explanationPage: {fileID: 0} - counter: {fileID: 0} + explanationCounter: {fileID: 0} + explanationTime: 0 + counterSFX: {fileID: 0} waitingForPropositionsPage: {fileID: 0} - waitingForPropositionsLabels: [] + propositionCounter: {fileID: 0} propositionTime: 60 - timerGUI: {fileID: 0} + waitingForPropositionsLabels: [] votingTime: 20 --- !u!4 &157909815 Transform: @@ -932,6 +934,7 @@ MonoBehaviour: submitNewPlayer: {fileID: 1158329299} listPlayersUI: {fileID: 1891690322} submitStartGame: {fileID: 638947073} + counter: {fileID: 0} HomeConnection: {fileID: 2027556831} WaitingRoom: {fileID: 1590939977} BeforeStart: {fileID: 563000513} @@ -3533,43 +3536,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} ---- !u!114 &1202782732 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1202782726} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 27a435387a7644784a6fc6ae538b68e5, type: 3} - m_Name: - m_EditorClassIdentifier: - currentPlayer: - name: - id: - creationDate: 0 - explanationTime: 4 - roomCodeField: {fileID: 2023851070} - roomError: {fileID: 991600093} - playerNameField: {fileID: 1163479463} - nameError: {fileID: 1224049646} - submitNewPlayer: {fileID: 1158329299} - listPlayersUI: {fileID: 1891690322} - submitStartGame: {fileID: 638947073} - counter: {fileID: 1383251891} - HomeConnection: {fileID: 2027556831} - WaitingRoom: {fileID: 1590939977} - BeforeStart: {fileID: 563000513} - TakePicture: {fileID: 1181392805} - VotePicture: {fileID: 531335861} - WaitingOtherPlayers: {fileID: 2095389711} - EndGame: {fileID: 1850164816} - myRoom: - code: - currentQuestion: 0 - creationDate: 0 - currentState: 0 --- !u!1 &1224049644 GameObject: m_ObjectHideFlags: 0