merge branch

This commit is contained in:
Marine 2024-01-28 01:56:12 +01:00
commit fa47e8fb8c
12 changed files with 55 additions and 98 deletions

BIN
Assets/Audio SFX/1.ogg (Stored with Git LFS)

Binary file not shown.

View File

@ -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:

BIN
Assets/Audio SFX/2.ogg (Stored with Git LFS)

Binary file not shown.

View File

@ -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:

BIN
Assets/Audio SFX/3.ogg (Stored with Git LFS)

Binary file not shown.

BIN
Assets/Audio SFX/Decompte.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3beaa7f0d20a77649ba21959c91856f8 guid: 2ff45dbe56b6a4d08bfa7b103fa4effb
AudioImporter: AudioImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 7 serializedVersion: 7

View File

@ -1382,7 +1382,7 @@ MonoBehaviour:
explanationPage: {fileID: 45150984} explanationPage: {fileID: 45150984}
explanationCounter: {fileID: 1798182259} explanationCounter: {fileID: 1798182259}
explanationTime: 4 explanationTime: 4
counterSFX: {fileID: 8300000, guid: 3beaa7f0d20a77649ba21959c91856f8, type: 3} counterSFX: {fileID: 8300000, guid: 2ff45dbe56b6a4d08bfa7b103fa4effb, type: 3}
waitingForPropositionsPage: {fileID: 1730465902} waitingForPropositionsPage: {fileID: 1730465902}
propositionCounter: {fileID: 1996258852} propositionCounter: {fileID: 1996258852}
propositionTime: 60 propositionTime: 60

View File

@ -547,7 +547,7 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 429358651} - m_Target: {fileID: 1181392807}
m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp
m_MethodName: WebcamStop m_MethodName: WebcamStop
m_Mode: 1 m_Mode: 1
@ -862,7 +862,6 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 429358650} - component: {fileID: 429358650}
- component: {fileID: 429358649} - component: {fileID: 429358649}
- component: {fileID: 429358651}
- component: {fileID: 429358652} - component: {fileID: 429358652}
- component: {fileID: 429358653} - component: {fileID: 429358653}
m_Layer: 0 m_Layer: 0
@ -899,22 +898,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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 --- !u!114 &429358652
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -927,7 +910,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3} m_Script: {fileID: 11500000, guid: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Canvas: {fileID: 1202782726}
--- !u!114 &429358653 --- !u!114 &429358653
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2939,7 +2921,7 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 429358651} - m_Target: {fileID: 1181392807}
m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp
m_MethodName: WebcamResume m_MethodName: WebcamResume
m_Mode: 1 m_Mode: 1
@ -3402,13 +3384,14 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1181392806} - component: {fileID: 1181392806}
- component: {fileID: 1181392807}
m_Layer: 5 m_Layer: 5
m_Name: TakePictureState m_Name: TakePictureState
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &1181392806 --- !u!224 &1181392806
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3435,6 +3418,22 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} 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 --- !u!1 &1202782726
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4299,7 +4298,7 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 429358651} - m_Target: {fileID: 1181392807}
m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp
m_MethodName: WebcamChange m_MethodName: WebcamChange
m_Mode: 1 m_Mode: 1

View File

@ -412,5 +412,3 @@ public enum GameState
VoteSent = 6, VoteSent = 6,
Score = 7 Score = 7
} }

View File

