private void update_node_location(bool active) { // Update options nodes int old_index = OptionsNodes.ActiveNodeIndex; OptionsNodes.Update(active, visible_indexes_range().Enumerate(), Offset); if (old_index != OptionsNodes.ActiveNodeIndex) { if (Input.ControlScheme == ControlSchemes.Buttons) { // Moved down if (old_index < OptionsNodes.ActiveNodeIndex) { while (OptionsNodes.ActiveNodeIndex >= (ROWS_AT_ONCE - 1) + Scroll && Scroll < OptionsNodes.Count - (ROWS_AT_ONCE)) { Scroll++; } } // Moved up else { while (OptionsNodes.ActiveNodeIndex < Scroll + 1 && Scroll > 0) { Scroll--; } } } if (Scrollbar != null) { Scrollbar.scroll = Scroll; } if (this.active_option_data.Gauge) { SettingsNodes.set_active_node(SettingsGroups[OptionsNodes.ActiveNodeIndex][0]); } else { SettingsNodes.set_active_node(SettingsGroups[OptionsNodes.ActiveNodeIndex][this.current_setting]); } refresh_arrow_visibility(); update_loc(); } // Update settings nodes old_index = SettingsNodes.ActiveNodeIndex; SettingsNodes.Update(!active ? ControlSet.None : (ControlSet.Mouse | ControlSet.Touch), visible_settings_range(), Offset); if (old_index != SettingsNodes.ActiveNodeIndex || Input.ControlSchemeSwitched) { jump_to_option(SettingsNodes.ActiveNode); update_loc(); int setting = SettingsGroups[OptionsNodes.ActiveNodeIndex].IndexOf(SettingsNodes.ActiveNode); Description.text = this.active_option_data.Options[setting].Description; } // Update touch scroll update_manual_scroll(active); }
public void refresh_nodes() { int active_index = 0; if (UnitNodes != null) { active_index = UnitNodes.ActiveNodeIndex; } var old_cursor = UnitCursor; ActorList = GetActorList(); List <PrepItemsUnitUINode> nodes = new List <PrepItemsUnitUINode>(); // Units for (int index = 0; index < ActorList.Count; index++) { Vector2 loc = new Vector2( (index % this.Columns) * unit_spacing() + 28, (index / this.Columns) * this.RowSize + this.ScissorRectOffset.Y) + unit_offset(); int id = ActorList[index]; nodes.Add(unit_node(id)); nodes[index].loc = loc + new Vector2(this.ScissorRectOffset.X - 8, 0); } UnitNodes = new PartialRangeVisibleUINodeSet <PrepItemsUnitUINode>(nodes); UnitNodes.CursorMoveSound = System_Sounds.Menu_Move1; for (int index = 0; index < ActorList.Count; index++) { refresh_map_sprite(index); refresh_font(index); } UnitCursor = new UICursor <PrepItemsUnitUINode>(UnitNodes); UnitCursor.draw_offset = new Vector2(-12, 0); UnitNodes.set_active_node(UnitNodes[active_index]); UnitCursor.move_to_target_loc(); if (old_cursor != null) { UnitCursor.loc = old_cursor.loc; } UnitNodes.Update(false); }
private void update_node_location(bool active) { int old_index = this.index; UnitNodes.Update(active, visible_indexes_range(false).Enumerate(), Offset - (this.loc + draw_offset)); if (old_index != this.index) { bool vertical_move = Math.Abs(this.index - old_index) >= this.Columns; if (vertical_move && Input.ControlScheme == ControlSchemes.Buttons) { // Moved down if (old_index < this.index) { while (this.index / this.Columns >= (this.VisibleRows - 1) + Scroll && Scroll < Rows - (this.VisibleRows)) { Scroll++; } } // Moved up else { while (this.index / this.Columns < Scroll + 1 && Scroll > 0) { Scroll--; } } } if (IndexChanged != null) { IndexChanged(this, new EventArgs()); } if (vertical_move) { if (Scrollbar != null) { Scrollbar.scroll = Scroll; } } } }