Project1
标题:
DEBUG功能调用公共事件
[打印本页]
作者:
EngShun
时间:
2010-12-7 22:08
标题:
DEBUG功能调用公共事件
调式模式时按F8会进入公共事件调式,
若调用公共事件会强制停止地图上的事件。
(注释仅是随便加了一点 -_-|| )
范例:
范例.rar
(185.1 KB, 下载次数: 79)
2010-12-7 22:06 上传
点击文件名下载附件
脚本:
# ◆ 公共事件调式系统 Common Event Debug
# 调式模式时按F8会进入公共事件调式,若调用公共事件会强制停止地图上的事件。
# (注释仅是随便加了一点 -_-|| )
class Scene_Map
alias scene_map_update update
def update
# 添加F8开启按键
if $DEBUG and Input.press?(Input::F8)
$scene = Scene_CED.new
end
scene_map_update
end
end
class Window_CED < Window_Selectable
# 初始化
def initialize
super(0, 64, 340, 416)
self.index = 0
@item_max = 0
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# 算出公共事件的数量
for i in 1..999
if $data_common_events[i] != nil
@item_max += 1
end
end
# 描绘公共事件
self.contents = Bitmap.new(width - 32, @item_max * 32)
for i in 0...@item_max
common_id = sprintf("%03d: ",i+1)
text = common_id + $data_common_events[i+1].name
self.contents.draw_text(4, i * 32, 320, 32, text)
end
end
end
class Scene_CED
# 主处理
def main
# 生成各种窗口
@help_window = Window_Help.new
@help_window.set_text("公共事件调式系统,按确定键执行公共事件。")
@info_window = Window_Base.new(340,64,300,416)
@info_window.contents = Bitmap.new(250,350)
@ced_window = Window_CED.new
Graphics.transition
loop do
Graphics.update
Input.update
update
# 刷新公共事件说明
update_info
if $scene != self
break
end
end
Graphics.freeze
$game_map.refresh
# 释放各种窗口
@info_window.dispose
@help_window.dispose
@ced_window.dispose
end
# 刷新
def update
@ced_window.update
if Input.trigger?(Input::B)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
# 强制停止地图上的事件
$game_system.map_interpreter.command_end
$scene = Scene_Map.new
# 调用公共事件
$game_temp.common_event_id = (@ced_window.index + 1)
return
end
end
# 刷新公共事件说明
def update_info
@info_window.contents.clear
# 描绘公共事件说明
@info_window.contents.font.color = Color.new(192, 224, 255, 255)
text_id = "ID :"
text_name = "名称:"
text_trigger = "目标:"
text_switch_id = "条件:"
@info_window.contents.draw_text(4,0,250,32,text_id)
@info_window.contents.draw_text(4,32,250,32,text_name)
@info_window.contents.draw_text(4,64,250,32,text_trigger)
@info_window.contents.draw_text(4,96,250,32,text_switch_id)
@info_window.contents.font.color = Color.new(255, 255, 255, 255)
id = sprintf("%03d",@ced_window.index + 1)
name = $data_common_events[@ced_window.index + 1].name
if $data_common_events[@ced_window.index + 1].trigger == 0
trigger = "无"
elsif $data_common_events[@ced_window.index + 1].trigger == 1
trigger = "自动执行"
else
trigger = "并行处理"
end
if $data_common_events[@ced_window.index + 1].trigger != 0
switch_id = sprintf("开关 %04d",$data_common_events[@ced_window.index + 1].switch_id)
else
switch_id = "无"
end
@info_window.contents.draw_text(65,0,250,32,id)
@info_window.contents.draw_text(65,32,250,32,name)
@info_window.contents.draw_text(65,64,250,32,trigger)
@info_window.contents.draw_text(65,96,250,32,switch_id)
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1