|
|
@@ -45,7 +45,11 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
public string GameStatus {
|
|
|
get { return gameStatus; }
|
|
|
set {
|
|
|
- gameStatus = value;
|
|
|
+ if (value.Equals("Avtive") && CurrentPlayer.Equals(Database.Instance.GetSignedInUser().Value, StringComparison.InvariantCultureIgnoreCase)) {
|
|
|
+ gameStatus = "YOUR_TURN";
|
|
|
+ } else {
|
|
|
+ gameStatus = value;
|
|
|
+ }
|
|
|
SetColor(gameStatus);
|
|
|
SetGameStatusText();
|
|
|
}
|
|
|
@@ -77,6 +81,7 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
private void Start() {
|
|
|
gameInfoButton = this.GetComponent<Button>();
|
|
|
gameInfoButton.onClick.AddListener(ShowInfoPanel);
|
|
|
+ PlayerInfos = new List<KeyValuePair<string, string>>();
|
|
|
}
|
|
|
|
|
|
private void ShowInfoPanel() {
|
|
|
@@ -93,6 +98,13 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
Players.Add(playerName);
|
|
|
}
|
|
|
|
|
|
+ public void addPlayerInfo(string playerName, string playerStatus) {
|
|
|
+ if (PlayerInfos == null) {
|
|
|
+ PlayerInfos = new List<KeyValuePair<string, string>>();
|
|
|
+ }
|
|
|
+ PlayerInfos.Add(new KeyValuePair<string, string>(playerName, playerStatus));
|
|
|
+ }
|
|
|
+
|
|
|
public string gameStatus;
|
|
|
|
|
|
private void SetColor(string status) {
|
|
|
@@ -123,7 +135,6 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
}
|
|
|
|
|
|
public void SetGameStatusText() {
|
|
|
- String extraInfo = ""; // TODO
|
|
|
if ("PENDING".Equals(GameStatus)) {
|
|
|
gameStatusText.gameObject.GetComponent<TextLocalization>().key = PENDING;
|
|
|
gameStatusText.text = LocalizationManager.Instance.GetText(PENDING);
|
|
|
@@ -137,7 +148,7 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
} else if ("OTHERS_TURN".Equals(GameStatus)) {
|
|
|
gameStatusText.gameObject.GetComponent<TextLocalization>().key = OTHERS_TURN;
|
|
|
string message = LocalizationManager.Instance.GetText(OTHERS_TURN);
|
|
|
- gameStatusText.text = String.Format(message, extraInfo);
|
|
|
+ gameStatusText.text = String.Format(message, CurrentPlayer);
|
|
|
gameTitleText.gameObject.GetComponent<TextLocalization>().key = "NOT_YOUR_TURN";
|
|
|
SetTitleText(LocalizationManager.Instance.GetText("NOT_YOUR_TURN"));
|
|
|
} else if ("DECLINED".Equals(GameStatus)) {
|
|
|
@@ -153,7 +164,7 @@ public class OnlineGameScript : MonoBehaviour {
|
|
|
} else if ("ACTIVE".Equals(GameStatus)) {
|
|
|
TextLocalization textLocalization = gameStatusText.gameObject.GetComponent<TextLocalization>();
|
|
|
textLocalization.key = ACTIVE;
|
|
|
- textLocalization.SetReplaceText(extraInfo);
|
|
|
+ textLocalization.SetReplaceText(CurrentPlayer);
|
|
|
gameTitleText.gameObject.GetComponent<TextLocalization>().key = ACTIVE_TITLE;
|
|
|
gameTitleText.text = LocalizationManager.Instance.GetText(ACTIVE_TITLE);
|
|
|
} else {
|