123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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);
- }
- }
|