コード例 #1
0
        // Open unit menu opened from pick units/organize
        protected void overviewMenu_Unit(object sender, EventArgs e)
        {
            var overviewMenu = (sender as Window_Prep_Unit_Overview);
            int actorId      = overviewMenu.actor_id;

            var unitMenu = new Window_Unit();

            if (overviewMenu is Window_Prep_PickUnits)
            {
                unitMenu.pickunits_window = overviewMenu as Window_Prep_PickUnits;
            }
            unitMenu.ActorId  = actorId;
            unitMenu.Status  += unitMenu_Status;
            unitMenu.Closing += unitMenu_Closing;
            AddUnitMenuCancelEvent(unitMenu);
            AddMenu(unitMenu);
        }
コード例 #2
0
        // Chapter option selected
        void worldmapMenu_ChapterCommandSelected(object sender, EventArgs e)
        {
            var worldmapMenu = sender as WorldmapMenu;

            switch (worldmapMenu.SelectedChapterCommand())
            {
            case ChapterCommands.StartChapter:
                // Open suspend deletion confirm menu, or start chapter
                if (worldmapMenu.PreviousChapterSelectionIncomplete())
                {
                    Global.game_system.play_se(System_Sounds.Buzzer);
                }
                else
                {
                    // If a map save or suspend already exists
#if DEBUG
                    if (Global.save_files_info != null &&
                        (Global.current_save_info.map_save_exists ||
                         Global.current_save_info.suspend_exists))
#else
                    if (Global.current_save_info.map_save_exists ||
                        Global.current_save_info.suspend_exists)
#endif
                    {
                        var deleteSuspendWindow = new Parchment_Confirm_Window();
                        deleteSuspendWindow.loc = new Vector2(Config.WINDOW_WIDTH - 152, Config.WINDOW_HEIGHT - 64) / 2;
                        deleteSuspendWindow.set_text("Temporary saves for this file\nwill be deleted. Proceed?");
                        deleteSuspendWindow.add_choice("Yes", new Vector2(32, 32));
                        deleteSuspendWindow.add_choice("No", new Vector2(88, 32));
                        deleteSuspendWindow.size  = new Vector2(152, 64);
                        deleteSuspendWindow.index = 1;

                        var deleteSuspendMenu = new ConfirmationMenu(deleteSuspendWindow);
                        deleteSuspendMenu.Confirmed += deleteSuspendMenu_Confirmed;
                        deleteSuspendMenu.Canceled  += menu_Closed;
                        AddMenu(deleteSuspendMenu);
                    }
                    else
                    {
                        Global.game_system.play_se(System_Sounds.Confirm);
                        MenuHandler.WorldmapStartChapter();
                    }
                }
                break;

            case ChapterCommands.SelectPrevious:
                // Open select previous chapter menu
                Global.game_system.play_se(System_Sounds.Confirm);
                AddPreviousChapterSelectionMenu(worldmapMenu);
                break;

            case ChapterCommands.Options:
                // Open options menu
                Global.game_system.play_se(System_Sounds.Confirm);
                AddOptionsMenu(false);
                break;

            case ChapterCommands.Unit:
                Global.game_system.play_se(System_Sounds.Confirm);
                Global.game_map = new Game_Map();
                // Open unit menu
                var unitMenu = new Window_Unit();
                unitMenu.Status  += unitMenu_Status;
                unitMenu.Closing += unitMenu_Closing;
                unitMenu.Closed  += unitMenu_Closed;
                AddMenu(unitMenu);
                break;

            case ChapterCommands.Manage:
                Global.game_system.play_se(System_Sounds.Confirm);
                Global.game_state.reset();
                Global.game_map = new Game_Map();
                // Open item management menu
                AddItemManageMenu();
                break;

            case ChapterCommands.Ranking:
                // Open ranking menu
                Global.game_system.play_se(System_Sounds.Confirm);
                var rankingsMenu = new WindowRankingsOverview(
                    MenuData.ChapterId,
                    Global.game_system.Difficulty_Mode);
                rankingsMenu.Closed += menu_Closed;
                AddMenu(rankingsMenu);
                break;
            }
        }
コード例 #3
0
 protected override void AddUnitMenuCancelEvent(Window_Unit unitMenu)
 {
     unitMenu.Closed += unitMenu_Closed;
 }
コード例 #4
0
        // Selected an item in the map menu
        private void mapMenu_Selected(object sender, EventArgs e)
        {
            switch ((sender as MapCommandMenu).SelectedOption)
            {
            case Map_Menu_Options.Unit:
                RemoveTopMenu();

                var unitMenu = new Window_Unit();
                unitMenu.Status += unitMenu_Status;
                unitMenu.Closed += unitMenu_Closed;
                AddMenu(unitMenu);
                break;

            case Map_Menu_Options.Data:
                RemoveTopMenu();

                var dataMenu = new Window_Data();
                dataMenu.Closed += menu_ClosedCanceled;
                AddMenu(dataMenu);
                break;

            case Map_Menu_Options.Options:
                RemoveTopMenu();

                var settingsTopMenu = new GameplaySettingsTopMenu(true);
                settingsTopMenu.Selected += SettingsTopMenu_Selected;
                settingsTopMenu.Closed   += menu_ClosedCanceled;
                settingsTopMenu.AddToManager(new MenuCallbackEventArgs(this.AddMenu, this.menu_Closed));
                break;

            case Map_Menu_Options.Suspend:
                var suspendConfirmWindow = new Parchment_Confirm_Window();
                suspendConfirmWindow.set_text("Save and quit?", new Vector2(8, 0));
                suspendConfirmWindow.add_choice("Yes", new Vector2(16, 16));
                suspendConfirmWindow.add_choice("No", new Vector2(56, 16));
                suspendConfirmWindow.size = new Vector2(104, 48);
                suspendConfirmWindow.loc  =
                    new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2 -
                    suspendConfirmWindow.size / 2;

                var suspendConfirmMenu = new ConfirmationMenu(suspendConfirmWindow);
                suspendConfirmMenu.Confirmed += suspendConfirmMenu_Confirmed;
                suspendConfirmMenu.Canceled  += menu_Closed;
                AddMenu(suspendConfirmMenu);
                break;

            case Map_Menu_Options.End:
                // If there are no units left to move, just end the turn
                if (!Global.game_map.ready_movable_units)
                {
                    MenuHandler.MapMenuEndTurn();
                }
                else
                {
                    var endTurnConfirmWindow = new Parchment_Confirm_Window();
                    endTurnConfirmWindow.set_text("End your turn?", new Vector2(8, 0));
                    endTurnConfirmWindow.add_choice("Yes", new Vector2(16, 16));
                    endTurnConfirmWindow.add_choice("No", new Vector2(56, 16));
                    endTurnConfirmWindow.size = new Vector2(104, 48);
                    endTurnConfirmWindow.loc  =
                        new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2 -
                        endTurnConfirmWindow.size / 2;

                    var endTurnConfirmMenu = new ConfirmationMenu(endTurnConfirmWindow);
                    endTurnConfirmMenu.Confirmed += endTurnConfirmMenu_Confirmed;
                    endTurnConfirmMenu.Canceled  += menu_Closed;
                    AddMenu(endTurnConfirmMenu);
                }
                break;
            }
        }
コード例 #5
0
 protected virtual void AddUnitMenuCancelEvent(Window_Unit unitMenu)
 {
     unitMenu.Closed += menu_Closed;
 }