Project1

标题: 在菜单中加入音乐音量调节 [打印本页]

作者: ROMB板    时间: 2012-6-23 19:00
标题: 在菜单中加入音乐音量调节
要怎么做?dsu_plus_rewardpost_czw
作者: 铅笔描绘的思念    时间: 2012-6-23 20:32
总是你呢。。脚本。。
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Melody - System Game Options
  4. # Last Date Updated: 2010.06.12
  5. # Level: Normal
  6. #
  7. # System Game Options replaces the "Game End" scene found in the default RPG
  8. # Maker VX with a system options menu. In this menu, the player can readjust
  9. # sound volumes, automatic dashing, and more. This changes one of the unused
  10. # game end scene into something a whole lot more useful.
  11. #
  12. #===============================================================================
  13. # Updates
  14. # -----------------------------------------------------------------------------
  15. # o 2010.06.12 - Bugfix for disposing the skins window.
  16. # o 2010.05.14 - Finished Script.
  17. # o 2010.05.12 - Started Script.
  18. #===============================================================================
  19. # Instructions
  20. # -----------------------------------------------------------------------------
  21. # To install this script, open up your script editor and copy/paste this script
  22. # to an open slot below ? Materials but above ? Main. Remember to save.
  23. #
  24. # 1. Scroll down, adjust the various Switches and Variable values to something
  25. #    empty or predetermined.
  26. # 2. Make a "Windows" folder in your project's "Graphics" folder. Insert the
  27. #    window skins you want to use there and adjust the WINDOW_HASH accordingly.
  28. #
  29. #===============================================================================
  30. # Compatibility
  31. # -----------------------------------------------------------------------------
  32. # - Replaces ALL of Scene_End. Expect no functionality with any scripts that
  33. #   will also replace Scene_End.
  34. # - This script is made to be specifically compatible with Battle Engine Melody.
  35. #===============================================================================

  36. $imported = {} if $imported == nil
  37. $imported["SystemGameOptions"] = true

  38. module YEM
  39.   module SYSTEM
  40.    
  41.     # This replaces the Game End title with the following text. And although
  42.     # script itself doesn't provide the icon, any script that may potentially
  43.     # link towards the System menu will reveal the System icon below.
  44.     TITLE = "系统"
  45.     ICON  = 134
  46.    
  47.     #===========================================================================
  48.     # Game System Commands
  49.     # --------------------------------------------------------------------------
  50.     # The following adjusts the order at which you would like the menu system
  51.     # commands to appear. Here is the reference table to their command ID's.
  52.     #      :blank        - Blank Item.
  53.     #      :volume_bgm   - Adjusts BGM volume.
  54.     #      :volume_bgs   - Adjusts BGS volume.
  55.     #      :volume_sfx   - Adjusts SFX volume.
  56.     #      :animations   - Turns on/off battle animations.
  57.     #      :autocursor   - Requires BEM. Memorized cursor position.
  58.     #      :skill_help   - Requires BEM. Display skill help.
  59.     #      :next_actor   - Requires BEM. Automatic Next Actor.
  60.     #      :atb_active   - Requires BEM. Sets ATB type.
  61.     #      :atb_speed    - Requires BEM. Sets ATB speed.
  62.     #      :auto_dash    - Controls if need to hold down dash button to run.
  63.     #      :instant_text - Whether or not text appears instantly in messages.
  64.     #      :windowskin   - Changes the windowskin.
  65.     #      :return_title - Return back to the title screen.
  66.     #      :return_menu  - Return back to the menu screen.
  67.     #===========================================================================
  68.    
  69.     # This array modifies the order your system menu options appear in from
  70.     # top to bottom. Rearrange them as you see fit or remove them if desired.
  71.     COMMANDS =[
  72.        :windowskin,   # Adjusts window skins.
  73.        :skill_help,   # Requires BEM. Shows skill help.
  74.        :atb_active,   # Requires BEM. Sets ATB type.
  75.        :atb_speeds,   # Requires BEM. Sets ATB speed.
  76.        :animations,   # Turns on/off battle animations.
  77.       :autocursor,   # Requires BEM. Memory cursor.
  78.       :next_actor,   # Requires BEM. Automatic Next Actor.
  79.       :bgm_volume,   # Adjusts BGM volume.
  80.       :bgs_volume,   # Adjusts BGS volume.
  81.       :sfx_volume,   # Adjusts SFX volume.
  82.       :auto_dash,    # Controls need to hold down dash button to run.
  83.       :instant_text, # Makes text appear instantly.
  84.       :blank,        # A blank space.
  85.       :return_title, # Return to the title screen.
  86.       :return_menu,  # Return back to the main menu.
  87.     ] # Do not remove this.
  88.    
  89.     # The following hash determines what variables and switches are used to
  90.     # adjust the system options menu. It's very important that you bind the
  91.     # values to the proper variables and switches in order for your game to
  92.     # run properly. In addition to adjusting the switches, you also apply
  93.     # text descriptions of each of the items here, too.
  94.      OPTIONS ={
  95.     # Option => Value
  96.       :bgm_variable  => 190,  # Variable used to adjust BGM volume.
  97.       :bgm_mute_sw   => 201,  # Switch used to mute/unmute the BGM.
  98.         :bgm_volume  => "BGM 音量",
  99.         :bgm_des     => "设置BGM音量 Z 切换没有和有",
  100.       :bgs_variable  => 191,  # Variable used to adjust BGS volume.
  101.       :bgs_mute_sw   => 202,  # Switch used to mute/unmute the BGS.
  102.         :bgs_volume  => "BGS 音量",
  103.         :bgs_des     => "设置BGS音量 Z 切换没有和有",
  104.       :sfx_variable  => 192,  # Variable used to adjust SFX volume.
  105.       :sfx_mute_sw   => 203,  # Switch used to mute/unmute the SFX.
  106.         :sfx_volume  => "SFX 音量",
  107.         :sfx_des     => "设置SFX音量 Z 切换没有和有",
  108.         :mute        => "静音",
  109.         :audio       => "音量 %d%%",
  110.       :atb_avariable => 193,  # Variable used for ATB Active Type.
  111.         :atb_aname   => "ActiveType",
  112.         :wait_0      => "Full",
  113.         :wait_0_des  => "ATB Gauge does not stop with battle menus open.",
  114.         :wait_1      => "Semi",
  115.         :wait_1_des  => "ATB Gauge stops during target selection.",
  116.         :wait_2      => "Stop",
  117.         :wait_2_des  => "ATB Gauge stops with battle menus open.",
  118.         :wait_3      => "Wait",
  119.         :wait_3_des  => "ATB Gauge stops with any member ready for action.",
  120.       :atb_svariable => 194,  # Variable used for ATB Speeds.
  121.         :atb_sname   => "Turn Speed",
  122.         :atb_s_des   => "Adjusts battle speed. Higher values are faster.",
  123.       :animation_sw  => 204,  # Switch used to display/hide animations.
  124.         :animations  => "动画",
  125.         :ani_des     => "开/关动画",
  126.         :ani_show    => "显示",
  127.         :ani_hide    => "隐藏",
  128.       :autocursor_sw => 205,  # Switch used for autocursors.
  129.         :autocursor  => "AutoCursor",
  130.         :curmem_des  => "Enables/Disables cursor memory for actions.",
  131.         :curmem_on   => "Memory",
  132.         :curmem_off  => "Reset",
  133.       :next_actor_sw => 206,  # Switch used for automatic next actor.
  134.         :next_actor  => "Next Actor",
  135.         :next_des    => "Move to next actor after selecting commands",
  136.         :next_on     => "Auto",
  137.         :next_off    => "Manual",
  138.       :skill_help_sw => 207,  # Switch used to enable skill help.
  139.         :skill_help  => "Skill Help",
  140.         :help_des    => "Display skill descriptions during battle phase.",
  141.         :help_on     => "Enabled",
  142.         :help_off    => "Disable",
  143.       :auto_dash_sw  => 208,  # Switch used to enable auto-dashing.
  144.         :auto_dash   => "自动跑步",
  145.         :dash_des    => "不需要按住Shift,角色会自动跑步",
  146.         :dash_on     => "跑步",
  147.         :dash_off    => "步行",
  148.       :inst_text_sw  => 209,  # Switch used to control instant text.
  149.         :instant_text => "即时文本",
  150.         :inst_des    => "文字会一次出现,而不是一个一个",
  151.         :inst_on     => "即时",
  152.         :inst_off    => "正常",
  153.       :return_title  => "回到标题",
  154.         :retitle_des => "返回到标题菜单,返回前请存档",
  155.       :return_menu   => "返回到主菜单",
  156.         :remenu_des  => "返回到主菜单",
  157.       :window_var    => 195,  # Variable used to change windowskins.
  158.         :windowskin  => "窗口",
  159.         :wind_des    => "更换游戏窗口",
  160.     } # Do not remove this.
  161.         
  162.     # This sets the default fonts used for your windows. Note that in this
  163.     # array, if a player doesn't have the font in front, it'll use the next one
  164.     # onward until the player does have that font installed.
  165.     DEFAULT = ["长城粗圆体"]
  166.     WRITING = [""]
  167.    

  168.    # The following adjusts the window skins used for your game. Match the
  169.     # Window skins with the names accordingly. Within the windowskin hash,
  170.     # the following settings are adjusted as such:
  171.     #     Name - File Name
  172.     #     Opac - Back Opacity
  173.     #     Bold - Bold font?
  174.     #   Italic - Italic font?
  175.     #   Shadow - Use shadows?
  176.     #     Size - Font Size
  177.     #     Font - Font Set
  178.     DEFAULT_SKIN_VALUE  = 1
  179.     WINDOW_HASH ={
  180.     # Window ID => [      Name, Opac,      Bold, Italic, Shadow, Size,    Font],
  181.           1 => [  "Window",     200, false,  false,   true,   20, DEFAULT],
  182.     } # Do not remove this.
  183.    
  184.   end # SYSTEM
  185. end # YEM

  186. #===============================================================================
  187. # Editting anything past this point may potentially result in causing computer
  188. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  189. # Therefore, edit at your own risk.
  190. #===============================================================================

  191. #===============================================================================
  192. # Vocab
  193. #===============================================================================

  194. module Vocab

  195.   #--------------------------------------------------------------------------
  196.   # overwrite method: self.game_end
  197.   #--------------------------------------------------------------------------
  198.   def self.game_end
  199.     return YEM::SYSTEM::TITLE
  200.   end
  201.   
  202. end # Vocab

  203. #===============================================================================
  204. # module Icon
  205. #===============================================================================

  206. module Icon
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # new method: self.system
  210.   #--------------------------------------------------------------------------
  211.   def self.system
  212.     return YEM::SYSTEM::ICON
  213.   end
  214.   
  215. end # Icon

  216. #===============================================================================
  217. # module Cache
  218. #===============================================================================

  219. module Cache
  220.   
  221.   #--------------------------------------------------------------------------
  222.   # new method: self.windows
  223.   #--------------------------------------------------------------------------
  224.   def self.windows(filename); load_bitmap("Graphics/Windows/", filename); end
  225.   
  226. end # Cache
  227. YEM::SYSTEM::WINDOWSKIN_VARIABLE = YEM::SYSTEM::OPTIONS[:window_var]
  228. #===============================================================================
  229. # RPG::BGM
  230. #===============================================================================
  231. unless $imported["BattleEngineMelody"]
  232. module RPG
  233. class BGM < AudioFile
  234.   
  235.   #--------------------------------------------------------------------------
  236.   # overwrite method: play
  237.   #--------------------------------------------------------------------------
  238.   def play
  239.     if @name.empty?
  240.       Audio.bgm_stop
  241.       @@last = BGM.new
  242.     else
  243.       vol = @volume
  244.       if $game_variables != nil
  245.         options = YEM::SYSTEM::OPTIONS
  246.         vol = vol * $game_variables[options[:bgm_variable]] / 100
  247.         vol = [[vol, 0].max, 100].min
  248.         vol = 0 if $game_switches[options[:bgm_mute_sw]]
  249.       end
  250.       Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch)
  251.       @@last = self
  252.     end
  253.   end
  254.   
  255. end # BGM
  256. class ME < AudioFile
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # overwrite method: play
  260.   #--------------------------------------------------------------------------
  261.   def play
  262.     if @name.empty?
  263.       Audio.me_stop
  264.     else
  265.       vol = @volume
  266.       if $game_variables != nil
  267.         options = YEM::SYSTEM::OPTIONS
  268.         vol = vol * $game_variables[options[:bgm_variable]] / 100
  269.         vol = [[vol, 0].max, 100].min
  270.         vol = 0 if $game_switches[options[:bgm_mute_sw]]
  271.       end
  272.       Audio.me_play("Audio/ME/" + @name, vol, @pitch)
  273.     end
  274.   end
  275.   
  276. end # ME
  277. class BGS < AudioFile
  278.   
  279.   #--------------------------------------------------------------------------
  280.   # overwrite method: play
  281.   #--------------------------------------------------------------------------
  282.   def play
  283.     if @name.empty?
  284.       Audio.bgs_stop
  285.       @@last = BGS.new
  286.     else
  287.       vol = @volume
  288.       if $game_variables != nil
  289.         options = YEM::SYSTEM::OPTIONS
  290.         vol = vol * $game_variables[options[:bgs_variable]] / 100
  291.         vol = [[vol, 0].max, 100].min
  292.         vol = 0 if $game_switches[options[:bgs_mute_sw]]
  293.       end
  294.       Audio.bgs_play("Audio/BGS/" + @name, vol, @pitch)
  295.       @@last = self
  296.     end
  297.   end
  298.   
  299. end # BGS
  300. class SE < AudioFile
  301.   
  302.   #--------------------------------------------------------------------------
  303.   # overwrite method: play
  304.   #--------------------------------------------------------------------------
  305.   def play
  306.     unless @name.empty?
  307.       vol = @volume
  308.       if $game_variables != nil
  309.         options = YEM::SYSTEM::OPTIONS
  310.         vol = vol * $game_variables[options[:sfx_variable]] / 100
  311.         vol = [[vol, 0].max, 100].min
  312.         vol = 0 if $game_switches[options[:sfx_mute_sw]]
  313.       end
  314.       Audio.se_play("Audio/SE/" + @name, vol, @pitch)
  315.     end
  316.   end
  317.   
  318. end # SE
  319. end # RPG
  320. end # $imported["BattleEngineMelody"]
  321. #===============================================================================
  322. # Game_System
  323. #===============================================================================

  324. class Game_System
  325.   
  326.   #--------------------------------------------------------------------------
  327.   # new method: create_system_options
  328.   #--------------------------------------------------------------------------
  329.   def create_system_options
  330.     return if @created_system_options
  331.     @created_system_options = true
  332.     options = YEM::SYSTEM::OPTIONS
  333.     $game_variables[options[:bgm_variable]] = 100
  334.     $game_variables[options[:bgs_variable]] = 100
  335.     $game_variables[options[:sfx_variable]] = 100
  336.     $game_switches[options[:bgm_mute_sw]] = false
  337.     $game_switches[options[:bgs_mute_sw]] = false
  338.     $game_switches[options[:sfx_mute_sw]] = false
  339.     $game_switches[options[:animation_sw]] = true
  340.     $game_switches[options[:autocursor_sw]] = true
  341.     $game_switches[options[:next_actor_sw]] = true
  342.     $game_switches[options[:skill_help_sw]] = false
  343.     $game_switches[options[:auto_dash_sw]] = false
  344.     $game_switches[options[:inst_text_sw]] = false
  345.     $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] =
  346.       YEM::SYSTEM::DEFAULT_SKIN_VALUE
  347.   end
  348.   
  349. end # Game_System

  350. #===============================================================================
  351. # Game_Player
  352. #===============================================================================

  353. class Game_Player < Game_Character
  354.   
  355.   #--------------------------------------------------------------------------
  356.   # alias method: dash?
  357.   #--------------------------------------------------------------------------
  358.   alias dash_sgo dash? unless $@
  359.   def dash?
  360.     if $game_switches[YEM::SYSTEM::OPTIONS[:auto_dash_sw]]
  361.       return false if @move_route_forcing
  362.       return false if $game_map.disable_dash?
  363.       return false if in_vehicle?
  364.       return false if Input.press?(Input::A)
  365.       return true
  366.     else
  367.       return dash_sgo
  368.     end
  369.   end
  370.   
  371. end # Game_Player



  372. #===============================================================================
  373. # Window_Base
  374. #===============================================================================

  375. class Window_Base < Window
  376.   
  377.   #--------------------------------------------------------------------------
  378.   # alias method: initialize
  379.   #--------------------------------------------------------------------------
  380.   alias initialize_window_sgo initialize unless $@
  381.   def initialize(x, y, width, height)
  382.     initialize_window_sgo(x, y, width, height)

  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # alias method: create_contents
  387.   #--------------------------------------------------------------------------
  388.   alias create_contents_base_sgo create_contents unless $@
  389.   def create_contents
  390.     create_contents_base_sgo
  391.     self.contents.font.color = normal_color
  392.   end
  393.   
  394. end # Window_Base

  395. #===============================================================================
  396. # Window_Selectable
  397. #===============================================================================

  398. class Window_Selectable < Window_Base
  399.   
  400.   #--------------------------------------------------------------------------
  401.   # alias method: create_contents
  402.   #--------------------------------------------------------------------------
  403.   alias create_contents_selectable_sgo create_contents unless $@
  404.   def create_contents
  405.     create_contents_selectable_sgo
  406.     self.contents.font.color = normal_color
  407.   end
  408.   
  409. end # Window_Selectable

  410. #===============================================================================
  411. # Window_SaveFile
  412. #===============================================================================

  413. class Window_SaveFile < Window_Base
  414.   
  415.   #--------------------------------------------------------------------------
  416.   # alias method: refresh
  417.   #--------------------------------------------------------------------------
  418.   alias refresh_savefile_mso refresh unless $@
  419.   def refresh
  420.     if @file_exist
  421.       n = @game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  422.       if n == 0 or !YEM::SYSTEM::WINDOW_HASH.include?(n)
  423.         n = YEM::SYSTEM::DEFAULT_SKIN_VALUE
  424.       end
  425.       skin = YEM::SYSTEM::WINDOW_HASH[n]

  426.     end
  427.     refresh_savefile_mso
  428.   end
  429.   
  430. end # Window_SaveFile

  431. #===============================================================================
  432. # Window_Message
  433. #===============================================================================

  434. class Window_Message < Window_Selectable
  435.   
  436.   #--------------------------------------------------------------------------
  437.   # alias method: update_show_fast
  438.   #--------------------------------------------------------------------------
  439.   alias update_show_fast_sgo update_show_fast unless $@
  440.   def update_show_fast
  441.     if $game_switches[YEM::SYSTEM::OPTIONS[:inst_text_sw]]
  442.       if self.pause or self.openness < 255
  443.         @show_fast = false
  444.       else
  445.         @show_fast = true
  446.       end
  447.       if @show_fast and @wait_count > 0
  448.         @wait_count -= 1
  449.       end
  450.     else
  451.       update_show_fast_sgo
  452.     end
  453.   end
  454.   
  455.   #--------------------------------------------------------------------------
  456.   # alias method: new_page
  457.   #--------------------------------------------------------------------------
  458.   alias new_page_sgo new_page unless $@
  459.   def new_page
  460.     new_page_sgo
  461.   end
  462.   
  463. end # Window_Message

  464. #===============================================================================
  465. # Window_SystemOptions
  466. #===============================================================================

  467. class Window_SystemOptions < Window_Selectable
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # initialize
  471.   #--------------------------------------------------------------------------
  472.   def initialize(help_window)
  473.     dy = help_window.height
  474.     dh = Graphics.height - dy
  475.     super(0, dy, Graphics.width, dh)
  476.     self.index = 0
  477.     refresh
  478.     @help_window = help_window
  479.     update_help
  480.   end
  481.   
  482.   #--------------------------------------------------------------------------
  483.   # item
  484.   #--------------------------------------------------------------------------
  485.   def item; return @data[self.index]; end
  486.   
  487.   #--------------------------------------------------------------------------
  488.   # refresh
  489.   #--------------------------------------------------------------------------
  490.   def refresh
  491.     @data = []
  492.     for command in YEM::SYSTEM::COMMANDS
  493.       case command
  494.       when :windowskin, :animations, :bgm_volume, :sfx_volume, :bgs_volume,
  495.       :auto_dash, :instant_text, :blank, :return_title, :return_menu
  496.       when :skill_help, :atb_active, :atb_speeds, :autocursor, :next_actor
  497.         next unless $imported["BattleEngineMelody"]
  498.         if [:atb_active, :atb_speeds].include?(command)
  499.           type = $game_variables[YEM::BATTLE_ENGINE::BATTLE_TYPE_VARIABLE]
  500.           next unless type == 2
  501.         end
  502.       else; next
  503.       end
  504.       @data.push(command)
  505.     end
  506.     @item_max = @data.size
  507.     create_contents
  508.     for i in 0...@item_max; draw_item(i); end
  509.   end
  510.   
  511.   #--------------------------------------------------------------------------
  512.   # draw_item
  513.   #--------------------------------------------------------------------------
  514.   def draw_item(index)
  515.     rect = item_rect(index)
  516.     self.contents.clear_rect(rect)
  517.     obj = @data[index]
  518.     return if obj == nil
  519.     case obj
  520.     when :windowskin
  521.       draw_window_item(obj, rect.clone)
  522.     when :bgm_volume, :sfx_volume, :bgs_volume
  523.       draw_volume_item(obj, rect.clone)
  524.     when :animations, :autocursor, :next_actor, :skill_help,
  525.     :auto_dash, :instant_text
  526.       draw_switch_item(obj, rect.clone)
  527.     when :atb_active, :atb_speeds
  528.       draw_atb_item(obj, rect.clone)
  529.     when :return_title, :return_menu
  530.       draw_solo_item(obj, rect.clone)
  531.     end
  532.   end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # draw_window_item
  536.   #--------------------------------------------------------------------------
  537.   def draw_window_item(obj, rect)
  538.     title = YEM::SYSTEM::OPTIONS[:windowskin]
  539.     self.contents.font.color = normal_color
  540.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  541.     dx = rect.x + rect.width/2
  542.     skin_id = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  543.     skin_name = YEM::SYSTEM::WINDOW_HASH[skin_id][0]
  544.     dx = rect.x + rect.width/2
  545.     self.contents.draw_text(dx, rect.y, rect.width/2, WLH, skin_name, 1)
  546.   end
  547.   
  548.   #--------------------------------------------------------------------------
  549.   # draw_volume_item
  550.   #--------------------------------------------------------------------------
  551.   def draw_volume_item(obj, rect)
  552.     options = YEM::SYSTEM::OPTIONS
  553.     case obj
  554.     when :bgm_volume
  555.       title = options[:bgm_volume]
  556.       value = $game_variables[options[:bgm_variable]]
  557.       mute  = $game_switches[options[:bgm_mute_sw]]
  558.     when :bgs_volume
  559.       title = options[:bgs_volume]
  560.       value = $game_variables[options[:bgs_variable]]
  561.       mute  = $game_switches[options[:bgs_mute_sw]]
  562.     when :sfx_volume
  563.       title = options[:sfx_volume]
  564.       value = $game_variables[options[:sfx_variable]]
  565.       mute  = $game_switches[options[:sfx_mute_sw]]
  566.     else; return
  567.     end
  568.     value = sprintf(options[:audio], value)
  569.     self.contents.font.color = normal_color
  570.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  571.     self.contents.font.color.alpha = mute ? 128 : 255
  572.     dx = rect.x + rect.width/2
  573.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, value, 1)
  574.     self.contents.font.color.alpha = mute ? 255 : 128
  575.     dx = rect.x + rect.width*3/4
  576.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, options[:mute], 1)
  577.   end
  578.   
  579.   #--------------------------------------------------------------------------
  580.   # draw_switch_item
  581.   #--------------------------------------------------------------------------
  582.   def draw_switch_item(obj, rect)
  583.     options = YEM::SYSTEM::OPTIONS
  584.     title = options[obj]
  585.     case obj
  586.     when :animations
  587.       name1 = options[:ani_show]
  588.       name2 = options[:ani_hide]
  589.       toggle = $game_switches[options[:animation_sw]]
  590.     when :autocursor
  591.       name1 = options[:curmem_on]
  592.       name2 = options[:curmem_off]
  593.       toggle = $game_switches[options[:autocursor_sw]]
  594.     when :next_actor
  595.       name1 = options[:next_on]
  596.       name2 = options[:next_off]
  597.       toggle = $game_switches[options[:next_actor_sw]]
  598.     when :skill_help
  599.       name1 = options[:help_on]
  600.       name2 = options[:help_off]
  601.       toggle = $game_switches[options[:skill_help_sw]]
  602.     when :cinematics
  603.       name1 = options[:cinem_on]
  604.       name2 = options[:cinem_off]
  605.       toggle = $game_switches[options[:cinematics_sw]]
  606.     when :auto_dash
  607.       name1 = options[:dash_on]
  608.       name2 = options[:dash_off]
  609.       toggle = $game_switches[options[:auto_dash_sw]]
  610.     when :instant_text
  611.       name1 = options[:inst_on]
  612.       name2 = options[:inst_off]
  613.       toggle = $game_switches[options[:inst_text_sw]]
  614.     else; return
  615.     end
  616.     self.contents.font.color = normal_color
  617.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  618.     self.contents.font.color.alpha = toggle ? 255 : 128
  619.     dx = rect.x + rect.width/2
  620.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name1, 1)
  621.     self.contents.font.color.alpha = toggle ? 128 : 255
  622.     dx = rect.x + rect.width*3/4
  623.     self.contents.draw_text(dx, rect.y, rect.width/4, WLH, name2, 1)
  624.   end
  625.   
  626.   #--------------------------------------------------------------------------
  627.   # draw_atb_item
  628.   #--------------------------------------------------------------------------
  629.   def draw_atb_item(obj, rect)
  630.     options = YEM::SYSTEM::OPTIONS
  631.     case obj
  632.     when :atb_active
  633.       title = options[:atb_aname]
  634.       value = $game_variables[options[:atb_avariable]]
  635.       #---
  636.       self.contents.font.color = normal_color
  637.       name1 = options[:wait_0]
  638.       dx = rect.x + rect.width/2
  639.       self.contents.font.color.alpha = (value == 0) ? 255 : 128
  640.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name1, 1)
  641.       name2 = options[:wait_1]
  642.       dx = rect.x + rect.width*5/8
  643.       self.contents.font.color.alpha = (value == 1) ? 255 : 128
  644.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name2, 1)
  645.       name3 = options[:wait_2]
  646.       dx = rect.x + rect.width*6/8
  647.       self.contents.font.color.alpha = (value == 2) ? 255 : 128
  648.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name3, 1)
  649.       name4 = options[:wait_3]
  650.       dx = rect.x + rect.width*7/8
  651.       self.contents.font.color.alpha = (value == 3) ? 255 : 128
  652.       self.contents.draw_text(dx, rect.y, rect.width/8, WLH, name4, 1)
  653.       #---
  654.     when :atb_speeds
  655.       title = options[:atb_sname]
  656.       value = $game_variables[options[:atb_svariable]] - 1
  657.       #---
  658.       for i in 0...10
  659.         self.contents.font.color = normal_color
  660.         name = (i + 1).to_s
  661.         dx = rect.x + rect.width * (10 + i)/20
  662.         self.contents.font.color.alpha = (value == i) ? 255 : 128
  663.         self.contents.draw_text(dx, rect.y, rect.width/20, WLH, name, 1)
  664.       end
  665.       #---
  666.     else; return
  667.     end
  668.     self.contents.font.color = normal_color
  669.     self.contents.draw_text(rect.x, rect.y, rect.width/2, WLH, title, 1)
  670.   end
  671.   
  672.   #--------------------------------------------------------------------------
  673.   # draw_solo_item
  674.   #--------------------------------------------------------------------------
  675.   def draw_solo_item(obj, rect)
  676.     options = YEM::SYSTEM::OPTIONS
  677.     case obj
  678.     when :return_title, :return_menu
  679.       text = options[obj]
  680.     else; return
  681.     end
  682.     self.contents.font.color = normal_color
  683.     self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text, 1)
  684.   end
  685.   
  686.   #--------------------------------------------------------------------------
  687.   # update
  688.   #--------------------------------------------------------------------------
  689.   def update
  690.     super
  691.     if Input.trigger?(Input::C)
  692.       input_case_c
  693.     elsif Input.repeat?(Input::LEFT)
  694.       input_case_left
  695.     elsif Input.repeat?(Input::RIGHT)
  696.       input_case_right
  697.     end
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # input_case_c
  702.   #--------------------------------------------------------------------------
  703.   def input_case_c
  704.     options = YEM::SYSTEM::OPTIONS
  705.     case item
  706.     when :windowskin
  707.       Sound.play_decision
  708.       $scene.open_skins_window
  709.       return
  710.     when :bgm_volume; switch = options[:bgm_mute_sw]
  711.     when :bgs_volume; switch = options[:bgs_mute_sw]
  712.     when :sfx_volume; switch = options[:sfx_mute_sw]
  713.     when :animations; switch = options[:animation_sw]
  714.     when :autocursor; switch = options[:autocursor_sw]
  715.     when :next_actor; switch = options[:next_actor_sw]
  716.     when :skill_help; switch = options[:skill_help_sw]
  717.     when :cinematics; switch = options[:cinematics_sw]
  718.     when :auto_dash;  switch = options[:auto_dash_sw]
  719.     when :instant_text; switch = options[:inst_text_sw]
  720.     when :return_title
  721.       $scene.command_to_title
  722.       return
  723.     when :return_menu
  724.       Sound.play_decision
  725.       $scene.return_scene
  726.       return
  727.     else; return
  728.     end
  729.     $game_switches[switch] = !$game_switches[switch]
  730.     Sound.play_decision
  731.     RPG::BGM::last.play if item == :bgm_volume
  732.     RPG::BGS::last.play if item == :bgs_volume
  733.     draw_item(self.index)
  734.   end
  735.   
  736.   #--------------------------------------------------------------------------
  737.   # input_case_left
  738.   #--------------------------------------------------------------------------
  739.   def input_case_left
  740.     options = YEM::SYSTEM::OPTIONS
  741.     ignore = false
  742.     case item
  743.     when :bgm_volume, :bgs_volume, :sfx_volume
  744.       value = Input.press?(Input::SHIFT) ? 10 : 1
  745.       case item
  746.       when :bgm_volume; variable = options[:bgm_variable]
  747.       when :bgs_volume; variable = options[:bgs_variable]
  748.       when :sfx_volume; variable = options[:sfx_variable]
  749.       end
  750.       return if $game_variables[variable] == 0
  751.       $game_variables[variable] -= value
  752.       $game_variables[variable] = [$game_variables[variable], 0].max
  753.       ignore = true
  754.     when :atb_active
  755.       variable = options[:atb_avariable]
  756.       return if $game_variables[variable] == 0
  757.       $game_variables[variable] -= 1
  758.       $game_variables[variable] = [$game_variables[variable], 0].max
  759.       ignore = true
  760.     when :atb_speeds
  761.       variable = options[:atb_svariable]
  762.       return if $game_variables[variable] == 1
  763.       $game_variables[variable] -= 1
  764.       $game_variables[variable] = [$game_variables[variable], 1].max
  765.       ignore = true
  766.     when :animations; switch = options[:animation_sw]
  767.     when :autocursor; switch = options[:autocursor_sw]
  768.     when :next_actor; switch = options[:next_actor_sw]
  769.     when :skill_help; switch = options[:skill_help_sw]
  770.     when :cinematics; switch = options[:cinematics_sw]
  771.     when :auto_dash;  switch = options[:auto_dash_sw]
  772.     when :instant_text; switch = options[:inst_text_sw]
  773.     else; return
  774.     end
  775.     unless ignore
  776.       return if $game_switches[switch]
  777.       $game_switches[switch] = true
  778.     end
  779.     Sound.play_cursor
  780.     RPG::BGM::last.play if item == :bgm_volume
  781.     RPG::BGS::last.play if item == :bgs_volume
  782.     draw_item(self.index)
  783.   end
  784.   
  785.   #--------------------------------------------------------------------------
  786.   # input_case_right
  787.   #--------------------------------------------------------------------------
  788.   def input_case_right
  789.     options = YEM::SYSTEM::OPTIONS
  790.     ignore = false
  791.     case item
  792.     when :bgm_volume, :bgs_volume, :sfx_volume
  793.       value = Input.press?(Input::SHIFT) ? 10 : 1
  794.       case item
  795.       when :bgm_volume; variable = options[:bgm_variable]
  796.       when :bgs_volume; variable = options[:bgs_variable]
  797.       when :sfx_volume; variable = options[:sfx_variable]
  798.       end
  799.       return if $game_variables[variable] == 100
  800.       $game_variables[variable] += value
  801.       $game_variables[variable] = [$game_variables[variable], 100].min
  802.       ignore = true
  803.     when :atb_active
  804.       variable = options[:atb_avariable]
  805.       return if $game_variables[variable] == 3
  806.       $game_variables[variable] += 1
  807.       $game_variables[variable] = [$game_variables[variable], 3].min
  808.       ignore = true
  809.     when :atb_speeds
  810.       variable = options[:atb_svariable]
  811.       return if $game_variables[variable] == 10
  812.       $game_variables[variable] += 1
  813.       $game_variables[variable] = [$game_variables[variable], 10].min
  814.       ignore = true
  815.     when :animations; switch = options[:animation_sw]
  816.     when :autocursor; switch = options[:autocursor_sw]
  817.     when :next_actor; switch = options[:next_actor_sw]
  818.     when :skill_help; switch = options[:skill_help_sw]
  819.     when :cinematics; switch = options[:cinematics_sw]
  820.     when :auto_dash;  switch = options[:auto_dash_sw]
  821.     when :instant_text; switch = options[:inst_text_sw]
  822.     else; return
  823.     end
  824.     unless ignore
  825.       return if !$game_switches[switch]
  826.       $game_switches[switch] = false
  827.     end
  828.     Sound.play_cursor
  829.     RPG::BGM::last.play if item == :bgm_volume
  830.     RPG::BGS::last.play if item == :bgs_volume
  831.     draw_item(self.index)
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # update_help
  836.   #--------------------------------------------------------------------------
  837.   def update_help
  838.     case item
  839.     when :bgm_volume; type = :bgm_des
  840.     when :bgs_volume; type = :bgs_des
  841.     when :sfx_volume; type = :sfx_des
  842.     when :animations; type = :ani_des
  843.     when :autocursor; type = :curmem_des
  844.     when :next_actor; type = :next_des
  845.     when :skill_help; type = :help_des
  846.     when :cinematics; type = :cinem_des
  847.     when :windowskin; type = :wind_des
  848.     when :auto_dash;  type = :dash_des
  849.     when :instant_text; type = :inst_des
  850.     when :return_title; type = :retitle_des
  851.     when :return_menu;  type = :remenu_des
  852.     when :atb_active
  853.       case $game_variables[YEM::SYSTEM::OPTIONS[:atb_avariable]]
  854.       when 0; type = :wait_0_des
  855.       when 1; type = :wait_1_des
  856.       when 2; type = :wait_2_des
  857.       when 3: type = :wait_3_des
  858.       end
  859.     when :atb_speeds; type = :atb_s_des
  860.     else; type = nil
  861.     end
  862.     text = YEM::SYSTEM::OPTIONS[type].to_s
  863.     @help_window.set_text(text, 1)
  864.   end
  865.   
  866. end # Window_SystemOptions

  867. #===============================================================================
  868. # Window_Skins
  869. #===============================================================================

  870. class Window_Skins < Window_Selectable
  871.   
  872.   #--------------------------------------------------------------------------
  873.   # initialize
  874.   #--------------------------------------------------------------------------
  875.   def initialize
  876.     dx = Graphics.width/4
  877.     dw = Graphics.width/2
  878.     dh = Graphics.height - 112
  879.     super(dx, 56, dw, dh)
  880.     @column_max = 1
  881.     self.index = 0
  882.     self.back_opacity = 255
  883.     self.openness = 0
  884.     self.active = false
  885.     refresh
  886.   end
  887.   
  888.   #--------------------------------------------------------------------------
  889.   # refresh
  890.   #--------------------------------------------------------------------------
  891.   def refresh
  892.     @data = []
  893.     variable = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE]
  894.     hash = YEM::SYSTEM::WINDOW_HASH.sort{ |a,b| a[0] <=> b[0] }
  895.     for key in hash
  896.       @data.push(key[0])
  897.       self.index = key[0] - 1 if key[0] == $game_variables[variable]
  898.     end
  899.     @item_max = @data.size
  900.     create_contents
  901.     for i in 0...@item_max
  902.       draw_item(i)
  903.     end
  904.   end
  905.   
  906.   #--------------------------------------------------------------------------
  907.   # draw_item
  908.   #--------------------------------------------------------------------------
  909.   def draw_item(index)
  910.     rect = item_rect(index)
  911.     self.contents.clear_rect(rect)
  912.     rect.width -= 4
  913.     text = YEM::SYSTEM::WINDOW_HASH[@data[index]][0]
  914.     self.contents.draw_text(rect, text, 1)
  915.   end
  916.   
  917. end # Window_Skins

  918. #===============================================================================
  919. # Scene_Title
  920. #===============================================================================

  921. class Scene_Title < Scene_Base
  922.   
  923.   #--------------------------------------------------------------------------
  924.   # alias method: create_game_objects
  925.   #--------------------------------------------------------------------------
  926.   alias create_game_objects_sgo create_game_objects unless $@
  927.   def create_game_objects
  928.     create_game_objects_sgo
  929.     $game_system.create_system_options
  930.   end
  931.   
  932. end # Scene_Title

  933. #===============================================================================
  934. # Scene_Map
  935. #===============================================================================

  936. class Scene_Map < Scene_Base
  937.   
  938.   #--------------------------------------------------------------------------
  939.   # alias method: start
  940.   #--------------------------------------------------------------------------
  941.   alias start_sgo start unless $@
  942.   def start
  943.     $game_system.create_system_options
  944.     start_sgo
  945.   end
  946.   
  947. end # Scene_Map

  948. #===============================================================================
  949. # Scene_Battle
  950. #===============================================================================

  951. class Scene_Battle < Scene_Base
  952.   
  953.   #--------------------------------------------------------------------------
  954.   # alias method: display_normal_animation
  955.   #--------------------------------------------------------------------------
  956.   unless $imported["BattleEngineMelody"]
  957.   alias display_normal_animation_sgo display_normal_animation unless $@
  958.   def display_normal_animation(targets, animation_id, mirror = false)
  959.     return if $game_switches[YEM::SYSTEM::OPTIONS[:animation_sw]]
  960.     display_normal_animation_sgo(targets, animation_id, mirror)
  961.   end
  962.   end # $imported["BattleEngineMelody"]
  963.   
  964. end # Scene_Battle

  965. #===============================================================================
  966. # Scene_End
  967. #===============================================================================

  968. class Scene_End < Scene_Base
  969.   
  970.   #--------------------------------------------------------------------------
  971.   # public instance variables
  972.   #--------------------------------------------------------------------------
  973.   attr_accessor :window_var
  974.   
  975.   #--------------------------------------------------------------------------
  976.   # overwrite method: start
  977.   #--------------------------------------------------------------------------
  978.   def start
  979.     super
  980.     create_menu_background
  981.     @window_var = YEM::SYSTEM::WINDOWSKIN_VARIABLE
  982.     @help_window = Window_Help.new
  983.     @options_window = Window_SystemOptions.new(@help_window)
  984.     @skins_window = Window_Skins.new
  985.   end
  986.   
  987.   #--------------------------------------------------------------------------
  988.   # overwrite method: post_start
  989.   #--------------------------------------------------------------------------
  990.   def post_start; super; end
  991.   
  992.   #--------------------------------------------------------------------------
  993.   # overwrite method: pre_terminate
  994.   #--------------------------------------------------------------------------
  995.   def pre_terminate; super; end
  996.    
  997.   #--------------------------------------------------------------------------
  998.   # overwrite method: close_command_window
  999.   #--------------------------------------------------------------------------
  1000.   def close_command_window; end
  1001.   
  1002.   #--------------------------------------------------------------------------
  1003.   # overwrite method: terminate
  1004.   #--------------------------------------------------------------------------
  1005.   def terminate
  1006.     super
  1007.     @help_window.dispose
  1008.     @options_window.dispose
  1009.     @skins_window.dispose
  1010.     dispose_menu_background
  1011.   end
  1012.   
  1013.   #--------------------------------------------------------------------------
  1014.   # overwrite method: update
  1015.   #--------------------------------------------------------------------------
  1016.   def update
  1017.     super
  1018.     @help_window.update
  1019.     @skins_window.update
  1020.     update_menu_background
  1021.     if @options_window.active
  1022.       update_options_window
  1023.     elsif @skins_window.active
  1024.       update_skins_window
  1025.     end
  1026.   end
  1027.   
  1028.   #--------------------------------------------------------------------------
  1029.   # new method: update_options_window
  1030.   #--------------------------------------------------------------------------
  1031.   def update_options_window
  1032.     @options_window.update
  1033.     if Input.trigger?(Input::B)
  1034.       Sound.play_cancel
  1035.       return_scene
  1036.     end
  1037.   end
  1038.   
  1039.   #--------------------------------------------------------------------------
  1040.   # new method: open_skins_window
  1041.   #--------------------------------------------------------------------------
  1042.   def open_skins_window
  1043.     @skins_window.open
  1044.     @skins_window.index = $game_variables[YEM::SYSTEM::WINDOWSKIN_VARIABLE] - 1
  1045.     @skins_window.active = true
  1046.     @options_window.active = false
  1047.   end
  1048.   
  1049.   #--------------------------------------------------------------------------
  1050.   # new method: update_skins_window
  1051.   #--------------------------------------------------------------------------
  1052.   def update_skins_window
  1053.     if @last_index != @skins_window.index
  1054.       @last_index = @skins_window.index
  1055.       update_skins
  1056.     end
  1057.     if Input.trigger?(Input::B)
  1058.       Sound.play_cancel
  1059.       @skins_window.close
  1060.       @skins_window.active = false
  1061.       @options_window.active = true
  1062.     elsif Input.trigger?(Input::C)
  1063.       Sound.play_decision
  1064.       @skins_window.close
  1065.       @skins_window.active = false
  1066.       @options_window.active = true
  1067.     end
  1068.   end
  1069.   
  1070.   #--------------------------------------------------------------------------
  1071.   # new method: update_skins
  1072.   #--------------------------------------------------------------------------
  1073.   def update_skins
  1074.     $game_variables[@window_var] = @skins_window.index + 1

  1075.     @options_window.refresh

  1076.     @help_window.set_text("")
  1077.     @options_window.update_help

  1078.     @skins_window.back_opacity = 255
  1079.     @skins_window.refresh
  1080.     @options_window.draw_item(@options_window.index)
  1081.   end
  1082.   
  1083. end # Scene_End

  1084. #===============================================================================
  1085. #
  1086. # END OF FILE
  1087. #
  1088. #===============================================================================
复制代码
不仅可以调音量还能干很多事。。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1