Beispiel #1
0
 private MyBasePanel GetPanel(MyUiType panelType)
 {
     PanelCache.TryGetValue(panelType, out instPanel);
     //判断缓存中是否有panel
     if (instPanel == null)
     {
         //find path by Name
         string path = "";
         foreach (var item in json.PanelInfoList)
         {
             if (item.PanelName == panelType.ToString())
             {
                 path = item.PanelPath;
             }
         }
         instPanel = GameObject.Instantiate(Resources.Load(path)) as GameObject;
         instPanel.transform.SetParent(CanvasTransform, false);
         PanelCache.Add(panelType, instPanel);
     }
     else
     {
         Debug.Log("Using Cache");
         // instPanel =
     }
     //MyBasePanel mb = instPanel.GetComponent<MyBasePanel>();
     return(instPanel.GetComponent <MyBasePanel>());
 }
Beispiel #2
0
    /// <summary>
    ///
    /// </summary>

    public void PushPanel(MyUiType panelType)
    {
        //????
        //if (PanelStack.Count != 0)
        //{
        //    PanelStack.Peek().OnPause();
        //}

        MyBasePanel basePanel = GetPanel(panelType);

        PanelStack.Push(basePanel);
        basePanel.OnEnter();
    }