Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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");
        }