/// <summary> /// push window /// </summary> /// <param name="subwindow"></param> public void PushWindow(UIAbstract subwindow) { if (_uiwindowstack.Contains(subwindow) == false) { _uiwindowstack.Push(subwindow); } }
/// <summary> /// Create UI /// </summary> public T CreateUI <T>(string path, UIStyle uiStyle, UIAbstract opendMe = null, Transform parentTrans = null) { GameObject resGo = GameObject.Instantiate(Resources.Load(path) as GameObject); if (resGo != null) { resGo.name = path.Remove(0, path.LastIndexOf('/') + 1); resGo.SetActive(false); if (parentTrans != null) { resGo.transform.parent = parentTrans; } else { resGo.transform.parent = canvasTransPanel; } resGo.transform.localPosition = Vector3.zero; resGo.transform.localScale = Vector3.one; T component = resGo.GetComponent <T>(); _currentUI = component as UIAbstract; _currentUI.SetStyle(uiStyle, opendMe); if (component != null) { return(component); } return(default(T)); } return(default(T)); }
// setting style public void SetStyle(UIStyle style, UIAbstract opendMe) { if (uiStype == UIStyle.NONE) { uiStype = style; } parentOpenMeUI = opendMe; }
// test update void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { // 배버튼이 작동 안하도록 하는 상황 만들기 UIAbstract uiwindow = UIController.Instance.GetBackWindow(); if (uiwindow != null) { uiwindow.Close(); } } }
/// <summary> /// pop window /// </summary> /// <returns></returns> public UIAbstract GetBackWindow() { if (_uiBackState == UIBackState.DO_NOT_BACK) { return(null); } if (_uiwindowstack.Count > 1) { UIAbstract backUI = _uiwindowstack.Pop(); _currentUI = _uiwindowstack.Pop(); if (_uiwindowstack.Count == 0) { _uiwindowstack.Push(_currentUI); } return(backUI); } else { return(null); } }