示例#1
0
        private void UpdateCurrentPanel()
        {
            IZUIPanel panel = null;

            for (int i = 0; i < panels.Count; i++)
            {
                IZUIPanel tmp = panels[i];
                if (tmp.isOpen && panel == null)
                {
                    panel = tmp;
                }
                else if (tmp.isOpen && tmp.depth > panel.depth)
                {
                    panel = tmp;
                }
            }
            if (panel != null)
            {
                UpdateHistory();
                _currentPanel = panel as ZUIPanel;
                current       = _currentPanel.name;
            }
            else
            {
                current       = "";
                _currentPanel = null;
            }
        }
示例#2
0
        private IZUIPanel CreatePanel(string uname, RectTransform parent)
        {
            ZUIPanel panel = null;

            for (int i = 0; i < prefabs.Count; i++)
            {
                ZUIPanel prefab = prefabs[i];
                if (prefab != null)
                {
                    panel = Instantiate(prefab);
                    if (panel != null)
                    {
                        panel.name = prefab.name;
                        panel.mTransform.SetParent(parent, false);
                        panel.mTransform.localScale = Vector3.one;
                        panel.effectPoint           = effectPoint;
                        panels.Add(panel);
                    }
                    else
                    {
                        ZLog.Warning("this is not ZUIPanel of these prefabs that is " + uname + "!!!");
                    }
                    break;
                }
            }
            if (panel == null)
            {
                ZLog.Warning("can not find prefab that name = " + uname);
            }
            return(panel);
        }
示例#3
0
 IEnumerator OpenInspector(ZUIPanel panel, UIParamInfo info)
 {
     while (panel.IsStartEnd == false)
     {
         yield return(null);
     }
     panel.Open(info);
 }
示例#4
0
 private void CloseWakenPanels()
 {
     UpdateHistory();
     for (int i = 0; i < panels.Count; i++)
     {
         if (panels[i].isOpen)
         {
             ClosePanel(panels[i]);
         }
     }
     _currentPanel = null;
 }
示例#5
0
 private void ActivePanel(IZUIPanel panel, UIParamInfo param)
 {
     if (panel == null)
     {
         return;
     }
     UpdateHistory();
     panel.WakenUp(panelParent);
     _currentPanel = panel as ZUIPanel;
     current       = _currentPanel.name;
     StartCoroutine(OpenInspector(_currentPanel, param));
 }
示例#6
0
        /// <summary>
        /// 重复打开
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="param"></param>
        public void RepeatOpenPanel(IZUIPanel panel, UIParamInfo param)
        {
            if (panel == null)
            {
                return;
            }
            UpdateHistory();
            panel.Open(panelParent, param);
            _currentPanel = panel as ZUIPanel;
            current       = _currentPanel.name;

            ZLog.Warning("panel name = " + current + " is opened!!!");
        }
示例#7
0
        public static ZUIPanel[] GetWakendPanels()
        {
            if (Instance == null)
            {
                Debug.LogError("panel controller is not find!!!");
            }
            List <ZUIPanel> list = new List <ZUIPanel>();

            for (int i = 0; i < Instance.panels.Count; i++)
            {
                ZUIPanel panel = Instance.panels[i] as ZUIPanel;
                if (panel != null && panel.isOpen)
                {
                    list.Add(panel);
                }
            }

            return(list.ToArray());
        }
示例#8
0
 public void InitPrefabs(List <AssetInfo> assets)
 {
     if (assets == null || assets.Count < 1)
     {
         return;
     }
     prefabs.Clear();
     for (int i = 0; i < assets.Count; i++)
     {
         AssetInfo info   = assets[i];
         ZUIPanel  prefab = ZAssetController.Instance.GetPrefab <ZUIPanel>(info.asset);
         if (prefab != null)
         {
             prefab.name  = info.name;
             prefab.grade = info.grade;
             prefabs.Add(prefab);
             //CreatePanel<ZUIPanel>(prefab,panelParent);
         }
     }
 }
示例#9
0
        public void ShowBackPanel()
        {
            if (_currentPanel != null)
            {
                ClosePanel(_currentPanel);
            }
            string uname = parent;

            if (string.IsNullOrEmpty(uname))
            {
                return;
            }
            history.RemoveAt(history.Count - 1);
            IZUIPanel panel = null;

            for (int i = 0; i < panels.Count; i++)
            {
                if (panels[i].definition == uname)
                {
                    panel = panels[i];
                    break;
                }
            }
            if (panel != null)
            {
                ZUIPanel tmp = panel as ZUIPanel;
                if (panel.isOpen)
                {
                    panel.Open(tmp.Info);
                }
                else
                {
                    panel.WakenUp(panelParent);
                    StartCoroutine(OpenInspector(tmp, tmp.Info));
                }
                _currentPanel = tmp;
                current       = _currentPanel.name;
                ZLog.Warning("ShowBackPanel....." + current);
            }
        }
示例#10
0
 void OnDestroy()
 {
     _currentPanel = null;
     panels.Clear();
 }