Project1

标题: 请问如何在菜单画面实现CD的转动(音乐鉴赏相关) [打印本页]

作者: 闪电    时间: 2008-9-16 05:39
标题: 请问如何在菜单画面实现CD的转动(音乐鉴赏相关)
顺便感谢下IamI朋友上次的帮忙

  1. class Window_Enjoy < Window_Base
  2. def initialize
  3.    super(640 - 224,480 - 152,224,152)
  4.    self.contents = Bitmap.new(width - 32,height - 32)
  5. end
  6. def update(ar)
  7.    refresh(ar)
  8. end
  9. def refresh(ar)
  10.    self.contents.clear
  11.    self.contents.draw_text(0,32*0,192,32,ar[0])
  12.    self.contents.draw_text(0,32*1,192,32,"出处:  " + ar[1])
  13.    self.contents.draw_text(0,32*2,192,32,"制作人:" + ar[2])
  14.    self.contents.draw_text(0,32*3,192,32,"词作者:" + ar[3])
  15. end
  16. end
  17. class Scene_Music
  18. #--------------------------------------------------------------------------
  19. # ● 主处理
  20. #--------------------------------------------------------------------------
  21. def main
  22.   # 生成命令窗口
  23.   s1 = "music1"
  24.   s2 = "music2"
  25.   s3 = "music3"
  26.   s4 = "music4"
  27.   @command_window = Window_Command.new(192, [s1, s2, s3,s4])
  28.   @command_window.x = 0
  29.   @command_window.y = 0
  30.   @musicname = ["001-Battle01","002-Battle02","003-Battle03","004-Battle04"]
  31.   @enjoys = [["music1","From","Maker","Words Maker"],
  32.   ["music2","From","Maker","Words Maker"],
  33.   ["music3","From","Maker","Words Maker"],
  34.   ["music4","From","Maker","Words Maker"]]
  35.   @enjoy_window = Window_Enjoy.new
  36.   Graphics.transition
  37.   loop do
  38.     Graphics.update
  39.     Input.update
  40.     update
  41.     if $scene != self
  42.       break
  43.     end
  44.   end
  45.   Graphics.freeze
  46.   @command_window.dispose
  47.   if $scene.is_a?(Scene_Title)
  48.     Graphics.transition
  49.     Graphics.freeze
  50.   end
  51. end
  52. #--------------------------------------------------------------------------
  53. # ● 刷新画面
  54. #--------------------------------------------------------------------------
  55. def update
  56.   @enjoy_window.update(@enjoys[@command_window.index])
  57.   @command_window.update
  58.   # 按下 B 键的情况下
  59.   if Input.trigger?(Input::B)
  60.     $game_system.se_play($data_system.cancel_se)
  61.     $scene = Scene_Title.new
  62.     return
  63.   end
  64.   # 按下 C 键的场合下
  65.   if Input.trigger?(Input::C)
  66.     # 命令窗口光标位置分支
  67.     name = "Audio/BGM/" + @musicname[@command_window.index]
  68.     Audio.bgm_play(name)
  69.     return
  70.   end
  71. end
  72. end
复制代码






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