Class: UI::Storage::CursorHandler
- Defined in:
- scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb
Overview
Class that handle all the logic related to cursor movement between each party of the UI
Instance Method Summary collapse
-
#index ⇒ Integer
Get the index of the cursor.
-
#initialize(cursor) ⇒ CursorHandler
constructor
Create a cusor handler.
-
#mode ⇒ Symbol
Get the cursor mode.
-
#move_down ⇒ Boolean
Move the cursor down.
-
#move_left ⇒ Boolean
Move the cursor to the left.
-
#move_right ⇒ Boolean
Move the cursor to the right.
-
#move_up ⇒ Boolean
Move the cursor up.
Constructor Details
#initialize(cursor) ⇒ CursorHandler
Create a cusor handler
7 8 9 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 7 def initialize(cursor) @cursor = cursor end |
Instance Method Details
#index ⇒ Integer
Get the index of the cursor
22 23 24 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 22 def index @cursor.index end |
#mode ⇒ Symbol
Get the cursor mode
13 14 15 16 17 18 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 13 def mode return :box if @cursor.inbox return :box_choice if @cursor.select_box return :party end |
#move_down ⇒ Boolean
Move the cursor down
60 61 62 63 64 65 66 67 68 69 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 60 def move_down @cursor.visible = true if @cursor.select_box @cursor.inbox = true @cursor.index = @cursor.index else @cursor.index += @cursor.inbox ? 6 : 2 end return true end |
#move_left ⇒ Boolean
Move the cursor to the left
37 38 39 40 41 42 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 37 def move_left @cursor.visible = true return false if @cursor.select_box return @cursor.inbox ? move_left_inbox : move_left_party end |
#move_right ⇒ Boolean
Move the cursor to the right
28 29 30 31 32 33 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 28 def move_right @cursor.visible = true return false if @cursor.select_box return @cursor.inbox ? move_right_inbox : move_right_party end |
#move_up ⇒ Boolean
Move the cursor up
46 47 48 49 50 51 52 53 54 55 56 |
# File 'scripts/01450 Systems/00200 Storage/00002 UI_Storage/00011 CursorHandler.rb', line 46 def move_up @cursor.visible = true return false if @cursor.select_box if @cursor.inbox && @cursor.index <= 5 @cursor.select_box = true else @cursor.index -= @cursor.inbox ? 6 : 2 end return true end |