예제 #1
0
        public PartyMenuScene(Game game)
            : base(game)
        {
            var keyboard = new KeyboardInputLayer(this, null);
            keyboard.AddKeyDownBinding(Keys.Escape, () => Game.PopScene());
            Components.Add(keyboard);

            _menu = new MenuDialog();
            _menu.MenuChanged += ChangeMenu;
            Gui.Screen.Desktop.Children.Add(_menu);

            _partyMenuDialog = new PartyMenuDialog(((SRPGGame)Game).Party);
            _partyMenuDialog.OnCharacterChange += SetCharacter;
            Gui.Screen.Desktop.Children.Add(_partyMenuDialog);

            _characterInfoDialog = new CharacterInfoDialog();
            _characterInfoDialog.ChangeItem += ChangeItem;
            Gui.Screen.Desktop.Children.Add(_characterInfoDialog);

            _inventoryDialog = new InventoryDialog();
            Gui.Screen.Desktop.Children.Add(_inventoryDialog);

            Gui.DrawOrder = 1000;
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
            ((FlatGuiVisualizer)Gui.Visualizer).RendererRepository.AddAssembly(typeof(FlatPictureControlRenderer).Assembly);
        }
예제 #2
0
        public LoadGameScene(Game game)
            : base(game)
        {
            // list of games
            var saveGameList = Data.SaveGame.FetchAll((SRPGGame)game);

            for(var i = 0; i < saveGameList.Count; i++)
            {
                var saveGame = saveGameList[i];
                var dlg = new SavedGameDialog(saveGame);
                dlg.Bounds = new UniRectangle(
                    new UniScalar(0), new UniScalar(110 * i),
                    new UniScalar(1.0f, -160), new UniScalar(100)
                );
                var fileNumber = i;
                dlg.OnSelect += () => ((SRPGGame) Game).LoadGame(fileNumber);
                Gui.Screen.Desktop.Children.Add(dlg);
            }

            // cancel button
            var button = new ButtonControl();
            button.Bounds = new UniRectangle(
                new UniScalar(1.0f, -150), new UniScalar(0),
                new UniScalar(150), new UniScalar(45)
            );
            button.Text = "Cancel";
            button.Pressed += (s, a) => Game.PopScene();
            Gui.Screen.Desktop.Children.Add(button);

            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #3
0
        public MainMenu(Game game)
            : base(game)
        {
            Components.Add(new BackgroundLayer(this, null, "MainMenu/bg") { DrawOrder = -10000 });
            _menuOptionsDialog = new MenuOptionsDialog();
            _menuOptionsDialog.Bounds = new UniRectangle(10, 10, 180, 275);

            _optionsControl = new OptionsControl();
            _optionsControl.Bounds = new UniRectangle(
                new UniScalar(0, 200), new UniScalar(10),
                new UniScalar(310), new UniScalar(500)
            );
            _optionsControl.OptionsCanceled += () => HideGui(_optionsControl);
            _optionsControl.OptionsSaved += (fullscreen, width, height) =>
                {
                    Game.ChangeResolution(fullscreen, width, height);
                    HideGui(_optionsControl);
                };
            HideGui(_optionsControl);

            _menuOptionsDialog.OnExitPressed += () => Game.Exit();
            _menuOptionsDialog.OnNewGamePressed += () => ((SRPGGame)Game).StartGame();

            _menuOptionsDialog.OnOptionsPressed += () =>
                {
                    ShowGui(_optionsControl);
                    _optionsControl.UpdateSettings(game);
                };

            _menuOptionsDialog.OnLoadGamePressed += () => ((SRPGGame)Game).ShowLoadScreen();
            _menuOptionsDialog.OnContinuePressed += () => ((SRPGGame)Game).ContinueLastGame();

            Gui.Screen.Desktop.Children.Add(_menuOptionsDialog);
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #4
0
        public void OpenPartyMenu()
        {
            if (_dialog != null)
            {
                return;
            }

            StopCharacter();

            Game.PushScene(new PartyMenuScene(Game));
        }
예제 #5
0
        public SaveGameScene(Game game, string zone, string door)
            : base(game)
        {
            // GUI elements:
            // cancel button
            var cancelButton = new ButtonControl();
            cancelButton.Text = "Cancel";
            cancelButton.Pressed += (s, a) => Game.PopScene();
            cancelButton.Bounds = new UniRectangle(
                new UniScalar(1.0f, -150), new UniScalar(0),
                new UniScalar(150), new UniScalar(45)
            );
            Gui.Screen.Desktop.Children.Add(cancelButton);

            // new save
            var newSaveButton = new ButtonControl();
            newSaveButton.Text = "New Save";
            newSaveButton.Pressed += (s, a) =>
                {
                    ((SRPGGame) Game).NewSaveGame(zone, door);
                    Game.PopScene();
                };
            newSaveButton.Bounds = new UniRectangle(
                new UniScalar(1.0f, -150), new UniScalar(55),
                new UniScalar(150), new UniScalar(45)
            );
            Gui.Screen.Desktop.Children.Add(newSaveButton);

            // list of saves
            // list of games
            var saveGameList = Data.SaveGame.FetchAll((SRPGGame)game);

            for (var i = 0; i < saveGameList.Count; i++)
            {
                var saveGame = saveGameList[i];
                var dlg = new SavedGameDialog(saveGame);
                dlg.Bounds = new UniRectangle(
                    new UniScalar(0), new UniScalar(110 * i),
                    new UniScalar(1.0f, -160), new UniScalar(100)
                );
                var fileNumber = i;
                dlg.OnSelect += () =>
                    {
                        ((SRPGGame) Game).SaveGame(fileNumber, zone, door);
                        Game.PopScene();
                    };
                Gui.Screen.Desktop.Children.Add(dlg);
            }

            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #6
0
        public OptionsScene(Game game)
            : base(game)
        {
            var keyboard = new KeyboardInputLayer(this, null);
            keyboard.AddKeyDownBinding(Keys.Escape, () => Game.PopScene());

            Components.Add(keyboard);

            var menuDialog = new MenuDialog();
            menuDialog.OnReturnPressed += () => Game.PopScene();
            menuDialog.OnExitPressed += () => Game.Exit();
            menuDialog.OnMainMenuPressed += () => ((SRPGGame)Game).ReturnToMainMenu();

            Gui.Screen.Desktop.Children.Add(menuDialog);
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #7
0
        public OverworldScene(Game game)
            : base(game)
        {
            _environment = new Environment(this, null) { DrawOrder = 1 };

            var keyboardInput = new KeyboardInput(this, null);
            Components.Add(keyboardInput);

            _hud = new HUD(this, null) {DrawOrder = 5};
            Components.Add(_hud);
            Components.Add(_environment);

            Avatar = Avatar.GenerateAvatar(Game, _environment, "fighter");

            Gui.DrawOrder = 1000;
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #8
0
        public OverworldScene(Game game) : base(game)
        {
            _environment = new Environment(this, null)
            {
                DrawOrder = 1
            };

            var keyboardInput = new KeyboardInput(this, null);

            Components.Add(keyboardInput);

            _hud = new HUD(this, null)
            {
                DrawOrder = 5
            };
            Components.Add(_hud);
            Components.Add(_environment);

            Avatar = Avatar.GenerateAvatar(Game, _environment, "fighter");

            Gui.DrawOrder  = 1000;
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");
        }
예제 #9
0
        public ShopScene(Game game, List<Item> shopInventory)
            : base(game)
        {
            _shopInventory = shopInventory;

            var keyboard = new KeyboardInputLayer(this, null);
            keyboard.AddKeyDownBinding(Keys.Escape, () => Game.PopScene());
            Components.Add(keyboard);

            Game.IsMouseVisible = true;

            Gui.DrawOrder = 1000;
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");

            // GUI elements:
            _shopInventoryDialog = new InventoryDialog();

            _shopInventoryDialog.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0),
                new UniScalar(225), new UniScalar(0.6F, -45)
            );
            _shopInventoryDialog.SetInventory(_shopInventory);
            _shopInventoryDialog.HoverChanged += UpdateItemFocus;
            _shopInventoryDialog.HoverCleared += ClearItemFocus;
            Gui.Screen.Desktop.Children.Add(_shopInventoryDialog);

            _playerInventoryDialog = new InventoryDialog();
            _playerInventoryDialog.Bounds = new UniRectangle(
                new UniScalar(235), new UniScalar(0),
                new UniScalar(225), new UniScalar(0.6F, -45)
            );
            _playerInventoryDialog.HoverChanged += UpdateItemFocus;
            _playerInventoryDialog.HoverCleared += ClearItemFocus;
            Gui.Screen.Desktop.Children.Add(_playerInventoryDialog);

            _itemPreviewDialog = new ItemPreviewDialog();
            _itemPreviewDialog.Bounds = new UniRectangle(
                new UniScalar(470), new UniScalar(0),
                new UniScalar(1.0f, -630), new UniScalar(0.6F, 0)
            );
            Gui.Screen.Desktop.Children.Add(_itemPreviewDialog);

            // money / information
            _infoDialog = new InfoDialog();
            _infoDialog.Bounds = new UniRectangle(
                new UniScalar(1.0F, -150), new UniScalar(0.0F, 45),
                new UniScalar(150), new UniScalar(0.6F, -45)
            );
            Gui.Screen.Desktop.Children.Add(_infoDialog);

            // party
            _partyDialog = new PartyDialog(((SRPGGame)Game).Party);
            _partyDialog.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0.6F, 10),
                new UniScalar(1.0F, 0), new UniScalar(0.4F, -10)
            );
            Gui.Screen.Desktop.Children.Add(_partyDialog);

            // exit button
            _exitButton = new ButtonControl();
            _exitButton.Text = "Exit";
            _exitButton.Bounds = new UniRectangle(
                new UniScalar(1.0F, -150), new UniScalar(0),
                new UniScalar(150), new UniScalar(35)
            );
            _exitButton.Pressed += (s, a) => Game.PopScene();
            Gui.Screen.Desktop.Children.Add(_exitButton);

            // buy selected
            _buyButton = new ButtonControl();
            _buyButton.Text = "Buy";
            _buyButton.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0.6F, -35),
                new UniScalar(225), new UniScalar(35)
            );
            _buyButton.Pressed += BuySelectedItems;
            Gui.Screen.Desktop.Children.Add(_buyButton);

            // sell selected
            _sellButton = new ButtonControl();
            _sellButton.Text = "Sell";
            _sellButton.Bounds = new UniRectangle(
                new UniScalar(235), new UniScalar(0.6F, -35),
                new UniScalar(225), new UniScalar(35)
            );
            _sellButton.Pressed += SellSelectedItems;
            Gui.Screen.Desktop.Children.Add(_sellButton);

            ClearItemFocus();
            RefreshShop();
        }
