Class: UI::Summary_Memo
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::Summary_Memo
- Defined in:
- scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb
Overview
UI part displaying the “Memo” of the Pokemon in the Summary
Direct Known Subclasses
Constant Summary
Constants inherited from SpriteStack
UI::SpriteStack::NO_INITIAL_IMAGE
Instance Attribute Summary
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#data=(pokemon)
Define the pokemon shown by this UI.
-
#init_memo
Initialize the Memo part.
-
#initialize(viewport) ⇒ Summary_Memo
constructor
Create a new Memo UI for the summary.
-
#load_egg_text_info(pokemon)
Load the text info when it's an egg.
-
#load_text_info(pokemon)
Load the text info.
-
#no_egg(object)
Set an object inivisible if the Pokemon is an egg.
-
#visible=(value)
Change the visibility of the ui.
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, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport) ⇒ Summary_Memo
Create a new Memo UI for the summary
6 7 8 9 10 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 6 def initialize() super(, 0, 0, default_cache: :interface) @invisible_if_egg = [] init_sprite end |
Instance Method Details
#data=(pokemon)
Define the pokemon shown by this UI
21 22 23 24 25 26 27 28 29 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 21 def data=(pokemon) if (self.visible = !pokemon.nil?) super @invisible_if_egg.each { |sprite| sprite.visible = false } if pokemon.egg? @level_text.x = @level_value.x + @level_value.width - @level_value.real_width - @level_text.real_width - 2 load_text_info(pokemon) end end |
#init_memo
Initialize the Memo part
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 39 def init_memo texts = text_file_get(27) with_surface(114, 19, 95) do # --- Static part --- add_line(0, texts[2]) # Nom no_egg add_line(1, texts[0]) # NoPokedex @level_text = no_egg(add_line(1, texts[29], dx: 1)) # Level no_egg add_line(2, texts[3]) # Type no_egg add_line(3, texts[8]) # DO no_egg add_line(3, texts[9], dx: 1) # Numero id no_egg add_line(4, texts[10]) # Pt exp no_egg add_line(5, texts[12]) # Next lvl no_egg add_line(6, text_get(23, 7)) # Objet # --- Data part --- with_font(20) { no_egg add_text(11, 125, 56, nil, 'EXP') } add_line(0, :name, 2, type: SymText, color: 1, dx: 1) @id = no_egg add_line(1, :id_text, 2, type: SymText, color: 1) @level_value = no_egg(add_line(1, :level_text, 2, type: SymText, color: 1, dx: 1)) no_egg add_line(3, :trainer_id_text, 2, type: SymText, color: 1, dx: 1) no_egg add_line(4, :exp_text, 2, type: SymText, color: 1, dx: 1) no_egg add_line(5, :exp_remaining_text, 2, type: SymText, color: 1, dx: 1) no_egg add_line(6, :item_name, 2, type: SymText, color: 1, dx: 1) end no_egg add_text(114, 19 + 16 * 3, 92, 16, :trainer_name, 2, type: SymText, color: 1) no_egg push(241, 19 + 34, nil, type: Type1Sprite) no_egg push(275, 19 + 34, nil, type: Type2Sprite) end |
#load_egg_text_info(pokemon)
Load the text info when it's an egg
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 96 def load_egg_text_info(pokemon) time_egg = pokemon.egg_at ? Time.at(pokemon.egg_at) : Time.new hash = { '[VAR NUM2(0007)]' => time_egg.strftime('%d'), '[VAR NUM2(0006)]' => time_egg.strftime('%m'), '[VAR NUM2(0005)]' => time_egg.strftime('%y'), '[VAR LOCATION(0008)]' => pokemon.egg_zone_name, '[VAR 0105(0008)]' => pokemon.egg_zone_name, '[VAR NUM3(0003)]' => pokemon.captured_level.to_s, '[VAR LOCATION(0004)]' => pokemon.captured_zone_name, '[VAR 0105(0004)]' => pokemon.captured_zone_name } if pokemon.step_remaining > 10_240 text = parse_text(28, 89, hash).gsub(/([0-9.]) ([a-z]+ *)\:/i) { "#{$1} \n#{$2}:" } elsif pokemon.step_remaining > 2_560 text = parse_text(28, 88, hash).gsub(/([0-9.]) ([a-z]+ *)\:/i) { "#{$1} \n#{$2}:" } elsif pokemon.step_remaining > 1_280 text = parse_text(28, 87, hash).gsub(/([0-9.]) ([a-z]+ *)\:/i) { "#{$1} \n#{$2}:" } else text = parse_text(28, 86, hash).gsub(/([0-9.]) ([a-z]+ *)\:/i) { "#{$1} \n#{$2}:" } end text.gsub!('Level', "\nLevel") if $options.language == 'en' @text_info.multiline_text = text # .gsub(/([^.]\.|\?|\!) /) { "#{$1} \n" } end |
#load_text_info(pokemon)
Load the text info
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 69 def load_text_info(pokemon) return load_egg_text_info(pokemon) if pokemon.egg? time = Time.at(pokemon.captured_at) time_egg = pokemon.egg_at ? Time.at(pokemon.egg_at) : time hash = { '[VAR NUM2(0007)]' => time_egg.strftime('%d'), '[VAR NUM2(0006)]' => time_egg.strftime('%m'), '[VAR NUM2(0005)]' => time_egg.strftime('%y'), '[VAR LOCATION(0008)]' => pokemon.egg_zone_name, '[VAR 0105(0008)]' => pokemon.egg_zone_name, '[VAR NUM3(0003)]' => pokemon.captured_level.to_s, '[VAR NUM2(0002)]' => time.strftime('%d'), '[VAR NUM2(0001)]' => time.strftime('%m'), '[VAR NUM2(0000)]' => time.strftime('%y'), '[VAR LOCATION(0004)]' => pokemon.captured_zone_name, '[VAR 0105(0004)]' => pokemon.captured_zone_name } mem = pokemon.memo_text || [] text = parse_text(mem[0] || 28, mem[1] || 25, hash).gsub(/([0-9.]) ([a-z]+ *)\:/i, "\\1 \n\\2:") text.gsub!('Level', "\nLevel") if $options.language == 'en' @text_info.multiline_text = text @id.load_color(pokemon.shiny ? 2 : 1) end |
#no_egg(object)
Set an object inivisible if the Pokemon is an egg
14 15 16 17 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 14 def no_egg(object) @invisible_if_egg << object return object end |
#visible=(value)
Change the visibility of the ui
33 34 35 36 |
# File 'scripts/01450 Systems/00102 Party/00002 UI/00200 Summary_Memo.rb', line 33 def visible=(value) super @invisible_if_egg.each { |sprite| sprite.visible = false } if @data&.egg? end |