Пример #1
0
        public GameEngineServer(ContentManager contentManager, IServiceRegistry services)
            : base(contentManager, services)
        {
            // Note that IGame already part of Services in the client engine because Stride specific systems depends
            // on IGame's existence, however be aware this is NOT included in GameEngineServer, so you must be careful
            // not to get IGame in server side systems.

            Services.AddOrOverwriteService(new GameEngineContext(isClient: false));

            _networkSystem = CreateKeyValue(new NetworkSystem(Services));
            //_scriptSystem = CreateKeyValue(new ScriptSystem(Services));
            _physicsSystem         = CreateKeyValue(new Bullet2PhysicsSystem(Services));
            _sceneSystem           = CreateKeyValue(new HeadlessSceneSystem(Services) as SceneSystem);
            _scenePreUpdateSystem  = CreateKeyValue(new ScenePreUpdateSystem(Services, _sceneSystem.System));
            _scenePostUpdateSystem = CreateKeyValue(new ScenePostUpdateSystem(Services, _sceneSystem.System));
            _streamingManager      = CreateKeyValue(() => new StreamingManager(Services));
            //_dynamicNavigationMeshSystem = CreateKeyValue(new DynamicNavigationMeshSystem(Services));

            Services.AddOrOverwriteService(_streamingManager.System);
            Services.AddOrOverwriteService <IStreamingManager>(_streamingManager.System);
            Services.AddOrOverwriteService <ITexturesStreamingProvider>(_streamingManager.System);

            Services.AddOrOverwriteService(DefaultGraphicsDeviceService);

            _networkService = _networkSystem.System;
        }
Пример #2
0
        public GameEngineClient(ContentManager contentManager, IServiceRegistry services, GameSystemCollection gameSystems)
            : base(contentManager, services, gameSystems)
        {
            // Note that IGame already part of Services in the client engine because Stride specific systems depends
            // on IGame's existence, however be aware this is NOT included in GameEngineServer, so you must be careful
            // not to get IGame in server side systems.
            Services.AddOrOverwriteService(new GameEngineContext(isClient: true));

            _networkSystem = CreateKeyValue(() => new NetworkSystem(Services));

            _debugTextSystem = CreateKeyValue(() => new DebugTextSystem(Services));
            Services.AddOrOverwriteService(_debugTextSystem.System);

            _physicsSystem         = CreateKeyValue(() => new Bullet2PhysicsSystem(Services));
            _sceneSystem           = CreateKeyValue(() => new SceneSystem(Services));
            _scenePreUpdateSystem  = CreateKeyValue(() => new ScenePreUpdateSystem(Services, _sceneSystem.System));
            _scenePostUpdateSystem = CreateKeyValue(() => new ScenePostUpdateSystem(Services, _sceneSystem.System));

            _scriptSystem = CreateKeyValue(() => new ScriptSystem(Services));
            Services.AddOrOverwriteService(_scriptSystem.System);

            var inputSystem = gameSystems.First(x => x is InputSystem) as InputSystem;

            _inputSystem = CreateKeyValue(inputSystem);
            var inputManager = inputSystem.Manager;

            inputManager.VirtualButtonConfigSet = new VirtualButtonConfigSet();

            _streamingManager = CreateKeyValue(() => new StreamingManager(Services));

            _audioSystem = CreateKeyValue(() => new AudioSystem(Services));
            Services.AddOrOverwriteService(_audioSystem.System);
            Services.AddOrOverwriteService <IAudioEngineProvider>(_audioSystem.System);

            _effectSystem = CreateKeyValue(() => new EffectSystem(Services));
            Services.AddOrOverwriteService(_effectSystem.System);

            _gameFontSystem = CreateKeyValue(() => new GameFontSystem(Services));
            Services.AddOrOverwriteService(_gameFontSystem.System.FontSystem);
            Services.AddOrOverwriteService <IFontFactory>(_gameFontSystem.System.FontSystem);

            _spriteAnimationSystem = CreateKeyValue(() => new SpriteAnimationSystem(Services));
            Services.AddOrOverwriteService(_spriteAnimationSystem.System);

            _uiSystem = CreateKeyValue(() => new UISystem(Services));
            Services.AddOrOverwriteService(_uiSystem.System);

            _profilingSystem = CreateKeyValue(() => new GameProfilingSystem(Services));
            Services.AddOrOverwriteService(_profilingSystem.System);

            //_vrDeviceSystem = CreateKeyValue(() => new VRDeviceSystem(Services));
            //Services.AddOrOverwriteService(_vrDeviceSystem.System);

            // Copy access to the graphics device manager
            Services.AddOrOverwriteService(services.GetSafeServiceAs <IGraphicsDeviceManager>());
            Services.AddOrOverwriteService(services.GetSafeServiceAs <IGraphicsDeviceService>());

            //_dynamicNavigationMeshSystem = CreateKeyValue(() => new DynamicNavigationMeshSystem(Services));
        }