Class: Window_DebugRight
- Inherits:
-
Window_Selectable
- Object
- Window
- Window_Base
- Window_Selectable
- Window_DebugRight
- Defined in:
- lib/rgss3_default_scripts/Window_DebugRight.rb
Overview
** Window_DebugRight
This window displays switches and variables separately on the debug screen.
Instance Attribute Summary collapse
-
#mode ⇒ Object
————————————————————————– * Public Instance Variables ————————————————————————–.
-
#top_id ⇒ Object
ID shown on top.
Attributes inherited from Window_Selectable
#cursor_all, #cursor_fix, #help_window, #index
Instance Method Summary collapse
-
#current_id ⇒ Object
————————————————————————– * Get Currently Selected ID ————————————————————————–.
-
#draw_item(index) ⇒ Object
————————————————————————– * Draw Item ————————————————————————–.
-
#initialize(x, y, width) ⇒ Window_DebugRight
constructor
————————————————————————– * Object Initialization ————————————————————————-.
-
#item_max ⇒ Object
————————————————————————– * Get Number of Items ————————————————————————–.
-
#refresh ⇒ Object
————————————————————————– * Refresh ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#update_switch_mode ⇒ Object
————————————————————————– * Update During Switch Mode ————————————————————————–.
-
#update_variable_mode ⇒ Object
————————————————————————– * Update During Variable Mode ————————————————————————–.
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, #col_max, #contents_height, #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_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_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_close, #update_open, #update_padding, #update_tone
Constructor Details
#initialize(x, y, width) ⇒ Window_DebugRight
-
Object Initialization
16 17 18 19 20 21 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 16 def initialize(x, y, width) super(x, y, width, fitting_height(10)) @mode = :switch @top_id = 1 refresh end |
Instance Attribute Details
#mode ⇒ Object
-
Public Instance Variables
11 12 13 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 11 def mode @mode end |
#top_id ⇒ Object
ID shown on top
12 13 14 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 12 def top_id @top_id end |
Instance Method Details
#current_id ⇒ Object
-
Get Currently Selected ID
82 83 84 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 82 def current_id top_id + index end |
#draw_item(index) ⇒ Object
-
Draw Item
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 38 def draw_item(index) data_id = @top_id + index id_text = sprintf("%04d:", data_id) id_width = text_size(id_text).width if @mode == :switch name = $data_system.switches[data_id] status = $game_switches[data_id] ? "[ON]" : "[OFF]" else name = $data_system.variables[data_id] status = $game_variables[data_id] end name = "" unless name rect = item_rect_for_text(index) change_color(normal_color) draw_text(rect, id_text) rect.x += id_width rect.width -= id_width + 60 draw_text(rect, name) rect.width += 60 draw_text(rect, status, 2) end |
#item_max ⇒ Object
-
Get Number of Items
25 26 27 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 25 def item_max return 10 end |
#refresh ⇒ Object
-
Refresh
31 32 33 34 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 31 def refresh contents.clear draw_all_items end |
#update ⇒ Object
-
Frame Update
88 89 90 91 92 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 88 def update super update_switch_mode if active && mode == :switch update_variable_mode if active && mode == :variable end |
#update_switch_mode ⇒ Object
-
Update During Switch Mode
96 97 98 99 100 101 102 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 96 def update_switch_mode if Input.trigger?(:C) Sound.play_ok $game_switches[current_id] = !$game_switches[current_id] redraw_current_item end end |
#update_variable_mode ⇒ Object
-
Update During Variable Mode
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rgss3_default_scripts/Window_DebugRight.rb', line 106 def update_variable_mode return unless $game_variables[current_id].is_a?(Numeric) value = $game_variables[current_id] value += 1 if Input.repeat?(:RIGHT) value -= 1 if Input.repeat?(:LEFT) value += 10 if Input.repeat?(:R) value -= 10 if Input.repeat?(:L) if $game_variables[current_id] != value $game_variables[current_id] = value Sound.play_cursor redraw_current_item end end |