Пример #1
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");
 }
Пример #2
0
    public static void Log(BT_Result _result, string msg)
    {
        switch (_result)
        {
        case BT_Result.FAIL:
            QLog.LogError("Bt_Result: " + _result);
            break;

        case BT_Result.RUNING:
            QLog.LogWarning("Bt_Result: " + _result);
            break;

        case BT_Result.SUCCESSFUL:
            QLog.Log("Bt_Result: " + _result);
            break;

        default:
            QLog.Log("Bt_Result: " + _result);
            break;
        }
    }
Пример #3
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);
        }