Class: UI::DexWinInfo

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb

Overview

Dex sprite that show the Pokemon infos

Constant Summary collapse

VISIBLE_SPRITES =

Change the data Array of visible sprites if the Pokemon was captured

1..7

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

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

Create a new dex win sprite



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb', line 55

def initialize(viewport)
  # Create the sprite stack at coordinate 131, 37 using the RPG::Cache.pokedex as image source
  super(viewport, 131, 37, default_cache: :pokedex)

  # Show the background of the WinInfos
  add_background('WinInfos')
  # Show the "caught" indicator
  add_sprite(8, 4, 'Catch')
  # Show the Pokedex Name of the Pokemon
  add_text(29, 4, 116, 16, :pokedex_name, type: SymText, color: 10)
  # Show the Specie of the Pokemon
  add_text(9, 27, 116, 16, :pokedex_species, type: SymText)
  # Show the weight (formated) of the Pokemon
  add_text(9, 67, 116, 16, :pokedex_weight, type: SymText)
  # Show the height (formated) of the Pokemon
  add_text(9, 87, 116, 16, :pokedex_height, type: SymText)
  # Show the 1st type of the Pokemon
  add_sprite(25, 47, NO_INITIAL_IMAGE, true, type: Type1Sprite)
  # Show the 2nd type of the Pokemon
  add_sprite(112, 47, NO_INITIAL_IMAGE, true, type: Type2Sprite)
end

Instance Method Details

#data=(pokemon)

Define the Pokemon shown by the UI

Parameters:



79
80
81
82
83
84
85
86
# File 'scripts/01450 Systems/00101 Dex/00002 UI/01400 Dex UIs.rb', line 79

def data=(pokemon)
  super(pokemon)
  # Show / hide the sprites according to the captured state of the Pokemon
  is_captured = pokemon && $pokedex.creature_caught?(pokemon.id)
  VISIBLE_SPRITES.each do |i|
    @stack[i].visible = is_captured
  end
end