Exemplo n.º 1
0
        private void InitServices()
        {
            //初始化ILRuntime

            //初始化模块管理器
            ModuleManager.Instance.Init();
            ModuleManager.Instance.RegisterModuleActivator(new NativeModuleActivator(ModuleDef.Namespace,
                                                                                     ModuleDef.NativeAssemblyName));

            //初始化UI管理器
            UIManager.Instance.Init("ui/");
            UIManager.MainScene    = "Main";
            UIManager.MainPage     = Modules.Home.UIDef.UIHomePage;
            UIManager.SceneLoading = "UISceneLoading";

            //初始化在线管理器
            OnlineManager.Instance.Init();

            //显示登录界面
            AppLoginPanel.Show();

            //如果登录成功了,初始化普通业务模块
            GlobalEvent.onLoginSuccess += OnLoginSuccess;
            GlobalEvent.onLoginFailed  += OnLoginFailed;
        }
Exemplo n.º 2
0
        private void OnLoginSuccess()
        {
            GlobalEvent.onLoginSuccess -= OnLoginSuccess;

            //隐藏登录界面
            AppLoginPanel.Hide();


            //直接初始化业务层模块
            ModuleManager.Instance.CreateModule(ModuleDef.HomeModule);
            ModuleManager.Instance.CreateModule(ModuleDef.PVEModule);
            ModuleManager.Instance.CreateModule(ModuleDef.PVPModule);
            ModuleManager.Instance.CreateModule(ModuleDef.RoomModule);

            //通过ILRScript来启动业务模块

            /*
             * bool ret = ILRManager.Instance.Invoke("Snaker.ScriptMain", "Init");
             * if (ret)
             * {
             *  //显示“初始化业务模块失败!”
             * }
             */


            ModuleManager.Instance.ShowModule(ModuleDef.HomeModule);
        }
Exemplo n.º 3
0
        private void InitServices()
        {
            //初始化ILRManager
            ILRManager.Instance.Init(RunMode.Script, false);
            ILRManager.Instance.AddSearchDirectory(Application.streamingAssetsPath + "/ILR/");

            //如果有热更新,可能从Http下载下来,等等
            ILRManager.Instance.LoadAssembly(ModuleDef.ScriptAssemblyName);


            //初始化模块管理器
            ModuleManager.Instance.Init();
            ModuleManager.Instance.RegisterModuleActivator(new NativeModuleActivator(ModuleDef.Namespace, ModuleDef.NativeAssemblyName));
            ModuleManager.Instance.RegisterModuleActivator(new ILRModuleActivator(ModuleDef.Namespace, ModuleDef.ScriptAssemblyName));

            //初始化UI管理器
            UIManager.Instance.Init("ui/");
            UIManager.MainScene    = "Main";
            UIManager.MainPage     = "Home/UIHomePage";
            UIManager.SceneLoading = "UISceneLoading";

            //初始化在线管理器
            OnlineManager.Instance.Init();

            //显示登录界面
            AppLoginPanel.Show();

            //如果登录成功了,初始化普通业务模块
            GlobalEvent.onLoginSuccess += OnLoginSuccess;
            GlobalEvent.onLoginFailed  += OnLoginFailed;
        }
Exemplo n.º 4
0
        private void OnLoginSuccess()
        {
            GlobalEvent.onLoginSuccess -= OnLoginSuccess;

            //隐藏登录界面
            AppLoginPanel.Hide();


            //直接初始化业务层模块
            //ModuleManager.Instance.CreateModule(ModuleDef.HomeModule);
            //ModuleManager.Instance.CreateModule(ModuleDef.PVEModule);
            //ModuleManager.Instance.CreateModule(ModuleDef.PVPModule);
            //ModuleManager.Instance.CreateModule(ModuleDef.RoomModule);
            //ModuleManager.Instance.CreateModule(ModuleDef.GameModule);

            //ModuleManager.Instance.ShowModule(ModuleDef.HomeModule);

            //通过ILRScript来启动业务模块


            bool ret = (bool)ILRManager.Instance.Invoke("Snaker.ScriptMain", "Init");

            if (!ret)
            {
                UIAPI.ShowMsgBox("初始化失败", "初始化热更业务模块", "确定", (arg) =>
                {
                    AppLoginPanel.Show();
                });
            }
        }
Exemplo n.º 5
0
        private void OnLoginFailed(int code, string info)
        {
            GlobalEvent.onLoginFailed -= OnLoginFailed;
            AppLoginPanel.Hide();
            UIAPI.ShowMsgBox("登录失败", info, "确定", (arg) =>
            {
                AppLoginPanel.Show();
            });

            //显示失败信息
        }
Exemplo n.º 6
0
        public static void Show()
        {
            ms_instance = UIRoot.Find <AppLoginPanel>("AppLoginPanel");

            if (ms_instance != null)
            {
                if (!ms_instance.gameObject.activeSelf)
                {
                    ms_instance.gameObject.SetActive(true);
                }
                ms_instance.txtName.text = AppConfig.Value.mainUserData.name;
            }
        }