#============================================================================== # ¡à Etude87_Variables_Ace #============================================================================== # ÀÛ¼ºÀÚ : ½ÀÀÛ(etude87@gmail.com) #============================================================================== # # ±âº»±â´ÉÀ¸·Î ÁÖ¾îÁö´Â 5000°³ÀÇ º¯¼ö ¿ÜÀÇ Ãß°¡ º¯¼ö¸¦ »ç¿ëÇÏ´Â ½ºÅ©¸³Æ® ÀÔ´Ï´Ù. # °ÔÀÓ ³»¿¡¼­ F9Å°¸¦ »ç¿ëÇÏ¿©, µð¹ö±× ¸ðµå·Î Á¶Àý °¡´ÉÇÕ´Ï´Ù. # $game_etude87_variables[n] ÀÇ ÇüÅ·Π»ç¿ëÇÏ½Ã¸é µË´Ï´Ù. # #============================================================================== module Etude87_Variables_Ace # etude87 º¯¼öÀÇ ÃÖ´ë¼ö Etude87_Var_Max = 100 # etude87 º¯¼öÀÇ À̸§ ¼³Á¤(µð¹ö±× â) Etude87_Var_Name = { 1 => "1¹ø º¯¼ö ÀÔ´Ï´Ù. »ÑÀ×»ÑÀ×", # º¯¼ö ID => º¯¼ö À̸§ 2 => "2¹ø º¯¼ö ÀÔ´Ï´Ù. ¤¾¤¾¤¾", # º¯¼ö ID => º¯¼ö À̸§ 3 => "3¹ø°´Â Á¢´Ï´Ù.", # º¯¼ö ID => º¯¼ö À̸§ } # <= Áö¿ìÁö ¸¶¼¼¿ä end #============================================================================== #============================================================================== class << DataManager #-------------------------------------------------------------------------- alias :etude87_create_game_objects :create_game_objects def create_game_objects etude87_create_game_objects $game_etude87_variables = Game_Etude87_Variables.new end #-------------------------------------------------------------------------- alias :etude87_make_save_contents :make_save_contents def make_save_contents contents = etude87_make_save_contents contents[:etude87_variables] = $game_etude87_variables contents end #-------------------------------------------------------------------------- alias :etude87_extract_save_contents :extract_save_contents def extract_save_contents(contents) etude87_extract_save_contents(contents) $game_etude87_variables = contents[:etude87_variables] end end #============================================================================== #============================================================================== class Game_Etude87_Variables #-------------------------------------------------------------------------- def initialize @data = [] end #-------------------------------------------------------------------------- def [](variable_id) @data[variable_id] || 0 end #-------------------------------------------------------------------------- def []=(variable_id, value) @data[variable_id] = value on_change end #-------------------------------------------------------------------------- def on_change $game_map.need_refresh = true end end #============================================================================== #============================================================================== class Window_DebugLeft < Window_Selectable #-------------------------------------------------------------------------- def mode index < @switch_max ? :switch : index < @switch_max + @variable_max ? :variable : :etude87_variable end #-------------------------------------------------------------------------- def top_id (index - (index < @switch_max ? 0 : index < @switch_max + @variable_max ? @switch_max : @switch_max + @variable_max )) * 10 + 1 end #-------------------------------------------------------------------------- def refresh @switch_max = ($data_system.switches.size - 1 + 9) / 10 @variable_max = ($data_system.variables.size - 1 + 9) / 10 @etude87_variable_max = (Etude87_Variables_Ace::Etude87_Var_Max - 1 + 9) / 10 @item_max = @switch_max + @variable_max + @etude87_variable_max create_contents draw_all_items end #-------------------------------------------------------------------------- def draw_item(index) if index < @switch_max n = index * 10 text = sprintf("S [%04d-%04d]", n+1, n+10) elsif index < @switch_max + @variable_max n = (index - @switch_max) * 10 text = sprintf("V [%04d-%04d]", n+1, n+10) else n = (index - @switch_max - @variable_max) * 10 text = sprintf("E [%04d-%04d]", n+1, n+10) end draw_text(item_rect_for_text(index), text) end end #============================================================================== #============================================================================== class Window_DebugRight < Window_Selectable #-------------------------------------------------------------------------- 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]" elsif @mode == :variable name = $data_system.variables[data_id] status = $game_variables[data_id] else name = Etude87_Variables_Ace::Etude87_Var_Name[data_id] if Etude87_Variables_Ace::Etude87_Var_Name.include?(data_id) status = $game_etude87_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 #-------------------------------------------------------------------------- def update super update_switch_mode if active && mode == :switch update_variable_mode if active && mode == :variable update_etude87_variable_mode if active && mode == :etude87_variable end #-------------------------------------------------------------------------- def update_etude87_variable_mode return unless $game_etude87_variables[current_id].is_a?(Numeric) value = $game_etude87_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_etude87_variables[current_id] != value $game_etude87_variables[current_id] = value Sound.play_cursor redraw_current_item end end end