예제 #10
0
 public BattleScene(Game game) : base(game)
 {
     QueuedCommands = new List <Command>();
     _commander     = new BattleCommander(game);
 }
예제 #11
0
        public ShopScene(Game game, List <Item> shopInventory) : base(game)
        {
            _shopInventory = shopInventory;

            var keyboard = new KeyboardInputLayer(this, null);

            keyboard.AddKeyDownBinding(Keys.Escape, () => Game.PopScene());
            Components.Add(keyboard);

            Game.IsMouseVisible = true;

            Gui.DrawOrder  = 1000;
            Gui.Visualizer = FlatGuiVisualizer.FromFile(Game.Services, "Content/Gui/main_gui.xml");

            // GUI elements:
            _shopInventoryDialog = new InventoryDialog();

            _shopInventoryDialog.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0),
                new UniScalar(225), new UniScalar(0.6F, -45)
                );
            _shopInventoryDialog.SetInventory(_shopInventory);
            _shopInventoryDialog.HoverChanged += UpdateItemFocus;
            _shopInventoryDialog.HoverCleared += ClearItemFocus;
            Gui.Screen.Desktop.Children.Add(_shopInventoryDialog);

            _playerInventoryDialog        = new InventoryDialog();
            _playerInventoryDialog.Bounds = new UniRectangle(
                new UniScalar(235), new UniScalar(0),
                new UniScalar(225), new UniScalar(0.6F, -45)
                );
            _playerInventoryDialog.HoverChanged += UpdateItemFocus;
            _playerInventoryDialog.HoverCleared += ClearItemFocus;
            Gui.Screen.Desktop.Children.Add(_playerInventoryDialog);

            _itemPreviewDialog        = new ItemPreviewDialog();
            _itemPreviewDialog.Bounds = new UniRectangle(
                new UniScalar(470), new UniScalar(0),
                new UniScalar(1.0f, -630), new UniScalar(0.6F, 0)
                );
            Gui.Screen.Desktop.Children.Add(_itemPreviewDialog);

            // money / information
            _infoDialog        = new InfoDialog();
            _infoDialog.Bounds = new UniRectangle(
                new UniScalar(1.0F, -150), new UniScalar(0.0F, 45),
                new UniScalar(150), new UniScalar(0.6F, -45)
                );
            Gui.Screen.Desktop.Children.Add(_infoDialog);

            // party
            _partyDialog        = new PartyDialog(((SRPGGame)Game).Party);
            _partyDialog.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0.6F, 10),
                new UniScalar(1.0F, 0), new UniScalar(0.4F, -10)
                );
            Gui.Screen.Desktop.Children.Add(_partyDialog);

            // exit button
            _exitButton        = new ButtonControl();
            _exitButton.Text   = "Exit";
            _exitButton.Bounds = new UniRectangle(
                new UniScalar(1.0F, -150), new UniScalar(0),
                new UniScalar(150), new UniScalar(35)
                );
            _exitButton.Pressed += (s, a) => Game.PopScene();
            Gui.Screen.Desktop.Children.Add(_exitButton);

            // buy selected
            _buyButton        = new ButtonControl();
            _buyButton.Text   = "Buy";
            _buyButton.Bounds = new UniRectangle(
                new UniScalar(0), new UniScalar(0.6F, -35),
                new UniScalar(225), new UniScalar(35)
                );
            _buyButton.Pressed += BuySelectedItems;
            Gui.Screen.Desktop.Children.Add(_buyButton);

            // sell selected
            _sellButton        = new ButtonControl();
            _sellButton.Text   = "Sell";
            _sellButton.Bounds = new UniRectangle(
                new UniScalar(235), new UniScalar(0.6F, -35),
                new UniScalar(225), new UniScalar(35)
                );
            _sellButton.Pressed += SellSelectedItems;
            Gui.Screen.Desktop.Children.Add(_sellButton);

            ClearItemFocus();
            RefreshShop();
        }
예제 #12
0
 public BattleScene(Game game)
     : base(game)
 {
     QueuedCommands = new List<Command>();
     _commander = new BattleCommander(game);
 }