查看: 1270|回复: 0

[已经过期] 关于音乐盒脚本的问题

[复制链接]
梦石
0
星屑
50
在线时间
476 小时
注册时间
2011-3-22
回帖
33
发表于 2014-1-14 14:32:03 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我用了一个音乐盒的脚本,但是这个脚本有个问题,
如果在Window_TitleCommand和Scene_Title中加入打开音乐盒的指令,
打开音乐盒之后解锁的音乐只有Scene_Title的背景音乐,而其他音乐要读取存档后在游戏过程中打开音乐盒才会显示解锁,
然后退出游戏,再打开游戏,从Scene_Title进入音乐盒,还是只有Scene_Title的背景音乐被解锁。
我觉得应该是脚本把音乐的解锁信息存到游戏存档中去了,所以在刚打开游戏没有读取存档的时候无法获取曾经解锁过的音乐。
要如何修改这个脚本才能在从Scene_Title进入音乐盒时,解锁所有之前在游戏过程中解锁过的音乐。或者提供另外一个具有上述功能的脚本。
附上本人使用的音乐盒脚本

  1. #==============================================================================
  2. # +++ MOG - MUSIC BOX  (v1.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Sistema que permite escutar as músicas tocadas durante o jogo.
  8. #==============================================================================
  9. #==============================================================================
  10. # UTILIZAÇÃO
  11. #
  12. # 1 - Crie uma pasta com o nome MUSIC COVER
  13. #     /Graphics/Music_Cover/
  14. #
  15. # 2 - Copie os seguintes arquivos contidos na Demo.
  16. #     Layout.png
  17. #     Layout2.png
  18. #
  19. #==============================================================================
  20. # OPCIONAL
  21. #
  22. # Para adicionar imagens vinculadas as músicas nomeie as imagens da
  23. # seguinte forma.
  24. #
  25. # FILE_NAME + _B1
  26. # FILE_NAME + _B2
  27. #
  28. # Exemplo (eg)
  29. #
  30. # Nome da música
  31. # Theme5.MP3 (Ogg/mid/etc...)
  32. #
  33. # Nome dos arquivos gráficos que ficarão na pasta /Graphics/Music_Cover/
  34. # Theme5_B1.png
  35. # Theme5_B2.png
  36. #
  37. # NOTA - O Sufixo _B1 é a imagem que terá o efeito scrolling, caso não queira
  38. #        o efeito de deslizar a imagem basta criar apenas um arquivo de
  39. #        imagem e nomea-lo com o sufixo _B2
  40. #
  41. #==============================================================================
  42. # Para chamar o script use o comando abaixo.
  43. #
  44. # SceneManager.call(Scene_Music_Box)
  45. #
  46. #==============================================================================

  47. #==============================================================================
  48. # ● Histórico (Version History)
  49. #==============================================================================
  50. # v 1.1 - Melhoria no sistema de dispose.
  51. #==============================================================================

  52. module MOG_MUSIC_BOX
  53.   # Posição da janela da lista de músicas.
  54.   MUSIC_LIST_POSITION_TEXT = [0, 200]
  55.   # Posição do layout da lista de músicas.
  56.   MUSIC_LIST_POSITION_LAYOUT = [0, 195]
  57.   # Tempo para ocultar a janela de lista de músicas.
  58.   MUSICLIST_FADE_TIME = 2#(Sec)
  59.   # Definição da velocidade de deslizar a imagem de fundo. [X,Y]
  60.   BACKGROUND_SCROLL_SPEED = [2,0]  
  61.   # Ativar a animação do gráfico do personagem. *(Não é obrigatório ser
  62.   # a imagem de um personagem, você pode criar outros efeitos de animações
  63.   # no lugar do personagem.
  64.   CHARACTER_SPRITE = true
  65.   # Velociadade da animação do personagem.
  66.   CHARACTER_ANIMATION_SPEED = 30
  67.   # Posição do personagem
  68.   CHARACTER_POSITION = [500,280]
  69.   # Definição da palavra Completado.
  70.   COMPLETED_WORD =  "Completed"
  71.   # Posição do texto de informação.
  72.   INFO_POSITION = [0,573]  
  73.   # Incluir músicas contidas no RTP.
  74.   INCLUDE_RTP = true
  75.   # Definição do diretório que foi instalado o RTP.
  76.   # Por padrão o caminho do diretório foi baseado no Windows 7 (64Bits).
  77.   # Outros sistemas operacionais o caminho do diretório é diferente.
  78.   RTP_PATH = "D:\software\game maker\RPG Maker VX Ace\RTP\Audio\BGM"
  79.   # Ativar o comando Music Box no menu principal.
  80.   MENU_COMMAND = false
  81.   # Nome do comando
  82.   MENU_COMMAND_NAME = "Music Box"  
  83. end


  84. #===============================================================================
  85. # ■ Game System
  86. #===============================================================================
  87. class Game_System
  88.   
  89.   attr_accessor  :music_book_list

  90. #--------------------------------------------------------------------------
  91. # ● Initialize
  92. #--------------------------------------------------------------------------                     
  93.   alias mog_music_book_initialize initialize
  94.   def initialize
  95.       mog_music_book_initialize
  96.       music_book_setup
  97.   end

  98. #--------------------------------------------------------------------------
  99. # ● Music Book Setup
  100. #--------------------------------------------------------------------------                  
  101.   def music_book_setup
  102.       return if !SceneManager.scene_is?(Scene_Title)
  103.       @music_book_list = []
  104.       @music_book_list.push([$data_system.title_bgm.name,true]) if $data_system.title_bgm.name != ""
  105.       path = "Audio/BGM/"  
  106.       make_music_list(path)  
  107.       if MOG_MUSIC_BOX::INCLUDE_RTP
  108.          path = MOG_MUSIC_BOX::RTP_PATH
  109.          make_music_list(path)
  110.       end
  111.     end  
  112.    
  113. #--------------------------------------------------------------------------
  114. # ● Make_Music_List
  115. #--------------------------------------------------------------------------                       
  116.   def make_music_list(path)
  117.       return if !File.directory?(path)
  118.       list = Dir.entries(path)
  119.       for i in 2...list.size
  120.           file_name = File.basename(list[i].to_s,  ".*")
  121.           @music_book_list.push([file_name,false]) unless repeated_song?(file_name)
  122.       end   
  123.    end
  124.   
  125. #--------------------------------------------------------------------------
  126. # ● Repeated Song?
  127. #--------------------------------------------------------------------------                          
  128.   def repeated_song?(file_name)
  129.       for i in [email]0...@music_book_list.size[/email]         
  130.          return true if @music_book_list[i].include?(file_name)
  131.       end
  132.       return false
  133.   end  
  134.    
  135. end  

  136. #===============================================================================
  137. # ■ RPG AudioFile
  138. #===============================================================================
  139. class RPG::BGM < RPG::AudioFile
  140.   
  141. #--------------------------------------------------------------------------
  142. # ● Play
  143. #--------------------------------------------------------------------------                     
  144.   alias mog_music_book_play play
  145.   def play(pos = 0)
  146.       mog_music_book_play(pos)
  147.       check_music_book
  148.   end
  149.   
  150. #--------------------------------------------------------------------------
  151. # ● Check Music Book
  152. #--------------------------------------------------------------------------                  
  153.   def check_music_book
  154.       return if $game_system.music_book_list == nil      
  155.       return if @name.empty?
  156.       for i in 0...$game_system.music_book_list.size
  157.           if $game_system.music_book_list[i][0] == @name
  158.              $game_system.music_book_list[i][1] = true
  159.              break
  160.           end  
  161.       end  
  162.   end  
  163.   
  164. end
  165.   
  166. #===============================================================================
  167. # ■ RPG Cache
  168. #===============================================================================
  169. module Cache
  170.   
  171.   #--------------------------------------------------------------------------
  172.   # ● Music Cover
  173.   #--------------------------------------------------------------------------
  174.   def self.music_cover(filename)
  175.       load_bitmap("Graphics/Music_Cover/", filename)
  176.   end
  177.   
  178. end  

  179. #===============================================================================
  180. # ■ RPG_FileTest
  181. #===============================================================================
  182. module RPG_FileTest
  183.   
  184.   #--------------------------------------------------------------------------
  185.   # ● RPG_FileTest.music_cover_exist?
  186.   #--------------------------------------------------------------------------
  187.   def RPG_FileTest.music_cover_exist?(filename)
  188.       return Cache.music_cover(filename) rescue return false
  189.   end  
  190.   
  191. end

  192. #==============================================================================
  193. # ■ Window_Picture
  194. #==============================================================================
  195. class Window_Music_List < Window_Selectable
  196.   
  197. #------------------------------------------------------------------------------
  198. # ● Initialize
  199. #------------------------------------------------------------------------------   
  200.   def initialize
  201.       super(0, 0, 544, 280)
  202.       self.opacity = 0
  203.       [url=home.php?mod=space&uid=370741]@Index[/url] = -1
  204.       @item_max = $game_system.music_book_list.size
  205.       refresh
  206.       select(0)
  207.       activate
  208.   end
  209. def set_cursor
  210.     mouse_row, mouse_col = mouse_window_area
  211.     if    mouse_row == -1
  212.       @move_state += 1 if need_scroll?
  213.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  214.     elsif mouse_row == -2
  215.       @move_state += 1 if need_scroll?
  216.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  217.     elsif mouse_col == -1
  218.       @move_state += 1 if need_scroll?
  219.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  220.     elsif mouse_col == -2
  221.       @move_state += 1 if need_scroll?
  222.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  223.     else
  224.       @move_state = 0
  225.       new_index = (top_row + mouse_row) * col_max + mouse_col
  226.       select(new_index) if new_index < item_max && new_index != @index
  227.     end
  228.   end
  229. #------------------------------------------------------------------------------
  230. # ● Refresh
  231. #------------------------------------------------------------------------------   
  232.   def refresh
  233.       if self.contents != nil
  234.          self.contents.dispose
  235.          self.contents = nil
  236.       end
  237.       if @item_max > 0         
  238.          self.contents = Bitmap.new(width - 32, 24 * @item_max)
  239.          for i in 0...@item_max
  240.             draw_item(i)
  241.          end
  242.          return
  243.       end
  244.       self.contents = Bitmap.new(width - 32, 24)
  245.       self.contents.draw_text(x,y,440,32,"No Data",0)   
  246.   end
  247.   
  248. #------------------------------------------------------------------------------
  249. # ● draw_item
  250. #------------------------------------------------------------------------------   
  251.   def draw_item(index)
  252.       x = 0
  253.       y = 24 * index
  254.       if $game_system.music_book_list[index][1]
  255.          change_color(normal_color,true)
  256.          music = "N" + sprintf("%02d", index + 1).to_s +  " - "+ $game_system.music_book_list[index][0].to_s
  257.       else
  258.          change_color(normal_color,false)
  259.          music = "N" + sprintf("%02d", index + 1).to_s +  " - Not Available"
  260.       end  
  261.       self.contents.draw_text(x,y,440,32,music,0)
  262.   end
  263.   
  264. #------------------------------------------------------------------------------
  265. # ● Col Max
  266. #------------------------------------------------------------------------------      
  267.   def col_max
  268.       return 1
  269.   end
  270.    
  271. #------------------------------------------------------------------------------
  272. # ● Item Max
  273. #------------------------------------------------------------------------------         
  274.   def item_max
  275.       return @item_max == nil ? 0 : @item_max
  276.   end  
  277.   
  278. end

  279. #===============================================================================
  280. # ■ Scene Music Box
  281. #===============================================================================
  282. class Scene_Music_Box
  283. include MOG_MUSIC_BOX

  284. #--------------------------------------------------------------------------
  285. # ● Main
  286. #--------------------------------------------------------------------------               
  287.   def main
  288.       
  289.       execute_dispose
  290.       create_music_list
  291.       create_layout
  292.       create_sprite_now_playing
  293.       create_character
  294.       execute_loop
  295.       execute_dispose      
  296.   end

  297. #--------------------------------------------------------------------------
  298. # ● Execute Loop
  299. #--------------------------------------------------------------------------                 
  300.   def execute_loop
  301.       Graphics.transition
  302.       loop do
  303.            Graphics.update
  304.            Input.update
  305.            update
  306.            break if SceneManager.scene != self
  307.      end        
  308.    end  
  309.   
  310. #--------------------------------------------------------------------------
  311. # ● Create Layout
  312. #--------------------------------------------------------------------------                 
  313.   def create_layout
  314.       @background = Plane.new
  315.       @background.z = 1
  316.       @background2 = Sprite.new
  317.       @background2.z = 2      
  318.       @layout = Sprite.new
  319.       @layout.bitmap = Cache.music_cover("Layout")
  320.       @layout.z = 90
  321.       @old_index = -1
  322.   end
  323.   
  324. #--------------------------------------------------------------------------
  325. # ● create Sprite now Playing
  326. #--------------------------------------------------------------------------                  
  327.   def create_sprite_now_playing
  328.       @now_playing = Plane.new
  329.       @now_playing.bitmap = Bitmap.new(800,608)
  330.       @now_playing.z = 100
  331.       check_completion
  332.       make_now_playing(true)
  333.   end  

  334. #--------------------------------------------------------------------------
  335. # ● Check Completion
  336. #--------------------------------------------------------------------------                     
  337.   def check_completion
  338.       comp = 0
  339.       for i in 0...$game_system.music_book_list.size
  340.           comp += 1 if $game_system.music_book_list[i][1]        
  341.       end
  342.       if  $game_system.music_book_list.size > 0   
  343.           @completed = "( " + COMPLETED_WORD + " " + (comp.to_f / $game_system.music_book_list.size * 100).truncate.to_s + "% )"
  344.       else
  345.           @completed = "( " + COMPLETED_WORD + " )"
  346.       end  
  347.   end
  348.   
  349. #--------------------------------------------------------------------------
  350. # ● Create_Character
  351. #--------------------------------------------------------------------------                       
  352.   def create_character
  353.       return if !CHARACTER_SPRITE
  354.       @character_index = 0
  355.       @character_animation_speed = 0
  356.       @character = Sprite.new
  357.       @character.z = 80
  358.       @character_image = Cache.music_cover("Character")
  359.       @character_frame_max = @character_image.width / @character_image.height
  360.       @character_width = @character_image.width / @character_frame_max  
  361.       @character.bitmap = Bitmap.new(@character_width,@character_image.height)
  362.       @character.x = CHARACTER_POSITION[0]
  363.       @character.y = CHARACTER_POSITION[1]     
  364.       make_character_bitmap
  365.   end
  366.   
  367. #--------------------------------------------------------------------------
  368. # ● Make Now Playing
  369. #--------------------------------------------------------------------------                     
  370. def make_now_playing(init = false)
  371.      @now_playing.bitmap.clear
  372.      @now_playing.bitmap.font.size = 20
  373.      @now_playing.bitmap.font.bold = true
  374.      text = song_name + "   " + @completed
  375.      text = @completed if init
  376.      @now_playing.bitmap.draw_text(INFO_POSITION[0],INFO_POSITION[1], 800, 32, text.to_s,1)      
  377.      @now_playing.opacity = 0
  378. end

  379. #--------------------------------------------------------------------------
  380. # ● Make Background
  381. #--------------------------------------------------------------------------                  
  382. def make_background
  383.      if @background.bitmap != nil
  384.         @background.bitmap.dispose
  385.         @background.bitmap = nil
  386.      end  
  387.      if RPG_FileTest.music_cover_exist?(song_name + "_B1")
  388.         @background.bitmap = Cache.music_cover(song_name + "_B1")
  389.      else
  390.         @background.bitmap = Cache.music_cover("")
  391.      end  
  392.      @background.opacity = 0
  393.      if @background2.bitmap != nil
  394.         @background2.bitmap.dispose
  395.         @background2.bitmap = nil
  396.      end  
  397.      if RPG_FileTest.music_cover_exist?(song_name + "_B2")
  398.         @background2.bitmap = Cache.music_cover(song_name + "_B2")
  399.      else
  400.         @background2.bitmap = Cache.music_cover("")
  401.      end  
  402.      @background2.opacity = 0     
  403. end

  404. #--------------------------------------------------------------------------
  405. # ● Song Name
  406. #--------------------------------------------------------------------------                    
  407. def song_name
  408.      if $game_system.music_book_list.size == 0      
  409.         return ""
  410.      end  
  411.      return $game_system.music_book_list[@music_list_window.index][0].to_s
  412. end

  413. #--------------------------------------------------------------------------
  414. # ● Create_Music_List
  415. #--------------------------------------------------------------------------                     
  416.   def create_music_list
  417.       [url=home.php?mod=space&uid=76426]@stop[/url] = true
  418.       @layout2 = Sprite.new
  419.       @layout2.bitmap = Cache.music_cover("Layout2")
  420.       @layout_org_position = [MUSIC_LIST_POSITION_LAYOUT[0],MUSIC_LIST_POSITION_LAYOUT[1]]      
  421.       @layout2.y = @layout_org_position[1]
  422.       @layout2.z = 90   
  423.       @music_list_window = Window_Music_List.new
  424.       @music_list_window.z = 100
  425.       @music_list_window_org = [MUSIC_LIST_POSITION_TEXT[0],MUSIC_LIST_POSITION_TEXT[1]]
  426.       @music_list_window.y = @music_list_window_org[1]
  427.       @music_index = @music_list_window.index
  428.       @fade_max =  60 + 60 * MUSICLIST_FADE_TIME
  429.       @fade_time = @fade_max
  430.       @music_list_window.x = 0
  431.       @music_list_window.contents_opacity = 0
  432.       @layout2.x = 0
  433.       @layout2.opacity = 0        
  434.   end  
  435.   
  436. #--------------------------------------------------------------------------
  437. # ● Initialize
  438. #--------------------------------------------------------------------------                  
  439.   def initialize
  440.       BattleManager.save_bgm_and_bgs
  441.       RPG::BGM.fade(2 * 1000)
  442.       RPG::BGS.fade(2 * 1000)
  443.       @w_visible = true
  444.   end  
  445. #--------------------------------------------------------------------------
  446. # ● Execute Dispose
  447. #--------------------------------------------------------------------------                  
  448.   def execute_dispose
  449.       return if @layout == nil
  450.       Graphics.freeze
  451.       @music_list_window.dispose
  452.       if @background.bitmap != nil
  453.          @background.bitmap.dispose
  454.       end      
  455.       @background.dispose
  456.       if @background2.bitmap != nil
  457.          @background2.bitmap.dispose
  458.       end      
  459.       @background2.dispose      
  460.       @layout.bitmap.dispose
  461.       @layout.dispose
  462.       @layout = nil
  463.       @layout2.bitmap.dispose
  464.       @layout2.dispose      
  465.       @now_playing.bitmap.dispose
  466.       @now_playing.dispose
  467.       if CHARACTER_SPRITE
  468.          @character.bitmap.dispose
  469.          @character.dispose
  470.          @character_image.dispose
  471.       end   
  472.       RPG::BGM.stop
  473.       BattleManager.replay_bgm_and_bgs
  474.   end
  475.   
  476. #--------------------------------------------------------------------------
  477. # ● Hide_Layout
  478. #--------------------------------------------------------------------------                       
  479.   def hide_layout
  480.       Sound.play_ok
  481.       @w_visible = @w_visible == true ? false : true
  482.       @fade_time = @w_visible ? @fade_max : 0
  483.       @layout.visible = @w_visible
  484.       if CHARACTER_SPRITE
  485.          @character.visible = @w_visible
  486.       end  
  487.   end   
  488.   
  489. #--------------------------------------------------------------------------
  490. # ● Update
  491. #--------------------------------------------------------------------------                  
  492.   def update
  493.       update_commands
  494.       update_animation
  495.   end

  496. #--------------------------------------------------------------------------
  497. # ● Update Animation
  498. #--------------------------------------------------------------------------                     
  499.   def update_animation
  500.       @now_playing.opacity += 2
  501.       @now_playing.ox += 1
  502.       update_list_fade
  503.       update_character_animation
  504.       update_background_animation
  505.   end  

  506. #--------------------------------------------------------------------------
  507. # ● Update Background Animation
  508. #--------------------------------------------------------------------------                       
  509.   def update_background_animation
  510.       @background.opacity += 1
  511.       @background2.opacity += 1
  512.       @background.ox += BACKGROUND_SCROLL_SPEED[0]
  513.       @background.oy += BACKGROUND_SCROLL_SPEED[1]   
  514.   end
  515.       
  516. #--------------------------------------------------------------------------
  517. # ● Update Character Animation
  518. #--------------------------------------------------------------------------                       
  519.   def update_character_animation
  520.       return if !CHARACTER_SPRITE or @stop
  521.       @character_animation_speed += 1
  522.       if @character_animation_speed > CHARACTER_ANIMATION_SPEED
  523.          @character_animation_speed = 0
  524.          @character_index += 1
  525.          @character_index = 0 if @character_index >= @character_frame_max
  526.          make_character_bitmap   
  527.       end
  528.   end

  529. #--------------------------------------------------------------------------
  530. # ● Make Character_bitmap
  531. #--------------------------------------------------------------------------                        
  532.   def make_character_bitmap
  533.       @character.bitmap.clear
  534.       src_rect_back = Rect.new(@character_width * @character_index, 0,@character_width,@character_image.height)
  535.       @character.bitmap.blt(0,0, @character_image, src_rect_back)  
  536.   end

  537. #--------------------------------------------------------------------------
  538. # ● Update List Fade
  539. #--------------------------------------------------------------------------                       
  540.   def update_list_fade
  541.       @fade_time = @fade_max if moved?
  542.       slide_speed = 5
  543.       fade_speed = 3
  544.       if @fade_time > 0
  545.          @fade_time -= 1
  546.          @layout2.opacity += fade_speed * 2
  547.          @music_list_window.contents_opacity += fade_speed * 2
  548.          if @music_list_window.x < @music_list_window_org[0]
  549.             @music_list_window.x += slide_speed * 2
  550.             @layout2.x += slide_speed * 2
  551.             if @music_list_window.x >= @music_list_window_org[0]
  552.                @music_list_window.x = @music_list_window_org[0]
  553.                @layout2.x = @layout_org_position[0]
  554.             end  
  555.          end
  556.       else
  557.          @music_list_window.x -= slide_speed
  558.          @music_list_window.contents_opacity -= fade_speed
  559.          @layout2.x -= slide_speed
  560.          @layout2.opacity -= fade_speed
  561.          if @music_list_window.x < -800
  562.             @music_list_window.x = -800
  563.             @music_list_window.contents_opacity = 0
  564.             @layout2.x = -800
  565.             @layout2.opacity = 0         
  566.           end  
  567.       end
  568.   end  

  569. #--------------------------------------------------------------------------
  570. # ● Moved?
  571. #--------------------------------------------------------------------------                       
  572.   def moved?
  573.       return true if Input.trigger?(:C)
  574.       return true if Input.trigger?(:B)
  575.       return true if Input.trigger?(:X)
  576.       return true if Input.trigger?(:R)
  577.       return true if Input.trigger?(:L)
  578.       return true if Input.press?(Input.dir4)
  579.       return false
  580.   end  
  581.   
  582. #--------------------------------------------------------------------------
  583. # ● Update Commands
  584. #--------------------------------------------------------------------------                     
  585.   def update_commands
  586.       @music_list_window.update
  587.       if Input.trigger?(:B)
  588.          return_to_scene
  589.       elsif Input.trigger?(:C)
  590.          play_song
  591.       elsif Input.trigger?(:X)
  592.          stop_song
  593.       elsif Input.trigger?(:Y)
  594.          hide_layout
  595.       end  
  596.   end
  597.   
  598. #--------------------------------------------------------------------------
  599. # ● Return to Scene
  600. #--------------------------------------------------------------------------                           
  601.   def return_to_scene
  602.       return if @fade_time == 0 and @layout2.opacity == 0
  603.       Sound.play_cancel
  604.       SceneManager.return
  605.   end
  606.       
  607. #--------------------------------------------------------------------------
  608. # ● index_changed?
  609. #--------------------------------------------------------------------------                        
  610.   def index_changed?
  611.       if @old_index != @music_list_window.index
  612.          @old_index = @music_list_window.index
  613.          return true
  614.       end  
  615.       return false
  616.   end  
  617.   
  618. #--------------------------------------------------------------------------
  619. # ● Play Song
  620. #--------------------------------------------------------------------------                       
  621.   def play_song
  622.       return if $game_system.music_book_list.size == 0
  623.       return if @fade_time == 0 and @layout2.opacity == 0
  624.       if $game_system.music_book_list[@music_list_window.index][1]
  625.          if index_changed? or @stop
  626.             Sound.play_ok            
  627.             @stop = false
  628.             Audio.bgm_play("Audio/BGM/" +  song_name, 100, 100) rescue nil
  629.             make_background
  630.             make_now_playing
  631.           end  
  632.       else
  633.          Sound.play_buzzer
  634.       end      
  635.   end  
  636.   
  637. #--------------------------------------------------------------------------
  638. # ● Stop Song
  639. #--------------------------------------------------------------------------                        
  640.   def stop_song
  641.       Sound.play_ok
  642.       @stop = true
  643.       RPG::BGM.fade(3 * 1000)
  644.       make_now_playing(true)   
  645.   end  
  646. end

  647. if MOG_MUSIC_BOX::MENU_COMMAND
  648. #==============================================================================
  649. # ■ Window Menu Command
  650. #==============================================================================
  651. class Window_MenuCommand < Window_Command  
  652.   
  653. #------------------------------------------------------------------------------
  654. # ● Add Main Commands
  655. #------------------------------------------------------------------------------     
  656.   alias mog_musicbox_add_main_commands add_main_commands
  657.   def add_main_commands
  658.       mog_musicbox_add_main_commands
  659.       add_command(MOG_MUSIC_BOX::MENU_COMMAND_NAME, :musicbox, main_commands_enabled)
  660.   end
  661. end   

  662. #==============================================================================
  663. # ■ Scene Menu
  664. #==============================================================================
  665. class Scene_Menu < Scene_MenuBase
  666.   
  667. #------------------------------------------------------------------------------
  668. # ● Create Command Windows
  669. #------------------------------------------------------------------------------      
  670.    alias mog_musicbox_create_command_window create_command_window
  671.    def create_command_window
  672.        mog_musicbox_create_command_window
  673.        @command_window.set_handler(:musicbox,     method(:Music_Box))
  674.    end
  675.    
  676. #------------------------------------------------------------------------------
  677. # ● Music Box
  678. #------------------------------------------------------------------------------        
  679.    def Music_Box
  680.        SceneManager.call(Scene_Music_Box)
  681.    end

  682. end   

  683. end

  684. $mog_rgss3_music_box = true
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部