Exemplo n.º 1
0
        public void StartGame()
        {
            Scene zoneScene = SceneFactory.CreateZoneScene(1, "Game", Game.Scene);

            Game.EventSystem.PublishAsync(new EventType.AppStartInitFinish()
            {
                ZoneScene = zoneScene
            }).Coroutine();
        }
Exemplo n.º 2
0
        protected override async ETTask Run(EventType.AppStart args)
        {
            // FunctionCallback.AdsGetAllConfigBytes = LoadConfigHelper.AdsLoadAllConfigBytes;
            // 注册热更层回调
            Game.Hotfix.Update            = Update;
            Game.Hotfix.LateUpdate        = LateUpdate;
            Game.Hotfix.OnApplicationQuit = OnApplicationQuit;

            Game.Scene.AddComponent <TimerComponent>();
            Game.Scene.AddComponent <CoroutineLockComponent>();
            Game.Scene.AddComponent <FUIPackageComponent>();


            // 加载配置          ---资源加载需要更改为addressables,暂时注释 @yzx 2021.5.20
            // Game.Scene.AddComponent<ResourcesComponent>();
            // ResourcesComponent.Instance.LoadBundle("config.unity3d");
            // ResourcesComponent.Instance.UnloadBundle("config.unity3d");
            // await ConfigComponent.Instance.LoadAsync();

            Game.Scene.AddComponent <AdsResComponent>();
            Game.Scene.AddComponent <ConfigComponent>();
            ConfigComponent.AdsGetAllConfigBytes = LoadConfigHelper.AdsLoadAllConfigBytes;
            await ConfigComponent.Instance.AdsLoadAsync("Config");

            //
            Game.Scene.AddComponent <OpcodeTypeComponent>();
            Game.Scene.AddComponent <MessageDispatcherComponent>();

            Game.Scene.AddComponent <NetThreadComponent>();

            Game.Scene.AddComponent <ZoneSceneManagerComponent>();

            Game.Scene.AddComponent <GlobalComponent>();
            Game.Scene.AddComponent <FUIComponent>();

            // 添加AI组件          ---资源加载需要更改为addressables,暂时注释 @yzx 2021.5.20
            // Game.Scene.AddComponent<AIDispatcherComponent>();

            // ResourcesComponent.Instance.LoadBundle("unit.unity3d");

            Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Process");

            await Game.EventSystem.Publish(new EventType.AppStartInitFinish()
            {
                ZoneScene = zoneScene
            });
        }
Exemplo n.º 3
0
        public static async ETTask <Scene> NewRobot(this RobotCase self, int zone, string name)
        {
            Scene zoneScene = null;

            try
            {
                zoneScene = SceneFactory.CreateZoneScene(zone, name, self);
                await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());

                await EnterMapHelper.EnterMapAsync(zoneScene);

                Log.Debug($"create robot ok: {zone}");
                return(zoneScene);
            }
            catch (Exception e)
            {
                zoneScene?.Dispose();
                throw new Exception($"RobotCase create robot fail, zone: {zone}", e);
            }
        }
Exemplo n.º 4
0
        private static async ETTask <Scene> NewRobot(this RobotCase self)
        {
            int   zone      = self.GetParent <RobotCaseComponent>().GetN();
            Scene zoneScene = null;

            try
            {
                zoneScene = SceneFactory.CreateZoneScene(zone, $"Robot_{zone}", self);
                await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());

                await EnterMapHelper.EnterMapAsync(zoneScene);

                Log.Debug($"create robot ok: {zone}");
                return(zoneScene);
            }
            catch (Exception e)
            {
                zoneScene?.Dispose();
                throw new Exception($"RobotCase create robot fail, zone: {zone}", e);
            }
        }