赞 | 0 |
VIP | 18 |
好人卡 | 3 |
积分 | 8 |
经验 | 39004 |
最后登录 | 2020-3-25 |
在线时间 | 532 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 756
- 在线时间
- 532 小时
- 注册时间
- 2011-10-3
- 帖子
- 2237
|
本帖最后由 神秘影子 于 2011-11-26 09:51 编辑
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 处理标题画面的类。
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
if $BTEST # 战斗测试的情况下
battle_test # 开始战斗测试处理
else # 普通游戏的情况下
super # 原来的主处理
end
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
load_database # 载入数据库
create_game_objects # 生成游戏对象
check_continue # 判断继续是否有效
create_title_graphic # 生成标题画面图像
create_command_window # 生成指令窗口
play_title_music # 播放标题画面音乐
end
#--------------------------------------------------------------------------
# ● 执行转换
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(5)
end
#--------------------------------------------------------------------------
# ● 开始后处理
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# ● 结束前处理
#--------------------------------------------------------------------------
def pre_terminate
super
close_command_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_command_window
snapshot_for_background
dispose_title_graphic
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0 # 新游戏
command_new_game
when 1 # 继续
command_continue
when 2 # 退出
command_shutdown
when 3 # 备注
print"没有备注"
end
end
end
#--------------------------------------------------------------------------
# ● 载入数据库
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$data_weapons = load_data("Data/Weapons.rvdata")
$data_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
end
#--------------------------------------------------------------------------
# ● 载入战斗测试用的数据库
#--------------------------------------------------------------------------
def load_bt_database
$data_actors = load_data("Data/BT_Actors.rvdata")
$data_classes = load_data("Data/BT_Classes.rvdata")
$data_skills = load_data("Data/BT_Skills.rvdata")
$data_items = load_data("Data/BT_Items.rvdata")
$data_weapons = load_data("Data/BT_Weapons.rvdata")
$data_armors = load_data("Data/BT_Armors.rvdata")
$data_enemies = load_data("Data/BT_Enemies.rvdata")
$data_troops = load_data("Data/BT_Troops.rvdata")
$data_states = load_data("Data/BT_States.rvdata")
$data_animations = load_data("Data/BT_Animations.rvdata")
$data_common_events = load_data("Data/BT_CommonEvents.rvdata")
$data_system = load_data("Data/BT_System.rvdata")
end
#--------------------------------------------------------------------------
# ● 生成各种游戏对象
#--------------------------------------------------------------------------
def create_game_objects
$game_temp = Game_Temp.new
$game_message = Game_Message.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.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
end
#--------------------------------------------------------------------------
# ● 判断继续是否有效
#--------------------------------------------------------------------------
def check_continue
@continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
end
#--------------------------------------------------------------------------
# ● 生成标题画面图像
#--------------------------------------------------------------------------
def create_title_graphic
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Title")
end
#--------------------------------------------------------------------------
# ● 释放标题画面图像
#--------------------------------------------------------------------------
def dispose_title_graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::new_game
s2 = Vocab::continue
s3 = Vocab::shutdown
s4 = "游戏版本:1.0"
@command_window = Window_Command.new(172, [s1, s2, s3, s4])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = 288
if @continue_enabled # 继续有效的情况下
@command_window.index = 1 # 光标位置符合
else # 无效的情况下
@command_window.draw_item(1, false) # 指令以半透明显示
end
@command_window.openness = 0
@command_window.open
end
#--------------------------------------------------------------------------
# ● 释放指令窗口
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 打开指令窗口
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# ● 关闭指令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# ● 播放标题画面音乐
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
#--------------------------------------------------------------------------
# ● 检测游戏者初期位置是否存在
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "没有设置游戏者初期位置。"
exit
end
end
#--------------------------------------------------------------------------
# ● 指令 : 新游戏
#--------------------------------------------------------------------------
def command_new_game
confirm_player_location
Sound.play_decision
$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
$scene = Scene_Map.new
RPG::BGM.fade(1500)
close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# ● 指令 : 继续
#--------------------------------------------------------------------------
def command_continue
if @continue_enabled
Sound.play_decision
$scene = Scene_File.new(false, true, false)
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● 指令 : 退出
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# ● 战斗测试
#--------------------------------------------------------------------------
def battle_test
load_bt_database # 载入战斗测试用数据库
create_game_objects # 生成游戏对象
Graphics.frame_count = 0 # 初始化游戏时间
$game_party.setup_battle_test_members
$game_troop.setup($data_system.test_troop_id)
$game_troop.can_escape = true
$game_system.battle_bgm.play
snapshot_for_background
$scene = Scene_Battle.new
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# menu_index : 指令光标初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status_window = Window_MenuStatus.new(160, 0)
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@gold_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "装备"
s2 = "技能"
s3 = "系统"
@command_window = Window_Command.new(160, [s1, s2, s3])
@command_window.index = @menu_index
if $game_party.members.size == 0 # 同伴人数为 0 的情况下
@command_window.draw_item(0, false) # 物品无效化
@command_window.draw_item(1, false) # 特技无效化
@command_window.draw_item(2, false) # 装备无效化
@command_window.draw_item(3, false) # 状态无效化
end
if $game_system.save_disabled # 禁止存档的情况下
@command_window.draw_item(4, true) # 存档还是有效
end
end
#--------------------------------------------------------------------------
# ● 更新指令选择
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0,1, # 特技、装备、状态
start_actor_selection
when 2 # 系统
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# ● アクター選択の開始
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● アクター選択の終了
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# ● アクター選択の更新
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # スキル
$scene = Scene_Skill.new(@status_window.index)
when 2 # 装備
$scene = Scene_Equip.new(@status_window.index)
when 3 # ステータス
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
#==============================================================================
# ■ Scene_End
#------------------------------------------------------------------------------
# 处理游戏结束画面的类。
#==============================================================================
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
end
#--------------------------------------------------------------------------
# ● 开始后处理
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# ● 结束前处理
#--------------------------------------------------------------------------
def pre_terminate
super
close_command_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_command_window
dispose_menu_background
end
#--------------------------------------------------------------------------
# ● 返回至原来的画面
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(5)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
case @command_window.index
when 6 # 返回标题
command_to_title
when 7 # 离开游戏
command_shutdown
when 8 # 取消操作
command_cancel
when 4 # 存档
$scene = Scene_File.new(true, false, false)
when 0 # 物品
$scene = Scene_Item.new
when 1,2,3 # 状态
start_actor_selection
when 5 # 备注
print"没有备注"
end
end
end
#--------------------------------------------------------------------------
# ● 更新菜单画面背景
#--------------------------------------------------------------------------
def update_menu_background
super
@menuback_sprite.tone.set(0, 0, 0, 128)
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "物品背包"
s2 = "查看技能"
s3 = "更换装备"
s4 = "角色状态"
s5 = "快速存档"
s6 = "菜单备注"
s7 = "返回标题"
s8 = "离开游戏"
s9 = "返回菜单"
@command_window = Window_Command.new(172, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (416 - @command_window.height) / 2
@command_window.openness = 0
end
#--------------------------------------------------------------------------
# ● 释放指令窗口
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 打开指令窗口
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# ● 关闭指令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# ● 选择指令 [转到标题画面] 时的处理
#--------------------------------------------------------------------------
def command_to_title
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = Scene_Title.new
close_command_window
Graphics.fadeout(60)
end
#--------------------------------------------------------------------------
# ● 选择指令 [退出] 时的处理
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# ● 选择指令 [取消] 时的处理
#--------------------------------------------------------------------------
def command_cancel
Sound.play_decision
return_scene
end
end
就是这个了,我想知道,是不是那几样不能归类于“系统”。
(我今天刚开始摸索脚本)
|
|