Class: UI::Shop::PkmDesc

Inherits:
UI::SpriteStack show all
Defined in:
scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb

Constant Summary collapse

WHITE_COLOR =
Color.new(255, 255, 255)

Constants inherited from UI::SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from UI::SpriteStack

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

Instance Method Summary collapse

Methods inherited from UI::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) ⇒ PkmDesc

Initialize the item description window graphisms and texts

Parameters:

  • viewport (Viewport)

    the viewport in which the SpriteStack will be displayed



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb', line 7

def initialize(viewport)
  super(viewport, 7, 184)
  @item_desc_window = add_background('shop/pkm_desc_window')
  @item_desc_name = add_text(20, 9, 150, 9, nil.to_s)
  @item_desc_name.draw_shadow = false
  @item_desc_name.fill_color = WHITE_COLOR
  @item_desc_text = add_text(14, 26, 286, 16, nil.to_s)
  @item_desc_text.draw_shadow = false
  @item_desc_species = add_text(58, 26, 286, 16, nil.to_s)
  @item_desc_species.draw_shadow = false
  @item_in_stock = add_text(205, 27, 145, 13, nil.to_s, color: 10)
  @item_in_stock.draw_shadow = false
  self.z = 4
end

Instance Method Details

#name=(name)

Update the text of the item's name

Parameters:

  • name (String)

    the string of the item's name



24
25
26
# File 'scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb', line 24

def name=(name)
  @item_desc_name.text = name
end

#nb_in_stock=(nb)

Update the number of the Pokémon in stock

Parameters:

  • nb (Integer)

    the number of the currently shown item in stock



42
43
44
# File 'scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb', line 42

def nb_in_stock=(nb)
  @item_in_stock.text = ext_text(9003, 0) + nb.to_s
end

#species=(species)

Update the species text for the Pokemon

Parameters:

  • species (String)

    the string of the Pokemon's species



36
37
38
# File 'scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb', line 36

def species=(species)
  @item_desc_species.text = species
end

#text=(text)

Update the level text for the Pokemon

Parameters:

  • text (String)

    the string of the Pokemon's level



30
31
32
# File 'scripts/01450 Systems/00203 Shop/00002 PokemonShop UI/00020 ItemDescWindow.rb', line 30

def text=(text)
  @item_desc_text.text = parse_text(27, 29) + " #{text}"
end