示例#1
0
 public GameState(Microsoft.Xna.Framework.Game game, GameStateManager manager)
     : base(game)
 {
     StateManager = manager;
     _childComponents = new List<GameComponent>();
     _tag = this;
 }
示例#2
0
 protected BaseGameState(Game game, GameStateManager manager)
     : base(game, manager)
 {
     Log = LogManager.GetLogger(this);
     Log.Debug("Constructing GameState... (" + GetType() + ")");
     Log = LogManager.GetLogger(this);
     GameRef = (MainGame) game;
     PlayerIndexInControl = PlayerIndex.One;
 }
示例#3
0
        public GamePlayScreen(Game game, GameStateManager manager)
            : base(game, manager)
        {
            if (!(game is MainGame))
                throw new Exception("GamePlayScreen constructor: Param 'game' is of type " + game.GetType() + "!");

            Log.Info("Setting game world...");
            World = ((MainGame) game).World;
        }
示例#4
0
 public LoadGameScreen(MainGame game, GameStateManager manager)
     : base(game, manager)
 {
 }
 public StartMenuScreen(Game game, GameStateManager manager)
     : base(game, manager)
 {
 }
 public CharacterGeneratorScreen(Game game, GameStateManager stateManager)
     : base(game, stateManager)
 {
 }
示例#7
0
        public MainGame()
        {
            _log = LogManager.GetLogger(this);

            Activated += GameActivated;
            Deactivated += GameDeactivated;

            _log.Debug("Setting initial FPS value");
            FPS = 0.0f;

            _log.Info("Setting graphics settings...");

            _graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = ScreenWidth,
                PreferredBackBufferHeight = ScreenHeight
            };

            _log.Info(string.Format("Screen size set to: [W]{0} x [H]{1}", ScreenWidth, ScreenHeight));

            _graphics.SynchronizeWithVerticalRetrace = false;
            //IsFixedTimeStep = false;

            _graphics.ApplyChanges();

            ScreenRectangle = new Rectangle(0, 0, ScreenWidth, ScreenHeight);

            _log.Debug("Setting content root directory...");

            Content.RootDirectory = "Content";

            // Create necessary folders if they don't exist
            try
            {
                if (!Directory.Exists(Paths.SettingsFolder))
                    Directory.CreateDirectory(Paths.SettingsFolder);
            }
            catch (IOException ex)
            {
                _log.Error("Failed to create necessary game folders. Exception details as follows...");
                _log.Fatal("IOException: " + ex.Message + Environment.NewLine + "Details:", ex);
                _log.Fatal("Game will now exit...");
                Exit();
            }

            _log.Info("Loading controls...");
            ControlsManager = new ControlsManager();
            _log.Debug("Controls loaded!");

            _log.Info("Creating components...");

            AudioManager = new AudioManager();

            _stateManager = new GameStateManager(this);
            TitleScreen = new TitleScreen(this, _stateManager);
            StartMenuScreen = new StartMenuScreen(this, _stateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _stateManager);
            SkillScreen = new SkillScreen(this, _stateManager);
            LoadGameScreen = new LoadGameScreen(this, _stateManager);
            GamePlayScreen = new GamePlayScreen(this, _stateManager);

            Components.Add(new InputHandler(this));
            Components.Add(_stateManager);

            _log.Info("Components created!");

            LoadMusic();

            var menuSong = AudioManager.Song.GetSong("MenuTheme");
            menuSong.SetStartFade(new FadeInfo(0.0f, 1.0f, 0.01f, TimeSpan.FromMilliseconds(20)));
            menuSong.SetEndFade(new FadeInfo(1.0f, 0.0f, 0.01f, TimeSpan.FromMilliseconds(15)));

            _log.Debug("Changing to TitleScreen...");
            _stateManager.ChangeState(TitleScreen);
        }
示例#8
0
 public SkillScreen(Game game, GameStateManager manager)
     : base(game, manager)
 {
     _linkLabelHandler = AddSkillLabelSelected;
 }