diff --git a/Assets/Audio SFX/1.ogg b/Assets/Audio SFX/1.ogg deleted file mode 100644 index 5dd46a5..0000000 --- a/Assets/Audio SFX/1.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:58ecc2a3d1528f75ee74d1fed84586afbafce5134a27e1ba1dcc3dcd42074d4d -size 7331 diff --git a/Assets/Audio SFX/1.ogg.meta b/Assets/Audio SFX/1.ogg.meta deleted file mode 100644 index 01db90d..0000000 --- a/Assets/Audio SFX/1.ogg.meta +++ /dev/null @@ -1,23 +0,0 @@ -fileFormatVersion: 2 -guid: 59e3c7eac1a310f448b7d3d50ccdf3ed -AudioImporter: - externalObjects: {} - serializedVersion: 7 - defaultSettings: - serializedVersion: 2 - loadType: 0 - sampleRateSetting: 0 - sampleRateOverride: 44100 - compressionFormat: 1 - quality: 1 - conversionMode: 0 - preloadAudioData: 0 - platformSettingOverrides: {} - forceToMono: 0 - normalize: 1 - loadInBackground: 0 - ambisonic: 0 - 3D: 1 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Audio SFX/2.ogg b/Assets/Audio SFX/2.ogg deleted file mode 100644 index c17108a..0000000 --- a/Assets/Audio SFX/2.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9a1577f2e8f3ca95d959bf542553aceb69c4a4d6872d21e862dbf30992472454 -size 7352 diff --git a/Assets/Audio SFX/2.ogg.meta b/Assets/Audio SFX/2.ogg.meta deleted file mode 100644 index a9a3eae..0000000 --- a/Assets/Audio SFX/2.ogg.meta +++ /dev/null @@ -1,23 +0,0 @@ -fileFormatVersion: 2 -guid: e6ae431cc10239b439b12c6836142bb6 -AudioImporter: - externalObjects: {} - serializedVersion: 7 - defaultSettings: - serializedVersion: 2 - loadType: 0 - sampleRateSetting: 0 - sampleRateOverride: 44100 - compressionFormat: 1 - quality: 1 - conversionMode: 0 - preloadAudioData: 0 - platformSettingOverrides: {} - forceToMono: 0 - normalize: 1 - loadInBackground: 0 - ambisonic: 0 - 3D: 1 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Audio SFX/3.ogg b/Assets/Audio SFX/3.ogg deleted file mode 100644 index 85ac107..0000000 --- a/Assets/Audio SFX/3.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:83de2bbeae91edb680df856a947a7f781a737bc20702ebe29acd388541e68b62 -size 8228 diff --git a/Assets/Audio SFX/Decompte.mp3 b/Assets/Audio SFX/Decompte.mp3 new file mode 100644 index 0000000..1a25489 --- /dev/null +++ b/Assets/Audio SFX/Decompte.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd2386e769fd6c160309a0ad936ccbb8162e4514284d106a8734e99d7a36753c +size 133583 diff --git a/Assets/Audio SFX/3.ogg.meta b/Assets/Audio SFX/Decompte.mp3.meta similarity index 91% rename from Assets/Audio SFX/3.ogg.meta rename to Assets/Audio SFX/Decompte.mp3.meta index e4d0adf..764bd17 100644 --- a/Assets/Audio SFX/3.ogg.meta +++ b/Assets/Audio SFX/Decompte.mp3.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3beaa7f0d20a77649ba21959c91856f8 +guid: 2ff45dbe56b6a4d08bfa7b103fa4effb AudioImporter: externalObjects: {} serializedVersion: 7 diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index 8c417b0..561ceb2 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -1382,7 +1382,7 @@ MonoBehaviour: explanationPage: {fileID: 45150984} explanationCounter: {fileID: 1798182259} explanationTime: 4 - counterSFX: {fileID: 8300000, guid: 3beaa7f0d20a77649ba21959c91856f8, type: 3} + counterSFX: {fileID: 8300000, guid: 2ff45dbe56b6a4d08bfa7b103fa4effb, type: 3} waitingForPropositionsPage: {fileID: 1730465902} propositionCounter: {fileID: 1996258852} propositionTime: 60 diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index 4de5de2..6087da2 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -547,7 +547,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 @@ -862,7 +862,6 @@ GameObject: m_Component: - component: {fileID: 429358650} - component: {fileID: 429358649} - - component: {fileID: 429358651} - component: {fileID: 429358652} - component: {fileID: 429358653} m_Layer: 0 @@ -899,22 +898,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 @@ -927,7 +910,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3} m_Name: m_EditorClassIdentifier: - Canvas: {fileID: 1202782726} --- !u!114 &429358653 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2939,7 +2921,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 @@ -3402,13 +3384,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 @@ -3435,6 +3418,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 @@ -4299,7 +4298,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 6d25655..fd32751 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -412,5 +412,3 @@ public enum GameState VoteSent = 6, Score = 7 } - - diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index f280767..7ff3c24 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -16,6 +16,7 @@ public class RoomManager : MonoBehaviour /// public TextMeshProUGUI roomCodeLabel; public List waitingForPlayersLabels = new List(); + private Dictionary waitingPlayersById = new Dictionary(); public PromptList promptList; [Header("Explanation Page")] @@ -31,6 +32,7 @@ public class RoomManager : MonoBehaviour public float propositionTime = 60; public List waitingForPropositionsLabels = new List(); private DateTime endOfPropositionDate = DateTime.MinValue; + private bool allPlayersHasProposedTwoPictures = false; [Header("Other")] private Room myRoom = null; @@ -72,6 +74,7 @@ private void Update() if (myRoom == null) return; + //While Explanation State if (myRoom.currentState == (int)GameState.Explanation && endOfExplanationDate != DateTime.MinValue) { TimeSpan duration = endOfExplanationDate - DateTime.Now; @@ -85,11 +88,19 @@ private void Update() } } + //while MakeProposition State if (myRoom.currentState == (int)GameState.MakeProposition && endOfPropositionDate != DateTime.MinValue) { TimeSpan duration = endOfPropositionDate - DateTime.Now; propositionCounter.text = ((int)duration.TotalSeconds).ToString("D1"); + foreach (TextMeshProUGUI tmp in waitingForPropositionsLabels) + { + if (tmp.gameObject.activeSelf) + { + + } + } } } @@ -100,6 +111,7 @@ private void SendRoomState(GameState _newState) private void ResetAllPlayerLabels() { + waitingPlayersById.Clear(); for (int i = 0; i < waitingForPlayersLabels.Count; i++) { waitingForPlayersLabels[i].text = $"Waiting for P{i + 1}"; @@ -222,12 +234,18 @@ public void PlayerSendProposition(Proposition _proposition) /// /// Called when the first player clicked "Start" /// - public void HostStartGame() + public void HostHasStartedGame() { waitingForPropositionsPage.SetActive(true); waitingForPlayersPage.SetActive(false); endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime); - AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero); + + for (int i = 0; i < waitingForPropositionsLabels.Count; i++) + { + TextMeshProUGUI tmp = waitingForPropositionsLabels[i]; + tmp.gameObject.SetActive(i < myRoom.players.Count); + } + } /// @@ -350,9 +368,10 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value) waitingForPlayersPage.SetActive(false); explanationPage.SetActive(true); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime); + AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero); break; case (int)GameState.MakeProposition: - HostStartGame(); + HostHasStartedGame(); break; default: break; @@ -368,19 +387,12 @@ private void UpdateConnectedPlayerList(List _players) ResetAllPlayerLabels(); Debug.Log($"players count = {_players.Count}"); - for (int i = 0; i < _players.Count; i++) + List orderedPlayers = _players.OrderBy(x => x.creationDate).ToList(); + for (int i = 0; i < orderedPlayers.Count; i++) { - Debug.Log($"player {i} = {_players[i].name}"); - waitingForPlayersLabels[i].text = _players[i].name; + waitingPlayersById.Add(orderedPlayers[i].id, waitingForPlayersLabels[i]); + Debug.Log($"player {i} = {orderedPlayers[i].name}"); + waitingForPlayersLabels[i].text = orderedPlayers[i].name; } } - - [ContextMenu("Fake Player Connection")] - private void FakePlayerConnection() - { - Player temp = new Player("Momo"); - temp.id = Guid.NewGuid().ToString(); - temp.SetName("Momo"); - } - } 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; + } });