Merge branch 'main' of github.com:LeGall29/GGJ2024
This commit is contained in:
commit
97860e4232
8
Assets/Music.meta
Normal file
8
Assets/Music.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 23eaa774a3a7d434183a4c336d52891f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/Music/Ending.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Music/Ending.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Assets/Music/Ending.mp3.meta
Normal file
23
Assets/Music/Ending.mp3.meta
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e1135788bf319bd42b6ca512976f9028
|
||||||
|
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/Music/Menu.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Music/Menu.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Assets/Music/Menu.mp3.meta
Normal file
23
Assets/Music/Menu.mp3.meta
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ac3efdb5c840704aafbf19188b3e61e
|
||||||
|
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/Music/Taking picture.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Music/Taking picture.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Assets/Music/Taking picture.mp3.meta
Normal file
23
Assets/Music/Taking picture.mp3.meta
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0e86c0433979a2d4c884b368808d3cdf
|
||||||
|
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:
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 705507994}
|
m_Sun: {fileID: 705507994}
|
||||||
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
m_IndirectSpecularColor: {r: 0.18018535, g: 0.22559482, b: 0.30677685, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@ -1376,8 +1376,8 @@ MonoBehaviour:
|
|||||||
- {fileID: 2137991537}
|
- {fileID: 2137991537}
|
||||||
- {fileID: 340074661}
|
- {fileID: 340074661}
|
||||||
promptList: {fileID: 0}
|
promptList: {fileID: 0}
|
||||||
explanationPage: {fileID: 0}
|
explanationPage: {fileID: 45150984}
|
||||||
counter: {fileID: 0}
|
counter: {fileID: 1798182259}
|
||||||
waitingForPropositionsPage: {fileID: 1730465902}
|
waitingForPropositionsPage: {fileID: 1730465902}
|
||||||
waitingForPropositionsLabels:
|
waitingForPropositionsLabels:
|
||||||
- {fileID: 972471162}
|
- {fileID: 972471162}
|
||||||
|
@ -3369,7 +3369,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &1181392806
|
--- !u!224 &1181392806
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -4098,7 +4098,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &1383251890
|
--- !u!224 &1383251890
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -20,7 +20,7 @@ public Room(string _code)
|
|||||||
players = new Dictionary<string, Player>();
|
players = new Dictionary<string, Player>();
|
||||||
questions = new Dictionary<string, Question>();
|
questions = new Dictionary<string, Question>();
|
||||||
currentQuestion = 0;
|
currentQuestion = 0;
|
||||||
currentState = 0;
|
currentState = 1; //default by PC
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> GetPlayerList()
|
public List<Player> GetPlayerList()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Firebase.Database;
|
using Firebase.Database;
|
||||||
using Firebase.Extensions;
|
using Firebase.Extensions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -11,9 +12,7 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GameManager : MonoBehaviour
|
public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
private GameState currentState;
|
|
||||||
private List<Player> players = new();
|
private List<Player> players = new();
|
||||||
private bool isFirst = false;
|
|
||||||
public Player currentPlayer = null;
|
public Player currentPlayer = null;
|
||||||
|
|
||||||
[Header("Other component")]
|
[Header("Other component")]
|
||||||
@ -57,15 +56,16 @@ private void Start()
|
|||||||
}
|
}
|
||||||
private void OnApplicationQuit()
|
private void OnApplicationQuit()
|
||||||
{
|
{
|
||||||
myOnlineRoom.Child("players").Child(currentPlayer.id).RemoveValueAsync();
|
myOnlineRoom.Child("players").Child(currentPlayer.id).RemoveValueAsync().ContinueWithOnMainThread(task =>
|
||||||
Debug.Log($"delete player {currentPlayer.name}");
|
{
|
||||||
myRoom = null;
|
Debug.Log($"delete player {currentPlayer.name}");
|
||||||
|
if(myOnlineRoom!= null)
|
||||||
|
{
|
||||||
|
myOnlineRoom.ValueChanged -= OnRoomUpdate;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameState GetCurrentState()
|
|
||||||
{
|
|
||||||
return currentState;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
@ -91,7 +91,6 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
|
|||||||
nameError.text = "You have to put a valid name";
|
nameError.text = "You have to put a valid name";
|
||||||
nameError.gameObject.SetActive(true);
|
nameError.gameObject.SetActive(true);
|
||||||
|
|
||||||
//TODO : MARINE : use the error label to explain to the user that they have forget to put a name
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +100,6 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
|
|||||||
roomError.text = "You have to put a room code";
|
roomError.text = "You have to put a room code";
|
||||||
roomError.gameObject.SetActive(true);
|
roomError.gameObject.SetActive(true);
|
||||||
|
|
||||||
//TODO : MARINE : use the error label to explain to the user that they have forget to put a room code
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,16 +122,18 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
|
|||||||
{
|
{
|
||||||
//then subscribe to it
|
//then subscribe to it
|
||||||
myOnlineRoom.ValueChanged += OnRoomUpdate;
|
myOnlineRoom.ValueChanged += OnRoomUpdate;
|
||||||
currentState = GameState.WaitingForOtherPlayersToJoin;
|
myRoom.currentState = (int)GameState.WaitingForOtherPlayersToJoin;
|
||||||
players.Add(currentPlayer);
|
players.Add(currentPlayer);
|
||||||
|
|
||||||
WaitingRoom.SetActive(true);
|
WaitingRoom.SetActive(true);
|
||||||
HomeConnection.SetActive(false);
|
HomeConnection.SetActive(false);
|
||||||
|
|
||||||
List<Player> list = new List<Player>();
|
List<Player> list = new List<Player>
|
||||||
list.Add(currentPlayer);
|
{
|
||||||
|
currentPlayer
|
||||||
|
};
|
||||||
|
|
||||||
UpdateDisplayedListUser(list) ;
|
UpdateDisplayedListUser(list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -202,19 +202,13 @@ public void StartGame()
|
|||||||
Debug.Log(JSON);
|
Debug.Log(JSON);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
myOnlineRoom.Child("currentState").SetValueAsync(2).ContinueWithOnMainThread(task =>
|
sendCurrentState(GameState.Explanation, () =>
|
||||||
{
|
{
|
||||||
if (task.IsFaulted)
|
Debug.Log($"start the game", this);
|
||||||
{
|
myRoom.currentState = (int)GameState.Explanation;
|
||||||
Debug.LogException(task.Exception);
|
WaitingRoom.SetActive(false);
|
||||||
}
|
BeforeStart.SetActive(true);
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Log($"start the game", this);
|
|
||||||
currentState = GameState.Explanation;
|
|
||||||
WaitingRoom.SetActive(false);
|
|
||||||
BeforeStart.SetActive(true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -222,7 +216,7 @@ public void StartGame()
|
|||||||
Debug.LogException(ex);
|
Debug.LogException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -232,7 +226,7 @@ public void StartGame()
|
|||||||
/// <param name="_prompt">The prompt to display</param>
|
/// <param name="_prompt">The prompt to display</param>
|
||||||
public void MakeAProposition(Prompt _prompt)
|
public void MakeAProposition(Prompt _prompt)
|
||||||
{
|
{
|
||||||
currentState = GameState.MakeProposition;
|
//currentState = GameState.MakeProposition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -282,13 +276,30 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
|||||||
{
|
{
|
||||||
Debug.LogException(ex);
|
Debug.LogException(ex);
|
||||||
}
|
}
|
||||||
|
if(myRoom == null) {
|
||||||
switch (currentState)
|
return;
|
||||||
|
}
|
||||||
|
switch (myRoom.currentState)
|
||||||
{
|
{
|
||||||
case GameState.WaitingForOtherPlayersToJoin:
|
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||||
{
|
{
|
||||||
CheckIfIAmTheFirst(myRoom.GetPlayerList());
|
CheckIfIAmTheFirst(myRoom.GetPlayerList());
|
||||||
UpdateDisplayedListUser(myRoom.GetPlayerList());
|
UpdateDisplayedListUser(myRoom.GetPlayerList());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (int)GameState.Explanation:
|
||||||
|
{
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (int)GameState.MakeProposition:
|
||||||
|
{
|
||||||
|
if (BeforeStart.activeInHierarchy)
|
||||||
|
{
|
||||||
|
BeforeStart.SetActive(false);
|
||||||
|
TakePicture.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,19 +314,41 @@ private void UpdateDisplayedListUser(List<Player> players)
|
|||||||
listPlayersUI.text += "\n" + players[i].name;
|
listPlayersUI.text += "\n" + players[i].name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckIfIAmTheFirst(List<Player> players)
|
private void CheckIfIAmTheFirst(List<Player> players)
|
||||||
{
|
{
|
||||||
|
bool isFirst = false;
|
||||||
if (players.Count > 1)
|
if (players.Count > 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
IOrderedEnumerable<Player> sortedList = players.OrderBy(x=>x.creationDate);
|
||||||
|
|
||||||
|
if(sortedList.Last().id == currentPlayer.id)
|
||||||
|
{
|
||||||
|
isFirst = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (isFirst)
|
||||||
{
|
{
|
||||||
|
submitStartGame.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void sendCurrentState(GameState state,Action callback_oncCurrentStateSent)
|
||||||
|
{
|
||||||
|
myOnlineRoom.Child("currentState").SetValueAsync((int)state).ContinueWithOnMainThread(task =>
|
||||||
|
{
|
||||||
|
if (task.IsFaulted)
|
||||||
|
{
|
||||||
|
Debug.LogException(task.Exception);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
callback_oncCurrentStateSent?.Invoke();
|
||||||
|
}
|
||||||
|
}); ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void OnClickSubmitSignIn()
|
public void OnClickSubmitSignIn()
|
||||||
{
|
{
|
||||||
@ -334,8 +367,7 @@ public enum GameState
|
|||||||
PropositionsSent = 4,
|
PropositionsSent = 4,
|
||||||
MakeVote = 5,
|
MakeVote = 5,
|
||||||
VoteSent = 6,
|
VoteSent = 6,
|
||||||
Score = 7,
|
Score = 7
|
||||||
Ending = 8
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ private void Awake()
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
explanationPage.SetActive(false);
|
||||||
|
waitingForPropositionsPage.SetActive(false);
|
||||||
|
waitingForPlayersPage.SetActive(true);
|
||||||
|
|
||||||
propositionCurrentTime = propositionTime;
|
propositionCurrentTime = propositionTime;
|
||||||
votingCurrentTime = votingTime;
|
votingCurrentTime = votingTime;
|
||||||
ResetAllPlayerLabels();
|
ResetAllPlayerLabels();
|
||||||
@ -70,7 +74,7 @@ private void Update()
|
|||||||
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;
|
||||||
counter.text = duration.TotalSeconds.ToString("D1");
|
counter.text = ((int)duration.TotalSeconds).ToString("D1");
|
||||||
|
|
||||||
if (duration.TotalMilliseconds <= 0)
|
if (duration.TotalMilliseconds <= 0)
|
||||||
{
|
{
|
||||||
@ -335,7 +339,7 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
|
|||||||
case (int)GameState.Explanation:
|
case (int)GameState.Explanation:
|
||||||
waitingForPlayersPage.SetActive(false);
|
waitingForPlayersPage.SetActive(false);
|
||||||
explanationPage.SetActive(true);
|
explanationPage.SetActive(true);
|
||||||
endOfExplanationDate = DateTime.Now.AddSeconds(30);
|
endOfExplanationDate = DateTime.Now.AddSeconds(3);
|
||||||
break;
|
break;
|
||||||
case (int)GameState.MakeProposition:
|
case (int)GameState.MakeProposition:
|
||||||
HostStartGame();
|
HostStartGame();
|
||||||
|
Loading…
Reference in New Issue
Block a user