private CommandMenu GetManageMenu(Vector2 optionLocation, int index = 0) { // Command Window Vector2 manage_loc = optionLocation + new Vector2(48, 8); var manageCommandWindow = new Window_Command(manage_loc, 72, new List <string> { "Organize", "Items", "Support" }); manageCommandWindow.text_offset = new Vector2(8, 0); manageCommandWindow.glow = true; manageCommandWindow.bar_offset = new Vector2(-8, 0); manageCommandWindow.stereoscopic = Config.PREPMAIN_WINDOW_DEPTH; manageCommandWindow.index = index; var manageCommandMenu = new CommandMenu(manageCommandWindow); manageCommandMenu.CreateCancelButton( Config.WINDOW_WIDTH - 128, Config.PREPMAIN_INFO_DEPTH); manageCommandMenu.Selected += manageCommandMenu_Selected; manageCommandMenu.Canceled += menu_Closed; return(manageCommandMenu); }
protected override Window_Command NewWindow() { List <string> strs = new List <string> { "Trade", "List", "Convoy", "Give All", "Optimize" }; var commandWindow = new Window_Command(new Vector2(Config.WINDOW_WIDTH - 128, Config.WINDOW_HEIGHT - 100), 56, strs); if (Global.battalion.actors.Count <= 1) { commandWindow.set_text_color(0, "Grey"); } if (Global.battalion.actors.Count <= 1 && Global.battalion.convoy_id == -1) { commandWindow.set_text_color(1, "Grey"); } if (Global.battalion.convoy_id == -1) { commandWindow.set_text_color(2, "Grey"); commandWindow.set_text_color(3, "Grey"); commandWindow.set_text_color(4, "Grey"); } commandWindow.size_offset = new Vector2(0, -8); commandWindow.text_offset = new Vector2(0, -4); commandWindow.glow_width = 56 - 8; commandWindow.glow = true; commandWindow.bar_offset = new Vector2(-8, 0); commandWindow.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Item_Options_Window"); commandWindow.color_override = 0; commandWindow.set_columns(2); commandWindow.stereoscopic = Config.PREPITEM_WINDOW_DEPTH; return(commandWindow); }
// Selected an item in the reinforcements menu void reinforcementsMenu_Selected(object sender, EventArgs e) { var reinforcementsMenu = sender as ReinforcementsMenu; List <string> commands = new List <string> { "Edit", "Add", "Paste", "Delete" }; var reinforcementsOptionsWindow = new Window_Command( reinforcementsMenu.WindowLoc + new Vector2(WindowCommandReinforcements.WIDTH + 8, 0), 80, commands); if (ReinforcementData.Count == 0) { reinforcementsOptionsWindow.set_text_color(0, "Grey"); reinforcementsOptionsWindow.set_text_color(3, "Grey"); } var reinforcementsOptionsMenu = new CommandMenu(reinforcementsOptionsWindow); reinforcementsOptionsMenu.Selected += reinforcementsOptionsMenu_Selected; reinforcementsOptionsMenu.Canceled += reinforcementsOptionsMenu_Canceled; AddMenu(reinforcementsOptionsMenu); }
public SettingsTopMenu() : base() { Vector2 loc = new Vector2(Config.WINDOW_WIDTH / 2 - 40, 32); List <string> settings = GetSettingsStrings(); // Window Window = new Window_Command(loc, 72, settings); Window.text_offset = new Vector2(8, 0); Window.glow = true; Window.bar_offset = new Vector2(-8, 0); Window.WindowVisible = false; Window.stereoscopic = Config.PREPMAIN_WINDOW_DEPTH; // Version Number VersionNumber = new TextSprite(); VersionNumber.loc = new Vector2(8, Config.WINDOW_HEIGHT - 16); VersionNumber.SetFont(Config.UI_FONT, Global.Content, "White"); VersionNumber.text = string.Format("v {0}", Global.RUNNING_VERSION); #if PRERELEASE || DEBUG VersionNumber.text += " - Private Beta"; #endif VersionNumber.stereoscopic = Config.MAPCOMMAND_WINDOW_DEPTH; // Background Background = new Menu_Background(); Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Status_Background"); Background.vel = new Vector2(-0.25f, 0); Background.tile = new Vector2(3, 2); Background.tint = new Color(128, 128, 128, 255); Background.stereoscopic = Config.MAPMENU_BG_DEPTH; }
protected virtual Window_Command NewWindow() { List <string> strs = new List <string> { "Trade", "List", "Convoy", "Give All", "Use", "Restock", "Optimize" }; if (Global.game_system.home_base || (Global.battalion.has_convoy && Global.game_battalions.active_convoy_shop != null)) { strs.Add("Shop"); } var commandWindow = new Window_Command(new Vector2(Config.WINDOW_WIDTH - 128, Config.WINDOW_HEIGHT - 100), 56, strs); if (Global.battalion.actors.Count <= 1) { commandWindow.set_text_color(0, "Grey"); } if (Global.battalion.actors.Count <= 1 && !Global.battalion.has_convoy) { commandWindow.set_text_color(1, "Grey"); } if (!Global.battalion.has_convoy) { commandWindow.set_text_color(2, "Grey"); commandWindow.set_text_color(6, "Grey"); commandWindow.set_text_color(7, "Grey"); } else if (Global.game_battalions.active_convoy_shop == null) { commandWindow.set_text_color(7, "Grey"); } commandWindow.size_offset = new Vector2(0, -8); commandWindow.text_offset = new Vector2(0, -4); commandWindow.glow_width = 56 - 8; commandWindow.glow = true; commandWindow.bar_offset = new Vector2(-8, 0); commandWindow.texture = Global.Content.Load <Texture2D>( @"Graphics\Windowskins\Preparations_Item_Options_Window"); commandWindow.color_override = 0; commandWindow.set_columns(2); commandWindow.stereoscopic = Config.PREPITEM_WINDOW_DEPTH; return(commandWindow); }
private Window_Command NewUnitWindow(List <string> commands, int width) { var window = new Window_Command( new Vector2(8 + (Global.player.is_on_left() ? (Config.WINDOW_WIDTH - (width + 16)) : 0), 24), width, commands); window.stereoscopic = Config.MAPCOMMAND_WINDOW_DEPTH; window.help_stereoscopic = Config.MAPCOMMAND_HELP_DEPTH; for (int i = 0; i < commands.Count; i++) { // Trade, Give/Take if (IndexRedirect[i] == 4 || IndexRedirect[i] == 6) { window.set_text_color(i, "Green"); } // Supply if (IndexRedirect[i] == 18) { window.set_text_color(i, "Green"); } // Talk if (IndexRedirect[i] == 8 && Constants.Gameplay.TALKING_IS_FREE_ACTION) { window.set_text_color(i, "Green"); } // Disabled commands if (Disabled.Contains(IndexRedirect[i])) { window.set_text_color(i, "Grey"); } } // Automatically selects a specific menu option if (Global.game_temp.SelectedMoveMenuChoice.IsSomething) { if (IndexRedirect.Contains(Global.game_temp.SelectedMoveMenuChoice)) { window.immediate_index = IndexRedirect.IndexOf(Global.game_temp.SelectedMoveMenuChoice); } } return(window); }
private static Window_Command new_map_window(int width) { List <string> commands = new List <string> { "Unit", "Data", "Options", "Suspend", "End" }; var window = new Window_Command( new Vector2(8 + (show_menu_on_right ? (Config.WINDOW_WIDTH - (width + 16)) : 0), 24), width, commands); window.stereoscopic = Config.MAPCOMMAND_WINDOW_DEPTH; window.help_stereoscopic = Config.MAPCOMMAND_HELP_DEPTH; if (Global.game_temp.end_turn_highlit) { window.immediate_index = (int)Map_Menu_Options.End; Global.game_temp.end_turn_highlit = false; } return(window); }
public void SelectChapter() { List <string> commands = new List <string> { "Start Chapter" }; ActiveChapterCommands = new List <ChapterCommands> { ChapterCommands.StartChapter }; if (MenuData.ValidPreviousChapters.Any(x => x.Value.Count > 1)) { commands.Add("Load Data"); ActiveChapterCommands.Add(ChapterCommands.SelectPrevious); } commands.Add("Options"); ActiveChapterCommands.Add(ChapterCommands.Options); if (UnitWindowAvailable) { commands.Add("Unit"); ActiveChapterCommands.Add(ChapterCommands.Unit); // Manage screen blocked in Classic if (!MenuData.AutoSelectChapter) { commands.Add("Manage"); ActiveChapterCommands.Add(ChapterCommands.Manage); } } if (RankingWindowAvailable) { commands.Add("Ranking"); ActiveChapterCommands.Add(ChapterCommands.Ranking); } ChapterCommandWindow = new Window_Command( CommandWindow.loc + new Vector2(8, 0), WIDTH - (16 + 16), commands); ChapterCommandWindow.tint = new Color(224, 224, 224, 224); ChapterCommandWindow.text_offset = new Vector2(4, 0); CommandWindow.active = false; CommandWindow.visible = false; }
private void PromotionChoiceMenu_Selected(object sender, EventArgs e) { Global.game_system.play_se(System_Sounds.Open); var promotionChoiceMenu = (sender as PromotionChoiceMenu); var promotionConfirmWindow = new Window_Command( promotionChoiceMenu.WindowLoc + new Vector2(64, 24), 48, new List <string> { "Change", "Cancel" }); promotionConfirmWindow.help_stereoscopic = Config.MAPCOMMAND_HELP_DEPTH; promotionConfirmWindow.small_window = true; var promotionConfirmMenu = new CommandMenu(promotionConfirmWindow, promotionChoiceMenu); promotionConfirmMenu.Selected += PromotionConfirmMenu_Selected; promotionConfirmMenu.Canceled += menu_Closed; AddMenu(promotionConfirmMenu); }
protected void initialize_sprites() { // Black Screen Black_Screen = new Sprite(); Black_Screen.texture = Global.Content.Load <Texture2D>(@"Graphics/White_Square"); Black_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); Black_Screen.tint = new Color(0, 0, 0, 255); // Map Darken Map_Darken = new Sprite(); Map_Darken.texture = Global.Content.Load <Texture2D>(@"Graphics/White_Square"); Map_Darken.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); update_map_darken_tint(); // Command Window Command_Window = new Window_Command(new Vector2(Config.WINDOW_WIDTH / 2 - 40, 32), 80, new List <string> { "View Map", "Formation", "Options", "Save" }); Command_Window.text_offset = new Vector2(8, 0); Command_Window.glow = true; Command_Window.bar_offset = new Vector2(-8, 0); refresh_input_help(); }
private void OpenWindow(Vector2 loc, int fileId) { List <string> strs = new List <string>(); int width; StartGameOptionRedirect.Clear(); strs.Add(string.IsNullOrEmpty( Global.save_files_info[fileId].chapter_id) ? "Start Game" : "Select Chapter"); StartGameOptionRedirect.Add((int)Start_Game_Options.World_Map); if (Global.save_files_info[fileId].suspend_exists) { strs.Add("Continue"); StartGameOptionRedirect.Add((int)Start_Game_Options.Load_Suspend); } if (Global.save_files_info[fileId].map_save_exists) { strs.Add("Checkpoint"); StartGameOptionRedirect.Add((int)Start_Game_Options.Load_Map_Save); } if (Global.save_files_info.Count < Config.SAVES_PER_PAGE * Config.SAVE_PAGES) { strs.Add("Move"); StartGameOptionRedirect.Add((int)Start_Game_Options.Move); strs.Add("Copy"); StartGameOptionRedirect.Add((int)Start_Game_Options.Copy); } strs.Add("Delete"); StartGameOptionRedirect.Add((int)Start_Game_Options.Delete); width = 80; loc += new Vector2(-width, 0); loc.Y = Math.Min(loc.Y, (Config.WINDOW_HEIGHT - 16) - (strs.Count + 1) * 16); Window = new Window_Command(loc, width, strs); Window.stereoscopic = Config.TITLE_CHOICE_DEPTH; }
private static Window_Command NewWindow(Game_Unit unit) { List <string> commands = new List <string>(); foreach (int classId in PromotionChoices(unit)) { commands.Add(Global.data_classes[classId].name); } Window_Command window; if (commands.Count <= MAX_ROWS) { window = new Window_Command(new Vector2(24, 8), WIDTH, commands); } else { window = new Window_Command_Scrollbar(new Vector2(24, 8), WIDTH + 8, MAX_ROWS, commands); } window.text_offset = new Vector2(4, 0); window.stereoscopic = Config.MAPCOMMAND_WINDOW_DEPTH; window.help_stereoscopic = Config.MAPCOMMAND_HELP_DEPTH; return(window); }
protected virtual void initialize_sprites() { // Black Screen Black_Screen = new Sprite(); Black_Screen.texture = Global.Content.Load <Texture2D>(@"Graphics/White_Square"); Black_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); Black_Screen.tint = new Color(0, 0, 0, 255); // Map Darken Map_Darken = new Sprite(); Map_Darken.texture = Global.Content.Load <Texture2D>(@"Graphics/White_Square"); Map_Darken.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); Map_Darken.tint = new Color(0, 0, 0, 128); // Banner Banner = new Sprite(); Banner.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen"); Banner.loc = new Vector2(0, 0); Banner.src_rect = new Rectangle(0, 0, 320, 40); Banner.tint = new Color(255, 255, 255, 128); Banner.stereoscopic = Config.PREPMAIN_BANNER_DEPTH; Goal = new TextSprite(); Goal.loc = new Vector2(Config.WINDOW_WIDTH - 144 / 2, 20); Goal.SetFont(Config.UI_FONT, Global.Content, "White"); Goal.stereoscopic = Config.PREPMAIN_BANNER_DEPTH; ChapterLabel = new ChapterLabel(); ChapterLabel.loc = new Vector2(Config.WINDOW_WIDTH - 144, 4); ChapterLabel.stereoscopic = Config.PREPMAIN_BANNER_DEPTH; ChapterLabel.SetChapter(Global.data_chapters[Global.game_state.chapter_id]); // Background Background = new Menu_Background(); Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Preparation_Background"); (Background as Menu_Background).vel = new Vector2(0, -1 / 3f); (Background as Menu_Background).tile = new Vector2(1, 2); Background.stereoscopic = Config.PREP_BG_DEPTH; // Command Window CommandWindow = new Window_Command(command_window_loc, 80, command_window_string()); CommandWindow.text_offset = new Vector2(8, 0); CommandWindow.glow = true; CommandWindow.bar_offset = new Vector2(-8, 0); CommandWindow.stereoscopic = Config.PREPMAIN_WINDOW_DEPTH; // Info Window InfoWindow = new Sprite(); InfoWindow.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen"); InfoWindow.loc = new Vector2(8, 128); InfoWindow.src_rect = new Rectangle(208, 40, 112, 64); InfoWindow.stereoscopic = Config.PREPMAIN_DATA_DEPTH; // Help Window CommandHelpWindow = new Sprite(); CommandHelpWindow.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Screen"); CommandHelpWindow.loc = new Vector2(160, 40); CommandHelpWindow.src_rect = new Rectangle(184, 104, 136, 112); CommandHelpWindow.stereoscopic = Config.PREPMAIN_INFO_DEPTH; // Help Text HelpText = new TextSprite(); HelpText.loc = new Vector2(176, 48); HelpText.SetFont(Config.UI_FONT, Global.Content, "White"); HelpText.text = ""; HelpText.stereoscopic = Config.PREPMAIN_INFO_DEPTH; // Info Label InfoLabel = new Sprite(); InfoLabel.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Preparation_Info_Text"); InfoLabel.loc = new Vector2(16, 136); InfoLabel.offset = new Vector2(-5, -2); InfoLabel.src_rect = new Rectangle(0, 0, InfoLabel.texture.Width, 28); InfoLabel.stereoscopic = Config.PREPMAIN_DATA_DEPTH; // Info AvgLvl = new RightAdjustedText(); AvgLvl.loc = new Vector2(108 - 32, 136); AvgLvl.SetFont(Config.UI_FONT, Global.Content, "Blue"); AvgLvl.stereoscopic = Config.PREPMAIN_DATA_DEPTH; EnemyAvgLvl = new RightAdjustedText(); EnemyAvgLvl.loc = new Vector2(108, 136); EnemyAvgLvl.SetFont(Config.UI_FONT, Global.Content, "Red"); EnemyAvgLvl.stereoscopic = Config.PREPMAIN_DATA_DEPTH; Funds = new RightAdjustedText(); Funds.loc = new Vector2(100, 152); Funds.SetFont(Config.UI_FONT, Global.Content, "Blue"); Funds.stereoscopic = Config.PREPMAIN_DATA_DEPTH; Counter = new Play_Time_Counter(); Counter.loc = new Vector2(20, 168); Counter.stereoscopic = Config.PREPMAIN_DATA_DEPTH; create_start_button(); }
// Selected an item in the map menu private void mapMenu_Selected(object sender, EventArgs e) { var mapMenu = (sender as UnitEditorMapCommandMenu); switch (mapMenu.SelectedOption) { case Unit_Editor_Options.Unit: RemoveTopMenu(); var unitMenu = new Window_Unit_Team(); unitMenu.Status += unitMenu_Status; unitMenu.Closed += unitMenu_Closed; AddMenu(unitMenu); break; case Unit_Editor_Options.Add_Unit: MenuHandler.UnitEditorMapMenuAddUnit(); break; case Unit_Editor_Options.Paste_Unit: MenuHandler.UnitEditorMapMenuPasteUnit(); break; case Unit_Editor_Options.Reinforcements: RemoveTopMenu(); var reinforcementsMenu = new ReinforcementsMenu(ReinforcementData); reinforcementsMenu.Selected += reinforcementsMenu_Selected; reinforcementsMenu.Canceled += menu_ClosedCanceled; AddMenu(reinforcementsMenu); break; case Unit_Editor_Options.Options: RemoveTopMenu(); var settingsTopMenu = new GameplaySettingsTopMenu(false); settingsTopMenu.Selected += SettingsTopMenu_Selected; settingsTopMenu.Closed += menu_ClosedCanceled; settingsTopMenu.AddToManager(new MenuCallbackEventArgs(this.AddMenu, this.menu_Closed)); break; case Unit_Editor_Options.Clear_Units: // Clear Units Vector2 optionLocation = mapMenu.SelectedOptionLocation; var clearUnitsWindow = new Window_Command( optionLocation + new Vector2(8, 24), 80, new List <string> { "Confirm", "Cancel" }); clearUnitsWindow.immediate_index = 1; var clearUnitsCommandMenu = new CommandMenu(clearUnitsWindow); clearUnitsCommandMenu.Selected += clearUnitsCommandMenu_Selected; clearUnitsCommandMenu.Canceled += confirmMenu_Canceled; AddMenu(clearUnitsCommandMenu); break; case Unit_Editor_Options.Mirror_Units: // Mirror Units optionLocation = mapMenu.SelectedOptionLocation; var mirrorUnitsWindow = new Window_Command( optionLocation + new Vector2(8, 24), 80, new List <string> { "Confirm", "Cancel" }); mirrorUnitsWindow.immediate_index = 1; var mirrorUnitsCommandMenu = new CommandMenu(mirrorUnitsWindow); mirrorUnitsCommandMenu.Selected += mirrorUnitsCommandMenu_Selected; mirrorUnitsCommandMenu.Canceled += confirmMenu_Canceled; AddMenu(mirrorUnitsCommandMenu); break; case Unit_Editor_Options.Playtest: MenuHandler.UnitEditorMapMenuPlaytest(); break; case Unit_Editor_Options.Revert: MenuHandler.UnitEditorMapMenuRevert(); break; case Unit_Editor_Options.Save: MenuHandler.UnitEditorMapMenuSave(); break; case Unit_Editor_Options.Quit: // Quit optionLocation = mapMenu.SelectedOptionLocation; var quitConfirmWindow = new Window_Confirmation(); int height = 48; quitConfirmWindow.loc = optionLocation + new Vector2(0, 24); if (quitConfirmWindow.loc.Y + height > Config.WINDOW_HEIGHT) { quitConfirmWindow.loc = optionLocation + new Vector2(0, -40); } quitConfirmWindow.set_text("Are you sure?"); quitConfirmWindow.add_choice("Yes", new Vector2(16, 16)); quitConfirmWindow.add_choice("No", new Vector2(56, 16)); quitConfirmWindow.size = new Vector2(88, height); quitConfirmWindow.index = 1; var quitConfirmMenu = new ConfirmationMenu(quitConfirmWindow); quitConfirmMenu.Confirmed += quitConfirmMenu_Confirmed; quitConfirmMenu.Canceled += confirmMenu_Canceled; AddMenu(quitConfirmMenu); break; } }
private void create_command_window(Supply_Command_Window type) { List <string> commands; switch (type) { case Supply_Command_Window.Give: commands = new List <string> { "Give" }; break; case Supply_Command_Window.Take: commands = new List <string> { "Take" }; break; case Supply_Command_Window.Restock: commands = new List <string> { "Restock" }; break; default: if (this.restock_blocked) { commands = new List <string> { "Give", "Take" } } ; else { commands = new List <string> { "Give", "Restock", "Take" } }; break; } int width = 56; int i = Math.Max(0, (int)type - 1); Vector2 loc = new Vector2( (64 + 12) + ((i % 2) * (width - 16)), (36 - 2) + ((i / 2) * 16)); //Vector2 loc = new Vector2( //Debug // (64 + 36), // (36 - 2)); Command_Window = new Window_Command(loc, width, commands); Command_Window.set_columns(this.restock_blocked ? 1 : 2); Command_Window.glow_width = width - 8; Command_Window.glow = true; Command_Window.bar_offset = new Vector2(-8, 0); Command_Window.text_offset = new Vector2(0, -4); Command_Window.size_offset = new Vector2(-8, -8); Command_Window.greyed_cursor = type != Supply_Command_Window.All; Command_Window.active = type == Supply_Command_Window.All; Command_Window.texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Item_Options_Window"); Command_Window.immediate_index = 0; Command_Window.color_override = 0; Command_Window.stereoscopic = Config.CONVOY_WINDOW_DEPTH; }
private void CloseChapterCommands() { CommandWindow.active = true; CommandWindow.visible = true; ChapterCommandWindow = null; }
public CommandMenu(Window_Command window, IHasCancelButton menu = null) { Window = window; CreateCancelButton(menu); }