Class: Window_Command

Inherits:
Window_Selectable show all
Defined in:
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)

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

- (Window_Command) initialize(x, y)


  • Object Initialization




11
12
13
14
15
16
17
18
# File '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

- (Object) add_command(name, symbol, enabled = true, ext = nil)


  • Add Command

    name    : Command name
    symbol  : Corresponding symbol
    enabled : Activation state flag
    ext     : Arbitrary extended data



61
62
63
# File '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

- (Object) alignment


  • Get Alignment




122
123
124
# File 'Window_Command.rb', line 122

def alignment
  return 0
end

- (Object) call_ok_handler


  • Call OK Handler




134
135
136
137
138
139
140
141
142
# File '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

- (Object) clear_command_list


  • Clear Command List




46
47
48
# File 'Window_Command.rb', line 46

def clear_command_list
  @list = []
end

- (Boolean) command_enabled?(index)


  • Get Activation State of Command


Returns:

  • (Boolean)


73
74
75
# File 'Window_Command.rb', line 73

def command_enabled?(index)
  @list[index][:enabled]
end

- (Object) command_name(index)


  • Get Command Name




67
68
69
# File 'Window_Command.rb', line 67

def command_name(index)
  @list[index][:name]
end

- (Object) current_data


  • Get Command Data of Selection Item




79
80
81
# File 'Window_Command.rb', line 79

def current_data
  index >= 0 ? @list[index] : nil
end

- (Object) current_ext


  • Get Extended Data of Selected Item




97
98
99
# File 'Window_Command.rb', line 97

def current_ext
  current_data ? current_data[:ext] : nil
end

- (Boolean) current_item_enabled?


  • Get Activation State of Selection Item


Returns:

  • (Boolean)


85
86
87
# File 'Window_Command.rb', line 85

def current_item_enabled?
  current_data ? current_data[:enabled] : false
end

- (Object) current_symbol


  • Get Symbol of Selection Item




91
92
93
# File 'Window_Command.rb', line 91

def current_symbol
  current_data ? current_data[:symbol] : nil
end

- (Object) draw_item(index)


  • Draw Item




115
116
117
118
# File '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

- (Object) item_max


  • Get Number of Items




40
41
42
# File 'Window_Command.rb', line 40

def item_max
  @list.size
end

- (Object) make_command_list


  • Create Command List




52
53
# File 'Window_Command.rb', line 52

def make_command_list
end

- (Boolean) ok_enabled?


  • Get Activation State of OK Processing


Returns:

  • (Boolean)


128
129
130
# File 'Window_Command.rb', line 128

def ok_enabled?
  return true
end

- (Object) refresh


  • Refresh




146
147
148
149
150
151
# File 'Window_Command.rb', line 146

def refresh
  clear_command_list
  make_command_list
  create_contents
  super
end

- (Object) select_ext(ext)


  • Move Cursor to Command with Specified Extended Data




109
110
111
# File 'Window_Command.rb', line 109

def select_ext(ext)
  @list.each_index {|i| select(i) if @list[i][:ext] == ext }
end

- (Object) select_symbol(symbol)


  • Move Cursor to Command with Specified Symbol




103
104
105
# File 'Window_Command.rb', line 103

def select_symbol(symbol)
  @list.each_index {|i| select(i) if @list[i][:symbol] == symbol }
end

- (Object) visible_line_number


  • Get Number of Lines to Show




34
35
36
# File 'Window_Command.rb', line 34

def visible_line_number
  item_max
end

- (Object) window_height


  • Get Window Height




28
29
30
# File 'Window_Command.rb', line 28

def window_height
  fitting_height(visible_line_number)
end

- (Object) window_width


  • Get Window Width




22
23
24
# File 'Window_Command.rb', line 22

def window_width
  return 160
end