Beispiel #1
0
        public void Close(string UIName)
        {
            UIBase uIBase;

            if (!TryGetUIBase(UIName, out uIBase))
            {
                return;
            }

            //取出界面,执行OnExit函数
            QLog.LogEditor(StringUtility.Format("{0} 执行OnExit函数", uIBase.UIName.ToString()));
            uIBase.OnClose();
            UIBasePool.Remove(uIBase);

            GameObject.Destroy(uIBase.CacheGameObject);
            uIBase = null;

            //取出最后的界面,执行OnResume函数
            UIBase lastUIBase;

            if (TryGetLastUIBase(out lastUIBase))
            {
                QLog.LogEditor(StringUtility.Format("{0} 执行OnResume函数", lastUIBase.UIName.ToString()));
                lastUIBase.OnResume();
            }
        }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     QLog.Sample("QLog.Sample");
     QLog.Log("QLog.Log");
     QLog.LogEditor("QLog.LogEditor");
     QLog.LogError("QLog.LogError");
     QLog.LogErrorEditor("QLog.LogErrorEditor");
     QLog.LogWarning("QLog.LogWarning");
     QLog.LogWarningEditor("QLog.LogWarningEditor");
 }
Beispiel #3
0
        public void Close()
        {
            UIBase lastUIBase;

            if (TryGetLastUIBase(out lastUIBase))
            {
                var UIName = lastUIBase.UIName;
                QLog.LogEditor(StringUtility.Format("统一关闭 {0} .", UIName.ToString()));
                Close(UIName);
            }
        }
Beispiel #4
0
        public void Close()
        {
            UIBase lastUIBase;

            if (TryGetLastUIBase(out lastUIBase))
            {
                EUI eUI = lastUIBase.eUI;
                QLog.LogEditor(StringPool.Format("统一关闭 {0} .", eUI.ToString()));
                Close(eUI);
            }
        }
Beispiel #5
0
        public void OnGroup(int pre, int cur)
        {
            QLog.LogEditor(StringPool.Format("点击pre = {0}, cur = {1}.", pre, cur));

            //设置所有组件的显示隐藏
            int length = list.Count;

            for (int i = 0; i < length; i++)
            {
                QToggleButton toggleButton = list[i];
                toggleButton.SetChoose(cur);
            }

            //设置组件的回调函数
            if (OnGroupAction != null)
            {
                OnGroupAction(pre, cur);
            }
        }
Beispiel #6
0
 private void ClickEvent()
 {
     if (bGroup)
     {
         if (index == curIndex)
         {
             return;
         }
         if (OnGroupAction != null)
         {
             OnGroupAction(curIndex, index);
         }
     }
     else
     {
         SetChoose(!bChoose);
         if (OnToggleAction != null)
         {
             OnToggleAction(bChoose);
         }
         QLog.LogEditor("当前bChoose: " + bChoose);
     }
 }
Beispiel #7
0
        public void Open(string UIName, params object[] objs)
        {
            UIBase uIBase;

            if (TryGetUIBase(UIName, out uIBase))
            {
                QLog.LogWarning(StringUtility.Concat("Already open UI, witch UIName is ", UIName.ToString()));
                return;
            }

            UIBase prefabDatabase = UnityEditor.AssetDatabase.LoadAssetAtPath <UIBase>(StringUtility.Concat(PATH_PREFAB_UI, UIName.ToString(), ".prefab"));

            if (prefabDatabase == null)
            {
                QLog.LogError(StringUtility.Concat("Can not find UIBase Script in UIName = ", UIName.ToString()));
                return;
            }

            uIBase = Object.Instantiate <UIBase>(prefabDatabase, UGUI.UGUICanvas.transform, false);
            if (uIBase == null)
            {
                QLog.LogError(StringUtility.Concat("Instantiate fail, UIName = ", UIName.ToString()));
                return;
            }

            //设置数据,判断是否进入
            uIBase.SetData(objs);
            if (!uIBase.IsCanOpen())
            {
                QLog.Log(StringUtility.Concat("The UIBase script can not enter, UIName = ", UIName.ToString()));
                return;
            }

            //取出最后的界面,执行OnPause函数
            UIBase lastUIBase;

            if (TryGetLastUIBase(out lastUIBase))
            {
                QLog.LogEditor(StringUtility.Format("{0} 执行暂停函数", lastUIBase.UIName.ToString()));
                lastUIBase.OnPause();
            }

            uIBase.CacheGameObject.SetActive(true);

            //设置层级
            var UINameDepth = uIBase.UINameType;
            int tmpDepth;

            if (DepthPool.TryGetValue(UINameDepth, out tmpDepth))
            {
                tmpDepth += DEPTH_BETWEEN_UI;
                DepthPool[UINameDepth] = tmpDepth;
            }
            else
            {
                tmpDepth += (int)UINameDepth + DEPTH_BETWEEN_UI;
                DepthPool.Add(UINameDepth, tmpDepth);
            }

            uIBase.SetDepth(UIName, tmpDepth);
            QLog.LogEditor(StringUtility.Format("{0} depth is {1}", uIBase.UIName.ToString(), tmpDepth.ToString()));


            //新界面,执行OnEnter函数
            QLog.LogEditor(StringUtility.Format("{0} 执行OnEnter函数", uIBase.UIName.ToString()));
            uIBase.OnOpen();
            UIBasePool.Add(uIBase);
        }