Class: UI::Bag::ButtonList
- Defined in:
- scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb
Overview
List of button showing the item name
Defined Under Namespace
Classes: ItemButton
Constant Summary collapse
- AMOUNT =
Number of button in the list
9
- BUTTON_OFFSET =
Offset between each button
25
- ACTIVE_OFFSET =
Offset between active button & inative button
-8 # Base X coordinate
- BASE_X =
Base X coordinate
191
- BASE_Y =
Base Y coordinate
18
Instance Attribute Summary collapse
-
#index ⇒ Integer
Index of the current active item.
Instance Method Summary collapse
-
#done? ⇒ Boolean
Test if the animation is done.
-
#initialize(viewport) ⇒ ButtonList
constructor
Create a new ButtonList.
-
#item_list=(list)
Set the item list.
-
#mouse_delta_index ⇒ Integer
Return the delta index with mouse position.
-
#move_down
Move all the button down.
-
#move_up
Move all the button up.
-
#update
Update the animation.
Constructor Details
#initialize(viewport) ⇒ ButtonList
Create a new ButtonList
18 19 20 21 22 23 24 25 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 18 def initialize() super(AMOUNT) do |i| ItemButton.new(, i) end @item_list = [] @name_list = [] @index = 0 end |
Instance Attribute Details
#index ⇒ Integer
Returns index of the current active item.
16 17 18 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 16 def index @index end |
Instance Method Details
#done? ⇒ Boolean
Test if the animation is done
37 38 39 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 37 def done? @animation.nil? end |
#item_list=(list)
Set the item list
62 63 64 65 66 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 62 def item_list=(list) @item_list = list @name_list = @item_list.collect { |id| data_item(id).exact_name } @name_list << text_get(22, 7) end |
#mouse_delta_index ⇒ Integer
Return the delta index with mouse position
70 71 72 73 74 75 76 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 70 def mouse_delta_index mouse_index = find_index(&:simple_mouse_in?) return 0 unless mouse_index active_index = find_index(&:active?) || 0 return mouse_index - active_index end |
#move_down
Move all the button down
55 56 57 58 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 55 def move_down @animation = :move_down_animation @counter = 0 end |
#move_up
Move all the button up
49 50 51 52 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 49 def move_up @animation = :move_up_animation @counter = 0 end |
#update
Update the animation
28 29 30 31 32 33 |
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00060 ButtonList.rb', line 28 def update return unless @animation send(@animation) @counter += 1 end |