ViewManager.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ViewManager : MonoBehaviour
  5. {
  6. public static int LOGINROOM_VIEW = 0;
  7. public static int SETNAME_VIEW = 1;
  8. public static int BASESET_VIEW = 2;
  9. public static int ROOM_VIEW = 3;
  10. public GameObject[] ViewList;
  11. public static ViewManager Instance;
  12. public GameObject Tusi;
  13. public TextMesh TusiText;
  14. void Start()
  15. {
  16. Instance = this;
  17. ShowView(LOGINROOM_VIEW);
  18. }
  19. void Update()
  20. {
  21. }
  22. public void ShowView(int index)
  23. {
  24. for (int i = 0; i < ViewList.Length; i++)
  25. {
  26. if (i == index)
  27. {
  28. ViewList[i].SetActive(true);
  29. }
  30. else
  31. {
  32. ViewList[i].SetActive(false);
  33. }
  34. }
  35. }
  36. public void ShowTuSi(string msg)
  37. {
  38. Tusi.SetActive(true);
  39. TusiText.text = msg;
  40. Invoke("CloseTusi", 2f);
  41. }
  42. public void CloseTusi()
  43. {
  44. Tusi.SetActive(false);
  45. }
  46. }