Class: Window_SkillList

Inherits:
Window_Selectable show all
Defined in:
lib/rgss3_default_scripts/Window_SkillList.rb

Overview

** Window_SkillList


This window is for displaying a list of available skills on the skill window.

Direct Known Subclasses

Window_BattleSkill

Instance Attribute Summary

Attributes inherited from Window_Selectable

#cursor_all, #cursor_fix, #help_window, #index

Instance Method Summary collapse

Methods inherited from Window_Selectable

#active=, #bottom_row, #bottom_row=, #call_cancel_handler, #call_handler, #call_ok_handler, #call_update_help, #cancel_enabled?, #clear_item, #contents_height, #cursor_down, #cursor_left, #cursor_movable?, #cursor_pagedown, #cursor_pageup, #cursor_right, #cursor_up, #draw_all_items, #ensure_cursor_visible, #handle?, #height=, #horizontal?, #item_height, #item_rect, #item_rect_for_text, #item_width, #ok_enabled?, #page_item_max, #page_row_max, #process_cancel, #process_cursor_move, #process_handling, #process_ok, #process_pagedown, #process_pageup, #redraw_current_item, #redraw_item, #row, #row_max, #select, #set_handler, #spacing, #top_row, #top_row=, #unselect, #update, #update_cursor, #update_padding, #update_padding_bottom

Methods inherited from Window_Base

#activate, #actor_name, #calc_line_height, #change_color, #close, #contents_height, #contents_width, #convert_escape_characters, #create_contents, #crisis_color, #deactivate, #dispose, #draw_actor_class, #draw_actor_face, #draw_actor_graphic, #draw_actor_hp, #draw_actor_icons, #draw_actor_level, #draw_actor_mp, #draw_actor_name, #draw_actor_nickname, #draw_actor_param, #draw_actor_simple_status, #draw_actor_tp, #draw_character, #draw_currency_value, #draw_current_and_max_values, #draw_face, #draw_gauge, #draw_icon, #draw_item_name, #draw_text, #draw_text_ex, #fitting_height, #gauge_back_color, #hide, #hp_color, #hp_gauge_color1, #hp_gauge_color2, #knockout_color, #line_height, #make_font_bigger, #make_font_smaller, #mp_color, #mp_cost_color, #mp_gauge_color1, #mp_gauge_color2, #normal_color, #obtain_escape_code, #obtain_escape_param, #open, #param_change_color, #party_member_name, #pending_color, #power_down_color, #power_up_color, #process_character, #process_draw_icon, #process_escape_character, #process_new_line, #process_new_page, #process_normal_character, #reset_font_settings, #show, #standard_padding, #system_color, #text_color, #text_size, #tp_color, #tp_cost_color, #tp_gauge_color1, #tp_gauge_color2, #translucent_alpha, #update, #update_close, #update_open, #update_padding, #update_tone

Constructor Details

#initialize(x, y, width, height) ⇒ Window_SkillList


  • Object Initialization




11
12
13
14
15
16
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 11

def initialize(x, y, width, height)
  super
  @actor = nil
  @stype_id = 0
  @data = []
end

Instance Method Details

#actor=(actor) ⇒ Object


  • Set Actor




20
21
22
23
24
25
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 20

def actor=(actor)
  return if @actor == actor
  @actor = actor
  refresh
  self.oy = 0
end

#col_maxObject


  • Get Digit Count




38
39
40
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 38

def col_max
  return 2
end

#current_item_enabled?Boolean


  • Get Activation State of Selection Item


Returns:

  • (Boolean)


56
57
58
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 56

def current_item_enabled?
  enable?(@data[index])
end

#draw_item(index) ⇒ Object


  • Draw Item




86
87
88
89
90
91
92
93
94
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 86

def draw_item(index)
  skill = @data[index]
  if skill
    rect = item_rect(index)
    rect.width -= 4
    draw_item_name(skill, rect.x, rect.y, enable?(skill))
    draw_skill_cost(rect, skill)
  end
end

#draw_skill_cost(rect, skill) ⇒ Object


  • Draw Skill Use Cost




98
99
100
101
102
103
104
105
106
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 98

def draw_skill_cost(rect, skill)
  if @actor.skill_tp_cost(skill) > 0
    change_color(tp_cost_color, enable?(skill))
    draw_text(rect, @actor.skill_tp_cost(skill), 2)
  elsif @actor.skill_mp_cost(skill) > 0
    change_color(mp_cost_color, enable?(skill))
    draw_text(rect, @actor.skill_mp_cost(skill), 2)
  end
end

#enable?(item) ⇒ Boolean


  • Display Skill in Active State?


Returns:

  • (Boolean)


68
69
70
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 68

def enable?(item)
  @actor && @actor.usable?(item)
end

#include?(item) ⇒ Boolean


  • Include in Skill List?


Returns:

  • (Boolean)


62
63
64
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 62

def include?(item)
  item && item.stype_id == @stype_id
end

#itemObject


  • Get Skill




50
51
52
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 50

def item
  @data && index >= 0 ? @data[index] : nil
end

#item_maxObject


  • Get Number of Items




44
45
46
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 44

def item_max
  @data ? @data.size : 1
end

#make_item_listObject


  • Create Skill List




74
75
76
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 74

def make_item_list
  @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
end

#refreshObject


  • Refresh




116
117
118
119
120
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 116

def refresh
  make_item_list
  create_contents
  draw_all_items
end

#select_lastObject


  • Restore Previous Selection Position




80
81
82
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 80

def select_last
  select(@data.index(@actor.last_skill.object) || 0)
end

#stype_id=(stype_id) ⇒ Object


  • Set Skill Type ID




29
30
31
32
33
34
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 29

def stype_id=(stype_id)
  return if @stype_id == stype_id
  @stype_id = stype_id
  refresh
  self.oy = 0
end

#update_helpObject


  • Update Help Text




110
111
112
# File 'lib/rgss3_default_scripts/Window_SkillList.rb', line 110

def update_help
  @help_window.set_item(item)
end