#脚本作者:68391151剑王
#脚本由休闲魔王完善显示文字,使用和转载请保留此信息
#打开窗口方式:$scene = Scene_MusicRoom.new
class Window_MusicRoom < Window_Selectable
def initialize
super(0, 85, 320, 360)
command_initialize
@item_max = @commands.size
@column_max = 1
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.opacity = 0
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_commands(i)
end
end
def draw_commands(index)
a = index * 32
self.contents.font.size = 24
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(0, a, 210, 32, @commands[index], 1)
end
def disable_item(index)
draw_item(index, disabled_color)
end
end
class Scene_MusicRoom
def initialize(menu_index = 0)
@menu_index = menu_index
def main
@musicback = Sprite.new
#Graphics/Pictures目录下必须有"音乐空间背景图片名称"的图片
@musicback.bitmap = Bitmap.new("Graphics/Pictures/音乐空间背景图片")
@music_window = Window_Command.new(192,["曲目1", "曲目2"])#这里的名称是在窗口中显示的
@music_window.back_opacity = 155 #这里是窗口的透明度
@music_window.x = 15 #窗口位置x坐标
@music_window.y = 85 #窗口位置y坐标
@music_window.oy = 0
@music_window.z = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@music_window.dispose
end
def update
@music_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@musicback.bitmap.dispose
$scene = Scene_Title.new
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @music_window.index
when 0
play = "曲目1" #曲目名称必须和Audio/BGM目录下的文件名相同
when 1
play = "曲目2" #曲目名称必须和Audio/BGM目录下的文件名相同
end
Audio.bgm_stop
Audio.bgm_play("Audio/BGM/" + play, 100, 100)
end
end
end
end
#脚本由休闲魔王完善显示文字,使用和转载请保留此信息
#打开窗口方式:$scene = Scene_MusicRoom.new
class Window_MusicRoom < Window_Selectable
def initialize
super(0, 85, 320, 360)
command_initialize
@item_max = @commands.size
@column_max = 1
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.opacity = 0
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_commands(i)
end
end
def draw_commands(index)
a = index * 32
self.contents.font.size = 24
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(0, a, 210, 32, @commands[index], 1)
end
def disable_item(index)
draw_item(index, disabled_color)
end
end
class Scene_MusicRoom
def initialize(menu_index = 0)
@menu_index = menu_index
def main
@musicback = Sprite.new
#Graphics/Pictures目录下必须有"音乐空间背景图片名称"的图片
@musicback.bitmap = Bitmap.new("Graphics/Pictures/音乐空间背景图片")
@music_window = Window_Command.new(192,["曲目1", "曲目2"])#这里的名称是在窗口中显示的
@music_window.back_opacity = 155 #这里是窗口的透明度
@music_window.x = 15 #窗口位置x坐标
@music_window.y = 85 #窗口位置y坐标
@music_window.oy = 0
@music_window.z = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@music_window.dispose
end
def update
@music_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@musicback.bitmap.dispose
$scene = Scene_Title.new
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @music_window.index
when 0
play = "曲目1" #曲目名称必须和Audio/BGM目录下的文件名相同
when 1
play = "曲目2" #曲目名称必须和Audio/BGM目录下的文件名相同
end
Audio.bgm_stop
Audio.bgm_play("Audio/BGM/" + play, 100, 100)
end
end
end
end