Class: Window_ChoiceList

Inherits:
Window_Command show all
Defined in:
lib/rgss3_default_scripts/Window_ChoiceList.rb

Overview

** Window_ChoiceList


This window is used for the event command [Show Choices].

Instance Attribute Summary

Attributes inherited from Window_Selectable

#cursor_all, #cursor_fix, #help_window, #index

Instance Method Summary collapse

Methods inherited from Window_Command

#add_command, #alignment, #clear_command_list, #command_enabled?, #command_name, #current_data, #current_ext, #current_item_enabled?, #current_symbol, #item_max, #ok_enabled?, #refresh, #select_ext, #select_symbol, #visible_line_number, #window_height, #window_width

Methods inherited from Window_Selectable

#active=, #bottom_row, #bottom_row=, #call_handler, #call_update_help, #clear_item, #col_max, #current_item_enabled?, #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_max, #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, #refresh, #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_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(message_window) ⇒ Window_ChoiceList


  • Object Initialization




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

def initialize(message_window)
  @message_window = message_window
  super(0, 0)
  self.openness = 0
  deactivate
end

Instance Method Details

#call_cancel_handlerObject


  • Call Cancel Handler




84
85
86
87
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 84

def call_cancel_handler
  $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  close
end

#call_ok_handlerObject


  • Call OK Handler




77
78
79
80
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 77

def call_ok_handler
  $game_message.choice_proc.call(index)
  close
end

#cancel_enabled?Boolean


  • Get Activation State of Cancel Processing


Returns:

  • (Boolean)


71
72
73
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 71

def cancel_enabled?
  $game_message.choice_cancel_type > 0
end

#contents_heightObject


  • Calculate Height of Window Contents




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

def contents_height
  item_max * item_height
end

#draw_item(index) ⇒ Object


  • Draw Item




64
65
66
67
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 64

def draw_item(index)
  rect = item_rect_for_text(index)
  draw_text_ex(rect.x, rect.y, command_name(index))
end

#make_command_listObject


  • Create Command List




56
57
58
59
60
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 56

def make_command_list
  $game_message.choices.each do |choice|
    add_command(choice, :choice)
  end
end

#max_choice_widthObject


  • Get Maximum Width of Choices




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

def max_choice_width
  $game_message.choices.collect {|s| text_size(s).width }.max
end

#startObject


  • Start Input Processing




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

def start
  update_placement
  refresh
  select(0)
  open
  activate
end

#update_placementObject


  • Update Window Position




30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rgss3_default_scripts/Window_ChoiceList.rb', line 30

def update_placement
  self.width = [max_choice_width + 12, 96].max + padding * 2
  self.width = [width, Graphics.width].min
  self.height = fitting_height($game_message.choices.size)
  self.x = Graphics.width - width
  if @message_window.y >= Graphics.height / 2
    self.y = @message_window.y - height
  else
    self.y = @message_window.y + @message_window.height
  end
end