Пример #1
0
 internal void ShowPanel(string panelName, params object[] param)
 {
     if (_dictPanel.ContainsKey(panelName))
     {
         if (IsPanelVisiable(panelName))
         {
             return;
         }
         else
         {
             _dictPanel[panelName].gameObject.SetActive(true);
         }
     }
     else
     {
         UIBasePanel panel     = Resources.Load <UIBasePanel>(string.Format("Prefabs/UI/{0}", panelName));
         UIBasePanel initPanel = GameObject.Instantiate <UIBasePanel>(panel, _tranUIRoot);
         initPanel.gameObject.name         = panelName;
         initPanel.transform.localScale    = Vector3.one;
         initPanel.transform.localPosition = Vector3.zero;
         initPanel.Param = param;
         initPanel.Init();
         _dictPanel.Add(panelName, initPanel);
     }
 }
Пример #2
0
    // 패널을 연다
    public UIBasePanel Open(string path, params object[] _parameters)
    {
        UIRootInit();

        UIBasePanel panel = GetPanel(path);

        if (panel == null)
        {
            GameObject oPanel = (GameObject)Instantiate(Resources.Load("UI/" + path));
            oPanel.name                    = path;
            oPanel.transform.parent        = _Default;
            oPanel.transform.localPosition = Vector3.zero;
            oPanel.transform.localScale    = Vector3.one;

            if (oPanel != null)
            {
                panel = oPanel.GetComponent <UIBasePanel>();
                panel.Init();
            }

            if (panel._ePanelType != ePanelState.None)
            {
                if (panel != null)
                {
                    if (panel._ePanelType == ePanelState.Default)
                    {
                        ListUIPanel.Insert(0, panel);
                    }
                    else
                    {
                        ListUIPanel.Add(panel);
                    }
                }
            }
        }
        else
        {
            // 리스트에서 가장 앞으로 옮긴다
            if (panel._ePanelType != ePanelState.None)
            {
                ListUIPanel.Remove(panel);
                ListUIPanel.Insert(0, panel);
            }
        }
        // 파라미터 저장
        panel.parameters = _parameters;

        if (panel._ePanelType == ePanelState.Default)
        {
            _CurUIBasePanel = panel;
        }
        panel.LateInit();

        //for (int i = 0; i < ListUIPanel.Count; ++i)
        //    Debug.Log(ListUIPanel[i].name);
        //Debug.Log("CurPanel : " + _CurUIBasePanel.name);

        return(panel);
    }