设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 855|回复: 0
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
476 小时
注册时间
2011-3-22
帖子
46
跳转到指定楼层
1
发表于 2014-1-14 14:32:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

RUBY 代码复制
  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. #==============================================================================
  49. # ● Histórico (Version History)
  50. #==============================================================================
  51. # v 1.1 - Melhoria no sistema de dispose.
  52. #==============================================================================
  53.  
  54. module MOG_MUSIC_BOX
  55.   # Posição da janela da lista de músicas.
  56.   MUSIC_LIST_POSITION_TEXT = [0, 200]
  57.   # Posição do layout da lista de músicas.
  58.   MUSIC_LIST_POSITION_LAYOUT = [0, 195]
  59.   # Tempo para ocultar a janela de lista de músicas.
  60.   MUSICLIST_FADE_TIME = 2#(Sec)
  61.   # Definição da velocidade de deslizar a imagem de fundo. [X,Y]
  62.   BACKGROUND_SCROLL_SPEED = [2,0]  
  63.   # Ativar a animação do gráfico do personagem. *(Não é obrigatório ser
  64.   # a imagem de um personagem, você pode criar outros efeitos de animações
  65.   # no lugar do personagem.
  66.   CHARACTER_SPRITE = true
  67.   # Velociadade da animação do personagem.
  68.   CHARACTER_ANIMATION_SPEED = 30
  69.   # Posição do personagem
  70.   CHARACTER_POSITION = [500,280]
  71.   # Definição da palavra Completado.
  72.   COMPLETED_WORD =  "Completed"
  73.   # Posição do texto de informação.
  74.   INFO_POSITION = [0,573]  
  75.   # Incluir músicas contidas no RTP.
  76.   INCLUDE_RTP = true
  77.   # Definição do diretório que foi instalado o RTP.
  78.   # Por padrão o caminho do diretório foi baseado no Windows 7 (64Bits).
  79.   # Outros sistemas operacionais o caminho do diretório é diferente.
  80.   RTP_PATH = "D:\software\game maker\RPG Maker VX Ace\RTP\Audio\BGM"
  81.   # Ativar o comando Music Box no menu principal.
  82.   MENU_COMMAND = false
  83.   # Nome do comando
  84.   MENU_COMMAND_NAME = "Music Box"  
  85. end
  86.  
  87.  
  88. #===============================================================================
  89. # ■ Game System
  90. #===============================================================================
  91. class Game_System
  92.  
  93.   attr_accessor  :music_book_list
  94.  
  95. #--------------------------------------------------------------------------
  96. # ● Initialize
  97. #--------------------------------------------------------------------------                     
  98.   alias mog_music_book_initialize initialize
  99.   def initialize
  100.       mog_music_book_initialize
  101.       music_book_setup
  102.   end
  103.  
  104. #--------------------------------------------------------------------------
  105. # ● Music Book Setup
  106. #--------------------------------------------------------------------------                  
  107.   def music_book_setup
  108.       return if !SceneManager.scene_is?(Scene_Title)
  109.       @music_book_list = []
  110.       @music_book_list.push([$data_system.title_bgm.name,true]) if $data_system.title_bgm.name != ""
  111.       path = "Audio/BGM/"  
  112.       make_music_list(path)  
  113.       if MOG_MUSIC_BOX::INCLUDE_RTP
  114.          path = MOG_MUSIC_BOX::RTP_PATH
  115.          make_music_list(path)
  116.       end
  117.     end  
  118.  
  119. #--------------------------------------------------------------------------
  120. # ● Make_Music_List
  121. #--------------------------------------------------------------------------                       
  122.   def make_music_list(path)
  123.       return if !File.directory?(path)
  124.       list = Dir.entries(path)
  125.       for i in 2...list.size
  126.           file_name = File.basename(list[i].to_s,  ".*")
  127.           @music_book_list.push([file_name,false]) unless repeated_song?(file_name)
  128.       end   
  129.    end
  130.  
  131. #--------------------------------------------------------------------------
  132. # ● Repeated Song?
  133. #--------------------------------------------------------------------------                          
  134.   def repeated_song?(file_name)
  135.       for i in [email]0...@music_book_list.size[/email]         
  136.          return true if @music_book_list[i].include?(file_name)
  137.       end
  138.       return false
  139.   end  
  140.  
  141. end  
  142.  
  143. #===============================================================================
  144. # ■ RPG AudioFile
  145. #===============================================================================
  146. class RPG::BGM < RPG::AudioFile
  147.  
  148. #--------------------------------------------------------------------------
  149. # ● Play
  150. #--------------------------------------------------------------------------                     
  151.   alias mog_music_book_play play
  152.   def play(pos = 0)
  153.       mog_music_book_play(pos)
  154.       check_music_book
  155.   end
  156.  
  157. #--------------------------------------------------------------------------
  158. # ● Check Music Book
  159. #--------------------------------------------------------------------------                  
  160.   def check_music_book
  161.       return if $game_system.music_book_list == nil      
  162.       return if @name.empty?
  163.       for i in 0...$game_system.music_book_list.size
  164.           if $game_system.music_book_list[i][0] == @name
  165.              $game_system.music_book_list[i][1] = true
  166.              break
  167.           end  
  168.       end  
  169.   end  
  170.  
  171. end
  172.  
  173. #===============================================================================
  174. # ■ RPG Cache
  175. #===============================================================================
  176. module Cache
  177.  
  178.   #--------------------------------------------------------------------------
  179.   # ● Music Cover
  180.   #--------------------------------------------------------------------------
  181.   def self.music_cover(filename)
  182.       load_bitmap("Graphics/Music_Cover/", filename)
  183.   end
  184.  
  185. end  
  186.  
  187. #===============================================================================
  188. # ■ RPG_FileTest
  189. #===============================================================================
  190. module RPG_FileTest
  191.  
  192.   #--------------------------------------------------------------------------
  193.   # ● RPG_FileTest.music_cover_exist?
  194.   #--------------------------------------------------------------------------
  195.   def RPG_FileTest.music_cover_exist?(filename)
  196.       return Cache.music_cover(filename) rescue return false
  197.   end  
  198.  
  199. end
  200.  
  201. #==============================================================================
  202. # ■ Window_Picture
  203. #==============================================================================
  204. class Window_Music_List < Window_Selectable
  205.  
  206. #------------------------------------------------------------------------------
  207. # ● Initialize
  208. #------------------------------------------------------------------------------   
  209.   def initialize
  210.       super(0, 0, 544, 280)
  211.       self.opacity = 0
  212.       [url=home.php?mod=space&uid=370741]@Index[/url] = -1
  213.       @item_max = $game_system.music_book_list.size
  214.       refresh
  215.       select(0)
  216.       activate
  217.   end
  218. def set_cursor
  219.     mouse_row, mouse_col = mouse_window_area
  220.     if    mouse_row == -1
  221.       @move_state += 1 if need_scroll?
  222.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  223.     elsif mouse_row == -2
  224.       @move_state += 1 if need_scroll?
  225.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  226.     elsif mouse_col == -1
  227.       @move_state += 1 if need_scroll?
  228.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  229.     elsif mouse_col == -2
  230.       @move_state += 1 if need_scroll?
  231.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  232.     else
  233.       @move_state = 0
  234.       new_index = (top_row + mouse_row) * col_max + mouse_col
  235.       select(new_index) if new_index < item_max && new_index != @index
  236.     end
  237.   end
  238. #------------------------------------------------------------------------------
  239. # ● Refresh
  240. #------------------------------------------------------------------------------   
  241.   def refresh
  242.       if self.contents != nil
  243.          self.contents.dispose
  244.          self.contents = nil
  245.       end
  246.       if @item_max > 0         
  247.          self.contents = Bitmap.new(width - 32, 24 * @item_max)
  248.          for i in 0...@item_max
  249.             draw_item(i)
  250.          end
  251.          return
  252.       end
  253.       self.contents = Bitmap.new(width - 32, 24)
  254.       self.contents.draw_text(x,y,440,32,"No Data",0)   
  255.   end
  256.  
  257. #------------------------------------------------------------------------------
  258. # ● draw_item
  259. #------------------------------------------------------------------------------   
  260.   def draw_item(index)
  261.       x = 0
  262.       y = 24 * index
  263.       if $game_system.music_book_list[index][1]
  264.          change_color(normal_color,true)
  265.          music = "N" + sprintf("%02d", index + 1).to_s +  " - "+ $game_system.music_book_list[index][0].to_s
  266.       else
  267.          change_color(normal_color,false)
  268.          music = "N" + sprintf("%02d", index + 1).to_s +  " - Not Available"
  269.       end  
  270.       self.contents.draw_text(x,y,440,32,music,0)
  271.   end
  272.  
  273. #------------------------------------------------------------------------------
  274. # ● Col Max
  275. #------------------------------------------------------------------------------      
  276.   def col_max
  277.       return 1
  278.   end
  279.  
  280. #------------------------------------------------------------------------------
  281. # ● Item Max
  282. #------------------------------------------------------------------------------         
  283.   def item_max
  284.       return @item_max == nil ? 0 : @item_max
  285.   end  
  286.  
  287. end
  288.  
  289. #===============================================================================
  290. # ■ Scene Music Box
  291. #===============================================================================
  292. class Scene_Music_Box
  293. include MOG_MUSIC_BOX
  294.  
  295. #--------------------------------------------------------------------------
  296. # ● Main
  297. #--------------------------------------------------------------------------               
  298.   def main
  299.  
  300.       execute_dispose
  301.       create_music_list
  302.       create_layout
  303.       create_sprite_now_playing
  304.       create_character
  305.       execute_loop
  306.       execute_dispose      
  307.   end
  308.  
  309. #--------------------------------------------------------------------------
  310. # ● Execute Loop
  311. #--------------------------------------------------------------------------                 
  312.   def execute_loop
  313.       Graphics.transition
  314.       loop do
  315.            Graphics.update
  316.            Input.update
  317.            update
  318.            break if SceneManager.scene != self
  319.      end        
  320.    end  
  321.  
  322. #--------------------------------------------------------------------------
  323. # ● Create Layout
  324. #--------------------------------------------------------------------------                 
  325.   def create_layout
  326.       @background = Plane.new
  327.       @background.z = 1
  328.       @background2 = Sprite.new
  329.       @background2.z = 2      
  330.       @layout = Sprite.new
  331.       @layout.bitmap = Cache.music_cover("Layout")
  332.       @layout.z = 90
  333.       @old_index = -1
  334.   end
  335.  
  336. #--------------------------------------------------------------------------
  337. # ● create Sprite now Playing
  338. #--------------------------------------------------------------------------                  
  339.   def create_sprite_now_playing
  340.       @now_playing = Plane.new
  341.       @now_playing.bitmap = Bitmap.new(800,608)
  342.       @now_playing.z = 100
  343.       check_completion
  344.       make_now_playing(true)
  345.   end  
  346.  
  347. #--------------------------------------------------------------------------
  348. # ● Check Completion
  349. #--------------------------------------------------------------------------                     
  350.   def check_completion
  351.       comp = 0
  352.       for i in 0...$game_system.music_book_list.size
  353.           comp += 1 if $game_system.music_book_list[i][1]        
  354.       end
  355.       if  $game_system.music_book_list.size > 0   
  356.           @completed = "( " + COMPLETED_WORD + " " + (comp.to_f / $game_system.music_book_list.size * 100).truncate.to_s + "% )"
  357.       else
  358.           @completed = "( " + COMPLETED_WORD + " )"
  359.       end  
  360.   end
  361.  
  362. #--------------------------------------------------------------------------
  363. # ● Create_Character
  364. #--------------------------------------------------------------------------                       
  365.   def create_character
  366.       return if !CHARACTER_SPRITE
  367.       @character_index = 0
  368.       @character_animation_speed = 0
  369.       @character = Sprite.new
  370.       @character.z = 80
  371.       @character_image = Cache.music_cover("Character")
  372.       @character_frame_max = @character_image.width / @character_image.height
  373.       @character_width = @character_image.width / @character_frame_max  
  374.       @character.bitmap = Bitmap.new(@character_width,@character_image.height)
  375.       @character.x = CHARACTER_POSITION[0]
  376.       @character.y = CHARACTER_POSITION[1]     
  377.       make_character_bitmap
  378.   end
  379.  
  380. #--------------------------------------------------------------------------
  381. # ● Make Now Playing
  382. #--------------------------------------------------------------------------                     
  383. def make_now_playing(init = false)
  384.      @now_playing.bitmap.clear
  385.      @now_playing.bitmap.font.size = 20
  386.      @now_playing.bitmap.font.bold = true
  387.      text = song_name + "   " + @completed
  388.      text = @completed if init
  389.      @now_playing.bitmap.draw_text(INFO_POSITION[0],INFO_POSITION[1], 800, 32, text.to_s,1)      
  390.      @now_playing.opacity = 0
  391. end
  392.  
  393. #--------------------------------------------------------------------------
  394. # ● Make Background
  395. #--------------------------------------------------------------------------                  
  396. def make_background
  397.      if @background.bitmap != nil
  398.         @background.bitmap.dispose
  399.         @background.bitmap = nil
  400.      end  
  401.      if RPG_FileTest.music_cover_exist?(song_name + "_B1")
  402.         @background.bitmap = Cache.music_cover(song_name + "_B1")
  403.      else
  404.         @background.bitmap = Cache.music_cover("")
  405.      end  
  406.      @background.opacity = 0
  407.      if @background2.bitmap != nil
  408.         @background2.bitmap.dispose
  409.         @background2.bitmap = nil
  410.      end  
  411.      if RPG_FileTest.music_cover_exist?(song_name + "_B2")
  412.         @background2.bitmap = Cache.music_cover(song_name + "_B2")
  413.      else
  414.         @background2.bitmap = Cache.music_cover("")
  415.      end  
  416.      @background2.opacity = 0     
  417. end
  418.  
  419. #--------------------------------------------------------------------------
  420. # ● Song Name
  421. #--------------------------------------------------------------------------                    
  422. def song_name
  423.      if $game_system.music_book_list.size == 0      
  424.         return ""
  425.      end  
  426.      return $game_system.music_book_list[@music_list_window.index][0].to_s
  427. end
  428.  
  429. #--------------------------------------------------------------------------
  430. # ● Create_Music_List
  431. #--------------------------------------------------------------------------                     
  432.   def create_music_list
  433.       [url=home.php?mod=space&uid=76426]@stop[/url] = true
  434.       @layout2 = Sprite.new
  435.       @layout2.bitmap = Cache.music_cover("Layout2")
  436.       @layout_org_position = [MUSIC_LIST_POSITION_LAYOUT[0],MUSIC_LIST_POSITION_LAYOUT[1]]      
  437.       @layout2.y = @layout_org_position[1]
  438.       @layout2.z = 90   
  439.       @music_list_window = Window_Music_List.new
  440.       @music_list_window.z = 100
  441.       @music_list_window_org = [MUSIC_LIST_POSITION_TEXT[0],MUSIC_LIST_POSITION_TEXT[1]]
  442.       @music_list_window.y = @music_list_window_org[1]
  443.       @music_index = @music_list_window.index
  444.       @fade_max =  60 + 60 * MUSICLIST_FADE_TIME
  445.       @fade_time = @fade_max
  446.       @music_list_window.x = 0
  447.       @music_list_window.contents_opacity = 0
  448.       @layout2.x = 0
  449.       @layout2.opacity = 0        
  450.   end  
  451.  
  452. #--------------------------------------------------------------------------
  453. # ● Initialize
  454. #--------------------------------------------------------------------------                  
  455.   def initialize
  456.       BattleManager.save_bgm_and_bgs
  457.       RPG::BGM.fade(2 * 1000)
  458.       RPG::BGS.fade(2 * 1000)
  459.       @w_visible = true
  460.   end  
  461. #--------------------------------------------------------------------------
  462. # ● Execute Dispose
  463. #--------------------------------------------------------------------------                  
  464.   def execute_dispose
  465.       return if @layout == nil
  466.       Graphics.freeze
  467.       @music_list_window.dispose
  468.       if @background.bitmap != nil
  469.          @background.bitmap.dispose
  470.       end      
  471.       @background.dispose
  472.       if @background2.bitmap != nil
  473.          @background2.bitmap.dispose
  474.       end      
  475.       @background2.dispose      
  476.       @layout.bitmap.dispose
  477.       @layout.dispose
  478.       @layout = nil
  479.       @layout2.bitmap.dispose
  480.       @layout2.dispose      
  481.       @now_playing.bitmap.dispose
  482.       @now_playing.dispose
  483.       if CHARACTER_SPRITE
  484.          @character.bitmap.dispose
  485.          @character.dispose
  486.          @character_image.dispose
  487.       end   
  488.       RPG::BGM.stop
  489.       BattleManager.replay_bgm_and_bgs
  490.   end
  491.  
  492. #--------------------------------------------------------------------------
  493. # ● Hide_Layout
  494. #--------------------------------------------------------------------------                       
  495.   def hide_layout
  496.       Sound.play_ok
  497.       @w_visible = @w_visible == true ? false : true
  498.       @fade_time = @w_visible ? @fade_max : 0
  499.       @layout.visible = @w_visible
  500.       if CHARACTER_SPRITE
  501.          @character.visible = @w_visible
  502.       end  
  503.   end   
  504.  
  505. #--------------------------------------------------------------------------
  506. # ● Update
  507. #--------------------------------------------------------------------------                  
  508.   def update
  509.       update_commands
  510.       update_animation
  511.   end
  512.  
  513. #--------------------------------------------------------------------------
  514. # ● Update Animation
  515. #--------------------------------------------------------------------------                     
  516.   def update_animation
  517.       @now_playing.opacity += 2
  518.       @now_playing.ox += 1
  519.       update_list_fade
  520.       update_character_animation
  521.       update_background_animation
  522.   end  
  523.  
  524. #--------------------------------------------------------------------------
  525. # ● Update Background Animation
  526. #--------------------------------------------------------------------------                       
  527.   def update_background_animation
  528.       @background.opacity += 1
  529.       @background2.opacity += 1
  530.       @background.ox += BACKGROUND_SCROLL_SPEED[0]
  531.       @background.oy += BACKGROUND_SCROLL_SPEED[1]   
  532.   end
  533.  
  534. #--------------------------------------------------------------------------
  535. # ● Update Character Animation
  536. #--------------------------------------------------------------------------                       
  537.   def update_character_animation
  538.       return if !CHARACTER_SPRITE or @stop
  539.       @character_animation_speed += 1
  540.       if @character_animation_speed > CHARACTER_ANIMATION_SPEED
  541.          @character_animation_speed = 0
  542.          @character_index += 1
  543.          @character_index = 0 if @character_index >= @character_frame_max
  544.          make_character_bitmap   
  545.       end
  546.   end
  547.  
  548. #--------------------------------------------------------------------------
  549. # ● Make Character_bitmap
  550. #--------------------------------------------------------------------------                        
  551.   def make_character_bitmap
  552.       @character.bitmap.clear
  553.       src_rect_back = Rect.new(@character_width * @character_index, 0,@character_width,@character_image.height)
  554.       @character.bitmap.blt(0,0, @character_image, src_rect_back)  
  555.   end
  556.  
  557. #--------------------------------------------------------------------------
  558. # ● Update List Fade
  559. #--------------------------------------------------------------------------                       
  560.   def update_list_fade
  561.       @fade_time = @fade_max if moved?
  562.       slide_speed = 5
  563.       fade_speed = 3
  564.       if @fade_time > 0
  565.          @fade_time -= 1
  566.          @layout2.opacity += fade_speed * 2
  567.          @music_list_window.contents_opacity += fade_speed * 2
  568.          if @music_list_window.x < @music_list_window_org[0]
  569.             @music_list_window.x += slide_speed * 2
  570.             @layout2.x += slide_speed * 2
  571.             if @music_list_window.x >= @music_list_window_org[0]
  572.                @music_list_window.x = @music_list_window_org[0]
  573.                @layout2.x = @layout_org_position[0]
  574.             end  
  575.          end
  576.       else
  577.          @music_list_window.x -= slide_speed
  578.          @music_list_window.contents_opacity -= fade_speed
  579.          @layout2.x -= slide_speed
  580.          @layout2.opacity -= fade_speed
  581.          if @music_list_window.x < -800
  582.             @music_list_window.x = -800
  583.             @music_list_window.contents_opacity = 0
  584.             @layout2.x = -800
  585.             @layout2.opacity = 0         
  586.           end  
  587.       end
  588.   end  
  589.  
  590. #--------------------------------------------------------------------------
  591. # ● Moved?
  592. #--------------------------------------------------------------------------                       
  593.   def moved?
  594.       return true if Input.trigger?(:C)
  595.       return true if Input.trigger?(:B)
  596.       return true if Input.trigger?(:X)
  597.       return true if Input.trigger?(:R)
  598.       return true if Input.trigger?(:L)
  599.       return true if Input.press?(Input.dir4)
  600.       return false
  601.   end  
  602.  
  603. #--------------------------------------------------------------------------
  604. # ● Update Commands
  605. #--------------------------------------------------------------------------                     
  606.   def update_commands
  607.       @music_list_window.update
  608.       if Input.trigger?(:B)
  609.          return_to_scene
  610.       elsif Input.trigger?(:C)
  611.          play_song
  612.       elsif Input.trigger?(:X)
  613.          stop_song
  614.       elsif Input.trigger?(:Y)
  615.          hide_layout
  616.       end  
  617.   end
  618.  
  619. #--------------------------------------------------------------------------
  620. # ● Return to Scene
  621. #--------------------------------------------------------------------------                           
  622.   def return_to_scene
  623.       return if @fade_time == 0 and @layout2.opacity == 0
  624.       Sound.play_cancel
  625.       SceneManager.return
  626.   end
  627.  
  628. #--------------------------------------------------------------------------
  629. # ● index_changed?
  630. #--------------------------------------------------------------------------                        
  631.   def index_changed?
  632.       if @old_index != @music_list_window.index
  633.          @old_index = @music_list_window.index
  634.          return true
  635.       end  
  636.       return false
  637.   end  
  638.  
  639. #--------------------------------------------------------------------------
  640. # ● Play Song
  641. #--------------------------------------------------------------------------                       
  642.   def play_song
  643.       return if $game_system.music_book_list.size == 0
  644.       return if @fade_time == 0 and @layout2.opacity == 0
  645.       if $game_system.music_book_list[@music_list_window.index][1]
  646.          if index_changed? or @stop
  647.             Sound.play_ok            
  648.             @stop = false
  649.             Audio.bgm_play("Audio/BGM/" +  song_name, 100, 100) rescue nil
  650.             make_background
  651.             make_now_playing
  652.           end  
  653.       else
  654.          Sound.play_buzzer
  655.       end      
  656.   end  
  657.  
  658. #--------------------------------------------------------------------------
  659. # ● Stop Song
  660. #--------------------------------------------------------------------------                        
  661.   def stop_song
  662.       Sound.play_ok
  663.       @stop = true
  664.       RPG::BGM.fade(3 * 1000)
  665.       make_now_playing(true)   
  666.   end  
  667. end
  668.  
  669. if MOG_MUSIC_BOX::MENU_COMMAND
  670. #==============================================================================
  671. # ■ Window Menu Command
  672. #==============================================================================
  673. class Window_MenuCommand < Window_Command  
  674.  
  675. #------------------------------------------------------------------------------
  676. # ● Add Main Commands
  677. #------------------------------------------------------------------------------     
  678.   alias mog_musicbox_add_main_commands add_main_commands
  679.   def add_main_commands
  680.       mog_musicbox_add_main_commands
  681.       add_command(MOG_MUSIC_BOX::MENU_COMMAND_NAME, :musicbox, main_commands_enabled)
  682.   end
  683. end   
  684.  
  685. #==============================================================================
  686. # ■ Scene Menu
  687. #==============================================================================
  688. class Scene_Menu < Scene_MenuBase
  689.  
  690. #------------------------------------------------------------------------------
  691. # ● Create Command Windows
  692. #------------------------------------------------------------------------------      
  693.    alias mog_musicbox_create_command_window create_command_window
  694.    def create_command_window
  695.        mog_musicbox_create_command_window
  696.        @command_window.set_handler(:musicbox,     method(:Music_Box))
  697.    end
  698.  
  699. #------------------------------------------------------------------------------
  700. # ● Music Box
  701. #------------------------------------------------------------------------------        
  702.    def Music_Box
  703.        SceneManager.call(Scene_Music_Box)
  704.    end
  705.  
  706. end   
  707.  
  708. end
  709.  
  710. $mog_rgss3_music_box = true
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 19:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表