Exemplo n.º 1
0
        /// <summary>
        /// 结束观察
        /// </summary>
        public double EndWatch()
        {
            RecordWatchEntity entity = CurrentWatch;

            if (entity == null)
            {
                LCSConsole.WriteError("观察还未开始...");
                return(0);
            }
            entity.EndWatch();
            double watchTime = entity.GetWatchTime();

            // 7位精度
            LCSConsole.WriteWarning("[Watch] {0} use time : {1}s.", entity.WatchKey, watchTime.ToString("F7"));
            return(watchTime);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 同步打开界面
        /// </summary>
        /// <param name="winName">界面的名字,唯一</param>
        /// <param name="winPath">界面加载路径</param>
        public static void OpenWindow(string winName, string winPath)
        {
            if (string.IsNullOrEmpty(winName))
            {
                LCSConsole.WriteError("打开的界面名字为空! winName = string.Empty");
                return;
            }

            if (string.IsNullOrEmpty(winPath))
            {
                LCSConsole.WriteError("加载资源 AssetBundle 文件路径为空! bundlePath = string.Empty");
                return;
            }

            LAUIBehaviour win = null;

            if (TryFind <LCSUIManage>(winName, out win))
            {
                return;
            }

            int depth = 1;
            // 当前最高的界面失去焦点
            LAUIBehaviour topWin = TopWindow();

            if (topWin != null)
            {
                depth = topWin.WinDepth + LCSConfig.DepthSpan;
                topWin.OnLostFocus();
            }

            if (!TryCreatePage(winName, winPath, out win))
            {
                LCSConsole.WriteWarning("创建 ui 界面 LAUIBehaviour 失败!");
                return;
            }

            // 初始化当前界面
            win.OnOpen(depth, winName);
            Add <LCSUIManage>(winName, win);
        }