累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
58751
OK点
16
推广点
0
同能卷
50
积分 68660
Title Screen Manager
by
MobiusXVI
Release Notes
Apr 2026 - v. 1.0 Initial Release
Introduction
This script allows you to:
Add custom commands to the title screen
Remove existing commands from the title screen
Re-order commands however you like
Move the command window to a new location
Change the command window's opacity, width, and font color
Change the title screen's background
Instructions
Copy the script into the script editor below the default scripts but above Main. If you're using other scripts which affect the title, I recommend placing this script above them in the script editor. Follow the instructions and configuration guidance within the script itself.
Script
Spoiler Ruby:
#=============================================================================== # Mobius' Title Screen Manager # Author: Mobius XVI # Version: 1.0 # Date: 30 APR 2026 #=============================================================================== # # Introduction: # # This script allows you to: # - Add custom commands to the title screen # - Remove existing commands from the title screen # - Re-order commands however you like # - Move the command window to a new location # - Change the command window's opacity, width, and font color # - Change the title screen's background # # # Instructions: # # - Place this script below all the default scripts but above main. # If you're using other scripts which affect the title, I recommend # placing this script above them in the script editor. # # - The customization section below has additional instructions # # - If you want to change the title background during play, # you can use the following script calls in events: # # Mobius::TitleScreenManager.\ # change_title_to_named \ # :castle # # Mobius::TitleScreenManager.\ # change_title_to_file \ # '001-Title01' # # Where you replace the name (':castle' or '001-Title01') with # either a named background key (see NAMED_BACKGROUNDS) or a # specific filename for a title in the Graphics/Titles folder. # # - If you want to change the title BGM during play, # you can use the following script calls in events: # # Mobius::TitleScreenManager.\ # change_bgm_to_named \ # :lullaby # # Mobius::TitleScreenManager.\ # change_bgm_to_audio \ # '063-Slow06', 100, 100 # # Where you replace the name (:lullaby) with a named BGM key # (see NAMED_BACKGROUND_MUSIC) or replace the name and numbers # ('063-Slow06', 100, 100) with a specific filename for a BGM # in the Audio/BGM folder and the desired volume and pitch. # # - If you want to change the title command window configuration during play, # you can use the following script calls in events: # # Mobius::TitleScreenManager.\ # change_command_to_named \ # :wide_center # # config = { # 'width' => 320, # 'opacity' => 20, # 'use_anchor' => true, # 'anchor' => :top_right, # 'text_align' => :center, # } # Mobius::TitleScreenManager.\ # change_command_to_config \ # config # # Where you replace the name (:wide_center) with a named command window # config key (see NAMED_COMMAND_WINDOWS) or replace the hash with # specific configuration settings for the command window. # # # Issues/Bugs/Possible Bugs: # # - As this script replaces the default title system scripts, it # may be incompatible with other title system scripts. # # # Credits/Thanks: # - Mobius XVI, author # # # License # # This script is available in its entirety for commercial and non-commercial # use. View the specific license terms below. # # The MIT License (MIT) # # Copyright (c) 2026 darmes # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # Further, if you do decide to use this script in a commercial product, # I'd ask that you let me know via a forum post or a PM. Thanks. # #============================================================================== # ** CUSTOMIZATION START #============================================================================== module Mobius #============================================================================== # ** Mobius - Title_Command_Window_Options #------------------------------------------------------------------------------ # This section contains all of the configuration settings for the title # screen's command window. #============================================================================== module Title_Command_Window_Options #============================================================================== # ** Anchor Options #------------------------------------------------------------------------------ # The anchor controls where on the screen the command window is placed. # If use_anchor is true, then the anchor setting will determine the # command window's position. The position is pinned to the specified corner # or edge of the screen with an offset margin as defined below. # If use_anchor is false, then the x and y settings will be used instead. # # The available anchor options are: # :top_left # :top_center # :top_right # :left # :center # :right # :bottom_left # :bottom_center # :bottom_right #============================================================================== DEFAULT_COMMAND_WINDOW_USE_ANCHOR = true # or false if you want to use x/y DEFAULT_COMMAND_WINDOW_ANCHOR = :bottom_center DEFAULT_COMMAND_WINDOW_MARGIN = 24 #============================================================================== # ** X/Y Options #------------------------------------------------------------------------------ # If use_anchor is false, then these X and Y settings will be used to set # the command window's position. X is the horizontal distance in pixels # from the left edge of the screen, and Y is the vertical distance in pixels # from the top edge of the screen. #============================================================================== DEFAULT_COMMAND_WINDOW_X = 0 DEFAULT_COMMAND_WINDOW_Y = 0 #============================================================================== # ** Style Options #------------------------------------------------------------------------------ # Font Color: The color of the window's text. Set this using RGB values. # Opacity: The opacity of the window, from 0 (invisible) to 255 (fully opaque) # Text Align: The alignment of the command window's text. # Can be :left, :center, or :right # Width: The width of the command window in pixels. #============================================================================== DEFAULT_COMMAND_WINDOW_FONT_COLOR = Color.new(255, 255, 255) DEFAULT_COMMAND_WINDOW_OPACITY = 160 DEFAULT_COMMAND_WINDOW_TEXT_ALIGN = :left DEFAULT_COMMAND_WINDOW_WIDTH = 192 #============================================================================== # ** Named Command Window Configurations #------------------------------------------------------------------------------ # If you have several different command window configurations that you want # to be able to re-use, you can define them once here then call them by name # in events using the change_command_to_named method. # # Valid keys for each config hash are: # "use_anchor" # "anchor" # "margin" # "x" # "y" # "font_color" # "opacity" # "text_align" # "width" #============================================================================== NAMED_COMMAND_WINDOWS = { :default => {}, :wide_center => { "width" => 320, "opacity" => 200, "use_anchor" => true, "anchor" => :center, "text_align" => :center, }, :oddly_placed => { "width" => 192, "opacity" => 100, "use_anchor" => false, "x" => 10, "y" => 10, "font_color" => Color.new(255, 0, 0), }, } end #============================================================================== # ** Mobius - Title_Options #------------------------------------------------------------------------------ # This section contains all of the configuration settings for the title # background and Background Music (BGM). #============================================================================== module Title_Options #============================================================================== # ** Named Backgrounds #------------------------------------------------------------------------------ # If you have several different backgrounds that you want to be able to re-use # you can define them once here then call them by name in events using the # change_title_to_named method. # # The pairing here is a symbol key (like :castle) linked to a string value # which is the filename for the background in the Graphics/Titles folder # (like '025-Castle01'). #============================================================================== NAMED_BACKGROUNDS = { :default => '001-Title01', :ship => '030-Ship01', :castle => '025-Castle01', } #============================================================================== # ** Named Background Music #------------------------------------------------------------------------------ # If you have several different BGMs that you want to be able to re-use # you can define them once here then call them by name in events using the # change_bgm_to_named method. # # The pairing here is a symbol key (like :lullaby) linked to a hash value # which contains the name, volume, and pitch for the BGM. The name is the # filename for the BGM in the Audio/BGM folder (like '063-Slow06'). #============================================================================== NAMED_BACKGROUND_MUSIC = { :default => { "name" => "064-Slow07", "volume" => 100, "pitch" => 100, }, :lullaby => { "name" => "063-Slow06", "volume" => 100, "pitch" => 100, }, :suspense => { "name" => "062-Slow05", "volume" => 100, "pitch" => 100, }, } end #============================================================================== # ** Mobius - Title_Commands #------------------------------------------------------------------------------ # These options allow you to configure all of the title commands. # Big picture: Every command has a 'command key' associated it with. # This allows you to link several different settings to the same command. # The keys are all of the type ':key_name'. That is a colon followed # by the key's name. As a rule, the keys should be all lowercase. # Additionally every command will need a key placed in the COMMAND_ORDER, # COMMAND_NAMES, and COMMAND_CALLS options below. #============================================================================== module Title_Commands #============================================================================== # ** Command Order #------------------------------------------------------------------------------ # Place all of your command keys in between the two square brackets. # Each key should be separated from the others with a comma. # The order in which these keys are placed will determine their order # in game, i.e. the first (top) key will be the first (top) command. #============================================================================== COMMAND_ORDER = [ :new_game, :continue, :shutdown, ] #============================================================================== # ** Command Display Names #------------------------------------------------------------------------------ # This links your command keys to their display text in game. # In general, these will be the same but they might vary a little. # Think of this like setting a 'word' in the database. # Each entry is a pair like this - :command_key => "Display Name" # Separate entries with commas. The order of these entries does NOT # affect the order in game. #============================================================================== COMMAND_NAMES = { :new_game => "New Game", :continue => "Continue", :shutdown => "Shutdown", } #============================================================================== # ** Command Script Calls #------------------------------------------------------------------------------ # This links your command keys to their script call. The default commands are # linked to the built-in methods for those commands. If you have a custom # scene that you want available from the title screen (like a gallery) and # if that script says you can call it by doing something likethis: # $scene = Scene_CustomScript.new # Then just include the 'Scene_CustomScript' part, and the rest will be # handled auto-magically (hopefully). If it doesn't work, reach out on the # forums and I'll try to help you get it working. # Separate entries with commas. The order of these entries does NOT # affect the order in game. #------------------------------------------------------------------------------ # NOTE FOR ADVANCED USERS # #------------------------------------------------------------------------------ # If you want to, you can write a custom method for a command and as long as # that method is in the Scene_Title class, you can link it to here. #============================================================================== COMMAND_CALLS = { :new_game => :command_new_game, :continue => :command_continue, :shutdown => :command_shutdown, # :example_scene => Scene_CustomScript, # :example_method => :my_custom_method, } #============================================================================== # ** Load Command Key Is? #------------------------------------------------------------------------------ # This sets which command key is the 'load' command key, so that it can be # disabled whenever there are no save files. In general, you can leave the # default load key alone in the above options and also leave this alone #============================================================================== LOAD_COMMAND = :continue end end #============================================================================== # ** CUSTOMIZATION END #------------------------------------------------------------------------------ # ** EDIT BELOW THIS LINE AT OWN RISK!!! #============================================================================== #============================================================================== # ** Mobius - Title Screen Manager #------------------------------------------------------------------------------ # This module holds the utility methods for managing the title screen #============================================================================== module Mobius module TitleScreenManager #-------------------------------------------------------------------------- # Throughout this module, you may wonder why there are duplicate methods. # The answer is that the self.<method> are Module level methods which # can be called from anywhere using Mobius::TitleScreenManager.<method>, while the # non-self.<method> are instance level methods which can be called from # any object that includes the Mobius::TitleScreenManager module, such as Scene_Title. #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # * Change Title To Named : Changes the title background to a named one #-------------------------------------------------------------------------- def self.change_title_to_named(name) filename = Mobius::Title_Options::NAMED_BACKGROUNDS[name] Mobius::TitleScreenManager.change_title_to_file(filename) end def change_title_to_named(name) Mobius::TitleScreenManager.change_title_to_named(name) end #-------------------------------------------------------------------------- # * Change Title To File : Changes the title background to a specific file #-------------------------------------------------------------------------- def self.change_title_to_file(filename) $data_system.title_name = filename save_data($data_system, "Data/System.rxdata") Mobius::TitleScreenManager.change_current_title end def change_title_to_file(filename) Mobius::TitleScreenManager.change_title_to_file(filename) end #-------------------------------------------------------------------------- # * Change Current Title : Changes the current title background #-------------------------------------------------------------------------- def self.change_current_title # Only run this if we're on the title screen if $scene.is_a?(Scene_Title) # Dispose of the old background $scene.main_cleanup_background # Create the new background $scene.main_sprite end end def change_current_title Mobius::TitleScreenManager.change_current_title end #-------------------------------------------------------------------------- # * Change BGM To Named : Changes the title BGM to a named one #-------------------------------------------------------------------------- def self.change_bgm_to_named(name) raw = Mobius::Title_Options::NAMED_BACKGROUND_MUSIC[name] Mobius::TitleScreenManager.change_bgm_to_audio(raw["name"], raw["volume"], raw["pitch"]) end def change_bgm_to_named(name) Mobius::TitleScreenManager.change_bgm_to_named(name) end #-------------------------------------------------------------------------- # * Change BGM To Audio : Changes the title BGM to a specific audio file #-------------------------------------------------------------------------- def self.change_bgm_to_audio(name, volume = 100, pitch = 100) audio = RPG::AudioFile.new(name, volume, pitch) $data_system.title_bgm = audio save_data($data_system, "Data/System.rxdata") Mobius::TitleScreenManager.change_current_bgm end def change_bgm_to_audio(name, volume = 100, pitch = 100) Mobius::TitleScreenManager.change_bgm_to_audio(name, volume, pitch) end #-------------------------------------------------------------------------- # * Change Current BGM : Changes the current title BGM #-------------------------------------------------------------------------- def self.change_current_bgm # Only run this if we're on the title screen if $scene.is_a?(Scene_Title) # Fade out old music over 500 milliseconds Audio.bgm_fade(500) $game_system.bgm_play($data_system.title_bgm) end end def change_current_bgm Mobius::TitleScreenManager.change_current_bgm end #-------------------------------------------------------------------------- # * Change Command To Named : Changes the title command to a named config #-------------------------------------------------------------------------- def self.change_command_to_named(name) data_config = Mobius::Title_Command_Window_Options::NAMED_COMMAND_WINDOWS[name] Mobius::TitleScreenManager.change_command_to_config(data_config) end def change_command_to_named(name) Mobius::TitleScreenManager.change_command_to_named(name) end #-------------------------------------------------------------------------- # * Change Command To Named : Changes the title command to a named config #-------------------------------------------------------------------------- def self.change_command_to_config(data_config) $data_system.title_command_window_config = data_config save_data($data_system, "Data/System.rxdata") Mobius::TitleScreenManager.change_current_command end def change_command_to_config(data_config) Mobius::TitleScreenManager.change_command_to_config(data_config) end #-------------------------------------------------------------------------- # * Change Current Command : Changes the current command window configuration #-------------------------------------------------------------------------- def self.change_current_command # Only run this if we're on the title screen if $scene.is_a?(Scene_Title) $scene.main_cleanup_command $scene.main_setup_command_window end end end end #============================================================================== # ** Mobius - Title Commands #------------------------------------------------------------------------------ # This module contains a few helper methods. #============================================================================== module Mobius module Title_Commands #-------------------------------------------------------------------------- # * Command Key to Index #-------------------------------------------------------------------------- def command_key_to_index(key) return COMMAND_ORDER.index(key) end #-------------------------------------------------------------------------- # * Command Index to Key #-------------------------------------------------------------------------- def command_index_to_key(index) return COMMAND_ORDER.at(index) end end end #============================================================================== # ** Mobius - Command Window Config #------------------------------------------------------------------------------ # This class is a data object that holds all of the configuration settings # for the title screen's command window. It also has a few helper methods # for applying those settings to a window. #============================================================================== module Mobius class Command_Window_Config include Mobius::Title_Command_Window_Options #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :width, :opacity, :use_anchor, :anchor attr_reader :margin, :x, :y, :font_color #-------------------------------------------------------------------------- # * Public Constants #-------------------------------------------------------------------------- SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 HALF_SCREEN_WIDTH = SCREEN_WIDTH / 2 HALF_SCREEN_HEIGHT = SCREEN_HEIGHT / 2 #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(config) @anchor = config["anchor"] || DEFAULT_COMMAND_WINDOW_ANCHOR @font_color = config["font_color"] || DEFAULT_COMMAND_WINDOW_FONT_COLOR @margin = config["margin"] || DEFAULT_COMMAND_WINDOW_MARGIN @opacity = config["opacity"] || DEFAULT_COMMAND_WINDOW_OPACITY @text_align_symbol = config["text_align"] || DEFAULT_COMMAND_WINDOW_TEXT_ALIGN @width = config["width"] || DEFAULT_COMMAND_WINDOW_WIDTH @x = config["x"] || DEFAULT_COMMAND_WINDOW_X @y = config["y"] || DEFAULT_COMMAND_WINDOW_Y @use_anchor = config["use_anchor"].nil? ? DEFAULT_COMMAND_WINDOW_USE_ANCHOR : config["use_anchor"] end #-------------------------------------------------------------------------- # * Text Align - Converts the text align symbol to a number that can be used in draw_text #-------------------------------------------------------------------------- def text_align case @text_align_symbol when :left then return 0 when :center then return 1 when :right then return 2 else raise "Unrecognized text align: #{@text_align_symbol}. Please check your spelling." end end #-------------------------------------------------------------------------- # * Apply To Window - Applies the configuration settings to a given window #-------------------------------------------------------------------------- def apply_to_window(window) window.opacity = @opacity window.set_width(@width, true) window.set_contents_align(text_align, true) window.set_font_color(@font_color, true) if @use_anchor apply_anchor_position(window) else window.x = @x window.y = @y end window.refresh end #-------------------------------------------------------------------------- # * Apply Anchor Position - Applies the anchor position settings to a given window #-------------------------------------------------------------------------- def apply_anchor_position(window) case @anchor when :top_left window.x = @margin window.y = @margin when :top_center window.x = HALF_SCREEN_WIDTH - window.width / 2 window.y = @margin when :top_right window.x = SCREEN_WIDTH - window.width - @margin window.y = @margin when :bottom_left window.x = @margin window.y = SCREEN_HEIGHT - window.height - @margin when :bottom_center window.x = HALF_SCREEN_WIDTH - window.width / 2 window.y = SCREEN_HEIGHT - window.height - @margin when :bottom_right window.x = SCREEN_WIDTH - window.width - @margin window.y = SCREEN_HEIGHT - window.height - @margin when :center window.x = HALF_SCREEN_WIDTH - window.width / 2 window.y = HALF_SCREEN_HEIGHT - window.height / 2 when :left window.x = @margin window.y = HALF_SCREEN_HEIGHT - window.height / 2 when :right window.x = SCREEN_WIDTH - window.width - @margin window.y = HALF_SCREEN_HEIGHT - window.height / 2 else raise "Unrecognized anchor: #{@anchor}. Please check your spelling." end end end end #============================================================================== # ** RPG - System #------------------------------------------------------------------------------ # This extends the RPG::System class to include a new instance variable for # storing the title command window configuration settings. This allows those # settings to be saved and loaded with the rest of the system data. #============================================================================== module RPG class System #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :title_command_window_config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias mobius_TitleScreenManager_initialize initialize def initialize mobius_TitleScreenManager_initialize @title_command_window_config = {} end end end #============================================================================== # ** Window_Command - Changes to the default command window class #============================================================================== class Window_Command < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias mobius_TitleScreenManager_initialize initialize def initialize(width, commands) @text_align = 0 @font_color = Color.new(255, 255, 255, 255) mobius_TitleScreenManager_initialize(width, commands) end #-------------------------------------------------------------------------- # * Set Width : Changes the width of the window and refreshes the contents #-------------------------------------------------------------------------- def set_width(width, skip_refresh = false) self.width = width self.contents.dispose self.contents = Bitmap.new(width - 32, @item_max * 32) refresh if not skip_refresh end #-------------------------------------------------------------------------- # * Set Font Color : Changes the font color and refreshes the contents #-------------------------------------------------------------------------- def set_font_color(color, skip_refresh = false) @font_color = color refresh if not skip_refresh end #-------------------------------------------------------------------------- # * Set Contents Align : Changes the text align and refreshes the contents #-------------------------------------------------------------------------- def set_contents_align(align, skip_refresh = false) @text_align = align refresh if not skip_refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, @font_color) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number # color : text color #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color rect = Rect.new(4, 32 * index, self.contents.width - 8, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], @text_align) end end #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This is a refactor of the original code with no modifications to make # extending this script easier #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # If battle test if $BTEST battle_test return end main_database main_sprite main_setup_command_window main_audio main_loop main_cleanup end #-------------------------------------------------------------------------- # * Main Processing : Database Initialization #-------------------------------------------------------------------------- def main_database # Load database $data_actors = load_data("Data/Actors.rxdata") $data_classes = load_data("Data/Classes.rxdata") $data_skills = load_data("Data/Skills.rxdata") $data_items = load_data("Data/Items.rxdata") $data_weapons = load_data("Data/Weapons.rxdata") $data_armors = load_data("Data/Armors.rxdata") $data_enemies = load_data("Data/Enemies.rxdata") $data_troops = load_data("Data/Troops.rxdata") $data_states = load_data("Data/States.rxdata") $data_animations = load_data("Data/Animations.rxdata") $data_tilesets = load_data("Data/Tilesets.rxdata") $data_common_events = load_data("Data/CommonEvents.rxdata") $data_system = load_data("Data/System.rxdata") # Make system object $game_system = Game_System.new end #-------------------------------------------------------------------------- # * Main Processing : Sprite Initialization #-------------------------------------------------------------------------- def main_sprite # Make title graphic @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) end #-------------------------------------------------------------------------- # * Main Processing : Window Initialization #-------------------------------------------------------------------------- def main_setup_command_window main_create_command_window main_test_continue main_continue_control end #-------------------------------------------------------------------------- # * Main Processing : Window Initialization #-------------------------------------------------------------------------- def main_create_command_window # Make command window s1 = "New Game" s2 = "Continue" s3 = "Shutdown" @command_window = Window_Command.new(192, [s1, s2, s3]) @command_window.back_opacity = 160 @command_window.x = 320 - @command_window.width / 2 @command_window.y = 288 end #-------------------------------------------------------------------------- # * Main Test Continue #-------------------------------------------------------------------------- def main_test_continue # Continue enabled determinant # Check if at least one save file exists # If enabled, make @continue_enabled true; if disabled, make it false @continue_enabled = false for i in 0..3 if FileTest.exist?("Save#{i+1}.rxdata") @continue_enabled = true end end end #-------------------------------------------------------------------------- # * Main Continue Control #-------------------------------------------------------------------------- def main_continue_control # If continue is enabled, move cursor to "Continue" # If disabled, display "Continue" text in gray if @continue_enabled @command_window.index = 1 else @command_window.disable_item(1) end end #-------------------------------------------------------------------------- # * Main Processing : Audio Initialization #-------------------------------------------------------------------------- def main_audio # Play title BGM $game_system.bgm_play($data_system.title_bgm) # Stop playing ME and BGS Audio.me_stop Audio.bgs_stop end #-------------------------------------------------------------------------- # * Main Processing : Scene Loop #-------------------------------------------------------------------------- def main_loop # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze end #-------------------------------------------------------------------------- # * Main Processing : Graphics Cleanup #-------------------------------------------------------------------------- def main_cleanup # Dispose of command window main_cleanup_command # Dispose of title graphic main_cleanup_background end #-------------------------------------------------------------------------- # * Main Processing : Graphics Cleanup #-------------------------------------------------------------------------- def main_cleanup_command # Dispose of command window @command_window.dispose end #-------------------------------------------------------------------------- # * Main Processing : Graphics Cleanup #-------------------------------------------------------------------------- def main_cleanup_background # Dispose of title graphic @sprite.bitmap.dispose @sprite.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update command window @command_window.update handle_command_input end #-------------------------------------------------------------------------- # * Frame Update - Command Window Input #-------------------------------------------------------------------------- def handle_command_input # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window.index when 0 # New game command_new_game when 1 # Continue command_continue when 2 # Shutdown command_shutdown end end end #-------------------------------------------------------------------------- # * Command: New Game #-------------------------------------------------------------------------- def command_new_game commandnewgame_audio # Audio Control commandnewgame_gamedata # Game Data Setup commandnewgame_partysetup # Party Setup commandnewgame_mapsetup # Map Setup commandnewgame_sceneswitch # Scene Switch end #-------------------------------------------------------------------------- # * Command: New Game : Audio Control #-------------------------------------------------------------------------- def commandnewgame_audio # Play decision SE $game_system.se_play($data_system.decision_se) # Stop BGM Audio.bgm_stop end #-------------------------------------------------------------------------- # * Command: New Game : Game Data Setup #-------------------------------------------------------------------------- def commandnewgame_gamedata # Reset frame count for measuring play time Graphics.frame_count = 0 # Make each type of game object $game_temp = Game_Temp.new $game_system = Game_System.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_self_switches = Game_SelfSwitches.new $game_screen = Game_Screen.new $game_actors = Game_Actors.new $game_party = Game_Party.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new end #-------------------------------------------------------------------------- # * Command: New Game : Party Setup #-------------------------------------------------------------------------- def commandnewgame_partysetup # Set up initial party $game_party.setup_starting_members end #-------------------------------------------------------------------------- # * Command: New Game : Map Setup #-------------------------------------------------------------------------- def commandnewgame_mapsetup # Set up initial map position $game_map.setup($data_system.start_map_id) # Move player to initial position $game_player.moveto($data_system.start_x, $data_system.start_y) # Refresh player $game_player.refresh # Run automatic change for BGM and BGS set with map $game_map.autoplay # Update map (run parallel process event) $game_map.update end #-------------------------------------------------------------------------- # * Command: New Game : Scene Switch #-------------------------------------------------------------------------- def commandnewgame_sceneswitch # Switch to map screen $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Command: Continue #-------------------------------------------------------------------------- def command_continue # If continue is disabled unless @continue_enabled # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to load screen $scene = Scene_Load.new end #-------------------------------------------------------------------------- # * Command: Shutdown #-------------------------------------------------------------------------- def command_shutdown # Play decision SE $game_system.se_play($data_system.decision_se) # Fade out BGM, BGS, and ME Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) # Shutdown $scene = nil end #-------------------------------------------------------------------------- # * Battle Test #-------------------------------------------------------------------------- def battle_test battletest_database commandnewgame_gamedata battletest_setup battletest_sceneswitch end #-------------------------------------------------------------------------- # * Battle Test : Load Database #-------------------------------------------------------------------------- def battletest_database # Load database (for battle test) $data_actors = load_data("Data/BT_Actors.rxdata") $data_classes = load_data("Data/BT_Classes.rxdata") $data_skills = load_data("Data/BT_Skills.rxdata") $data_items = load_data("Data/BT_Items.rxdata") $data_weapons = load_data("Data/BT_Weapons.rxdata") $data_armors = load_data("Data/BT_Armors.rxdata") $data_enemies = load_data("Data/BT_Enemies.rxdata") $data_troops = load_data("Data/BT_Troops.rxdata") $data_states = load_data("Data/BT_States.rxdata") $data_animations = load_data("Data/BT_Animations.rxdata") $data_tilesets = load_data("Data/BT_Tilesets.rxdata") $data_common_events = load_data("Data/BT_CommonEvents.rxdata") $data_system = load_data("Data/BT_System.rxdata") end #-------------------------------------------------------------------------- # * Battle Test : Setup #-------------------------------------------------------------------------- def battletest_setup # Set up party for battle test $game_party.setup_battle_test_members # Set troop ID, can escape flag, and battleback $game_temp.battle_troop_id = $data_system.test_troop_id $game_temp.battle_can_escape = true $game_map.battleback_name = $data_system.battleback_name end #-------------------------------------------------------------------------- # * Battle Test : Scene Switch #-------------------------------------------------------------------------- def battletest_sceneswitch # Play battle start SE $game_system.se_play($data_system.battle_start_se) # Play battle BGM $game_system.bgm_play($game_system.battle_bgm) # Switch to battle screen $scene = Scene_Battle.new end end #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This is the changes for this script #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Configuration Binding #-------------------------------------------------------------------------- include Mobius::Title_Command_Window_Options include Mobius::Title_Options include Mobius::Title_Commands include Mobius::TitleScreenManager #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @disabled_commands = [] end #-------------------------------------------------------------------------- # * Main Processing : Window Initialization #-------------------------------------------------------------------------- def main_create_command_window # Collect commands commands = COMMAND_ORDER.collect { |cmd| COMMAND_NAMES[cmd] } # Collect config for command window data_config = $data_system.title_command_window_config || {} config = Mobius::Command_Window_Config.new(data_config) # Make command window @command_window = Window_Command.new(config.width, commands) config.apply_to_window(@command_window) end #-------------------------------------------------------------------------- # * Main Test Initialization #-------------------------------------------------------------------------- def main_continue_control # If continue is enabled, move cursor to "Continue" # If disabled, display "Continue" text in gray continue_index = command_key_to_index(LOAD_COMMAND) if @continue_enabled @command_window.index = continue_index else @command_window.disable_item(continue_index) disable_command(LOAD_COMMAND) end end #-------------------------------------------------------------------------- # * Frame Update - Command Window Input #-------------------------------------------------------------------------- def handle_command_input # If C button was pressed if Input.trigger?(Input::C) on_command end end #-------------------------------------------------------------------------- # * On Command #-------------------------------------------------------------------------- def on_command # Get index and key index = @command_window.index key = command_index_to_key(index) # Exit processing if command is disabled if command_disabled?(index) command_fail else command_success(key) end end #-------------------------------------------------------------------------- # * Command Success #-------------------------------------------------------------------------- def command_success(key) play_decision_se # Switch to new screen process_command_call(key) end #-------------------------------------------------------------------------- # * Command Fail #-------------------------------------------------------------------------- def command_fail play_buzzer_se end #-------------------------------------------------------------------------- # * Process Command Call #-------------------------------------------------------------------------- def process_command_call(key) # Get command call cmd_call = COMMAND_CALLS[key] # If call is a Class, treat as a scene class if cmd_call.is_a?(Class) $scene = cmd_call.new # If call is a symbol, treat as method name elsif cmd_call.is_a?(Symbol) method(cmd_call).call else raise "Unrecognized command: #{cmd_call}. Please check your spelling." end end #-------------------------------------------------------------------------- # * Command: New Game : Audio Control #-------------------------------------------------------------------------- def commandnewgame_audio # Stop BGM Audio.bgm_stop end #-------------------------------------------------------------------------- # * Command: Continue #-------------------------------------------------------------------------- def command_continue # Switch to load screen $scene = Scene_Load.new end #-------------------------------------------------------------------------- # * Command: Shutdown #-------------------------------------------------------------------------- def command_shutdown # Fade out BGM, BGS, and ME Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) # Shutdown $scene = nil end #-------------------------------------------------------------------------- # * Disable Command #-------------------------------------------------------------------------- def disable_command(key) # Get command index index = command_key_to_index(key) # Set text to disabled @command_window.disable_item(index) # Add index to disabled commands @disabled_commands.push(index).uniq! end #-------------------------------------------------------------------------- # * Enable Command #-------------------------------------------------------------------------- def enable_command(key) # Get comand index index = command_key_to_index(key) # Set text to disabled @command_window.disable_item(index) # Add index to disabled commands @disabled_commands.delete(index) end #-------------------------------------------------------------------------- # * Command Disabled? #-------------------------------------------------------------------------- def command_disabled?(index) return @disabled_commands.include?(index) end #-------------------------------------------------------------------------- # * Play Decision SE #-------------------------------------------------------------------------- def play_decision_se $game_system.se_play($data_system.decision_se) end #-------------------------------------------------------------------------- # * Play Buzzer SE #-------------------------------------------------------------------------- def play_buzzer_se $game_system.se_play($data_system.buzzer_se) end end 复制代码
FAQ
Q. Can this do _______?
A. Maybe! Leave a post on the forum, and I might just add the feature if it can't already do it.
Q. This doesn't work! Every time I launch the game, it's back to using the defaults and not my changes!
A. Whenever you save the project from the editor, it overwrites the changes made by my script. You can either launch the game from the editor without saving or launch it directly from the application (outside the editor).
Credits and Thanks
- MobiusXVI, author
License
This script is available in its entirety for commercial and non-commercial use. View the full license terms in the script header.
本贴来自国际rpgmaker官方论坛作者:MobiusXVI处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/title-screen-manager.183445/