#-------------------------------------------------------------------------- # ● 显示图片 #------------------------------------------------------------------------- filename = "Graphics/Pictures/Logo" # 图片文件名 time0 = 60 # 渐显所需时间(单位:帧) time1 = 120 # 渐显完毕后等待时间(单位:帧) time2 = 60 # 渐隐所需时间(单位:帧) time3 = 60 # 渐隐完毕后等待时间(单位:帧) @show_logo = Sprite.new @show_logo.opacity = 0 @show_logo.bitmap = Bitmap.new(filename) v0 = 255 / time0 v2 = 255 / time2 for i in 1..time0 #渐显 @show_logo.opacity = i * v0 Graphics.update end @show_logo.opacity = 255 Graphics.wait time1 # 等待 for i in 1..time2 #渐隐 @show_logo.opacity = 255 - i * v2 Graphics.update end @show_logo.dispose Graphics.wait time3 #
#encoding:utf-8 #============================================================================== # ■ Scene_Title #------------------------------------------------------------------------------ # 标题画面 #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # ● 开始处理 #-------------------------------------------------------------------------- def start super SceneManager.clear Graphics.freeze create_background create_foreground create_command_window play_title_music end #-------------------------------------------------------------------------- # ● 获取渐变速度 #-------------------------------------------------------------------------- def transition_speed return 20 end #-------------------------------------------------------------------------- # ● 结束处理 #-------------------------------------------------------------------------- def terminate super SceneManager.snapshot_for_background dispose_background dispose_foreground end #-------------------------------------------------------------------------- # ● 生成背景 #-------------------------------------------------------------------------- def create_background @sprite1 = Sprite.new @sprite1.bitmap = Cache.title1($data_system.title1_name) @sprite2 = Sprite.new @sprite2.bitmap = Cache.title2($data_system.title2_name) center_sprite(@sprite1) center_sprite(@sprite2) end #-------------------------------------------------------------------------- # ● 生成前景 #-------------------------------------------------------------------------- def create_foreground @foreground_sprite = Sprite.new @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height) @foreground_sprite.z = 100 draw_game_title if $data_system.opt_draw_title end #-------------------------------------------------------------------------- # ● 绘制游戏标题 #-------------------------------------------------------------------------- def draw_game_title @foreground_sprite.bitmap.font.size = 48 rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2) @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1) end #-------------------------------------------------------------------------- # ● 释放背景 #-------------------------------------------------------------------------- def dispose_background @sprite1.bitmap.dispose @sprite1.dispose @sprite2.bitmap.dispose @sprite2.dispose end #-------------------------------------------------------------------------- # ● 释放前景 #-------------------------------------------------------------------------- def dispose_foreground @foreground_sprite.bitmap.dispose @foreground_sprite.dispose end #-------------------------------------------------------------------------- # ● 执行精灵居中 #-------------------------------------------------------------------------- def center_sprite(sprite) sprite.ox = sprite.bitmap.width / 2 sprite.oy = sprite.bitmap.height / 2 sprite.x = Graphics.width / 2 sprite.y = Graphics.height / 2 end #-------------------------------------------------------------------------- # ● 生成指令窗口 #-------------------------------------------------------------------------- def create_command_window @command_window = Window_TitleCommand.new @command_window.set_handler(:new_game, method(:command_new_game)) @command_window.set_handler(:continue, method(:command_continue)) @command_window.set_handler(:shutdown, method(:command_shutdown)) end #-------------------------------------------------------------------------- # ● 关闭指令窗口 #-------------------------------------------------------------------------- def close_command_window @command_window.close update until @command_window.close? end #-------------------------------------------------------------------------- # ● 指令“开始游戏” #-------------------------------------------------------------------------- def command_new_game DataManager.setup_new_game close_command_window fadeout_all $game_map.autoplay SceneManager.goto(Scene_Map) end #-------------------------------------------------------------------------- # ● 指令“继续游戏” #-------------------------------------------------------------------------- def command_continue close_command_window SceneManager.call(Scene_Load) end #-------------------------------------------------------------------------- # ● 指令“退出游戏” #-------------------------------------------------------------------------- def command_shutdown close_command_window fadeout_all SceneManager.exit end #-------------------------------------------------------------------------- # ● 播放标题画面音乐 #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end end
#encoding:utf-8 #============================================================================== # ■ Scene_Title #------------------------------------------------------------------------------ # 标题画面 #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # ● 开始处理 #-------------------------------------------------------------------------- def start super SceneManager.clear Graphics.freeze create_background create_foreground create_command_window play_title_music filename = "Graphics/Pictures/Logo" # 图片文件名 time0 = 60 # 渐显所需时间(单位:帧) time1 = 120 # 渐显完毕后等待时间(单位:帧) time2 = 60 # 渐隐所需时间(单位:帧) time3 = 60 # 渐隐完毕后等待时间(单位:帧) @show_logo = Sprite.new @show_logo.opacity = 0 @show_logo.bitmap = Bitmap.new(filename) v0 = 255 / time0 v2 = 255 / time2 for i in 1..time0 #渐显 @show_logo.opacity = i * v0 Graphics.update end @show_logo.opacity = 255 Graphics.wait time1 # 等待 for i in 1..time2 #渐隐 @show_logo.opacity = 255 - i * v2 Graphics.update end @show_logo.dispose Graphics.wait time3 end #-------------------------------------------------------------------------- # ● 获取渐变速度 #-------------------------------------------------------------------------- def transition_speed return 20 end #-------------------------------------------------------------------------- # ● 结束处理 #-------------------------------------------------------------------------- def terminate super SceneManager.snapshot_for_background dispose_background dispose_foreground end #-------------------------------------------------------------------------- # ● 生成背景 #-------------------------------------------------------------------------- def create_background @sprite1 = Sprite.new @sprite1.bitmap = Cache.title1($data_system.title1_name) @sprite2 = Sprite.new @sprite2.bitmap = Cache.title2($data_system.title2_name) center_sprite(@sprite1) center_sprite(@sprite2) end #-------------------------------------------------------------------------- # ● 生成前景 #-------------------------------------------------------------------------- def create_foreground @foreground_sprite = Sprite.new @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height) @foreground_sprite.z = 100 draw_game_title if $data_system.opt_draw_title end #-------------------------------------------------------------------------- # ● 绘制游戏标题 #-------------------------------------------------------------------------- def draw_game_title @foreground_sprite.bitmap.font.size = 48 rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2) @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1) end #-------------------------------------------------------------------------- # ● 释放背景 #-------------------------------------------------------------------------- def dispose_background @sprite1.bitmap.dispose @sprite1.dispose @sprite2.bitmap.dispose @sprite2.dispose end #-------------------------------------------------------------------------- # ● 释放前景 #-------------------------------------------------------------------------- def dispose_foreground @foreground_sprite.bitmap.dispose @foreground_sprite.dispose end #-------------------------------------------------------------------------- # ● 执行精灵居中 #-------------------------------------------------------------------------- def center_sprite(sprite) sprite.ox = sprite.bitmap.width / 2 sprite.oy = sprite.bitmap.height / 2 sprite.x = Graphics.width / 2 sprite.y = Graphics.height / 2 end #-------------------------------------------------------------------------- # ● 生成指令窗口 #-------------------------------------------------------------------------- def create_command_window @command_window = Window_TitleCommand.new @command_window.set_handler(:new_game, method(:command_new_game)) @command_window.set_handler(:continue, method(:command_continue)) @command_window.set_handler(:shutdown, method(:command_shutdown)) end #-------------------------------------------------------------------------- # ● 关闭指令窗口 #-------------------------------------------------------------------------- def close_command_window @command_window.close update until @command_window.close? end #-------------------------------------------------------------------------- # ● 指令“开始游戏” #-------------------------------------------------------------------------- def command_new_game DataManager.setup_new_game close_command_window fadeout_all $game_map.autoplay SceneManager.goto(Scene_Map) end #-------------------------------------------------------------------------- # ● 指令“继续游戏” #-------------------------------------------------------------------------- def command_continue close_command_window SceneManager.call(Scene_Load) end #-------------------------------------------------------------------------- # ● 指令“退出游戏” #-------------------------------------------------------------------------- def command_shutdown close_command_window fadeout_all SceneManager.exit end #-------------------------------------------------------------------------- # ● 播放标题画面音乐 #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |