Exemplo n.º 1
0
        protected override void OnShown(EventArgs e)
        {
            SetNormalViewSize();
            LoadGame(CreateGame(_world, _startingPlayer), _world);
            _world          = null;
            _startingPlayer = null;

            base.OnShown(e);
        }
Exemplo n.º 2
0
        private void LoadGame(TextAdventureGame game, Engine.Objects.World world)
        {
            CloseGame();

            Text  = world.Title + " - Text Adventure";
            _game = game;
            _game.Run();
            xnaControl.DrawBackground = false;
        }
Exemplo n.º 3
0
 private TextAdventureGame CreateGame(Engine.Objects.World world, Player startingPlayer)
 {
     return(new TextAdventureGame(
                xnaControl.GraphicsDevice,
                world,
                startingPlayer,
                _multimediaPlayer,
                _fpsConfigurationSection,
                _logConfigurationSection,
                _worldTimeConfigurationSection));
 }
Exemplo n.º 4
0
        private void OpenGame(string path)
        {
            try
            {
                Engine.Objects.World world = WorldLoader.Instance.FromAssembly(path);

                LoadGame(CreateGame(world, world.StartingPlayer), world);
            }
            catch (Exception exception)
            {
                MessageBoxHelper.Instance.ShowError(this, String.Format("Error opening game:{0}{0}{1}", Environment.NewLine, exception.Message));
            }
        }
Exemplo n.º 5
0
        private static void Main()
        {
            Engine.Objects.World world = GetWorld();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);

            var gameForm = new GameForm(world, world.StartingPlayer);

            Application.Idle += (sender, args) => ApplicationOnIdle(gameForm);
            Application.Run(gameForm);

            SoundSystem.Instance.Release();
        }
Exemplo n.º 6
0
        public GameForm(Engine.Objects.World world, Player startingPlayer)
        {
            world.ThrowIfNull("world");
            startingPlayer.ThrowIfNull("startingPlayer");

            _world = world;
            _startingPlayer = startingPlayer;
            _multimediaPlayer = new MultimediaPlayer(_volumeConfigurationSection);

            InitializeComponent();
            SetNormalViewSize();

            fpsToolStripMenuItem.Checked = _fpsConfigurationSection.Visible;
            logToolStripMenuItem.Checked = _logConfigurationSection.Visible;
            worldTimeToolStripMenuItem.Checked = _worldTimeConfigurationSection.Visible;
            soundEffectsToolStripMenuItem.Checked = true;
            musicToolStripMenuItem.Checked = true;
        }
Exemplo n.º 7
0
        public GameForm(Engine.Objects.World world, Player startingPlayer)
        {
            world.ThrowIfNull("world");
            startingPlayer.ThrowIfNull("startingPlayer");

            _world            = world;
            _startingPlayer   = startingPlayer;
            _multimediaPlayer = new MultimediaPlayer(_volumeConfigurationSection);

            InitializeComponent();
            SetNormalViewSize();

            fpsToolStripMenuItem.Checked          = _fpsConfigurationSection.Visible;
            logToolStripMenuItem.Checked          = _logConfigurationSection.Visible;
            worldTimeToolStripMenuItem.Checked    = _worldTimeConfigurationSection.Visible;
            soundEffectsToolStripMenuItem.Checked = true;
            musicToolStripMenuItem.Checked        = true;
        }
        public TextAdventureGame(
            GraphicsDevice graphicsDevice,
            Engine.Objects.World world,
            Player player,
            IMultimediaPlayer multimediaPlayer,
            IFpsConfiguration fpsConfiguration,
            ILogConfiguration logConfiguration,
            IWorldTimeConfiguration worldTimeConfiguration)
            : base(graphicsDevice, new ContentDirectoryContentManagerProvider())
        {
            world.ThrowIfNull("world");
            player.ThrowIfNull("player");
            multimediaPlayer.ThrowIfNull("multimediaPlayer");
            fpsConfiguration.ThrowIfNull("fpsConfiguration");
            logConfiguration.ThrowIfNull("logConfiguration");
            worldTimeConfiguration.ThrowIfNull("worldTimeConfiguration");

            _world = world;
            _player = player;
            _multimediaPlayer = multimediaPlayer;
            _fpsConfiguration = fpsConfiguration;
            _logConfiguration = logConfiguration;
            _worldTimeConfiguration = worldTimeConfiguration;
        }
        public TextAdventureGame(
            GraphicsDevice graphicsDevice,
            Engine.Objects.World world,
            Player player,
            IMultimediaPlayer multimediaPlayer,
            IFpsConfiguration fpsConfiguration,
            ILogConfiguration logConfiguration,
            IWorldTimeConfiguration worldTimeConfiguration)
            : base(graphicsDevice, new ContentDirectoryContentManagerProvider())
        {
            world.ThrowIfNull("world");
            player.ThrowIfNull("player");
            multimediaPlayer.ThrowIfNull("multimediaPlayer");
            fpsConfiguration.ThrowIfNull("fpsConfiguration");
            logConfiguration.ThrowIfNull("logConfiguration");
            worldTimeConfiguration.ThrowIfNull("worldTimeConfiguration");

            _world                  = world;
            _player                 = player;
            _multimediaPlayer       = multimediaPlayer;
            _fpsConfiguration       = fpsConfiguration;
            _logConfiguration       = logConfiguration;
            _worldTimeConfiguration = worldTimeConfiguration;
        }
Exemplo n.º 10
0
        protected override void OnShown(EventArgs e)
        {
            SetNormalViewSize();
            LoadGame(CreateGame(_world, _startingPlayer), _world);
            _world = null;
            _startingPlayer = null;

            base.OnShown(e);
        }