|
|
@@ -1,5 +1,4 @@
|
|
|
using System;
|
|
|
-using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
@@ -7,7 +6,7 @@ using UnityEngine.UI;
|
|
|
public class OnlineGameScript : MonoBehaviour {
|
|
|
|
|
|
// Status color Pending, not your turn, your turn, declined
|
|
|
- List<Color32> statusColors = new List<Color32>() { new Color32(234, 164, 17, 100), new Color32(255, 255, 24, 175), new Color32(0, 255, 0, 100), new Color32(75, 50, 75, 100) };
|
|
|
+ List<Color32> statusColors = new List<Color32>() { new Color32(234, 164, 17, 100), new Color32(255, 255, 24, 175), new Color32(0, 255, 0, 100), new Color32(219, 12, 65, 100) };
|
|
|
public Text gameStatusText;
|
|
|
public Text gameTitleText;
|
|
|
|
|
|
@@ -30,17 +29,27 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
public string StartDate { get => startDate; set => startDate = value; }
|
|
|
public string LastPlayedDate1 { get => LastPlayedDate; set => LastPlayedDate = value; }
|
|
|
public string FinishedDate { get => finishedDate; set => finishedDate = value; }
|
|
|
-
|
|
|
- public enum Status {
|
|
|
- PENDING,
|
|
|
- OTHERS_TURN,
|
|
|
- YOUR_TURN,
|
|
|
- DECLINED
|
|
|
+ public string GameStatus {
|
|
|
+ get { return gameStatus; }
|
|
|
+ set {
|
|
|
+ gameStatus = value;
|
|
|
+ SetColor(gameStatus);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private string PENDING = "ONLINE_GAME_STATUS_VALUE_PENDING";
|
|
|
+ private string OTHERS_TURN = "ONLINE_GAME_STATUS_VALUE_OTHERS_TURN";
|
|
|
+ private string DECLINED = "ONLINE_GAME_STATUS_VALUE_DECLINED";
|
|
|
+ private string YOUR_TURN = "ONLINE_GAME_STATUS_VALUE_YOUR_TURN";
|
|
|
+
|
|
|
+ // 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.
|
|
|
+
|
|
|
+ public string gameStatus;
|
|
|
+
|
|
|
// Start is called before the first frame update
|
|
|
void Start() {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// Update is called once per frame
|
|
|
@@ -48,15 +57,19 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void SetStatusColor(Status status) {
|
|
|
- if (status.Equals(Status.PENDING)) {
|
|
|
- this.GetComponent<Image>().color = statusColors[0];
|
|
|
- } else if (status.Equals(Status.OTHERS_TURN)) {
|
|
|
- this.GetComponent<Image>().color = statusColors[1];
|
|
|
- } else if (status.Equals(Status.YOUR_TURN)) {
|
|
|
- this.GetComponent<Image>().color = statusColors[2];
|
|
|
- } else if (status.Equals(Status.DECLINED)) {
|
|
|
- this.GetComponent<Image>().color = statusColors[3];
|
|
|
+ private void SetColor(string status) {
|
|
|
+ Image image = this.GetComponent<Image>();
|
|
|
+ Debug.Log(status);
|
|
|
+ if ("PENDING".Equals(status)) {
|
|
|
+ image.color = statusColors[0];
|
|
|
+ } else if ("YOUR_TURN".Equals(status)) {
|
|
|
+ image.color = statusColors[1];
|
|
|
+ } else if ("OTHERS_TURN".Equals(status)) {
|
|
|
+ image.color = statusColors[2];
|
|
|
+ } else if ("DECLINED".Equals(status)) {
|
|
|
+ image.color = statusColors[3];
|
|
|
+ } else {
|
|
|
+ image.color = new Color32(100, 100, 100, 100);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -64,8 +77,22 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
gameTitleText.text = text;
|
|
|
}
|
|
|
|
|
|
- public void SetGameStatusText(string text) {
|
|
|
- gameStatusText.text = text;
|
|
|
+ public void SetGameStatusText() {
|
|
|
+ SetGameStatusText("");
|
|
|
+ }
|
|
|
+ public void SetGameStatusText(string extraInfo) {
|
|
|
+ if ("PENDING".Equals(GameStatus)) {
|
|
|
+ gameStatusText.text = LocalizationManager.Instance.GetText(PENDING);
|
|
|
+ } else if ("YOUR_TURN".Equals(GameStatus)) {
|
|
|
+ gameStatusText.text = LocalizationManager.Instance.GetText(YOUR_TURN);
|
|
|
+ } else if ("OTHERS_TURN".Equals(GameStatus)) {
|
|
|
+ string message = LocalizationManager.Instance.GetText(OTHERS_TURN);
|
|
|
+ gameStatusText.text = String.Format(message, extraInfo);
|
|
|
+ } else if ("DECLINED".Equals(GameStatus)) {
|
|
|
+ gameStatusText.text = LocalizationManager.Instance.GetText(DECLINED);
|
|
|
+ } else {
|
|
|
+ gameStatusText.text = "SOMETHING WRONG WITH STATUS TITLE FROM TEXT " + GameStatus;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void SetId(string id) {
|
|
|
@@ -92,4 +119,8 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
Int32.TryParse(round, out int intRound);
|
|
|
Round = intRound;
|
|
|
}
|
|
|
+
|
|
|
+ public void SetGameStatus(string status) {
|
|
|
+ GameStatus = status;
|
|
|
+ }
|
|
|
}
|