设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1924|回复: 0
打印 上一主题 下一主题

[原创发布] DEBUG功能调用公共事件

[复制链接]

Lv2.观梦者

梦石
0
星屑
635
在线时间
244 小时
注册时间
2010-9-9
帖子
472
跳转到指定楼层
1
发表于 2010-12-7 22:08:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
调式模式时按F8会进入公共事件调式,
若调用公共事件会强制停止地图上的事件。
(注释仅是随便加了一点 -_-|| )
范例: 范例.rar (185.1 KB, 下载次数: 79)
脚本:
  1. #  ◆ 公共事件调式系统 Common Event Debug
  2. #  调式模式时按F8会进入公共事件调式,若调用公共事件会强制停止地图上的事件。
  3. #  (注释仅是随便加了一点 -_-|| )

  4. class Scene_Map
  5.   alias scene_map_update update
  6.   def update
  7.     # 添加F8开启按键
  8.     if $DEBUG and Input.press?(Input::F8)
  9.       $scene = Scene_CED.new
  10.     end
  11.     scene_map_update
  12.   end
  13. end

  14. class Window_CED < Window_Selectable
  15.   # 初始化
  16.   def initialize
  17.     super(0, 64, 340, 416)
  18.     self.index = 0
  19.     @item_max = 0
  20.     if self.contents != nil
  21.       self.contents.dispose
  22.       self.contents = nil
  23.     end
  24.     # 算出公共事件的数量
  25.     for i in 1..999
  26.       if $data_common_events[i] != nil
  27.         @item_max += 1
  28.       end
  29.     end
  30.     # 描绘公共事件
  31.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  32.     for i in 0...@item_max
  33.       common_id = sprintf("%03d: ",i+1)
  34.       text = common_id + $data_common_events[i+1].name
  35.       self.contents.draw_text(4, i * 32, 320, 32, text)
  36.     end
  37.   end
  38. end

  39. class Scene_CED
  40.   # 主处理
  41.   def main
  42.     # 生成各种窗口
  43.     @help_window = Window_Help.new
  44.     @help_window.set_text("公共事件调式系统,按确定键执行公共事件。")
  45.     @info_window = Window_Base.new(340,64,300,416)
  46.     @info_window.contents = Bitmap.new(250,350)
  47.     @ced_window = Window_CED.new
  48.     Graphics.transition
  49.     loop do
  50.       Graphics.update
  51.       Input.update
  52.       update
  53.       # 刷新公共事件说明
  54.       update_info
  55.       if $scene != self
  56.         break
  57.       end
  58.     end
  59.     Graphics.freeze
  60.     $game_map.refresh
  61.     # 释放各种窗口
  62.     @info_window.dispose
  63.     @help_window.dispose
  64.     @ced_window.dispose
  65.   end
  66.   # 刷新
  67.   def update
  68.     @ced_window.update
  69.     if Input.trigger?(Input::B)
  70.       $scene = Scene_Map.new
  71.       return
  72.     end
  73.     if Input.trigger?(Input::C)
  74.       # 强制停止地图上的事件
  75.       $game_system.map_interpreter.command_end
  76.       $scene = Scene_Map.new
  77.       # 调用公共事件
  78.       $game_temp.common_event_id = (@ced_window.index + 1)
  79.       return
  80.     end
  81.   end
  82.   # 刷新公共事件说明
  83.   def update_info
  84.     @info_window.contents.clear
  85.     # 描绘公共事件说明
  86.     @info_window.contents.font.color = Color.new(192, 224, 255, 255)
  87.     text_id = "ID  :"
  88.     text_name = "名称:"
  89.     text_trigger = "目标:"
  90.     text_switch_id = "条件:"
  91.     @info_window.contents.draw_text(4,0,250,32,text_id)
  92.     @info_window.contents.draw_text(4,32,250,32,text_name)
  93.     @info_window.contents.draw_text(4,64,250,32,text_trigger)
  94.     @info_window.contents.draw_text(4,96,250,32,text_switch_id)
  95.     @info_window.contents.font.color = Color.new(255, 255, 255, 255)
  96.     id = sprintf("%03d",@ced_window.index + 1)
  97.     name = $data_common_events[@ced_window.index + 1].name
  98.     if $data_common_events[@ced_window.index + 1].trigger == 0
  99.       trigger = "无"
  100.     elsif $data_common_events[@ced_window.index + 1].trigger == 1
  101.       trigger = "自动执行"
  102.     else
  103.       trigger = "并行处理"
  104.     end
  105.     if $data_common_events[@ced_window.index + 1].trigger != 0
  106.       switch_id = sprintf("开关 %04d",$data_common_events[@ced_window.index + 1].switch_id)
  107.     else
  108.       switch_id = "无"
  109.     end
  110.     @info_window.contents.draw_text(65,0,250,32,id)
  111.     @info_window.contents.draw_text(65,32,250,32,name)
  112.     @info_window.contents.draw_text(65,64,250,32,trigger)
  113.     @info_window.contents.draw_text(65,96,250,32,switch_id)
  114.   end
  115. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-15 06:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表