Class: Window_Command
- Inherits:
-
Window_Selectable
- Object
- Window
- Window_Base
- Window_Selectable
- Window_Command
- Defined in:
- lib/rgss3_default_scripts/Window_Command.rb
Overview
** Window_Command
This window deals with general command choices.
Direct Known Subclasses
Window_ActorCommand, Window_ChoiceList, Window_GameEnd, Window_HorzCommand, Window_MenuCommand, Window_PartyCommand, Window_SkillCommand, Window_TitleCommand
Instance Attribute Summary
Attributes inherited from Window_Selectable
#cursor_all, #cursor_fix, #help_window, #index
Instance Method Summary collapse
-
#add_command(name, symbol, enabled = true, ext = nil) ⇒ Object
————————————————————————– * Add Command name : Command name symbol : Corresponding symbol enabled : Activation state flag ext : Arbitrary extended data ————————————————————————–.
-
#alignment ⇒ Object
————————————————————————– * Get Alignment ————————————————————————–.
-
#call_ok_handler ⇒ Object
————————————————————————– * Call OK Handler ————————————————————————–.
-
#clear_command_list ⇒ Object
————————————————————————– * Clear Command List ————————————————————————–.
-
#command_enabled?(index) ⇒ Boolean
————————————————————————– * Get Activation State of Command ————————————————————————–.
-
#command_name(index) ⇒ Object
————————————————————————– * Get Command Name ————————————————————————–.
-
#current_data ⇒ Object
————————————————————————– * Get Command Data of Selection Item ————————————————————————–.
-
#current_ext ⇒ Object
————————————————————————– * Get Extended Data of Selected Item ————————————————————————–.
-
#current_item_enabled? ⇒ Boolean
————————————————————————– * Get Activation State of Selection Item ————————————————————————–.
-
#current_symbol ⇒ Object
————————————————————————– * Get Symbol of Selection Item ————————————————————————–.
-
#draw_item(index) ⇒ Object
————————————————————————– * Draw Item ————————————————————————–.
-
#initialize(x, y) ⇒ Window_Command
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#item_max ⇒ Object
————————————————————————– * Get Number of Items ————————————————————————–.
-
#make_command_list ⇒ Object
————————————————————————– * Create Command List ————————————————————————–.
-
#ok_enabled? ⇒ Boolean
————————————————————————– * Get Activation State of OK Processing ————————————————————————–.
-
#refresh ⇒ Object
————————————————————————– * Refresh ————————————————————————–.
-
#select_ext(ext) ⇒ Object
————————————————————————– * Move Cursor to Command with Specified Extended Data ————————————————————————–.
-
#select_symbol(symbol) ⇒ Object
————————————————————————– * Move Cursor to Command with Specified Symbol ————————————————————————–.
-
#visible_line_number ⇒ Object
————————————————————————– * Get Number of Lines to Show ————————————————————————–.
-
#window_height ⇒ Object
————————————————————————– * Get Window Height ————————————————————————–.
-
#window_width ⇒ Object
————————————————————————– * Get Window Width ————————————————————————–.
Methods inherited from Window_Selectable
#active=, #bottom_row, #bottom_row=, #call_cancel_handler, #call_handler, #call_update_help, #cancel_enabled?, #clear_item, #col_max, #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, #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_help, #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) ⇒ Window_Command
-
Object Initialization
11 12 13 14 15 16 17 18 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 11 def initialize(x, y) clear_command_list make_command_list super(x, y, window_width, window_height) refresh select(0) activate end |
Instance Method Details
#add_command(name, symbol, enabled = true, ext = nil) ⇒ Object
-
Add Command
name : Command name symbol : Corresponding symbol enabled : Activation state flag ext : Arbitrary extended data
61 62 63 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 61 def add_command(name, symbol, enabled = true, ext = nil) @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext}) end |
#alignment ⇒ Object
-
Get Alignment
122 123 124 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 122 def alignment return 0 end |
#call_ok_handler ⇒ Object
-
Call OK Handler
134 135 136 137 138 139 140 141 142 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 134 def call_ok_handler if handle?(current_symbol) call_handler(current_symbol) elsif handle?(:ok) super else activate end end |
#clear_command_list ⇒ Object
-
Clear Command List
46 47 48 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 46 def clear_command_list @list = [] end |
#command_enabled?(index) ⇒ Boolean
-
Get Activation State of Command
73 74 75 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 73 def command_enabled?(index) @list[index][:enabled] end |
#command_name(index) ⇒ Object
-
Get Command Name
67 68 69 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 67 def command_name(index) @list[index][:name] end |
#current_data ⇒ Object
-
Get Command Data of Selection Item
79 80 81 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 79 def current_data index >= 0 ? @list[index] : nil end |
#current_ext ⇒ Object
-
Get Extended Data of Selected Item
97 98 99 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 97 def current_ext current_data ? current_data[:ext] : nil end |
#current_item_enabled? ⇒ Boolean
-
Get Activation State of Selection Item
85 86 87 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 85 def current_item_enabled? current_data ? current_data[:enabled] : false end |
#current_symbol ⇒ Object
-
Get Symbol of Selection Item
91 92 93 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 91 def current_symbol current_data ? current_data[:symbol] : nil end |
#draw_item(index) ⇒ Object
-
Draw Item
115 116 117 118 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 115 def draw_item(index) change_color(normal_color, command_enabled?(index)) draw_text(item_rect_for_text(index), command_name(index), alignment) end |
#item_max ⇒ Object
-
Get Number of Items
40 41 42 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 40 def item_max @list.size end |
#make_command_list ⇒ Object
-
Create Command List
52 53 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 52 def make_command_list end |
#ok_enabled? ⇒ Boolean
-
Get Activation State of OK Processing
128 129 130 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 128 def ok_enabled? return true end |
#refresh ⇒ Object
-
Refresh
146 147 148 149 150 151 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 146 def refresh clear_command_list make_command_list create_contents super end |
#select_ext(ext) ⇒ Object
-
Move Cursor to Command with Specified Extended Data
109 110 111 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 109 def select_ext(ext) @list.each_index {|i| select(i) if @list[i][:ext] == ext } end |
#select_symbol(symbol) ⇒ Object
-
Move Cursor to Command with Specified Symbol
103 104 105 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 103 def select_symbol(symbol) @list.each_index {|i| select(i) if @list[i][:symbol] == symbol } end |
#visible_line_number ⇒ Object
-
Get Number of Lines to Show
34 35 36 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 34 def visible_line_number item_max end |
#window_height ⇒ Object
-
Get Window Height
28 29 30 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 28 def window_height fitting_height(visible_line_number) end |
#window_width ⇒ Object
-
Get Window Width
22 23 24 |
# File 'lib/rgss3_default_scripts/Window_Command.rb', line 22 def window_width return 160 end |