예제 #1
0
        public static CompositeGameModule CreateCompositeGameModule(Contexts contexts)
        {
            var motors         = MotorsFactory.CraeteMotors(contexts, SingletonManager.Get <CameraConfigManager>().Config);
            var sessionObjects = contexts.session.commonSession;

            var gameModule = new CompositeGameModule();

            IHitBoxEntityManager      hitBoxEntityManager = new HitBoxEntityManager(contexts, false);
            ICompensationWorldFactory factory             =
                new ClientCompensationWorldFactory(contexts.session.commonSession.GameContexts, hitBoxEntityManager);
            var        clientDamageInfoCollector = new ClientDamageInfoCollector(contexts.player);
            GameModule cmdModule = new UserCmdGameModule(contexts,
                                                         factory,
                                                         new BulletHitHandler(
                                                             contexts,
                                                             sessionObjects.EntityIdGenerator,
                                                             null,
                                                             clientDamageInfoCollector,
                                                             contexts.session.entityFactoryObject.SoundEntityFactory,
                                                             SingletonManager.Get <EnvironmentTypeConfigManager>()),
                                                         new MeleeHitHandler(contexts, null, sessionObjects.EntityIdGenerator,
                                                                             clientDamageInfoCollector, contexts.session.entityFactoryObject.SoundEntityFactory),
                                                         new ThrowingHitHandler(contexts, null),
                                                         contexts.session.commonSession,
                                                         motors);

            cmdModule.AddSystem(new PlayerAddMarkSystem(contexts));
            cmdModule.AddSystem(new PlayerSprayPaintSystem(contexts));

            gameModule.AddModule(cmdModule);

            gameModule.AddModule(new BulletModule(contexts));
            gameModule.AddModule(new ThrowingModule(contexts));
            gameModule.AddModule(new ClientEffectModule(contexts));
            gameModule.AddModule(new ClientVehicleModule(contexts));
            gameModule.AddModule(new ClientPlayerModule(contexts));


            if (SharedConfig.IsRobot)
            {
                gameModule.AddModule(new ClientRobotModule(contexts));
            }

            gameModule.AddSystem(new VisionCenterUpdateSystem(contexts));
            gameModule.AddSystem(new TerrainDataLoadSystem(contexts));
            if (SingletonManager.Get <MapConfigManager>().SceneParameters is SceneConfig)
            {
                gameModule.AddSystem(new ClientAutoWorldShiftRenderSystem(contexts));
            }

            gameModule.AddSystem(new OcclusionCullingSystem(contexts));

            gameModule.AddModule(new ClientSceneObjectModule(contexts, sessionObjects));
            //  gameModule.AddModule(new ClientSoundModule(contexts));
            gameModule.AddModule(new ClientGamePlayModule(contexts));
            gameModule.AddModule(new ClientFreeMoveModule(contexts));
            gameModule.AddModule(new UiModule(contexts));

            gameModule.AddModule(new ConfigurationRefreshModule(contexts));
            SingletonManager.Get <FreeUiManager>().Contexts1 = contexts;
            SimpleMessageManager.Instance.Init(contexts.session.entityFactoryObject.SoundEntityFactory);
            SingletonManager.Get <RealTimeCullingUpdater>().Initial(contexts);

            return(gameModule);
        }
예제 #2
0
        public static CompositeGameModule CreateRobotCompositeGameModule(Contexts contexts)
        {
            var motors         = MotorsFactory.CraeteMotors(contexts, SingletonManager.Get <CameraConfigManager>().Config);
            var sessionObjects = contexts.session.commonSession;

            var gameModule = new CompositeGameModule();

            IHitBoxEntityManager      hitBoxEntityManager = new HitBoxEntityManager(contexts, false);
            ICompensationWorldFactory factory             =
                new ClientCompensationWorldFactory(contexts.session.commonSession.GameContexts, hitBoxEntityManager);
            var        clientDamageInfoCollector = new ClientDamageInfoCollector(contexts.player);
            GameModule cmdModule = new UserCmdGameModule(contexts,
                                                         factory,
                                                         new BulletHitHandler(
                                                             contexts,
                                                             sessionObjects.EntityIdGenerator,
                                                             null,
                                                             clientDamageInfoCollector,
                                                             contexts.session.entityFactoryObject.SoundEntityFactory,
                                                             SingletonManager.Get <EnvironmentTypeConfigManager>()),
                                                         new MeleeHitHandler(contexts, null, sessionObjects.EntityIdGenerator,
                                                                             clientDamageInfoCollector, contexts.session.entityFactoryObject.SoundEntityFactory),
                                                         new ThrowingHitHandler(contexts, null),
                                                         contexts.session.commonSession,
                                                         motors);

            //     cmdModule.AddSystem(new PlayerAddMarkSystem(contexts));

            gameModule.AddModule(cmdModule);
            //      gameModule.AddModule(new BulletModule(contexts));
            //      gameModule.AddModule(new ThrowingModule(contexts));
            //      gameModule.AddModule(new ClientEffectModule(contexts));
            //  gameModule.AddModule(new ClientVehicleModule(contexts));
            // gameModule.AddModule(new ClientPlayerModule(contexts));
            if (SharedConfig.IsRobot)
            {
                gameModule.AddModule(new ClientRobotModule(contexts));
            }

            //     gameModule.AddModule(new ClientSceneObjectModule(contexts, sessionObjects));
            //     gameModule.AddModule(new ClientSoundModule(contexts));
            gameModule.AddModule(new ClientGamePlayModule(contexts));
            gameModule.AddModule(new ClientFreeMoveModule(contexts));


            gameModule.AddModule(new ConfigurationRefreshModule(contexts));

            SimpleProto loginSucess = FreePool.Allocate();

            loginSucess.Key = FreeMessageConstant.ClientLoginSucess;
            if (contexts.session.clientSessionObjects.NetworkChannel != null)
            {
                contexts.session.clientSessionObjects.NetworkChannel.SendReliable((int)EClient2ServerMessage.FreeEvent,
                                                                                  loginSucess);
            }

            SingletonManager.Get <FreeUiManager>().Contexts1 = contexts;
            SimpleMessageManager.Instance.Init(contexts.session.entityFactoryObject.SoundEntityFactory);
            SingletonManager.Get <RealTimeCullingUpdater>().Initial(contexts);

            return(gameModule);
        }