| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- 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) };
- public Text gameStatusText;
- public Text gameTitleText;
- public enum Status {
- PENDING,
- OTHERS_TURN,
- YOUR_TURN,
- DECLINED
- }
- // Start is called before the first frame update
- void Start() {
- }
- // Update is called once per frame
- void Update() {
- }
- 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];
- }
- }
- public void SetTitleText(string text) {
- gameTitleText.text = text;
- }
- public void SetGameStatusText(string text) {
- gameStatusText.text = text;
- }
- }
|