Class: UI::Shop::ItemDesc

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

Constant Summary

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) ⇒ ItemDesc

Initialize the item description window graphisms and texts

Parameters:

  • viewport (Viewport)

    the viewport in which the SpriteStack will be displayed



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

def initialize(viewport)
  super(viewport, 7, 144)
  @item_desc_window = add_background('shop/item_desc_window')
  @item_desc_name = add_text(22, 8, 150, 9, nil.to_s)
  @item_desc_name.draw_shadow = false
  @item_desc_text = add_text(10, 22, 286, 16, nil.to_s)
  @item_desc_text.draw_shadow = false
  @item_in_stock = add_text(23, 73, 145, 13, nil.to_s, color: 10)
  @item_in_stock.draw_shadow = false
  @img_item_in_bag = add_sprite(256, 76, 'shop/img_item_in_bag')
  @nb_item_bag = add_text(276, 76, 23, 8, nil.to_s, color: 10)
  @nb_item_bag.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



23
24
25
# File 'scripts/01450 Systems/00203 Shop/00002 ItemShop UI/00050 ItemDescWindow.rb', line 23

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

#nb_in_stock=(nb)

Update the number of the item in stock

Parameters:

  • nb (Integer)

    the number of the currently shown item in stock



41
42
43
# File 'scripts/01450 Systems/00203 Shop/00002 ItemShop UI/00050 ItemDescWindow.rb', line 41

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

#nb_item=(nb)

Update the number of currently possessed same item

Parameters:

  • nb (Integer)

    the number of the currrently shown item in the player bag



35
36
37
# File 'scripts/01450 Systems/00203 Shop/00002 ItemShop UI/00050 ItemDescWindow.rb', line 35

def nb_item=(nb)
  @nb_item_bag.text = nb.to_s
end

#text=(text)

Update the description text for the item

Parameters:

  • text (String)

    the string of the item's description



29
30
31
# File 'scripts/01450 Systems/00203 Shop/00002 ItemShop UI/00050 ItemDescWindow.rb', line 29

def text=(text)
  @item_desc_text.multiline_text = text
end