Class: UI::ShortcutElement

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00207 Shortcut/00002 UI/00500 Shortcut.rb

Overview

UI component that shows a shortcut item

Constant Summary collapse

OFFSET_Y =

Offset Y to prevent UI element to overlap with BaseUI

28

Constants inherited from SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

Attributes inherited from SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

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, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, index, item_id, key) ⇒ ShortcutElement

Create a new Item sell button

Parameters:

  • viewport (Viewport)

    the viewport in which the SpriteStack will be displayed

  • index (Integer)

    index used to align the element in the UI

  • item_id (Integer, Symbol)

    ID of the item to show

  • key (Symbol)

    the key the player has to press



14
15
16
17
18
19
20
21
22
23
24
25
# File 'scripts/01450 Systems/00207 Shortcut/00002 UI/00500 Shortcut.rb', line 14

def initialize(viewport, index, item_id, key)
  super(viewport)
  @index = index
  @data = item_id
  @key = key
  create_background
  adjust_position(self[0])
  create_item_name
  create_quantity
  create_key
  create_icon
end

Instance Attribute Details

#indexInteger

Returns Index of the button in the list.

Returns:

  • (Integer)

    Index of the button in the list



7
8
9
# File 'scripts/01450 Systems/00207 Shortcut/00002 UI/00500 Shortcut.rb', line 7

def index
  @index
end