QuanJuBackManager.cs 735 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class QuanJuBackManager : MonoBehaviour
  5. {
  6. public static QuanJuBackManager Instance ;
  7. public GameObject nowWindow;
  8. public Stack<GameObject> stackList=new Stack<GameObject>();
  9. public void setStack(GameObject go)
  10. {
  11. stackList.Push(go);
  12. }
  13. public void back()
  14. {
  15. if(stackList.Count<=0)
  16. {
  17. WindowMainManager.instance.m.isOn=true;
  18. }
  19. else
  20. {
  21. nowWindow.SetActive(false);
  22. stackList.Pop().SetActive(true);
  23. }
  24. }
  25. public void clearstack()
  26. {
  27. stackList.Clear();
  28. }
  29. void Awake()
  30. {
  31. Instance=this;
  32. }
  33. }