Class: UI::Bag::InfoCompact

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00103 Bag/00002 UI/00080 InfoCompact.rb

Overview

Class that shows the minimal item info

Constant Summary collapse

COORDINATES =

Coordinate of the UI

9, 145

Constants inherited from SpriteStack

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, mode) ⇒ InfoCompact

Create a new InfoCompact

Parameters:

  • viewport (Viewport)
  • mode (Symbol)

    mode of the bag scene



13
14
15
16
17
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00080 InfoCompact.rb', line 13

def initialize(viewport, mode)
  super(viewport, *COORDINATES)
  @mode = mode
  init_sprite
end

Instance Attribute Details

#modeSymbol (readonly)

Mode of the bag

Returns:

  • (Symbol)


7
8
9
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00080 InfoCompact.rb', line 7

def mode
  @mode
end

Instance Method Details

#show_item(id)

Change the item it shows

Parameters:

  • id (Integer)

    ID of the item to show



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'scripts/01450 Systems/00103 Bag/00002 UI/00080 InfoCompact.rb', line 21

def show_item(id)
  unless (self.visible = !id.nil?)
    @icon.data = 0
    @icon.visible = true
    return @stack.first.visible = true
  end
  item = data_item(id)
  @icon.data = id
  @quantity.text = (id == 0 ? 0 : $bag.item_quantity(id)).to_s.to_pokemon_number
  @num_x.visible = @quantity.visible = item.is_limited
  @name.text = item.exact_name
  @price_text&.text = parse_text(11, 9, /\[VAR NUM7[^\]]*\]/ => (item.price / 2).to_s)
end