This commit is contained in:
Otaku9999 2024-01-28 02:56:18 +01:00
commit 82ce0a92f4
11 changed files with 349 additions and 73 deletions

BIN
Assets/Audio SFX/camera-flash-sound-effect.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

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

View File

@ -1369,6 +1369,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
waitingForPlayersPage: {fileID: 1117928114} waitingForPlayersPage: {fileID: 1117928114}
roomCodeLabel: {fileID: 1805240027} roomCodeLabel: {fileID: 1805240027}
playerJoinSFX: {fileID: 8300000, guid: b4d0bdddc893f476a8eb330e58108608, type: 3}
waitingForPlayersLabels: waitingForPlayersLabels:
- {fileID: 1794849355} - {fileID: 1794849355}
- {fileID: 1452182577} - {fileID: 1452182577}
@ -1378,7 +1379,6 @@ MonoBehaviour:
- {fileID: 496953434} - {fileID: 496953434}
- {fileID: 2137991537} - {fileID: 2137991537}
- {fileID: 340074661} - {fileID: 340074661}
promptList: {fileID: 0}
explanationPage: {fileID: 45150984} explanationPage: {fileID: 45150984}
explanationCounter: {fileID: 1798182259} explanationCounter: {fileID: 1798182259}
explanationTime: 4 explanationTime: 4
@ -1395,6 +1395,7 @@ MonoBehaviour:
- {fileID: 1854893636} - {fileID: 1854893636}
- {fileID: 2065109614} - {fileID: 2065109614}
- {fileID: 1197279072} - {fileID: 1197279072}
promptList: {fileID: 0}
votingTime: 20 votingTime: 20
--- !u!114 &375256413 --- !u!114 &375256413
MonoBehaviour: MonoBehaviour:

View File

@ -3385,13 +3385,14 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1181392806} - component: {fileID: 1181392806}
- component: {fileID: 1181392807} - component: {fileID: 1181392807}
- component: {fileID: 1181392808}
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: 1 m_IsActive: 0
--- !u!224 &1181392806 --- !u!224 &1181392806
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3434,6 +3435,21 @@ MonoBehaviour:
freezeButton: {fileID: 223773138} freezeButton: {fileID: 223773138}
resumeButton: {fileID: 1114535086} resumeButton: {fileID: 1114535086}
photoBox: {fileID: 1316036600} 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 --- !u!1 &1202782726
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6279,9 +6295,9 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 429358652} - m_Target: {fileID: 1181392808}
m_TargetAssemblyTypeName: StorageManager, Assembly-CSharp m_TargetAssemblyTypeName: QuestionHandler, Assembly-CSharp
m_MethodName: UploadPhoto m_MethodName: OnSubmitButton
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}

View File

