Class: UI::PSDKMenuButton
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::PSDKMenuButton
- Defined in:
- scripts/01450 Systems/00100 Menu/00002 UI/00300 MenuButton.rb
Overview
Button that is shown in the main menu
Constant Summary collapse
- BASIC_COORDINATE =
Basic coordinate of the button on screen
[192, 16]
- OFFSET_COORDINATE =
Offset between each button
[0, 24]
- SELECT_POSITION_OFFSET =
Offset between selected position and unselected position
[-6, 0]
- TEXT_MESSAGES =
List of text message to send in order to get the right text
[ [:text_get, 14, 1], # Dex [:text_get, 14, 0], # PARTY [:text_get, 14, 2], # BAG [:text_get, 14, 3], # TCARD [:text_get, 14, 5], # Options [:text_get, 14, 4], # Save [:ext_text, 9000, 26], # Quit [:text_get, 14, 2] # BAG (girl) ]
- ANGLE_VARIATION =
Angle variation of the icon in one direction
15
Constants inherited from SpriteStack
Instance Attribute Summary collapse
-
#selected ⇒ Boolean
Selected.
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#initialize(viewport, real_index, positional_index) ⇒ PSDKMenuButton
constructor
Create a new PSDKMenuButton.
-
#update
Update the button animation.
Methods inherited from SpriteStack
#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport, real_index, positional_index) ⇒ PSDKMenuButton
Create a new PSDKMenuButton
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'scripts/01450 Systems/00100 Menu/00002 UI/00300 MenuButton.rb', line 30 def initialize(, real_index, positional_index) x = BASIC_COORDINATE.first + positional_index * OFFSET_COORDINATE.first y = BASIC_COORDINATE.last + positional_index * OFFSET_COORDINATE.last super(, x, y) @real_index = real_index @real_index = 7 if real_index == 2 && $trainer. @selected = false add_background('menu_button') # @type [SpriteSheet] @icon = add_sprite(12, 0, 'menu_icons', 2, 8, type: SpriteSheet) @icon.select(0, @real_index) @icon.set_origin(@icon.width / 2, @icon.height / 2) @icon.set_position(@icon.x + @icon.ox, @icon.y + @icon.oy) add_text(40, 0, 0, 23, send(*TEXT_MESSAGES[@real_index]).sub(PFM::Text::TRNAME[0], $trainer.name)) end |
Instance Attribute Details
#selected ⇒ Boolean
Returns selected.
25 26 27 |
# File 'scripts/01450 Systems/00100 Menu/00002 UI/00300 MenuButton.rb', line 25 def selected @selected end |
Instance Method Details
#update
Update the button animation
47 48 49 50 51 52 53 54 55 56 57 |
# File 'scripts/01450 Systems/00100 Menu/00002 UI/00300 MenuButton.rb', line 47 def update return unless @selected if @counter < (2 * ANGLE_VARIATION) @icon.angle -= 1 elsif @counter < (4 * ANGLE_VARIATION) @icon.angle += 1 else return @counter = 0 end @counter += 1 end |