Class: UI::Storage::ModeHandler
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb
Overview
Class responsive of handling the mode for the PC UI
Constant Summary collapse
- AVAILABLE_MODES =
List the available modes
%i[pokemon item battle]
- AVAILABLE_SELECTION_MODES =
List the available modes
%i[detailed fast grouped]
Instance Attribute Summary collapse
-
#mode ⇒ Symbol
Get the current mode.
-
#selection_mode ⇒ Symbol
Get the current selection mode.
Instance Method Summary collapse
-
#add_mode_ui(mode_ui)
Add a mode ui.
-
#add_selection_mode_ui(selection_mode_ui)
Add a selection mode ui.
-
#initialize(mode, selection_mode) ⇒ ModeHandler
constructor
Create a new Mode Handler.
-
#swap_mode ⇒ Symbol
Swap the mode.
-
#swap_selection_mode ⇒ Symbol
Swap the selection mode.
Constructor Details
#initialize(mode, selection_mode) ⇒ ModeHandler
Create a new Mode Handler
17 18 19 20 21 22 23 24 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 17 def initialize(mode, selection_mode) # @type [Array<#mode=>] @mode_uis = [] # @type [Array<#selection_mode=>] @select_mode_uis = [] self.mode = mode self.selection_mode = selection_mode end |
Instance Attribute Details
#mode ⇒ Symbol
Get the current mode
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 7 def mode @mode end |
#selection_mode ⇒ Symbol
Get the current selection mode
12 13 14 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 12 def selection_mode @selection_mode end |
Instance Method Details
#add_mode_ui(mode_ui)
Add a mode ui
28 29 30 31 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 28 def add_mode_ui(mode_ui) @mode_uis << mode_ui mode_ui.mode = @mode end |
#add_selection_mode_ui(selection_mode_ui)
Add a selection mode ui
35 36 37 38 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 35 def add_selection_mode_ui(selection_mode_ui) @select_mode_uis << selection_mode_ui selection_mode_ui.selection_mode = @selection_mode end |
#swap_mode ⇒ Symbol
Swap the mode
62 63 64 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 62 def swap_mode self.mode = AVAILABLE_MODES[AVAILABLE_MODES.index(@mode) + 1] || AVAILABLE_MODES.first end |
#swap_selection_mode ⇒ Symbol
Swap the selection mode
68 69 70 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00010 ModeHandler.rb', line 68 def swap_selection_mode self.selection_mode = AVAILABLE_SELECTION_MODES[AVAILABLE_SELECTION_MODES.index(@selection_mode) + 1] || AVAILABLE_SELECTION_MODES.first end |