double _shortClickTime = 300;//ms, Minimum amount of time before button is considered "held" public SelectionManager( TextDrawingService textDrawingService, SpriteBatch spriteBatch, ClientShipManager clientShipManager, MessageService_ToServer messageManager, PhysicsManager physicsManager, PlayerShipManager playerShipManager, TargetingService targetingService, UIConversionService uiConversionService) { _textDrawingService = textDrawingService; _spriteBatch = spriteBatch; _clientShipManager = clientShipManager; _messageManager = messageManager; _physicsManager = physicsManager; _playerShipManager = playerShipManager; _targetingManager = targetingService; _uiConversionService = uiConversionService; }
public MainManager(BloomComponent bloom, TextDrawingService textDrawingService, Game game, IGameStateManager gameStateManager, GraphicsDeviceManager graphics, MainNetworkingManager mainNetworkingManager) { _textDrawingService = textDrawingService; _game = game; _gameStateManager = gameStateManager; _graphics = graphics; _mainNetworkingManager = mainNetworkingManager; _drawsPerSecondCounter = new OPSCounter(5); _updatesPerSecondCounter = new OPSCounter(5); }
public GameStateManager( CameraService cameraService, IEnumerable <IGameState> gameStates, TextDrawingService textDrawingService, GlobalGameWebLayer globalGameWebLayer) { _cameraService = cameraService; _textDrawingService = textDrawingService; _gameStates = new Dictionary <GameStateType, IGameState>(); _globalGameWebLayer = globalGameWebLayer; _globalGameWebLayer.Activate(); foreach (var gsm in gameStates) { _gameStates.Add(gsm.StateType, gsm); } SetState(GameStateType.Login); }
protected override MainManager _manualBuild() { #region Singletons ClientManager clientManager = new ClientManager(new CoreNetworkConfig()); CameraService cameraService = new CameraService(); TextDrawingService textDrawingService = null; BloomComponent bloom = null; LidgrenMessenger messenger = new LidgrenMessenger(clientManager); MessageService_ToServer messageService = new MessageService_ToServer(messenger); LidgrenNetworkingService networkingService = new LidgrenNetworkingService(); // Force the static to initialize now Utilities.NextUnique(); #endregion List <IGameState> gameStates = new List <IGameState>(); gameStates.Add(BotStateBuilder.BuildPlanetStateManager(clientManager, networkingService, new PhysicsConfig())); gameStates.Add(BotStateBuilder.BuildSpaceStateManager(clientManager, networkingService)); gameStates.Add(_buildLoginStateManager(null, clientManager, messageService, networkingService)); NewChatManager chatManager = new NewChatManager(clientManager); GameStateManager gameStateManager = BuildGameStateManager(cameraService, gameStates, textDrawingService, null); MainNetworkingManager mainNetworkingManager = new MainNetworkingManager(chatManager, clientManager, networkingService); return(new MainManager(bloom, textDrawingService, this, gameStateManager, _graphics, mainNetworkingManager)); }
protected override GameStateManager BuildGameStateManager(CameraService cameraService, IEnumerable <IGameState> gameStates, TextDrawingService textDrawingService, GlobalGameWebLayer globalGameWebLayer) { return(new BotnetGameStateManager(cameraService, gameStates, textDrawingService, globalGameWebLayer)); }
public BotnetGameStateManager(CameraService cameraService, IEnumerable <IGameState> gameStates, TextDrawingService textDrawingService, GlobalGameWebLayer globalGameWebLayer) : base(cameraService, gameStates, textDrawingService, globalGameWebLayer) { }
DrawableSpaceStateManager _buildSpaceStateManager(GlobalGameUISingleton globalGameUiSingleton, CameraService cameraService, TextureManager textureManager, ParticleManager particleManager, TextDrawingService textDrawingService, MessageService_ToServer messageService, IClientWebViewConfig clientWebviewConfig, LidgrenNetworkingService networkingService, BloomComponent bloom) { CollisionManager instance_collisionManager; ParticleManager instance_particleManager = null; SimulationManager instance_simulationManager; TargetingService instance_targetingService; TeamManager instance_teamManager; UIConversionService instance_uiConversionService; ClientShipManager instance_clientShipManager; PhysicsManager instance_physicsManager; ProjectileManager instance_projectileManager; StructureFactoryManager instance_structureFactoryManager; WarpHoleManager instance_warpholeManager; SelectionManager instance_selectionManager; FloatyAreaObjectManager instance_floatyAreaObjectManager; //Space unique BackgroundManager instance_backgroundManager = null; SpaceManager instance_spaceManager; BorderManager instance_borderManager = null; GravityManager instance_gravityManager; SpaceObjectManager instance_spaceObjectManager; instance_collisionManager = new CollisionManager(messageService); if (_loadGraphics) { instance_particleManager = new ParticleManager(_graphics, _spriteBatch, Content, textureManager); } instance_simulationManager = new SimulationManager(); instance_targetingService = new TargetingService(); instance_teamManager = new TeamManager(instance_targetingService); PlayerShipManager instance_playerShipManager = new PlayerShipManager(messageService); IClientPlayerInfoManager instance_clientPlayerInfoManager = new PlayablePlayerInfoManager(instance_playerShipManager); instance_uiConversionService = new UIConversionService(cameraService, instance_playerShipManager, _spriteBatch); instance_physicsManager = new PhysicsManager(); instance_projectileManager = new ProjectileManager(instance_particleManager, instance_physicsManager.World, _spriteBatch, instance_targetingService, instance_simulationManager, messageService, instance_collisionManager); instance_clientShipManager = new ClientShipManager(instance_particleManager, instance_playerShipManager, _spriteBatch, textureManager, instance_simulationManager, instance_targetingService, instance_teamManager, instance_projectileManager, messageService, instance_clientPlayerInfoManager, false); instance_structureFactoryManager = new StructureFactoryManager(messageService, instance_physicsManager.World, instance_projectileManager, instance_targetingService, instance_teamManager, textureManager, instance_clientShipManager, _spriteBatch, false); instance_warpholeManager = new WarpHoleManager(messageService, instance_particleManager, instance_physicsManager, instance_clientShipManager, _loadGraphics ? textureManager.Warphole : null); instance_selectionManager = new SelectionManager(textDrawingService, _spriteBatch, instance_clientShipManager, messageService, instance_physicsManager, instance_playerShipManager, instance_targetingService, instance_uiConversionService); if (_loadGraphics) { instance_backgroundManager = new BackgroundManager(Content, instance_particleManager, _spriteBatch, cameraService, new Random(8)); } instance_borderManager = new BorderManager(_loadGraphics?textureManager.tex_DotW:null, _spriteBatch, instance_physicsManager); instance_gravityManager = new GravityManager(instance_physicsManager); instance_spaceObjectManager = new SpaceObjectManager(textureManager, messageService, _spriteBatch, instance_particleManager, instance_physicsManager); instance_spaceManager = new SpaceManager(_spriteBatch, instance_borderManager, instance_gravityManager, instance_physicsManager, instance_spaceObjectManager, instance_warpholeManager); instance_floatyAreaObjectManager = new FloatyAreaObjectManager(instance_physicsManager.World, textureManager, messageService, _spriteBatch, particleManager); return(new DrawableSpaceStateManager( messageService, instance_clientPlayerInfoManager, instance_backgroundManager, bloom, instance_collisionManager, this, Window, globalGameUiSingleton, networkingService, _spriteBatch, instance_particleManager, instance_physicsManager, instance_playerShipManager, instance_projectileManager, instance_selectionManager, instance_simulationManager, instance_clientShipManager, instance_spaceManager, instance_structureFactoryManager, textureManager, instance_targetingService, instance_teamManager, instance_warpholeManager, instance_spaceObjectManager, instance_uiConversionService, instance_floatyAreaObjectManager)); }
DrawablePlanetStateManager _buildPlanetStateManager(GlobalGameUISingleton globalGameUiSingleton, CameraService cameraService, TextureManager textureManager, ParticleManager particleManager, TextDrawingService textDrawingService, MessageService_ToServer messageService, LidgrenNetworkingService networkingService) { CollisionManager instance_collisionManager; ParticleManager instance_particleManager = null; SimulationManager instance_simulationManager; TargetingService instance_targetingService; TeamManager instance_teamManager; UIConversionService instance_uiConversionService; ClientShipManager instance_clientShipManager; PhysicsManager instance_physicsManager; ProjectileManager instance_projectileManager; StructureFactoryManager instance_structureFactoryManager; WarpHoleManager instance_warpholeManager; SelectionManager instance_selectionManager; FloatyAreaObjectManager instance_floatyAreaObjectManager; instance_collisionManager = new CollisionManager(messageService); if (_loadGraphics) { instance_particleManager = new ParticleManager(_graphics, _spriteBatch, Content, textureManager); } instance_simulationManager = new SimulationManager(); instance_targetingService = new TargetingService(); instance_teamManager = new TeamManager(instance_targetingService); PlayerShipManager instance_playerShipManager = new PlayerShipManager(messageService); IClientPlayerInfoManager instance_clientPlayerInfoManager = new PlayablePlayerInfoManager(instance_playerShipManager); instance_uiConversionService = new UIConversionService(cameraService, instance_playerShipManager, _spriteBatch); instance_physicsManager = new PhysicsManager(); instance_projectileManager = new ProjectileManager(instance_particleManager, instance_physicsManager.World, _spriteBatch, instance_targetingService, instance_simulationManager, messageService, instance_collisionManager); instance_clientShipManager = new ClientShipManager(instance_particleManager, instance_playerShipManager, _spriteBatch, textureManager, instance_simulationManager, instance_targetingService, instance_teamManager, instance_projectileManager, messageService, instance_clientPlayerInfoManager, false); instance_structureFactoryManager = new StructureFactoryManager(messageService, instance_physicsManager.World, instance_projectileManager, instance_targetingService, instance_teamManager, textureManager, instance_clientShipManager, _spriteBatch, false); instance_warpholeManager = new WarpHoleManager(messageService, instance_particleManager, instance_physicsManager, instance_clientShipManager, _loadGraphics?textureManager.Warphole:null); instance_selectionManager = new SelectionManager(textDrawingService, _spriteBatch, instance_clientShipManager, messageService, instance_physicsManager, instance_playerShipManager, instance_targetingService, instance_uiConversionService); instance_floatyAreaObjectManager = new FloatyAreaObjectManager(instance_physicsManager.World, textureManager, messageService, _spriteBatch, particleManager); PhysicsConfig physicsConfig = new PhysicsConfig(); return(new DrawablePlanetStateManager( _spriteBatch, instance_clientPlayerInfoManager, instance_collisionManager, globalGameUiSingleton, instance_particleManager, instance_physicsManager, instance_playerShipManager, instance_projectileManager, instance_clientShipManager, instance_structureFactoryManager, textureManager, networkingService, instance_selectionManager, instance_simulationManager, instance_targetingService, instance_teamManager, GameStateType.Planet, instance_uiConversionService, instance_warpholeManager, Window, instance_floatyAreaObjectManager, messageService, physicsConfig.PlanetTileWidth, physicsConfig.PlanetTileHeight)); }
protected virtual MainManager _manualBuild() { #region Singletons ClientManager clientManager = new ClientManager(new CoreNetworkConfig()); CameraService cameraService = new CameraService(); ParticleManager particleManager = null; TextDrawingService textDrawingService = null; TextureManager textureManager = null; BloomComponent bloom = null; if (_loadGraphics) { textureManager = new TextureManager(Content); particleManager = new ParticleManager(_graphics, _spriteBatch, Content, textureManager); textDrawingService = new TextDrawingService(textureManager.DefaultDrawFont, _spriteBatch); bloom = new BloomComponent(Content, _spriteBatch); } LidgrenMessenger messenger = new LidgrenMessenger(clientManager); MessageService_ToServer messageService = new MessageService_ToServer(messenger); IClientWebViewConfig clientWebviewConfig = null; switch (_environment) { case ClientEnvironmentType.Development: clientWebviewConfig = new DebugClientWebViewConfig(); break; default: throw new Exception("You should add a production config, yo!"); } var chatManager = new NewChatManager(clientManager); LidgrenNetworkingService networkingService = new LidgrenNetworkingService(); GlobalGameUISingleton globalGameUiSingleton = new GlobalGameUISingleton(clientWebviewConfig, GraphicsDevice, Window, _spriteBatch); GlobalGameWebLayer globalGameWebLayer = new GlobalGameWebLayer(clientWebviewConfig, new GameInterfaceWebView(globalGameUiSingleton, chatManager, new GameInterfaceViewModel())); // Force the static to initialize now Utilities.NextUnique(); #endregion List <IGameState> gameStates = new List <IGameState>(); gameStates.Add(_buildPlanetStateManager(globalGameUiSingleton, cameraService, textureManager, particleManager, textDrawingService, messageService, networkingService)); gameStates.Add(_buildSpaceStateManager(globalGameUiSingleton, cameraService, textureManager, particleManager, textDrawingService, messageService, clientWebviewConfig, networkingService, bloom)); //gameStates.Add(_buildMoonStateManager(chatManager, CefSharpViewFactory, cameraService, textureManager, particleManager, textDrawingService, messageService, clientWebviewConfig, networkingService)); gameStates.Add(_buildPortStateManager(globalGameUiSingleton, messageService, networkingService)); gameStates.Add(_buildLoginStateManager(globalGameUiSingleton, clientManager, messageService, networkingService)); gameStates.Add(_buildColonyStateManager(globalGameUiSingleton, messageService, networkingService)); GameStateManager gameStateManager = BuildGameStateManager(cameraService, gameStates, textDrawingService, globalGameWebLayer); MainNetworkingManager mainNetworkingManager = new MainNetworkingManager(chatManager, clientManager, networkingService); return(new MainManager(bloom, textDrawingService, this, gameStateManager, _graphics, mainNetworkingManager)); }