Merge branch 'main' of github.com:LeGall29/GGJ2024
This commit is contained in:
commit
40cd75f8b4
BIN
Assets/Audio SFX/camera-flash-sound-effect.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Audio SFX/camera-flash-sound-effect.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Assets/Audio SFX/camera-flash-sound-effect.mp3.meta
Normal file
23
Assets/Audio SFX/camera-flash-sound-effect.mp3.meta
Normal file
@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4d0bdddc893f476a8eb330e58108608
|
||||
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/Voting session.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/Music/Voting session.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Assets/Music/Voting session.mp3.meta
Normal file
23
Assets/Music/Voting session.mp3.meta
Normal file
@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d782d7e00ee5a0d40a3c005d87c15b3a
|
||||
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:
|
@ -1369,6 +1369,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
waitingForPlayersPage: {fileID: 1117928114}
|
||||
roomCodeLabel: {fileID: 1805240027}
|
||||
playerJoinSFX: {fileID: 8300000, guid: b4d0bdddc893f476a8eb330e58108608, type: 3}
|
||||
waitingForPlayersLabels:
|
||||
- {fileID: 1794849355}
|
||||
- {fileID: 1452182577}
|
||||
@ -1378,7 +1379,6 @@ MonoBehaviour:
|
||||
- {fileID: 496953434}
|
||||
- {fileID: 2137991537}
|
||||
- {fileID: 340074661}
|
||||
promptList: {fileID: 0}
|
||||
explanationPage: {fileID: 45150984}
|
||||
explanationCounter: {fileID: 1798182259}
|
||||
explanationTime: 4
|
||||
@ -1395,6 +1395,7 @@ MonoBehaviour:
|
||||
- {fileID: 1854893636}
|
||||
- {fileID: 2065109614}
|
||||
- {fileID: 1197279072}
|
||||
promptList: {fileID: 0}
|
||||
votingTime: 20
|
||||
--- !u!114 &375256413
|
||||
MonoBehaviour:
|
||||
|
@ -3385,13 +3385,14 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1181392806}
|
||||
- component: {fileID: 1181392807}
|
||||
- component: {fileID: 1181392808}
|
||||
m_Layer: 5
|
||||
m_Name: TakePictureState
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1181392806
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3434,6 +3435,21 @@ MonoBehaviour:
|
||||
freezeButton: {fileID: 223773138}
|
||||
resumeButton: {fileID: 1114535086}
|
||||
photoBox: {fileID: 1316036600}
|
||||
--- !u!114 &1181392808
|
||||
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: 02a8e72b27188ad7f8079b04e756e652, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
managers: {fileID: 429358648}
|
||||
explainText: {fileID: 2139867527}
|
||||
promptList: {fileID: 11400000, guid: 21907abc84e40403ca34c4fb9ab30b06, type: 2}
|
||||
--- !u!1 &1202782726
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -6279,9 +6295,9 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 429358652}
|
||||
m_TargetAssemblyTypeName: StorageManager, Assembly-CSharp
|
||||
m_MethodName: UploadPhoto
|
||||
- m_Target: {fileID: 1181392808}
|
||||
m_TargetAssemblyTypeName: QuestionHandler, Assembly-CSharp
|
||||
m_MethodName: OnSubmitButton
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -31,11 +31,14 @@ void Start()
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (wTexture)
|
||||
Texture2D texture = GetPhoto();
|
||||
|
||||
if (texture)
|
||||
{
|
||||
photoBox.texture = GetPhoto();
|
||||
Resources.UnloadUnusedAssets();
|
||||
photoBox.texture = texture;
|
||||
}
|
||||
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
|
||||
public void WebcamResume()
|
||||
@ -123,7 +126,7 @@ public Texture2D GetPhoto()
|
||||
return photo;
|
||||
}
|
||||
|
||||
if (!wTexture)
|
||||
if (!wTexture || WebCamTexture.devices.Count() < 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[Serializable]
|
||||
@ -28,14 +29,62 @@ public List<Player> GetPlayerList()
|
||||
return new List<Player>(players.Values);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return the list of player ordered by who joined first
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Player> GetOrderedPlayerList()
|
||||
{
|
||||
return players.Values.OrderBy(x => x.creationDate).ToList();
|
||||
}
|
||||
|
||||
public List<Question> GetQuestionList()
|
||||
{
|
||||
return new List<Question>(questions.Values);
|
||||
}
|
||||
|
||||
public void setPlayersAreReady(int _state)
|
||||
public List<Question> GetQuestionsByPlayer(Player player)
|
||||
{
|
||||
List<Question> questions = new();
|
||||
|
||||
foreach (Question question in GetQuestionList())
|
||||
{
|
||||
foreach (Proposition proposition in new List<Proposition>(question.propositions.Values))
|
||||
{
|
||||
if (proposition.owner.id == player.id)
|
||||
{
|
||||
questions.Add(question);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return questions;
|
||||
}
|
||||
|
||||
|
||||
public void SetPlayersAreReady(int _state)
|
||||
{
|
||||
currentState = _state;
|
||||
}
|
||||
|
||||
public List<Proposition> GetPropositionsByPlayer(Player player)
|
||||
{
|
||||
List<Proposition> propositions = new();
|
||||
|
||||
foreach (Question question in GetQuestionList())
|
||||
{
|
||||
foreach (Proposition proposition in new List<Proposition>(question.propositions.Values))
|
||||
{
|
||||
if (proposition.owner.id == player.id)
|
||||
{
|
||||
propositions.Add(proposition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return propositions;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
|
||||
|
||||
/// <summary>
|
||||
/// This is the game state manager on the phone side
|
||||
@ -82,7 +81,7 @@ private void OnApplicationQuit()
|
||||
|
||||
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;
|
||||
counter.text = ((int)duration.TotalSeconds).ToString("D1");
|
||||
@ -220,12 +219,12 @@ private void JoinRoom(Action callback_OnRoomJoined)
|
||||
public void StartGame()
|
||||
{
|
||||
// send Start Game
|
||||
myRoom.setPlayersAreReady(1);
|
||||
myRoom.SetPlayersAreReady(1);
|
||||
string JSON = JsonUtility.ToJson(myRoom);
|
||||
Debug.Log(JSON);
|
||||
try
|
||||
{
|
||||
sendCurrentState(GameState.Explanation, () =>
|
||||
SendCurrentState(GameState.Explanation, () =>
|
||||
{
|
||||
Debug.Log($"start the game", this);
|
||||
myRoom.currentState = (int)GameState.Explanation;
|
||||
@ -238,8 +237,6 @@ public void StartGame()
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -385,7 +382,7 @@ private void CheckIfIAmTheFirst(List<Player> players)
|
||||
submitStartGame.SetActive(true);
|
||||
}
|
||||
}
|
||||
public void sendCurrentState(GameState state, Action callback_oncCurrentStateSent)
|
||||
public void SendCurrentState(GameState state, Action callback_oncCurrentStateSent)
|
||||
{
|
||||
myOnlineRoom.Child("currentState").SetValueAsync((int)state).ContinueWithOnMainThread(task =>
|
||||
{
|
||||
|
74
Assets/Scripts/QuestionHandler.cs
Normal file
74
Assets/Scripts/QuestionHandler.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class QuestionHandler : MonoBehaviour
|
||||
{
|
||||
public GameObject managers;
|
||||
private GameManager gameManager;
|
||||
public TextMeshProUGUI explainText;
|
||||
public PromptList promptList;
|
||||
private List<Question> player2questions;
|
||||
private int currentQuestion = 0;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
player2questions = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer);
|
||||
Redraw(++currentQuestion);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
player2questions = null;
|
||||
}
|
||||
|
||||
void Redraw(int currentQuestion)
|
||||
{
|
||||
Prompt prompt = promptList.prompts.Find(x => x.id == player2questions[currentQuestion - 1].promptId);
|
||||
explainText.SetText(prompt.en);
|
||||
|
||||
CameraManager cameraManager = gameObject.GetComponent<CameraManager>();
|
||||
cameraManager.WebcamResume();
|
||||
}
|
||||
|
||||
string GetQuestionRef(string promptId)
|
||||
{
|
||||
return gameManager.myRoom.questions.First(x => x.Value.promptId == promptId).Key;
|
||||
}
|
||||
|
||||
string GetPropRef(string questionRef, string playerId)
|
||||
{
|
||||
return gameManager.myRoom.questions[questionRef].propositions.First(x => x.Value.owner.id == playerId).Key;
|
||||
}
|
||||
|
||||
public void OnSubmitButton()
|
||||
{
|
||||
string questionRef = GetQuestionRef(player2questions[currentQuestion - 1].promptId);
|
||||
|
||||
StorageManager storageManager = managers.GetComponent<StorageManager>();
|
||||
storageManager.UploadPhoto(
|
||||
gameManager.myRoom.code,
|
||||
gameManager.currentPlayer.id,
|
||||
GetQuestionRef(questionRef),
|
||||
GetPropRef(questionRef, gameManager.currentPlayer.id));
|
||||
|
||||
if (currentQuestion < 2) {
|
||||
Redraw(++currentQuestion);
|
||||
} else {
|
||||
gameManager.myRoom.currentState = (int) GameState.PropositionsSent;
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/QuestionHandler.cs.meta
Normal file
11
Assets/Scripts/QuestionHandler.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02a8e72b27188ad7f8079b04e756e652
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,9 +15,8 @@ public class RoomManager : MonoBehaviour
|
||||
/// TextMeshPro that show the value of the current rooom code
|
||||
/// </summary>
|
||||
public TextMeshProUGUI roomCodeLabel;
|
||||
public AudioClip playerJoinSFX;
|
||||
public List<TextMeshProUGUI> waitingForPlayersLabels = new List<TextMeshProUGUI>();
|
||||
private Dictionary<string, TextMeshProUGUI> waitingPlayersById = new Dictionary<string, TextMeshProUGUI>();
|
||||
public PromptList promptList;
|
||||
|
||||
[Header("Explanation Page")]
|
||||
public GameObject explanationPage;
|
||||
@ -31,10 +30,13 @@ public class RoomManager : MonoBehaviour
|
||||
public TextMeshProUGUI propositionCounter;
|
||||
public float propositionTime = 60;
|
||||
public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>();
|
||||
private Dictionary<string, TextMeshProUGUI> propositionLabelsByID = new Dictionary<string, TextMeshProUGUI>();
|
||||
private DateTime endOfPropositionDate = DateTime.MinValue;
|
||||
private bool allPlayersHasProposedTwoPictures = false;
|
||||
private Dictionary<string, Proposition[]> propositionsPerPlayers = new Dictionary<string, Proposition[]>();
|
||||
|
||||
[Header("Other")]
|
||||
public PromptList promptList;
|
||||
private Room myRoom = null;
|
||||
public float votingTime = 20;
|
||||
|
||||
@ -94,13 +96,34 @@ private void Update()
|
||||
TimeSpan duration = endOfPropositionDate - DateTime.Now;
|
||||
propositionCounter.text = ((int)duration.TotalSeconds).ToString("D1");
|
||||
|
||||
foreach (TextMeshProUGUI tmp in waitingForPropositionsLabels)
|
||||
//foreach labels
|
||||
foreach (var labelByID in propositionLabelsByID)
|
||||
{
|
||||
if (tmp.gameObject.activeSelf)
|
||||
//if the label is connected to a player
|
||||
if (labelByID.Value.gameObject.activeSelf)
|
||||
{
|
||||
|
||||
//check if this player has send 2 propositions
|
||||
bool playerHasAnswerBoth = true;
|
||||
foreach (Proposition p in propositionsPerPlayers[labelByID.Key])
|
||||
{
|
||||
if (string.IsNullOrEmpty(p.photoUrl))
|
||||
{
|
||||
playerHasAnswerBoth = false;
|
||||
}
|
||||
}
|
||||
//if its the case
|
||||
if (playerHasAnswerBoth)
|
||||
{
|
||||
//put player label in green if finished
|
||||
labelByID.Value.color = Color.green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allPlayersHasProposedTwoPictures || duration.TotalMilliseconds <= 0)
|
||||
{
|
||||
SendRoomState(GameState.MakeVote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +134,6 @@ 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}";
|
||||
@ -226,11 +248,6 @@ private int GenerateRandomAvailableCode(List<int> _impossibleCodes)
|
||||
return random;
|
||||
}
|
||||
|
||||
public void PlayerSendProposition(Proposition _proposition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the first player clicked "Start"
|
||||
/// </summary>
|
||||
@ -240,53 +257,30 @@ public void HostHasStartedGame()
|
||||
waitingForPlayersPage.SetActive(false);
|
||||
endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime);
|
||||
|
||||
propositionLabelsByID.Clear();
|
||||
|
||||
//display only correct numbers of labels
|
||||
for (int i = 0; i < waitingForPropositionsLabels.Count; i++)
|
||||
{
|
||||
TextMeshProUGUI tmp = waitingForPropositionsLabels[i];
|
||||
tmp.gameObject.SetActive(i < myRoom.players.Count);
|
||||
}
|
||||
|
||||
}
|
||||
//registers the labels per player ID
|
||||
List<Player> orderedPlayers = myRoom.GetPlayerList().OrderBy(x => x.creationDate).ToList();
|
||||
for (int i = 0; i < orderedPlayers.Count; i++)
|
||||
{
|
||||
propositionLabelsByID.Add(orderedPlayers[i].id, waitingForPropositionsLabels[i]);
|
||||
waitingForPlayersLabels[i].text = orderedPlayers[i].name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the proposition timer
|
||||
/// </summary>
|
||||
public void StartPropositionTimer()
|
||||
{
|
||||
//Register all propositions of each players
|
||||
foreach (Player p in myRoom.GetOrderedPlayerList())
|
||||
{
|
||||
List<Proposition> propositionsForPlayer = myRoom.GetPropositionsByPlayer(p);
|
||||
propositionsPerPlayers.Add(p.id, propositionsForPlayer.ToArray());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Automatically called when the proposition timer has finished
|
||||
/// </summary>
|
||||
public void PropositionTimerFinished()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the voting timer
|
||||
/// </summary>
|
||||
public void StartVotingTimer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Automatically called when the voting timer has finished
|
||||
/// </summary>
|
||||
public void VotingTimerFinished()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automatically called when a proposition is updated (someone has voted or a picture has been proposed)
|
||||
/// </summary>
|
||||
public void OnPropositionUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -347,8 +341,14 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
|
||||
Debug.LogError(value.DatabaseError.Message);
|
||||
return;
|
||||
}
|
||||
if (value.Snapshot.Value == null)
|
||||
{
|
||||
Debug.Log("Trying to update room, but it's empty. Maybe you are exiting the app, so it's ok", this);
|
||||
return;
|
||||
}
|
||||
string JSON = value.Snapshot.GetRawJsonValue();
|
||||
Debug.Log($"your room has been updated :\n{JSON}");
|
||||
GameState lastState = (GameState)myRoom.currentState;
|
||||
try
|
||||
{
|
||||
myRoom = JsonConvert.DeserializeObject<Room>(JSON);
|
||||
@ -358,19 +358,50 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
|
||||
//this is done only when entering a new state
|
||||
if (lastState != (GameState)myRoom.currentState)
|
||||
{
|
||||
OnNewGameStateStarted();
|
||||
}
|
||||
else
|
||||
{
|
||||
//this is done each time something change
|
||||
switch (myRoom.currentState)
|
||||
{
|
||||
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||
UpdateConnectedPlayerList(myRoom.GetPlayerList());
|
||||
break;
|
||||
case (int)GameState.Explanation:
|
||||
break;
|
||||
case (int)GameState.MakeProposition:
|
||||
CheckPlayersPropositions();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when we enter in a new game state
|
||||
/// </summary>
|
||||
private void OnNewGameStateStarted()
|
||||
{
|
||||
switch (myRoom.currentState)
|
||||
{
|
||||
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||
UpdateConnectedPlayerList(myRoom.GetPlayerList());
|
||||
Debug.Log("New State : WaitingForOtherPlayersToJoin");
|
||||
break;
|
||||
case (int)GameState.Explanation:
|
||||
Debug.Log("New State : Explanation");
|
||||
waitingForPlayersPage.SetActive(false);
|
||||
explanationPage.SetActive(true);
|
||||
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
|
||||
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
|
||||
break;
|
||||
case (int)GameState.MakeProposition:
|
||||
Debug.Log("New State : MakeProposition");
|
||||
HostHasStartedGame();
|
||||
break;
|
||||
default:
|
||||
@ -378,19 +409,37 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will update allPlayersHasProposedTwoPictures to true or false
|
||||
/// </summary>
|
||||
private void CheckPlayersPropositions()
|
||||
{
|
||||
allPlayersHasProposedTwoPictures = true;
|
||||
|
||||
foreach (var propositionsByPlayer in propositionsPerPlayers)
|
||||
{
|
||||
foreach (Proposition p in propositionsByPlayer.Value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(p.photoUrl))
|
||||
allPlayersHasProposedTwoPictures = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update the player labels on the WaitingForPlayer page
|
||||
/// </summary>
|
||||
/// <param name="_players"></param>
|
||||
private void UpdateConnectedPlayerList(List<Player> _players)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(playerJoinSFX, Vector3.zero);
|
||||
ResetAllPlayerLabels();
|
||||
|
||||
Debug.Log($"players count = {_players.Count}");
|
||||
List<Player> orderedPlayers = _players.OrderBy(x => x.creationDate).ToList();
|
||||
for (int i = 0; i < orderedPlayers.Count; i++)
|
||||
{
|
||||
waitingPlayersById.Add(orderedPlayers[i].id, waitingForPlayersLabels[i]);
|
||||
Debug.Log($"player {i} = {orderedPlayers[i].name}");
|
||||
waitingForPlayersLabels[i].text = orderedPlayers[i].name;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ void Update()
|
||||
|
||||
}
|
||||
|
||||
public void UploadPhoto()
|
||||
public void UploadPhoto(string roomCode, string playerId, string questionRef, string propRef)
|
||||
{
|
||||
Texture2D photo = gameObject.GetComponent<CameraManager>().GetPhoto();
|
||||
byte[] photoBytes = ImageConversion.EncodeToJPG(photo);
|
||||
|
Loading…
Reference in New Issue
Block a user