Esempio n. 1
0
 public GameController(Storyboard storyboard, CommonContentManager contentManager, Messenger messenger)
 {
     LastGameEvent   = Flatlings.GameEvents.Waiting;
     _storyboard     = storyboard;
     _contentManager = contentManager;
     _messenger      = messenger;
 }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Services.AddService(typeof(IScreenOrchestrator), this);

            var messenger = new Messenger();

            Services.AddService(typeof(Messenger), messenger);
            Services.AddService(typeof(MultiplayerGameManager), new MultiplayerGameManager());
            Services.AddService(typeof(GameStateService), new GameStateService());
            _dispatcher = new Dispatcher();
            DispatcherScheduler.SetDispatcher(_dispatcher);
            Services.AddService(typeof(Dispatcher), _dispatcher);

            messenger.Register <TransitionToScreenMessage>(this, HandleTransitionToScreenMessage);
            messenger.Register <StartingMultiplayerGameMessage>(this, message => HandleStartingGameMessage());
            messenger.Register <StartingSinglePlayerGameMessage>(this, message => HandleStartingGameMessage());

            var commonContentManager = new CommonContentManager(this);

            commonContentManager.Initialize();
            Services.AddService(typeof(CommonContentManager), commonContentManager);

            var fontManager = new FontManager(this);

            fontManager.Initialize();
            Services.AddService(typeof(FontManager), fontManager);
            AddScreen("Game", new GameScreen(this));
            AddScreen("Help", new HelpScreen(this));
            AddScreen("MainMenu", new MainMenuScreen(this));
            AddScreen("StartMultiplayer", new StartMultiplayerGameScreen(this));
            AddScreen("WaitingForPlayers", new WaitingForPlayersScreen(this));
            AddScreen("JoinMultiplayer", new JoinMultiplayerGameScreen(this));
            AddScreen("GameStarting", new GameStartingScreen(this));
            AddScreen("Scoreboard", new ScoreboardScreen(this));

            base.Initialize();
        }
 public MultiPlayerGameController(MultiplayerGameManager gameManager, Storyboard storyboard, CommonContentManager contentManager, Messenger messenger) : base(storyboard, contentManager, messenger)
 {
     _gameManager = gameManager;
 }
Esempio n. 4
0
 public SinglePlayerGameController(Storyboard storyboard, CommonContentManager contentManager, Messenger messenger) : base(storyboard, contentManager, messenger)
 {
 }