赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 908 |
最后登录 | 2014-9-2 |
在线时间 | 10 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 10 小时
- 注册时间
- 2012-6-3
- 帖子
- 90
|
- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
- class Scene_Title
- #--------------------------------------------------------------------------
- # ● 住处理
- #--------------------------------------------------------------------------
- def main
- if $message_index == nil
- $message_index = 0
- end
- # 战斗测试的情况下
- if $BTEST
- battle_test
- return
- end
- # 载入数据库
- #........................................................................
- $data_mapinfos = load_data("Data/MapInfos.rxdata")
- #........................................................................
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- #提取游戏数据
- #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
- #File.open("dll/data.sjxyq","rb") { |file|
- ##........................................................................
- #$data_mapinfos = load_data("Map/MapInfos.map")
- ##........................................................................
- #$data_actors = Marshal.load(file)
- #$data_classes = Marshal.load(file)
- #$data_skills = Marshal.load(file)
- #$data_items = Marshal.load(file)
- #$data_weapons = Marshal.load(file)
- #$data_armors = Marshal.load(file)
- #$data_enemies = Marshal.load(file)
- #$data_troops = Marshal.load(file)
- #$data_states = Marshal.load(file)
- #$data_animations = Marshal.load(file)
- #$data_tilesets = Marshal.load(file)
- #$data_common_events = Marshal.load(file)
- #$data_system = Marshal.load(file)
- #}
- #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
- # 生成系统对像
- $game_system = Game_System.new
- #打包游戏数据
- #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
- #File.open("Data/data.sjxyq", "wb") { |f|
- #Marshal.dump($data_actors, f)
- #Marshal.dump($data_classes, f)
- #Marshal.dump($data_skills, f)
- #Marshal.dump($data_items, f)
- #Marshal.dump($data_weapons, f)
- #Marshal.dump($data_armors, f)
- #Marshal.dump($data_enemies , f)
- #Marshal.dump($data_troops, f)
- #Marshal.dump($data_states, f)
- #Marshal.dump($data_animations, f)
- #Marshal.dump($data_tilesets, f)
- #Marshal.dump($data_common_events, f)
- #Marshal.dump($data_system , f)
- #}
- #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
- # 生成标题图形 改成随机切换图形
- @sprite = Sprite.new
- #@sprite.bitmap = RPG::Cache.title($data_system.title_name)
- @randpic = rand(3)
- @sprite.bitmap = RPG::Cache.title("title#{@randpic}.jpg")
- # 生成命令窗口
- s1 = "新游戏"
- s2 = "继续"
- s3 = "退出"
- #为了判定现在为标题画面
- $title = 1
- @command_window = Window_Command.new(192, [s1, s2, s3])
- @command_window.back_opacity = 0
- @command_window.opacity = 0
- @command_window.contents_opacity = 0
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 288
- $sprite_new = Sprite.new(@command_window.viewport)
- $sprite_load = Sprite.new
- $sprite_end = Sprite.new
- $sprite_new.bitmap = RPG::Cache.picture("1.png")
- $sprite_new.x = @command_window.x + 20
- $sprite_new.y = @command_window.y + 16 + 0
- $sprite_load.bitmap = RPG::Cache.picture("3.png")
- $sprite_load.x = @command_window.x + 20
- $sprite_load.y = @command_window.y + 16 + 32
- $sprite_end.bitmap = RPG::Cache.picture("5.png")
- $sprite_end.x = @command_window.x + 20
- $sprite_end.y = @command_window.y + 16 + 64
- @loop_animation = RPG::Sprite.new(@command_window.viewport)
- #角色动画
- @loop_player_animation = RPG::Sprite.new
- case @randpic
- when 0
- @loop_player_animation.loop_animation($data_animations[139])
- @loop_player_animation.x = 225
- @loop_player_animation.y = 220
- when 1
- @loop_player_animation.loop_animation($data_animations[140])
- @loop_player_animation.x = 230
- @loop_player_animation.y = 130
- when 2
- @loop_player_animation.loop_animation($data_animations[141])
- @loop_player_animation.x = 105
- @loop_player_animation.y = 185
- end
-
- # 判定继续的有效性
- # 存档文件一个也不存在的时候也调查
- # 有効为 @continue_enabled 为 true、無効为 false
- @continue_enabled = false
- for i in 0..7
- if FileTest.exist?("Save/Save#{i}.rxdata")
- @continue_enabled = true
- end
- end
- # 继续为有效的情况下、光标停止在继续上
- # 无效的情况下、继续的文字显示为灰色
- if @continue_enabled
- @command_window.index = 1
- else
- @command_window.disable_item(1)
- end
- # 演奏标题 BGM
- $game_system.bgm_play($data_system.title_bgm)
- # 停止演奏 ME、BGS
- Audio.me_stop
- Audio.bgs_stop
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换就中断循环
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- # 释放命令窗口
- @command_window.dispose
- # 释放标题图形
- @sprite.bitmap.dispose
- @sprite.dispose
-
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- dx = 47
- dy = 10
- # 刷新命令窗口
- @command_window.update
- @loop_animation.update
- #刷新角色图像
- @loop_player_animation.update
- case @command_window.index
- when 0
- $sprite_new.bitmap = RPG::Cache.picture("2.png")
- $sprite_load.bitmap = RPG::Cache.picture("3.png")
- $sprite_end.bitmap = RPG::Cache.picture("5.png")
- @loop_animation.x = $sprite_new.x + dx
- @loop_animation.y = $sprite_new.y + dy
- @loop_animation.loop_animation($data_animations[1188])
- when 1
- $sprite_new.bitmap = RPG::Cache.picture("1.png")
- $sprite_load.bitmap = RPG::Cache.picture("4.png")
- $sprite_end.bitmap = RPG::Cache.picture("5.png")
- @loop_animation.x = $sprite_load.x + dx
- @loop_animation.y = $sprite_load.y + dy
- @loop_animation.loop_animation($data_animations[1189])
- when 2
- $sprite_new.bitmap = RPG::Cache.picture("1.png")
- $sprite_load.bitmap = RPG::Cache.picture("3.png")
- $sprite_end.bitmap = RPG::Cache.picture("6.png")
- @loop_animation.x = $sprite_end.x + dx
- @loop_animation.y = $sprite_end.y + dy
- @loop_animation.loop_animation($data_animations[1190])
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置的分支
- case @command_window.index
- when 0 # 新游戏
- $title =0
- command_new_game
- when 1 # 继续
- $title =0
- command_continue
- when 2 # 退出
- command_shutdown
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 释放资源
- #--------------------------------------------------------------------------
- def dispose
- #释放人物动画
- unless @loop_player_animation.disposed?
- @loop_player_animation.loop_animation(nil)
- @loop_player_animation.dispose
- @loop_player_animation = nil
- end
- #释放背景图形
- unless @sprite.bitmap.disposed?
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #释放选项动画
- unless @loop_animation.disposed?
- @loop_animation.dispose
- $sprite_new.bitmap.dispose
- $sprite_new.dispose
- $sprite_load.bitmap.dispose
- $sprite_load.dispose
- $sprite_end.bitmap.dispose
- $sprite_end.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 新游戏
- #--------------------------------------------------------------------------
- def command_new_game
- #释放图形
- dispose
- #停止当前演奏的SE
- $game_system.se_stop
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 停止 BGM
- Audio.bgm_stop
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置初期同伴位置
- $game_party.setup_starting_members
- # 设置初期位置的地图
- $game_map.setup($data_system.start_map_id)
- # 主角向初期位置移动
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- # 刷新主角
- $game_player.refresh
- # 执行地图设置的 BGM 与 BGS 的自动切换
- $game_map.autoplay
- # 刷新地图 (执行并行事件)
- $game_map.update
- #初期金钱+1000
- $game_party.gain_gold(10000)
- # 切换地图画面
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 继续
- #--------------------------------------------------------------------------
- def command_continue
- #停止当前演奏的SE
- $game_system.se_stop
- # 继续无效的情况下
- unless @continue_enabled
- # 演奏无效 SE
- $game_system.se_play($data_system.buzzer_se)
- $title = 1
- return
- end
- dispose
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到读档画面
- $scene = Scene_Load.new
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 退出
- #--------------------------------------------------------------------------
- def command_shutdown
- #停止当前演奏的SE
- $game_system.se_stop
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # BGM、BGS、ME 的淡入淡出
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- Dir.chdir("Temp")
- for f in Dir["*"]
- if FileTest.directory?(f)
- else
- File.delete(f)
- end
- end
- # 退出
- $scene = nil
-
- end
- #--------------------------------------------------------------------------
- # ● 战斗测试
- #--------------------------------------------------------------------------
- def battle_test
- # 载入数据库 (战斗测试用)
- $data_actors = load_data("Data/BT_Actors.rxdata")
- $data_classes = load_data("Data/BT_Classes.rxdata")
- $data_skills = load_data("Data/BT_Skills.rxdata")
- $data_items = load_data("Data/BT_Items.rxdata")
- $data_weapons = load_data("Data/BT_Weapons.rxdata")
- $data_armors = load_data("Data/BT_Armors.rxdata")
- $data_enemies = load_data("Data/BT_Enemies.rxdata")
- $data_troops = load_data("Data/BT_Troops.rxdata")
- $data_states = load_data("Data/BT_States.rxdata")
- $data_animations = load_data("Data/BT_Animations.rxdata")
- $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
- $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
- $data_system = load_data("Data/BT_System.rxdata")
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置战斗测试用同伴
- $game_party.setup_battle_test_members
- # 设置队伍 ID、可以逃走标志、战斗背景
- $game_temp.battle_troop_id = $data_system.test_troop_id
- $game_temp.battle_can_escape = true
- $game_map.battleback_name = $data_system.battleback_name
- # 演奏战斗开始 BGM
- $game_system.se_play($data_system.battle_start_se)
- # 演奏战斗 BGM
- $game_system.bgm_play($game_system.battle_bgm)
- # 切换到战斗画面
- $scene = Scene_Battle.new
- end
- end
复制代码 |
评分
-
查看全部评分
|