@ -31,11 +31,14 @@ void Start()
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (wTexture) Texture2D texture = GetPhoto();
if (texture)
{ {
photoBox.texture = GetPhoto(); photoBox.texture = texture;
Resources.UnloadUnusedAssets();
} }
Resources.UnloadUnusedAssets();
} }
public void WebcamResume() public void WebcamResume()
@ -123,7 +126,7 @@ public Texture2D GetPhoto()
return photo; return photo;
} }
if (!wTexture) if (!wTexture || WebCamTexture.devices.Count() < 1)
{ {
return null; return null;
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
[Serializable] [Serializable]
@ -28,14 +29,62 @@ public List<Player> GetPlayerList()
return new List<Player>(players.Values); 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() public List<Question> GetQuestionList()
{ {
return new List<Question>(questions.Values); 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; 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;
}
} }

View File

@ -7,7 +7,6 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
/// <summary> /// <summary>
/// This is the game state manager on the phone side /// This is the game state manager on the phone side
@ -82,7 +81,7 @@ private void OnApplicationQuit()
private void Update() 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 = ((int)duration.TotalSeconds).ToString("D1"); counter.text = ((int)duration.TotalSeconds).ToString("D1");
@ -220,12 +219,12 @@ private void JoinRoom(Action callback_OnRoomJoined)
public void StartGame() public void StartGame()
{ {
// send Start Game // send Start Game
myRoom.setPlayersAreReady(1); myRoom.SetPlayersAreReady(1);
string JSON = JsonUtility.ToJson(myRoom); string JSON = JsonUtility.ToJson(myRoom);
Debug.Log(JSON); Debug.Log(JSON);
try try
{ {
sendCurrentState(GameState.Explanation, () => SendCurrentState(GameState.Explanation, () =>
{ {
Debug.Log($"start the game", this); Debug.Log($"start the game", this);
myRoom.currentState = (int)GameState.Explanation; myRoom.currentState = (int)GameState.Explanation;
@ -238,8 +237,6 @@ public void StartGame()
{ {
Debug.LogException(ex); Debug.LogException(ex);
} }
} }
/// <summary> /// <summary>
@ -298,7 +295,7 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{ {
string JSON = e.Snapshot.GetRawJsonValue(); string JSON = e.Snapshot.GetRawJsonValue();
myRoom = JsonConvert.DeserializeObject<Room>(e.Snapshot.GetRawJsonValue()); myRoom = JsonConvert.DeserializeObject<Room>(e.Snapshot.GetRawJsonValue());
} }
} }
catch (Exception ex) catch (Exception ex)
@ -312,14 +309,31 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
} }
switch (myRoom.currentState) switch (myRoom.currentState)
{ {
case (int)GameState.EnteringName:
{
if (EndGame.activeInHierarchy)
{
EndGame.SetActive(false);
HomeConnection.SetActive(true);
}
break;
}
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
{ {
CheckIfIAmTheFirst(myRoom.GetPlayerList()); if (!HomeConnection.activeInHierarchy)
UpdateDisplayedListUser(myRoom.GetPlayerList()); {
CheckIfIAmTheFirst(myRoom.GetPlayerList());
UpdateDisplayedListUser(myRoom.GetPlayerList());
}
break; break;
} }
case (int)GameState.Explanation: case (int)GameState.Explanation:
{ {
if (EndGame.activeInHierarchy)
{
EndGame.SetActive(false);
}
WaitingRoom.SetActive(false); WaitingRoom.SetActive(false);
BeforeStart.SetActive(true); BeforeStart.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(3); endOfExplanationDate = DateTime.Now.AddSeconds(3);
@ -368,7 +382,7 @@ private void CheckIfIAmTheFirst(List<Player> players)
submitStartGame.SetActive(true); 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 => myOnlineRoom.Child("currentState").SetValueAsync((int)state).ContinueWithOnMainThread(task =>
{ {
@ -390,6 +404,39 @@ public void OnClickSubmitSignIn()
string roomCode = roomCodeField.text; string roomCode = roomCodeField.text;
PlayerValidateNameAndServerRoom(playerName, roomCode); PlayerValidateNameAndServerRoom(playerName, roomCode);
} }
public void onClickSamePlayers()
{
myRoom.currentState = (int)GameState.Explanation;
myRoom.currentQuestion = 2;
myRoom.questions = null;
string json = JsonUtility.ToJson(myRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
});
}
public void onClickNewPlayers()
{
myRoom.currentState = (int)GameState.EnteringName;
myRoom.currentQuestion = 0;
myRoom.questions = null;
myRoom.players = null;
string json = JsonUtility.ToJson(myRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
});
}
} }
public enum GameState public enum GameState

View 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()
{
gameManager = managers.GetComponent<GameManager>();
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 02a8e72b27188ad7f8079b04e756e652
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,9 +15,8 @@ public class RoomManager : MonoBehaviour
/// TextMeshPro that show the value of the current rooom code /// TextMeshPro that show the value of the current rooom code
/// </summary> /// </summary>
public TextMeshProUGUI roomCodeLabel; public TextMeshProUGUI roomCodeLabel;
public AudioClip playerJoinSFX;
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;
[Header("Explanation Page")] [Header("Explanation Page")]
public GameObject explanationPage; public GameObject explanationPage;
@ -31,10 +30,13 @@ public class RoomManager : MonoBehaviour
public TextMeshProUGUI propositionCounter; public TextMeshProUGUI propositionCounter;
public float propositionTime = 60; public float propositionTime = 60;
public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>(); public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>();
private Dictionary<string, TextMeshProUGUI> propositionLabelsByID = new Dictionary<string, TextMeshProUGUI>();
private DateTime endOfPropositionDate = DateTime.MinValue; private DateTime endOfPropositionDate = DateTime.MinValue;
private bool allPlayersHasProposedTwoPictures = false; private bool allPlayersHasProposedTwoPictures = false;
private Dictionary<string, Proposition[]> propositionsPerPlayers = new Dictionary<string, Proposition[]>();
[Header("Other")] [Header("Other")]
public PromptList promptList;
private Room myRoom = null; private Room myRoom = null;
public float votingTime = 20; public float votingTime = 20;
@ -94,13 +96,34 @@ private void Update()
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) //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() 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}";
@ -226,11 +248,6 @@ private int GenerateRandomAvailableCode(List<int> _impossibleCodes)
return random; return random;
} }
public void PlayerSendProposition(Proposition _proposition)
{
}
/// <summary> /// <summary>
/// Called when the first player clicked "Start" /// Called when the first player clicked "Start"
/// </summary> /// </summary>
@ -240,53 +257,30 @@ public void HostHasStartedGame()
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime); endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime);
propositionLabelsByID.Clear();
//display only correct numbers of labels
for (int i = 0; i < waitingForPropositionsLabels.Count; i++) for (int i = 0; i < waitingForPropositionsLabels.Count; i++)
{ {
TextMeshProUGUI tmp = waitingForPropositionsLabels[i]; TextMeshProUGUI tmp = waitingForPropositionsLabels[i];
tmp.gameObject.SetActive(i < myRoom.players.Count); 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> //Register all propositions of each players
/// Start the proposition timer foreach (Player p in myRoom.GetOrderedPlayerList())
/// </summary> {
public void StartPropositionTimer() 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); Debug.LogError(value.DatabaseError.Message);
return; 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(); string JSON = value.Snapshot.GetRawJsonValue();
Debug.Log($"your room has been updated :\n{JSON}"); Debug.Log($"your room has been updated :\n{JSON}");
GameState lastState = (GameState)myRoom.currentState;
try try
{ {
myRoom = JsonConvert.DeserializeObject<Room>(JSON); myRoom = JsonConvert.DeserializeObject<Room>(JSON);
@ -358,19 +358,50 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
Debug.LogException(ex); 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) switch (myRoom.currentState)
{ {
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
UpdateConnectedPlayerList(myRoom.GetPlayerList()); Debug.Log("New State : WaitingForOtherPlayersToJoin");
break; break;
case (int)GameState.Explanation: case (int)GameState.Explanation:
Debug.Log("New State : Explanation");
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); AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
break; break;
case (int)GameState.MakeProposition: case (int)GameState.MakeProposition:
Debug.Log("New State : MakeProposition");
HostHasStartedGame(); HostHasStartedGame();
break; break;
default: 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> /// <summary>
/// Update the player labels on the WaitingForPlayer page /// Update the player labels on the WaitingForPlayer page
/// </summary> /// </summary>
/// <param name="_players"></param> /// <param name="_players"></param>
private void UpdateConnectedPlayerList(List<Player> _players) private void UpdateConnectedPlayerList(List<Player> _players)
{ {
AudioSource.PlayClipAtPoint(playerJoinSFX, Vector3.zero);
ResetAllPlayerLabels(); ResetAllPlayerLabels();
Debug.Log($"players count = {_players.Count}"); Debug.Log($"players count = {_players.Count}");
List<Player> orderedPlayers = _players.OrderBy(x => x.creationDate).ToList(); List<Player> orderedPlayers = _players.OrderBy(x => x.creationDate).ToList();
for (int i = 0; i < orderedPlayers.Count; i++) for (int i = 0; i < orderedPlayers.Count; i++)
{ {
waitingPlayersById.Add(orderedPlayers[i].id, waitingForPlayersLabels[i]);
Debug.Log($"player {i} = {orderedPlayers[i].name}"); Debug.Log($"player {i} = {orderedPlayers[i].name}");
waitingForPlayersLabels[i].text = orderedPlayers[i].name; waitingForPlayersLabels[i].text = orderedPlayers[i].name;
} }

View File

@ -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(); Texture2D photo = gameObject.GetComponent<CameraManager>().GetPhoto();
byte[] photoBytes = ImageConversion.EncodeToJPG(photo); byte[] photoBytes = ImageConversion.EncodeToJPG(photo);