示例#1
0
        /// <summary>
        /// 异步打开界面回调
        /// </summary>
        private static void AsyncOpenWindowCallback(string winName, GameObject go)
        {
            if (string.IsNullOrEmpty(winName))
            {
                LCSConsole.WriteError("打开的界面名字为空! winName = string.Empty");
                return;
            }

            if (go == null)
            {
                LCSConsole.WriteError("资源加载失败!");
                return;
            }

            GameObject ui = GameObject.Instantiate(go) as GameObject;

            if (ui == null)
            {
                return;
            }
            LCSCompHelper.InitTransform(go, UIRoot);
            LAUIBehaviour win = LCSCompHelper.GetComponent <LAUIBehaviour>(ui);

            int           depth  = 1;
            LAUIBehaviour topWin = TopWindow();

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

            // 初始化当前界面
            win.OnOpen(depth, winName);
            Add <LCSUIManage>(winName, win);
        }
示例#2
0
        /// <summary>
        ///  创建界面
        /// </summary>
        /// <param name="winPath">加载资源路径</param>
        /// <param name="winName">打开界面的名字</param>
        private static LAUIBehaviour CreatePage(string winName, string winPath)
        {
            if (string.IsNullOrEmpty(winName))
            {
                LCSConsole.WriteError("打开的界面名字为空! pageName = " + winName);
                return(null);
            }
            if (string.IsNullOrEmpty(winPath))
            {
                LCSConsole.WriteError("加载资源 AssetBundle 文件路径为空! bundlePath = " + winPath);
                return(null);
            }
            GameObject ui = LCSManageSource.LoadSource(winName, winPath);

            if (ui == null)
            {
                LCSConsole.WriteError("加载的资源不存在!");
                return(null);
            }
            GameObject go = GameObject.Instantiate(ui) as GameObject;

            if (go == null)
            {
                return(null);
            }
            LCSCompHelper.InitTransform(go, UIRoot);
            return(LCSCompHelper.GetComponent <LAUIBehaviour>(go));
        }