PAC Main Menu 1.1Автор : Pacman
Скрипт изменяет меню в игре, а именно добавляет анимацию при открытии, иконки ко кнопкам, название текущей карты и время проведенное в игре.
Спойлер Оригинальный скрипт:Код:#=============================================================================== # # PAC Main Menu Ace (1.2) # 15/7/2012 # By Pacman # #=============================================================================== # # This is the PAC Main Menu converted to VX Ace. On a basic level, this offers # a configurable setup for your main menu, allowing the user to create, alter # and move the position of menu commands at their pleasure. It can be used # very simply to merely reorder the default commands, or to its' fullest # potential, that is creating commands to put custom scenes into the menu. It # also offers two graphical features: adding an EXP gauge into the menu status # window, and adding icons into the command display. Both are optional and # customizable. # #=============================================================================== # # ~! INSTALLATION !~ # Paste above Main, below Materials. I suggest you paste this high up in your # custom scripts list, for technical reasons considering overwriting methods. # There are details for configuration below. # #=============================================================================== # # ~! DO NOT HESITATE TO ASK FOR HELP !~ # This can get very confusing, and there is so much you can do with this, so if # you would like to know anything, just ask. # #=============================================================================== #-------------------- module PAC; module MM # <- Do not touch. #------------------ # How to set up your menu commands: # Below is the COMMANDS array, which holds all the commands for the menu in # it. Within the array is a set of more arrays. Each array represents one # command. These command arrays can contain 5 elements, which each give a # piece of information to the script that sets up the menu. Note that each # element must be followed by a comma or an error will occur. Make sure that # each array begins with an open square bracket ([) and a close square bracket # (]). #---------- # Element 1 - The Name # The first element of each array is the name that is displayed for that # command on the menu. It must be written in quotation marks ('' or ""). #---------- # Element 2 - The Method # The second element of each array is the name of the method that is executed # when the command is selected. The method must be located in the Scene_Menu # class. If you are planning on using this in tandem with a custom script's # scene, you should try and find the methods necessary to open that scene. # If a scene requires actor selection (Skill, Equip, etc.), put # "command_personal" as the method and set the scene in element 5. #---------- # Element 3 - The Icon # The third element of each array is a number: the index of the icon to be # displayed in the menu window. The index is the number displayed at the # bottom-left of the icon selection window. #---------- # Element 4 - The Disable Method # The fourth element of each array is a condition which, if met, disables # the command associated with it. The method must be located in the Scene_Menu # class, or accessible otherwise. To disable a command with a switch, use: # "$game_switches[x]" which will disable the command when switch with ID x is # on. To do the same with a variable, use: # "$game_variables[x] <=> n" which will disable the command when variable with # ID x is <=> to n. # This element can be ommited, or simply written as nil if you don't want one. # It must be there if you wish to include the fifth element though. #---------- # Element 5 - The Scene Call # The fifth element (teehee) of each array is only required if the second # element is set to 'command_personal'. It is the command to be executed upon # actor selection. This is required for scenes that are specific to actors, # namely Skill, Equip, Status and any custom scenes that are similar. #---------- # If you have any inquiries on how to use these elements in the most effective # way possible, or at all, ask away. #---------- COMMANDS = [ # <- Do not touch #---------- ['Inventory', # Command Name 'command_item', # Command Method 270, # Command Icon 'main_commands_enabled'], # Disable Method #---------- ['Skills', 'command_personal', 112, 'main_commands_enabled', 'SceneManager.call(Scene_Skill)'], # Scene Call. #---------- ['Equipment', 'command_personal', 147, 'main_commands_enabled', 'SceneManager.call(Scene_Equip)'], #---------- ['Status', 'command_personal', 121, 'main_commands_enabled', 'SceneManager.call(Scene_Status)'], #---------- ['Formation', 'command_formation', 12, 'formation_enabled'], #---------- ['Save', 'command_save', 117, 'save_enabled'], #---------- ['Game End', 'command_game_end', 6] #---------- ] # <- Do not touch. #------------------ Exp_Gauge = true # Use the EXP Gauge? Exp_Color1 = "text_color(30)" # Color 1 for EXP gauge. Exp_Color2 = "text_color(31)" # Color 2 for EXP gauge. Exp_a = "EXP" # Text displayed on the EXP Gauge. Icons = true # Use icons in the menu display? ALIGNMENT = 0 # Alignment of menu command text. 0 for left, 1 for center, 2 # for right. Map_Window = true # Use the map window in the menu display? Time_Window = true # Use the time window in the menu display? Time_Height = 1 # Height of the time window. Gold_Window = true # Use the gold window in the menu display Gold_Correction = true # Correct the gold window's y value to fit in? Windows_Pos = :left # Command, gold, map and time window orientation. :left # or :right. Anything else will go to :left. Heal_Button = :F5 # Button to fully heal the party in the menu. Set to nil if # you don't want that. It will also clear all statuses. Only in test play, of # course. #-------------------- end; end #-------------------- #=============================================================================== # # END OF CONFIGURATION # #============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles system data. It saves the disable state of saving and # menus. Instances of this class are referenced by $game_system. #============================================================================== class Game_System #-------------------------------------------------------------------------- # Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :menu_index, :menu_actor_selection #-------------------------------------------------------------------------- # Alias listing #-------------------------------------------------------------------------- alias pac_mm_gsys_ini initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) pac_mm_gsys_ini(*args) @menu_index = 0 @menu_actor_selection = false end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== if PAC::MM::Exp_Gauge class Window_Base < Window #-------------------------------------------------------------------------- # Alias Listing #-------------------------------------------------------------------------- alias pac_mm_wnbs_simsta draw_actor_simple_status if PAC::MM::Exp_Gauge #-------------------------------------------------------------------------- # * Get Text Colors (writing color without the u is killing me) #-------------------------------------------------------------------------- def exp_gauge_color1; eval PAC::MM::Exp_Color1 rescue text_color(30); end def exp_gauge_color2; eval PAC::MM::Exp_Color2 rescue text_color(31); end #-------------------------------------------------------------------------- # * Draw EXP #-------------------------------------------------------------------------- def draw_actor_exp(actor, x, y, width = 60) draw_gauge(x, y, width, actor.final_exp_rate, exp_gauge_color1, exp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, PAC::MM::Exp_a) draw_current_and_max_values(x, y, width, actor.exp, actor.next_level_exp, normal_color, normal_color) end #-------------------------------------------------------------------------- # * Draw Simple Status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y, *args) pac_mm_wnbs_simsta(actor, x, y, *args) draw_actor_exp(actor, x + 58, y + line_height) end end end #============================================================================== # ** Window_MenuStatus #------------------------------------------------------------------------------ # This window displays the map name on the menu screen. #============================================================================== class Window_MenuMap < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, fitting_height(1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear change_color(normal_color) unless $game_map.display_name.empty? draw_text(contents.rect, $game_map.display_name, 1) end end end #============================================================================== # ** Window_Time #------------------------------------------------------------------------------ # This window displays play time on the menu screen. #============================================================================== class Window_Time < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, fitting_height(PAC::MM::Time_Height || 1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear @time = Graphics.frame_count / Graphics.frame_rate hour = @time / 3600 min = @time / 60 % 60 sec = @time % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) change_color(normal_color) draw_text(contents.rect, text, 1) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super refresh if Graphics.frame_count / Graphics.frame_rate != @time end end #============================================================================== # ** Window_MenuCommand #------------------------------------------------------------------------------ # This command window appears on the menu screen. #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * Initialize Command Selection Position (Class Method) #-------------------------------------------------------------------------- def self.init_command_position(*args) @@last_command_symbol ||= nil end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list(*args) PAC::MM::COMMANDS.each {|c| add_command(c[0], c[0].to_sym, pac_disable(c))} end #-------------------------------------------------------------------------- # * Disable PAC Command #-------------------------------------------------------------------------- def pac_disable(command) command[3] || '' end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index, *args) rect = item_rect_for_text(index) if PAC::MM::Icons && PAC::MM::COMMANDS[index][2] != nil irect = item_rect(index) draw_icon(PAC::MM::COMMANDS[index][2], irect.x, irect.y) rect.x += 24 end change_color(normal_color, command_enabled?(index)) draw_text(rect, command_name(index), PAC::MM::ALIGNMENT) end end #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs the menu screen processing. #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # Alias listing #-------------------------------------------------------------------------- alias pac_mm_start start alias pac_mm_update update alias pac_mm_cgw create_gold_window if PAC::MM::Gold_Correction alias pac_mm_opc on_personal_cancel #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start(*args) pac_mm_start @@start_personal ||= false if @@start_personal; @command_window.deactivate; command_personal; end if PAC::MM::Windows_Pos == :right @gold_window.x = Graphics.width-@gold_window.width if @gold_window != nil @status_window.x = 0 end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) pac_mm_update(*args) update_heal end #-------------------------------------------------------------------------- # * Update Heal Butten #-------------------------------------------------------------------------- def update_heal # BUTTEN if $TEST && PAC::MM::Heal_Button != nil && Input.trigger?(PAC::MM::Heal_Button) Sound.play_recovery $game_party.members do |actor| actor.recover_all end end end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window(*args) @command_window = Window_MenuCommand.new PAC::MM::COMMANDS.each {|c| @command_window.set_handler(c[0].to_sym, pac_method(c)) } @command_window.set_handler(:cancel, method(:return_scene)) if PAC::MM::Windows_Pos == :right @command_window.x = Graphics.width - @command_window.width end create_map_window create_time_window end #-------------------------------------------------------------------------- # * Create Gold Window #-------------------------------------------------------------------------- if PAC::MM::Gold_Correction; def create_gold_window(*args) pac_mm_cgw(*args) @gold_window.visible = false if !PAC::MM::Gold_Window y = @command_window.height y += @map_window.height if @map_window y += @time_window.height if @time_window @gold_window.y = y end; end #-------------------------------------------------------------------------- # * Create Map Window #-------------------------------------------------------------------------- def create_map_window x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0 @map_window = Window_MenuMap.new(x, @command_window.height) @map_window.visible = false if !PAC::MM::Map_Window end #-------------------------------------------------------------------------- # * Create Time Window #-------------------------------------------------------------------------- def create_time_window x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0 y = @map_window.nil? ? @command_window.height : @map_window.height + @map_window.y @time_window = Window_Time.new(x, y) @time_window.visible = fasle if !PAC::MM::Time_Window end #-------------------------------------------------------------------------- # * Get Method for Command #-------------------------------------------------------------------------- def pac_method(command) method(command[1] || '') end #-------------------------------------------------------------------------- # * [OK] Personal Command #-------------------------------------------------------------------------- def on_personal_ok(*args) @@start_personal = true eval(PAC::MM::COMMANDS[@command_window.index][4]) rescue nil end #-------------------------------------------------------------------------- # * [Cancel] Personal Command #-------------------------------------------------------------------------- def on_personal_cancel(*args) pac_mm_opc(*args) @command_window.activate @@start_personal = false end end ($pac ||= {})[:main_menu] = 1.2 #=============================================================================== # # END OF SCRIPT # #===============================================================================
Спойлер Русифицированный:Код:#=============================================================================== # # PAC Main Menu Ace (1.2) # 15/7/2012 # By Pacman # #=============================================================================== # # This is the PAC Main Menu converted to VX Ace. On a basic level, this offers # a configurable setup for your main menu, allowing the user to create, alter # and move the position of menu commands at their pleasure. It can be used # very simply to merely reorder the default commands, or to its' fullest # potential, that is creating commands to put custom scenes into the menu. It # also offers two graphical features: adding an EXP gauge into the menu status # window, and adding icons into the command display. Both are optional and # customizable. # #=============================================================================== # # ~! INSTALLATION !~ # Paste above Main, below Materials. I suggest you paste this high up in your # custom scripts list, for technical reasons considering overwriting methods. # There are details for configuration below. # #=============================================================================== # # ~! DO NOT HESITATE TO ASK FOR HELP !~ # This can get very confusing, and there is so much you can do with this, so if # you would like to know anything, just ask. # #=============================================================================== #-------------------- module PAC; module MM # <- Do not touch. #------------------ # How to set up your menu commands: # Below is the COMMANDS array, which holds all the commands for the menu in # it. Within the array is a set of more arrays. Each array represents one # command. These command arrays can contain 5 elements, which each give a # piece of information to the script that sets up the menu. Note that each # element must be followed by a comma or an error will occur. Make sure that # each array begins with an open square bracket ([) and a close square bracket # (]). #---------- # Element 1 - The Name # The first element of each array is the name that is displayed for that # command on the menu. It must be written in quotation marks ('' or ""). #---------- # Element 2 - The Method # The second element of each array is the name of the method that is executed # when the command is selected. The method must be located in the Scene_Menu # class. If you are planning on using this in tandem with a custom script's # scene, you should try and find the methods necessary to open that scene. # If a scene requires actor selection (Skill, Equip, etc.), put # "command_personal" as the method and set the scene in element 5. #---------- # Element 3 - The Icon # The third element of each array is a number: the index of the icon to be # displayed in the menu window. The index is the number displayed at the # bottom-left of the icon selection window. #---------- # Element 4 - The Disable Method # The fourth element of each array is a condition which, if met, disables # the command associated with it. The method must be located in the Scene_Menu # class, or accessible otherwise. To disable a command with a switch, use: # "$game_switches[x]" which will disable the command when switch with ID x is # on. To do the same with a variable, use: # "$game_variables[x] <=> n" which will disable the command when variable with # ID x is <=> to n. # This element can be ommited, or simply written as nil if you don't want one. # It must be there if you wish to include the fifth element though. #---------- # Element 5 - The Scene Call # The fifth element (teehee) of each array is only required if the second # element is set to 'command_personal'. It is the command to be executed upon # actor selection. This is required for scenes that are specific to actors, # namely Skill, Equip, Status and any custom scenes that are similar. #---------- # If you have any inquiries on how to use these elements in the most effective # way possible, or at all, ask away. #---------- COMMANDS = [ # <- Do not touch #---------- ['Вещи', # Command Name 'command_item', # Command Method 270, # Command Icon 'main_commands_enabled'], # Disable Method #---------- ['Навыки', 'command_personal', 112, 'main_commands_enabled', 'SceneManager.call(Scene_Skill)'], # Scene Call. #---------- ['Экипировка', 'command_personal', 147, 'main_commands_enabled', 'SceneManager.call(Scene_Equip)'], #---------- ['Статус', 'command_personal', 121, 'main_commands_enabled', 'SceneManager.call(Scene_Status)'], #---------- ['Строй', 'command_formation', 12, 'formation_enabled'], #---------- ['Запись', 'command_save', 117, 'save_enabled'], #---------- ['Выход', 'command_game_end', 6] #---------- ] # <- Do not touch. #------------------ Exp_Gauge = true # Use the EXP Gauge? Exp_Color1 = "text_color(30)" # Color 1 for EXP gauge. Exp_Color2 = "text_color(31)" # Color 2 for EXP gauge. Exp_a = "EXP" # Text displayed on the EXP Gauge. Icons = true # Use icons in the menu display? ALIGNMENT = 0 # Alignment of menu command text. 0 for left, 1 for center, 2 # for right. Map_Window = true # Use the map window in the menu display? Time_Window = true # Use the time window in the menu display? Time_Height = 1 # Height of the time window. Gold_Window = true # Use the gold window in the menu display Gold_Correction = true # Correct the gold window's y value to fit in? Windows_Pos = :left # Command, gold, map and time window orientation. :left # or :right. Anything else will go to :left. Heal_Button = :F5 # Button to fully heal the party in the menu. Set to nil if # you don't want that. It will also clear all statuses. Only in test play, of # course. #-------------------- end; end #-------------------- #=============================================================================== # # END OF CONFIGURATION # #============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles system data. It saves the disable state of saving and # menus. Instances of this class are referenced by $game_system. #============================================================================== class Game_System #-------------------------------------------------------------------------- # Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :menu_index, :menu_actor_selection #-------------------------------------------------------------------------- # Alias listing #-------------------------------------------------------------------------- alias pac_mm_gsys_ini initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) pac_mm_gsys_ini(*args) @menu_index = 0 @menu_actor_selection = false end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== if PAC::MM::Exp_Gauge class Window_Base < Window #-------------------------------------------------------------------------- # Alias Listing #-------------------------------------------------------------------------- alias pac_mm_wnbs_simsta draw_actor_simple_status if PAC::MM::Exp_Gauge #-------------------------------------------------------------------------- # * Get Text Colors (writing color without the u is killing me) #-------------------------------------------------------------------------- def exp_gauge_color1; eval PAC::MM::Exp_Color1 rescue text_color(30); end def exp_gauge_color2; eval PAC::MM::Exp_Color2 rescue text_color(31); end #-------------------------------------------------------------------------- # * Draw EXP #-------------------------------------------------------------------------- def draw_actor_exp(actor, x, y, width = 60) draw_gauge(x, y, width, actor.final_exp_rate, exp_gauge_color1, exp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, PAC::MM::Exp_a) draw_current_and_max_values(x, y, width, actor.exp, actor.next_level_exp, normal_color, normal_color) end #-------------------------------------------------------------------------- # * Draw Simple Status #-------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y, *args) pac_mm_wnbs_simsta(actor, x, y, *args) draw_actor_exp(actor, x + 58, y + line_height) end end end #============================================================================== # ** Window_MenuStatus #------------------------------------------------------------------------------ # This window displays the map name on the menu screen. #============================================================================== class Window_MenuMap < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, fitting_height(1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear change_color(normal_color) unless $game_map.display_name.empty? draw_text(contents.rect, $game_map.display_name, 1) end end end #============================================================================== # ** Window_Time #------------------------------------------------------------------------------ # This window displays play time on the menu screen. #============================================================================== class Window_Time < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, fitting_height(PAC::MM::Time_Height || 1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear @time = Graphics.frame_count / Graphics.frame_rate hour = @time / 3600 min = @time / 60 % 60 sec = @time % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) change_color(normal_color) draw_text(contents.rect, text, 1) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super refresh if Graphics.frame_count / Graphics.frame_rate != @time end end #============================================================================== # ** Window_MenuCommand #------------------------------------------------------------------------------ # This command window appears on the menu screen. #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * Initialize Command Selection Position (Class Method) #-------------------------------------------------------------------------- def self.init_command_position(*args) @@last_command_symbol ||= nil end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list(*args) PAC::MM::COMMANDS.each {|c| add_command(c[0], c[0].to_sym, pac_disable(c))} end #-------------------------------------------------------------------------- # * Disable PAC Command #-------------------------------------------------------------------------- def pac_disable(command) command[3] || '' end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index, *args) rect = item_rect_for_text(index) if PAC::MM::Icons && PAC::MM::COMMANDS[index][2] != nil irect = item_rect(index) draw_icon(PAC::MM::COMMANDS[index][2], irect.x, irect.y) rect.x += 24 end change_color(normal_color, command_enabled?(index)) draw_text(rect, command_name(index), PAC::MM::ALIGNMENT) end end #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs the menu screen processing. #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # Alias listing #-------------------------------------------------------------------------- alias pac_mm_start start alias pac_mm_update update alias pac_mm_cgw create_gold_window if PAC::MM::Gold_Correction alias pac_mm_opc on_personal_cancel #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start(*args) pac_mm_start @@start_personal ||= false if @@start_personal; @command_window.deactivate; command_personal; end if PAC::MM::Windows_Pos == :right @gold_window.x = Graphics.width-@gold_window.width if @gold_window != nil @status_window.x = 0 end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) pac_mm_update(*args) update_heal end #-------------------------------------------------------------------------- # * Update Heal Butten #-------------------------------------------------------------------------- def update_heal # BUTTEN if $TEST && PAC::MM::Heal_Button != nil && Input.trigger?(PAC::MM::Heal_Button) Sound.play_recovery $game_party.members do |actor| actor.recover_all end end end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window(*args) @command_window = Window_MenuCommand.new PAC::MM::COMMANDS.each {|c| @command_window.set_handler(c[0].to_sym, pac_method(c)) } @command_window.set_handler(:cancel, method(:return_scene)) if PAC::MM::Windows_Pos == :right @command_window.x = Graphics.width - @command_window.width end create_map_window create_time_window end #-------------------------------------------------------------------------- # * Create Gold Window #-------------------------------------------------------------------------- if PAC::MM::Gold_Correction; def create_gold_window(*args) pac_mm_cgw(*args) @gold_window.visible = false if !PAC::MM::Gold_Window y = @command_window.height y += @map_window.height if @map_window y += @time_window.height if @time_window @gold_window.y = y end; end #-------------------------------------------------------------------------- # * Create Map Window #-------------------------------------------------------------------------- def create_map_window x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0 @map_window = Window_MenuMap.new(x, @command_window.height) @map_window.visible = false if !PAC::MM::Map_Window end #-------------------------------------------------------------------------- # * Create Time Window #-------------------------------------------------------------------------- def create_time_window x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0 y = @map_window.nil? ? @command_window.height : @map_window.height + @map_window.y @time_window = Window_Time.new(x, y) @time_window.visible = fasle if !PAC::MM::Time_Window end #-------------------------------------------------------------------------- # * Get Method for Command #-------------------------------------------------------------------------- def pac_method(command) method(command[1] || '') end #-------------------------------------------------------------------------- # * [OK] Personal Command #-------------------------------------------------------------------------- def on_personal_ok(*args) @@start_personal = true eval(PAC::MM::COMMANDS[@command_window.index][4]) rescue nil end #-------------------------------------------------------------------------- # * [Cancel] Personal Command #-------------------------------------------------------------------------- def on_personal_cancel(*args) pac_mm_opc(*args) @command_window.activate @@start_personal = false end end ($pac ||= {})[:main_menu] = 1.2 #=============================================================================== # # END OF SCRIPT # #===============================================================================
Ring Menu Add-on for PAC Main MenuАддон заменяет меню из скрипта выше на круговое.
Для того, чтобы он правильно работал, соответственно нужно еще иметь скрипт выше.
Спойлер Аддон:Код:#=============================================================================== # # Ring Menu Addon (for PAC Main Menu Ace) # 19/06/2014 # By Pacman # #=============================================================================== # # This script is an addon for PAC Main Menu Ace. This script will only work # reliably if you have PAC Main Menu Ace version 1.2 or higher above it in the # scripts menu. (To get PAC Main Menu Ace - http://pastebin.com/Z7JN31gT) # This script will turn the main menu in to a ring menu reminiscent of SNES-era # RPGs. # This script allows for two different radii of the ring - an x-radius and a # y-radius. This means it has the capacity to produce ellipses as well as # circles. # This script can also scale the selected and deselected icons independently; # i.e. making the selected option larger. # #=============================================================================== module PAC::MM::RING MENU_RADIUS_X = 128 # X Radius MENU_RADIUS_Y = 64 # Y Radius MENU_SPEED = 8 # Changes movement speed of icons MENU_TEXT = true # Show menu text? (true or false) MENU_TEXT_SIZE = 18 # Menu Text size. integer or nil for default size MENU_ICON_PLACEMENT = :bottom # :top or :bottom BACKGROUND_ALPHA = 192 # integer (0 - 255) SCALE_GAIN = 8 # pixels gained in big icon scaling SCALE_LOSS = 4 # pixels lost in small icon scaling end #=============================================================================== # # END CONFIG # #============================================================================== # ** Math #------------------------------------------------------------------------------ # A module that supports floating-point calculations. #============================================================================== module Math #-------------------------------------------------------------------------- # * Trigonometric functions in degrees #-------------------------------------------------------------------------- ["sin","cos","tan"].each { |type| trig_eval_code = %Q( def self.#{type}d(value) return self.#{type}(value * PI / 180) end) eval (trig_eval_code) } end #============================================================================== # ** Window_MenuCommand #------------------------------------------------------------------------------ # This command window appears on the menu screen. #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :index attr_reader :angle attr_accessor :gosh_dang_it #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @gosh_dang_it = false @angle = 0 super(0, 0) @list.delete_if {|i| !i[:enabled]} self.width = Graphics.width self.height = Graphics.height self.opacity = 0 self.visible = self.active refresh end #-------------------------------------------------------------------------- # * Get Angle Size #-------------------------------------------------------------------------- def angle_size return 360 / item_max end #-------------------------------------------------------------------------- # * Draw Big Icon # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_big_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) dest = rect.clone dest.width = dest.height = (24 + PAC::MM::RING::SCALE_GAIN) dest.x = x - PAC::MM::RING::SCALE_GAIN/2 dest.y = y - PAC::MM::RING::SCALE_GAIN/2 contents.stretch_blt(dest, bitmap, rect, enabled ? 255 : translucent_alpha) end #-------------------------------------------------------------------------- # * Draw Small Icon # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_small_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) dest = rect.clone dest.width = dest.height = (24 - PAC::MM::RING::SCALE_LOSS) dest.x = x + PAC::MM::RING::SCALE_LOSS/2 dest.y = y + PAC::MM::RING::SCALE_LOSS/2 contents.stretch_blt(dest, bitmap, rect, translucent_alpha / 2) end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(method_index, enabled = true) radius = PAC::MM::RING::MENU_RADIUS_X yradius = PAC::MM::RING::MENU_RADIUS_Y yradius *= -1 if PAC::MM::RING::MENU_ICON_PLACEMENT == :top n = (method_index - self.index) * angle_size + @angle cx = radius * Math.sind(n) + (Graphics.width / 2) cy = yradius * Math.cosd(n) + (Graphics.height / 2) if n == 0 # Selected index self.contents.font.color.alpha = enabled ? 255 : 128 s = self.contents.font.size self.contents.font.size = PAC::MM::RING::MENU_TEXT_SIZE || s self.contents.draw_text(Graphics.width / 2 - 80, Graphics.height / 2 - line_height, 160, line_height, PAC::MM::COMMANDS[method_index][0], 1) if PAC::MM::RING::MENU_TEXT self.contents.font.size = s draw_big_icon(PAC::MM::COMMANDS[method_index][2], cx - 12, cy - 12, (enabled)) else # All other indexes draw_small_icon(PAC::MM::COMMANDS[method_index][2], cx - 12, cy - 12, (false)) end end def okay return end #-------------------------------------------------------------------------- # * Update Spin Animation #-------------------------------------------------------------------------- def update_spin(reverse = false) speed = PAC::MM::RING::MENU_SPEED @angle += (reverse ? -angle_size : angle_size) / speed.to_f Graphics.update refresh end #-------------------------------------------------------------------------- # * Frame Update # aliasing is for chumps #-------------------------------------------------------------------------- def update super update_index end #-------------------------------------------------------------------------- # * Update input thingies #-------------------------------------------------------------------------- def update_index return if !active if Input.trigger?(:LEFT) || Input.repeat?(:LEFT) || Input.trigger?(:UP) || Input.repeat?(:UP) Sound.play_cursor while @angle.round < angle_size update_spin end @index -= 1 @index %= item_max @angle = 0 refresh elsif Input.trigger?(:RIGHT) || Input.repeat?(:RIGHT) || Input.trigger?(:DOWN) || Input.repeat?(:DOWN) Sound.play_cursor while @angle.round > -angle_size update_spin(true) end @index += 1 @index %= item_max @angle = 0 refresh end end #-------------------------------------------------------------------------- # * Fix the cursor #-------------------------------------------------------------------------- def cursor_down(*args) cursor_right(*args) end def cursor_up(*args) cursor_left(*args) end def update_cursor end end #============================================================================== # ** Window_MenuStatus #------------------------------------------------------------------------------ # This window displays party member status on the menu screen. #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias pac_mm_rm_init initialize def initialize(*args) pac_mm_rm_init(*args) self.x = (Graphics.width - self.width) / 2 self.y = (Graphics.height - self.height) / 2 end end #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs the menu screen processing. #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # Aliasing things #-------------------------------------------------------------------------- alias pac_mm_rm_strt start alias pac_mm_rm_cmdpnl command_personal alias pac_mm_rm_cmdfrm command_formation alias pac_mm_rm_onfc on_formation_cancel #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start(*args) pac_mm_rm_strt(*args) @command_window.hide if @@start_personal @command_window.index = (@@last_index ||= 0) @command_window.refresh @status_window.hide unless @@start_personal @status_window.close unless @@start_personal end #-------------------------------------------------------------------------- # * Create Background #-------------------------------------------------------------------------- def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(16, 16, 16, PAC::MM::RING::BACKGROUND_ALPHA) end #-------------------------------------------------------------------------- # * [Skill], [Equipment] and [Status] Commands #-------------------------------------------------------------------------- def command_personal(*args) @command_window.close @status_window.show @status_window.open pac_mm_rm_cmdpnl(*args) end #-------------------------------------------------------------------------- # * [Formation] Command #-------------------------------------------------------------------------- def command_formation(*args) @command_window.close @status_window.show @status_window.open pac_mm_rm_cmdfrm(*args) end #-------------------------------------------------------------------------- # * [Cancel] Personal Command #-------------------------------------------------------------------------- def on_personal_cancel(*args) pac_mm_opc(*args) @status_window.close @command_window.show @command_window.open @@start_personal = false end #-------------------------------------------------------------------------- # * Formation [Cancel] #-------------------------------------------------------------------------- def on_formation_cancel(*args) pac_mm_rm_onfc(*args) @status_window.close @command_window.show @command_window.open @@start_personal = false end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate(*args) @@last_index = @command_window.index super end end ($pac ||= {})[:ring] = 1 unless $pac[:main_menu] >= 1.2 msgbox "You require PAC Main Menu Ace for the Ring Menu script to work." msgbox "Find the script at http://pastebin.com/Z7JN31gT"; exit end #=============================================================================== # # END OF SCRIPT # #===============================================================================
Родная страница
Сайт автора
Социальные закладки