@ -16,6 +16,7 @@ public class RoomManager : MonoBehaviour
/// </summary> /// </summary>
public TextMeshProUGUI roomCodeLabel; public TextMeshProUGUI roomCodeLabel;
public List<TextMeshProUGUI> waitingForPlayersLabels = new List<TextMeshProUGUI>(); public List<TextMeshProUGUI> waitingForPlayersLabels = new List<TextMeshProUGUI>();
private Dictionary<string, TextMeshProUGUI> waitingPlayersById = new Dictionary<string, TextMeshProUGUI>();
public PromptList promptList; public PromptList promptList;
[Header("Explanation Page")] [Header("Explanation Page")]
@ -31,6 +32,7 @@ public class RoomManager : MonoBehaviour
public float propositionTime = 60; public float propositionTime = 60;
public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>(); public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>();
private DateTime endOfPropositionDate = DateTime.MinValue; private DateTime endOfPropositionDate = DateTime.MinValue;
private bool allPlayersHasProposedTwoPictures = false;
[Header("Other")] [Header("Other")]
private Room myRoom = null; private Room myRoom = null;
@ -72,6 +74,7 @@ private void Update()
if (myRoom == null) if (myRoom == null)
return; return;
//While Explanation State
if (myRoom.currentState == (int)GameState.Explanation && endOfExplanationDate != DateTime.MinValue) if (myRoom.currentState == (int)GameState.Explanation && endOfExplanationDate != DateTime.MinValue)
{ {
TimeSpan duration = endOfExplanationDate - DateTime.Now; TimeSpan duration = endOfExplanationDate - DateTime.Now;
@ -85,11 +88,19 @@ private void Update()
} }
} }
//while MakeProposition State
if (myRoom.currentState == (int)GameState.MakeProposition && endOfPropositionDate != DateTime.MinValue) if (myRoom.currentState == (int)GameState.MakeProposition && endOfPropositionDate != DateTime.MinValue)
{ {
TimeSpan duration = endOfPropositionDate - DateTime.Now; TimeSpan duration = endOfPropositionDate - DateTime.Now;
propositionCounter.text = ((int)duration.TotalSeconds).ToString("D1"); 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() private void ResetAllPlayerLabels()
{ {
waitingPlayersById.Clear();
for (int i = 0; i < waitingForPlayersLabels.Count; i++) for (int i = 0; i < waitingForPlayersLabels.Count; i++)
{ {
waitingForPlayersLabels[i].text = $"Waiting for P{i + 1}"; waitingForPlayersLabels[i].text = $"Waiting for P{i + 1}";
@ -222,12 +234,18 @@ public void PlayerSendProposition(Proposition _proposition)
/// <summary> /// <summary>
/// Called when the first player clicked "Start" /// Called when the first player clicked "Start"
/// </summary> /// </summary>
public void HostStartGame() public void HostHasStartedGame()
{ {
waitingForPropositionsPage.SetActive(true); waitingForPropositionsPage.SetActive(true);
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime); 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);
}
} }
/// <summary> /// <summary>
@ -350,9 +368,10 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
explanationPage.SetActive(true); explanationPage.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
break; break;
case (int)GameState.MakeProposition: case (int)GameState.MakeProposition:
HostStartGame(); HostHasStartedGame();
break; break;
default: default:
break; break;
@ -368,19 +387,12 @@ private void UpdateConnectedPlayerList(List<Player> _players)
ResetAllPlayerLabels(); ResetAllPlayerLabels();
Debug.Log($"players count = {_players.Count}"); Debug.Log($"players count = {_players.Count}");
for (int i = 0; i < _players.Count; i++) List<Player> orderedPlayers = _players.OrderBy(x => x.creationDate).ToList();
for (int i = 0; i < orderedPlayers.Count; i++)
{ {
Debug.Log($"player {i} = {_players[i].name}"); waitingPlayersById.Add(orderedPlayers[i].id, waitingForPlayersLabels[i]);
waitingForPlayersLabels[i].text = _players[i].name; 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");
}
} }

View File

@ -6,7 +6,6 @@
public class StorageManager : MonoBehaviour public class StorageManager : MonoBehaviour
{ {
public GameObject Canvas;
private StorageReference storage; private StorageReference storage;
private DatabaseReference realtimeDB; private DatabaseReference realtimeDB;
@ -39,7 +38,7 @@ public void UploadPhoto()
Texture2D photo = gameObject.GetComponent<CameraManager>().GetPhoto(); Texture2D photo = gameObject.GetComponent<CameraManager>().GetPhoto();
byte[] photoBytes = ImageConversion.EncodeToJPG(photo); byte[] photoBytes = ImageConversion.EncodeToJPG(photo);
GameManager game = Canvas.GetComponent<GameManager>(); GameManager game = gameObject.GetComponent<GameManager>();
string imageUuid = Guid.NewGuid().ToString(); string imageUuid = Guid.NewGuid().ToString();
StorageReference imageRef = storage.Child($"{game.myRoom.code}/{game.currentPlayer.id}/{imageUuid}.png"); 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. // Metadata contains file metadata such as size, content-type, and md5hash.
StorageMetadata metadata = task.Result; StorageMetadata metadata = task.Result;
} }
}); });