private void LeftArrow_ArrowClicked(object sender, System.EventArgs e) { var arrow = sender as Page_Arrow; Items.set_active_node(Items[LeftArrows[arrow]]); change_index(-1); }
protected override void UpdateMenu(bool active) { int index = StyleNodes.ActiveNodeIndex; StyleNodes.Update(active, -MenuLoc); if (index != StyleNodes.ActiveNodeIndex) { StylePanels[index].active = false; StyleNodes.ActiveNode.active = true; } CancelButton.Update(active); if (active) { var styleIndex = StyleNodes.consume_triggered( Inputs.A, MouseButtons.Left, TouchGestures.Tap); if (styleIndex.IsSomething) { Global.game_system.play_se(System_Sounds.Confirm); StyleNodes.set_active_node(StyleNodes[styleIndex]); OnSelected(new EventArgs()); } else if (Global.Input.triggered(Inputs.B) || Global.Input.KeyPressed(Keys.Escape) || CancelButton.consume_trigger(MouseButtons.Left) || CancelButton.consume_trigger(TouchGestures.Tap)) { Global.game_system.play_se(System_Sounds.Cancel); OnCanceled(new EventArgs()); } } }
public StyleSelectionMenu() { StylePanels = new Mode_Style_Info_Panel[Enum_Values.GetEnumCount(typeof(Mode_Styles))]; int offset = 0; for (int i = 0; i < StylePanels.Length; i++) { StylePanels[i] = new Mode_Style_Info_Panel((Mode_Styles)i); StylePanels[i].stereoscopic = Config.TITLE_MENU_DEPTH; StylePanels[i].active = false; StylePanels[i].loc = new Vector2(0, offset); offset += StylePanels[i].height + 8; } MenuLoc = new Vector2( (Config.WINDOW_WIDTH - Mode_Style_Info_Panel.WIDTH) / 2, (Config.WINDOW_HEIGHT - 16) / 2); MenuLoc -= new Vector2(0, (offset / 2) / 8 * 8); StyleNodes = new UINodeSet <Mode_Style_Info_Panel>(StylePanels); StyleNodes.set_active_node(StyleNodes[(int)Mode_Styles.Standard]); StyleNodes.ActiveNode.active = true; CancelButton = Button_Description.button(Inputs.B, Config.WINDOW_WIDTH - 64); CancelButton.description = "Cancel"; CancelButton.stereoscopic = Config.TITLE_MENU_DEPTH; }
public DifficultySelectionMenu() { DifficultyPanels = new Difficulty_Info_Panel[Enum_Values.GetEnumCount(typeof(Difficulty_Modes))]; int offset = 0; for (int i = 0; i < DifficultyPanels.Length; i++) { DifficultyPanels[i] = new Difficulty_Info_Panel((Difficulty_Modes)i); DifficultyPanels[i].stereoscopic = Config.TITLE_MENU_DEPTH; DifficultyPanels[i].active = false; DifficultyPanels[i].loc = new Vector2(0, offset); offset += DifficultyPanels[i].height + 8; } MenuLoc = new Vector2( (Config.WINDOW_WIDTH - Difficulty_Info_Panel.WIDTH) / 2, (Config.WINDOW_HEIGHT - 16) / 2); MenuLoc -= new Vector2(0, (offset / 2) / 8 * 8); DifficultyNodes = new UINodeSet <Difficulty_Info_Panel>(DifficultyPanels); DifficultyNodes.set_active_node(DifficultyNodes[(int)Difficulty_Modes.Normal]); DifficultyNodes.ActiveNode.active = true; CancelButton = Button_Description.button(Inputs.B, Config.WINDOW_WIDTH - 64); CancelButton.description = "Cancel"; CancelButton.stereoscopic = Config.TITLE_MENU_DEPTH; }
public WindowRankingsOverview(string chapter, Difficulty_Modes difficulty) { Chapter = chapter; Difficulty = difficulty; initialize_sprites(); update_black_screen(); // Jump to chapter int index = Rankings.FindIndex(x => x.Key == chapter); Nodes.set_active_node(Nodes[index]); Cursor.UpdateTargetLoc(); Cursor.move_to_target_loc(); }
public ExtrasMenu() : base() { MenuChoices.Add(new MainMenuChoicePanel("Sound Room")); MenuChoices.Add(new MainMenuChoicePanel("Supports")); MenuChoices.Add(new MainMenuChoicePanel("Credits")); MenuChoices[(int)ExtrasSelections.SoundRoom].Visible = Global.progress.SoundRoomAccessible; MenuChoices[(int)ExtrasSelections.SupportViewer].Visible = Global.progress.SupportViewerAccessible; RefreshLocs(); IEnumerable <MainMenuChoicePanel> nodes = new List <MainMenuChoicePanel>(MenuChoices); nodes = nodes.Where(x => x.Visible); ChoiceNodes = new UINodeSet <MainMenuChoicePanel>(nodes); ChoiceNodes.CursorMoveSound = System_Sounds.Menu_Move1; ChoiceNodes.SoundOnMouseMove = true; ChoiceNodes.set_active_node(nodes.FirstOrDefault()); Selection = (ExtrasSelections)MenuChoices.IndexOf(ChoiceNodes.ActiveNode); RefreshLocs(); }
internal void RefreshMenuChoices() { SuspendExists = Global.suspend_file_info != null; MenuChoices[(int)Main_Menu_Selections.Resume].Visible = SuspendExists; MenuChoices[(int)Main_Menu_Selections.Extras].Visible = Global.progress.ExtrasAccessible; if (SuspendExists) { SuspendPanel = new Suspend_Info_Panel(true); SuspendPanel.loc = new Vector2(-16, 8); SuspendPanel.stereoscopic = Config.TITLE_MENU_DEPTH; } else { SuspendPanel = null; } StartGamePanel = new StartGame_Info_Panel( Global.latest_save_id, MainMenuChoicePanel.PANEL_WIDTH, true); // Show preview of the latest save, if there is one StartGamePanel.active = Global.latest_save_id != -1; StartGamePanel.loc = new Vector2(-16, 8); StartGamePanel.stereoscopic = Config.TITLE_MENU_DEPTH; RefreshLocs(); IEnumerable <MainMenuChoicePanel> nodes = new List <MainMenuChoicePanel>(MenuChoices); nodes = nodes.Where(x => x.Visible); ChoiceNodes = new UINodeSet <MainMenuChoicePanel>(nodes); ChoiceNodes.CursorMoveSound = System_Sounds.Menu_Move1; ChoiceNodes.SoundOnMouseMove = true; ChoiceNodes.set_active_node(MenuChoices[(int)Selection]); RefreshLocs(); }
internal PreviousChapterSelectionMenu( Vector2 centerLoc, string chapterId, WorldmapMenuData menuData, IHasCancelButton menu = null) { ChapterId = chapterId; ProgressionIds = menuData.ValidPreviousChapters.Keys.ToList(); ValidPreviousChapters = menuData.ValidPreviousChapters; PreviousChapterIndices = menuData.UsablePreviousChapterIndices; Window = new SystemWindowHeadered(); Window.width = 104; Window.height = 32 + 16 * (ValidPreviousChapters.Count + 1) + 4; Window.offset = new Vector2(0, 16); Loc = centerLoc - (new Vector2(Window.width, Window.height) - Window.offset) / 2; Header = new TextSprite(); Header.draw_offset = new Vector2(8, -8); Header.SetFont(Config.UI_FONT, Global.Content, "Yellow"); Header.text = ValidPreviousChapters.Count > 1 ? "Previous Chapters" : "Previous Chapter"; Divider = new StatusWindowDivider(); Divider.draw_offset = new Vector2(8, Window.height - 44); Divider.SetWidth(Window.width - 16); LeftArrows = new Dictionary <Page_Arrow, int>(); RightArrows = new Dictionary <Page_Arrow, int>(); // Center, then adjust left to account for map sprite int x = ((Window.width / 2) / 8 * 8) - 16; List <CommandUINode> nodes = new List <CommandUINode>(); for (int i = 0; i < ProgressionIds.Count; i++) { int y = i * 16 + 8; var text = new TextSprite(); text.SetFont(Config.UI_FONT, Global.Content, "White"); text.text = chapter(i).Id; var node = new MapSpriteUINode("", text, 56); refresh_map_sprite(node, i); node.loc = new Vector2(x, y); nodes.Add(node); // Add arrows for this set of chapters, // if there's more than one choice if (chapter_list(i).Count > 1) { var left_arrow = new Page_Arrow(); left_arrow.loc = new Vector2(8, y); left_arrow.ArrowClicked += LeftArrow_ArrowClicked; LeftArrows.Add(left_arrow, i); var right_arrow = new Page_Arrow(); right_arrow.loc = new Vector2(Window.width - 8, y); right_arrow.mirrored = true; right_arrow.ArrowClicked += RightArrow_ArrowClicked; RightArrows.Add(right_arrow, i); } } // Add confirm choice var confirmText = new TextSprite( Config.UI_FONT, Global.Content, "White", new Vector2(4, 0), "Confirm"); var confirm = new TextUINode("", confirmText, 56); confirm.loc = new Vector2(x, nodes.Count * 16 + 8 + 4); nodes.Add(confirm); Items = new UINodeSet <CommandUINode>(nodes); Items.WrapVerticalSameColumn = true; Items.CursorMoveSound = System_Sounds.Menu_Move1; Items.HorizontalCursorMoveSound = System_Sounds.Menu_Move2; Items.AngleMultiplier = 2f; Items.TangentDirections = new List <CardinalDirections> { CardinalDirections.Left, CardinalDirections.Right }; Items.refresh_destinations(); Items.set_active_node(confirm); UICursor = new UICursor <CommandUINode>(Items); UICursor.draw_offset = new Vector2(-12, 0); //UICursor.ratio = new int[] { 1, 3 }; //Debug CreateCancelButton(menu); }