Exemplo n.º 1
0
 /// <summary>
 ///  push window
 /// </summary>
 /// <param name="subwindow"></param>
 public void PushWindow(UIAbstract subwindow)
 {
     if (_uiwindowstack.Contains(subwindow) == false)
     {
         _uiwindowstack.Push(subwindow);
     }
 }
Exemplo n.º 2
0
    /// <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));
    }
Exemplo n.º 3
0
    // setting style
    public void SetStyle(UIStyle style, UIAbstract opendMe)
    {
        if (uiStype == UIStyle.NONE)
        {
            uiStype = style;
        }

        parentOpenMeUI = opendMe;
    }
Exemplo n.º 4
0
 // test update
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         // 배버튼이 작동 안하도록 하는 상황 만들기
         UIAbstract uiwindow = UIController.Instance.GetBackWindow();
         if (uiwindow != null)
         {
             uiwindow.Close();
         }
     }
 }
Exemplo n.º 5
0
    /// <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);
        }
    }