using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class OnlineGameScript : MonoBehaviour { // Status color Pending, not your turn, your turn, declined List statusColors = new List() { new Color32(234, 164, 17, 100), new Color32(255, 255, 24, 175), new Color32(0, 255, 0, 100), new Color32(219, 12, 65, 100), new Color32(12,12,219,150) }; public Text gameStatusText; public Text gameTitleText; private int id; private int winNumber; private int answerTimer; private int roundTimeLimit; private string currentPlayer; private int round; private string startDate; private string lastPlayedDate; private string finishedDate; private List players; private List> playerInfos; public int GetId() { return id; } public void SetId(int value) { id = value; } public int WinNumber { get => winNumber; set => winNumber = value; } public int AnswerTimer { get => answerTimer; set => answerTimer = value; } public int RoundTimeLimit { get => roundTimeLimit; set => roundTimeLimit = value; } public string CurrentPlayer { get => currentPlayer; set => currentPlayer = value; } public int Round { get => round; set => round = value; } public string StartDate { get => startDate; set => startDate = value; } public string LastPlayedDate { get => lastPlayedDate; set => lastPlayedDate = value; } public string FinishedDate { get => finishedDate; set => finishedDate = value; } public string GameStatus { get { return gameStatus; } set { if (value.Equals("Avtive") && CurrentPlayer.Equals(Database.Instance.GetSignedInUser().Value, StringComparison.InvariantCultureIgnoreCase)) { gameStatus = "YOUR_TURN"; } else { gameStatus = value; } SetColor(gameStatus); SetGameStatusText(); } } public List> PlayerInfos { get => playerInfos; set => playerInfos = value; } public List Players { get => players; set => players = value; } private string PENDING_TITLE = "ONLINE_GAME_STATUS_TITLE_VALUE_PENDING"; private string ACTIVE_TITLE = "ONLINE_GAME_STATUS_TITLE_ACTIVE"; private string DECLINED_TITLE = "ONLINE_GAME_STATUS_TITLE_DECLINED"; private string INVITED_TITLE = "ONLINE_GAME_STATUS_TITLE_INVITED"; private string FINISHED_TITLE = "ONLINE_GAME_STATUS_TITLE_INVITED"; private string PENDING = "ONLINE_GAME_STATUS_PENDING"; private string DECLINED = "ONLINE_GAME_STATUS_DECLINED"; private string ACTIVE = "ONLINE_GAME_STATUS_ACTIVE"; private string INVITED = "ONLINE_GAME_STATUS_INVITED"; private string OTHERS_TURN = "ONLINE_GAME_STATUS_OTHERS_TURN"; private string YOUR_TURN = "ONLINE_GAME_STATUS_YOUR_TURN"; // BEHÖVS EN FINISHED OCKSÅ. // behövs nog en partialy declined status också, om en av fyra tackar nej kanske man viss spela ändå. // behövs också en med dina inbjudningar. private Button gameInfoButton; private void Start() { gameInfoButton = this.GetComponent