using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ViewManager : MonoBehaviour { public static int LOGINROOM_VIEW = 0; public static int SETNAME_VIEW = 1; public static int BASESET_VIEW = 2; public static int ROOM_VIEW = 3; public GameObject[] ViewList; public static ViewManager Instance; public GameObject Tusi; public Text TusiText; void Start() { Instance = this; ShowView(LOGINROOM_VIEW); } void Update() { LoginManager.Instance.InputUserName(); LoginManager.Instance.InputUserName1(); } public void ShowView(int index) { for (int i = 0; i < ViewList.Length; i++) { if (i == index) { ViewList[i].SetActive(true); } else { ViewList[i].SetActive(false); } } } public void ShowTuSi(string action, string msg="") { switch (action) { case "PassError": Tusi.SetActive(true); TusiText.text = msg; Invoke("CloseTusi", 2f); break; case "ServerException": Tusi.SetActive(true); TusiText.text = "服务器异常"; Invoke("CloseTusi", 2f); break; case "JoinRoom": Tusi.SetActive(true); TusiText.text = msg + "已经加入了房间"; Invoke("CloseTusi", 2f); break; case "LeaveRoom": Tusi.SetActive(true); TusiText.text = msg + "已经退出了房间"; Invoke("CloseTusi", 2f); break; } } public void CloseTusi() { Tusi.SetActive(false); } }