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

Project1

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

[已经过期] 详尽任务显示界面的任务如何固定任务选项?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
跳转到指定楼层
1
发表于 2012-8-22 07:33:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
比如:我1号任务接了,1号任务就在第1个位置,但是当我接了2号任务,1号任务就被2号任务挤到下一行去了。请问如何固定任务选项位置?

脚本:
  1. =begin
  2. --------------------------------------------------------------------------
  3. 详尽任务显示界面 v2.1
  4. --------------------------------------------------------------------------
  5. By 叶子

  6. 日期与更新
  7. 3-29-2006 -v1.0
  8. 4-3-2006  -v2.0
  9. -可以改变文字颜色,显示变量,显示图标,显示图片
  10. -大幅简化了编写任务内容的过程,加入自动换行功能
  11. -精简了窗口,使其还可以用作图鉴系统、日记系统等等
  12. 4-6-2006  -v2.1
  13. -增加了获得全部任务与删除全部任务命令
  14. -改正通假字,修改了示例任务3
  15. --------------------------------------------------------------------------
  16. 顾名思义,就是显示任务资料的界面
  17. 任务资料要预先在这里设定好
  18. 下载范例工程,能帮助你更快更好地掌握使用方法
  19. --------------------------------------------------------------------------
  20. 使用方法:

  21. 1、召唤任务显示界面:$scene = Scene_Task.new

  22. 可以在事件中的“脚本”指令加入这段东西,又或者修改 Scene_Menu 来增加一个显示
  23. 任务的选项。如果是修改 Scene_Menu 增加选项的话,在脚本倒数第30行左右,
  24. 把 $scene = Scene_Map.new 修改成 $scene = Scene_Menu.new(任务界面index)

  25. 2、设置任务资料

  26.   2.1、相关内容解析
  27.   
  28.   所有内容文字必须用双引号括住
  29.   
  30.   名称:任务的名字(显示在左边窗口中),大小为208×32,如果全部为文字的话,
  31.         够放九个全角字符
  32.         
  33.   简介:任务的介绍(显示在右边窗口中),宽368,高不限
  34.   
  35.         文字可以自动换行
  36.   
  37.    2.1.1、控制码解析
  38.    
  39.    名称和内容均可用控制码,注意两条反斜线都要打!
  40.    
  41.    \\v[n] 显示n号变量
  42.    \\c[n] 改变字体颜色。
  43.           n=1~7 时同“显示文章”的\c[n],n=8 时为半透明色,n=9 时为系统色(青色)
  44.    \\n[i] 显示i号角色名字
  45.    \\i[文件名] 显示图标
  46.    \\p[文件名] 显示图片
  47.    
  48.    2.1.2、高级:内嵌表达式
  49.         
  50.    请参考帮助-脚本入门-字符串-内嵌表达式相关内容。
  51.    它可以用来在任务的名称和简介那里显示变量。
  52.    常用的表达式(注意不要漏了井号和大括号):
  53.    #{$game_variables[n]}       ——插入n号变量的值
  54.    #{$game_party.item_number(n)}  ——插入持有n号物品数量
  55.                                       同理还有weapon_number,armor_number
  56.    还可以预先定义一个变量,再插入(例子见示例任务3-灵魂线)
  57.    
  58.   2.2、注意事项
  59.   
  60.    2.2.1、括号、逗号和双引号 [ ] , " 必须使用半角符号(英文输入),
  61.           引号内的内容则没有关系
  62.          
  63.    2.2.2、单引号 ' 和双引号 " 的区别:
  64.           为了不出错误,全部用双引号吧!当然如果你对Ruby很熟悉,那就没所谓了
  65.   
  66.   2.3、开始设置吧!
  67.   从107行开始设置任务资料,可以参考示例任务来设置,请仔细阅读附加讲解
  68.   
  69. 3、接受任务

  70. 事件里的“脚本”指令输入:get_task(任务ID)
  71. 例如 get_task(1) 就是接受1号任务

  72.   3.1、获得全部任务
  73.   
  74.   事件里的“脚本”指令输入:get_all_task
  75.   这个功能基本上是用来在编写好所有任务资料后测试排版的
  76.   

  77. 4、完成/删除任务

  78. 事件里的“脚本”指令输入:finish_task(任务ID)
  79. 例如 finish_task(1) 就是完成1号任务

  80. 注意:本脚本不负责完成任务后的奖励之类的东西,请自行在事件中判断,
  81.        这里的完成任务指的是从任务列表中删去此任务

  82.   4.1、删除全部任务
  83.   
  84.   事件里的“脚本”指令输入:finish_all_task
  85.   作为获得全部任务的对应功能存在,似乎不会怎么用到
  86. =end

  87. class Scene_Task
  88.   # 这里设置任务内容翻页音效
  89.   CHANGE_PAGE_SE = "Audio/SE/046-Book01"
  90. end

  91. class Game_Party
  92.   #--------------------------------------------------------------------------
  93.   # ● 设置任务资料
  94.   #--------------------------------------------------------------------------
  95.   def get_tasks_info
  96.     @tasks_info = []
  97.    
  98.     #-讲解-
  99.     # 三个示例任务由浅入深,其实只要看懂第一个就可以使用了。
  100.     # 任务的写法多种多样,不限于这三个任务的方法
  101.     #----
  102.     #-----------------------------
  103.     # 示例任务1:沙漠中的五叶花
  104.     #-----------------------------
  105.     名称 = "1"
  106.     #-讲解-
  107.     # 注意!脚本编辑器的变色功能并不是非常完善,所以换行后字变黑了,但仍然是字符
  108.     # 串的一部分,所以不要忘记在内容最后打一个双引号
  109.     # 按回车是强制换行
  110.     #----
  111.     简介 = ""
  112.     #-讲解-
  113.     # 每个任务最后一定要加上:
  114.     # @tasks_info[任务ID] = Game_Task.new(名称, 简介)
  115.     # 接受任务和完成任务都是用这个任务ID来索引
  116.     #----
  117.     @tasks_info[1] = Game_Task.new(名称, 简介)
  118.    
  119.     #-----------------------------
  120.     # 示例任务2:克萝莉亚的药瓶
  121.     #-----------------------------
  122.     名称 = "2"
  123.     #-讲解-
  124.     # 这里使用了字符串相加,例如 s = "a" + "b" ,s 就是 "ab"
  125.     # 还用了内嵌表达式,$game_party.item_number(38) 就是38号物品的数量
  126.     #----
  127.     简介 =""
  128.     @tasks_info[2] = Game_Task.new(名称, 简介)
  129.    
  130.     名称 = "3"
  131.     #-讲解-
  132.     # 这里使用了字符串相加,例如 s = "a" + "b" ,s 就是 "ab"
  133.     # 还用了内嵌表达式,$game_party.item_number(38) 就是38号物品的数量
  134.     #----
  135.     简介 =""
  136.     @tasks_info[3] = Game_Task.new(名称, 简介)  
  137.   end
  138. end
  139.    
  140. #==============================================================================
  141. # ■ Interpreter
  142. #------------------------------------------------------------------------------
  143. #  执行事件命令的解释器。本类在 Game_System 类
  144. # 与 Game_Event 类的内部使用。
  145. #==============================================================================

  146. class Interpreter
  147.   #--------------------------------------------------------------------------
  148.   # ● 接受任务
  149.   #--------------------------------------------------------------------------
  150.   def get_task(id)
  151.     task = $game_party.tasks_info[id]
  152.     return true if (task.nil? or $game_party.current_tasks.include?(task.id))
  153.     $game_party.current_tasks.unshift(task.id)
  154.     return true
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 获得全部任务
  158.   #--------------------------------------------------------------------------
  159.   def get_all_task
  160.     # 清空当前任务
  161.     $game_party.current_tasks.clear
  162.     for task in $game_party.tasks_info
  163.       next if task.nil?
  164.       $game_party.current_tasks.unshift(task.id)
  165.     end
  166.     return true
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 完成/放弃任务
  170.   #--------------------------------------------------------------------------
  171.   def finish_task(id)
  172.     task = $game_party.tasks_info[id]
  173.     return true if task.nil?
  174.     $game_party.current_tasks.delete(task.id)
  175.     return true
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 删除全部任务
  179.   #--------------------------------------------------------------------------
  180.   def finish_all_task
  181.     $game_party.current_tasks.clear
  182.     return true
  183.   end
  184. end

  185. #==============================================================================
  186. # ■ Game_Party
  187. #------------------------------------------------------------------------------
  188. #  处理同伴的类。包含金钱以及物品的信息。本类的实例
  189. # 请参考 $game_party。
  190. #==============================================================================

  191. class Game_Party
  192.   #--------------------------------------------------------------------------
  193.   # ● 定义实例变量
  194.   #--------------------------------------------------------------------------
  195.   attr_writer     :latest_task                  # 上次查看的任务
  196.   #--------------------------------------------------------------------------
  197.   # ● 取得任务资料
  198.   #--------------------------------------------------------------------------
  199.   def tasks_info
  200.     if @tasks_info.nil?
  201.       get_tasks_info
  202.     end
  203.     return @tasks_info
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 取得当前任务
  207.   #--------------------------------------------------------------------------
  208.   def current_tasks
  209.     if @current_tasks.nil?
  210.       @current_tasks = []
  211.     end
  212.     return @current_tasks
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 上次查看的任务
  216.   #--------------------------------------------------------------------------
  217.   def latest_task
  218.     if !current_tasks.include?(@latest_task)
  219.       @latest_task = current_tasks[0]
  220.     end
  221.     return @latest_task
  222.   end
  223. end

  224. #==============================================================================
  225. # ■ Game_Task
  226. #------------------------------------------------------------------------------
  227. #  处理任务的类。包含任务的信息。
  228. #==============================================================================

  229. class Game_Task
  230.   attr_accessor   :name                   # 名称
  231.   attr_accessor   :briefing               # 简介
  232.   def initialize(name, briefing)
  233.     @name = name
  234.     @briefing = briefing
  235.   end
  236.   def height
  237.     text = @briefing.clone
  238.     x = 0
  239.     y = 64
  240.     min_y = 0
  241.     # 限制文字处理
  242.     begin
  243.       last_text = text.clone
  244.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  245.     end until text == last_text
  246.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  247.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  248.     end
  249.     # 为了方便、将 "\\\\" 变换为 "\000"
  250.     text.gsub!(/\\\\/) { "\000" }
  251.     # "\C" 变为 "\001"
  252.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  253.     # "\I" 变为 "\002"
  254.     text.gsub!(/\\[Ii]/) { "\002" }
  255.     # "\P" 变为 "\003"
  256.     text.gsub!(/\\[Pp]/) { "\003" }
  257.     # c 获取 1 个字 (如果不能取得文字就循环)
  258.     while ((c = text.slice!(/./m)) != nil)
  259.       # \\ 的情况下
  260.       if c == "\000"
  261.         # 还原为本来的文字
  262.         c = "\\"
  263.       end
  264.       # \C[n] 的情况下
  265.       if c == "\001"
  266.         # 更改文字色
  267.         text.sub!(/\[([0-9]+)\]/, "")
  268.         # 下面的文字
  269.         next
  270.       end
  271.       # 图标的情况下
  272.       if c == "\002"
  273.         icon_name = ''
  274.         while ((cha = text.slice!(/./m)) != ']')
  275.           next if cha == '['
  276.           icon_name += cha
  277.         end
  278.         icon = RPG::Cache.icon(icon_name)
  279.         if x + icon.width > 368
  280.           x = 0
  281.           y += [32, min_y].max
  282.           min_y = 0
  283.         end
  284.         x += 28
  285.         next
  286.       end
  287.       # 图片的情况下
  288.       if c == "\003"
  289.         pic_name = ''
  290.         while ((cha = text.slice!(/./m)) != ']')
  291.           next if cha == '['
  292.           pic_name += cha
  293.         end
  294.         pic = RPG::Cache.picture(pic_name)
  295.         if x + pic.width > 368
  296.           x = 0
  297.           y += [32, min_y].max
  298.           min_y = 0
  299.         end
  300.         x += pic.width
  301.         min_y = [pic.height, 32].max
  302.         next
  303.       end
  304.       # 另起一行文字的情况下
  305.       if c == "\n"
  306.         y += [32, min_y].max
  307.         min_y = 0
  308.         x = 0
  309.         # 下面的文字
  310.         next
  311.       end
  312.       # 自动换行处理
  313.       if x + 22 > 368
  314.         y += [32, min_y].max
  315.         min_y = 0
  316.         x = 0
  317.       end
  318.       # x 为要描绘文字的加法运算
  319.       x += 22
  320.     end
  321.     return (y + [32, min_y].max)
  322.   end
  323.   def id
  324.     return $game_party.tasks_info.index(self)
  325.   end
  326. end

  327. #==============================================================================
  328. # ■ Window_Task_Name
  329. #------------------------------------------------------------------------------
  330. #  任务名称显示窗口。
  331. #==============================================================================

  332. class Window_Task_Name < Window_Selectable
  333.   #--------------------------------------------------------------------------
  334.   # ● 初始化对像
  335.   #--------------------------------------------------------------------------
  336.   def initialize(tasks)
  337.     super(0, 0, 240, 480)
  338.     @tasks = []
  339.     for id in tasks
  340.       @tasks.push($game_party.tasks_info[id])
  341.     end
  342.     @item_max = tasks.size
  343.     self.contents = Bitmap.new(
  344.     self.width - 32, @item_max == 0 ? 32 : @item_max * 32)
  345.     refresh
  346.     self.index = 0
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 刷新
  350.   #--------------------------------------------------------------------------
  351.   def refresh
  352.     self.contents.clear
  353.     if @tasks != []
  354.       for task in @tasks
  355.         draw_item(task)
  356.       end
  357.     else
  358.       draw_blank
  359.     end
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ● 描绘项目
  363.   #--------------------------------------------------------------------------
  364.   def draw_item(task)
  365.     text = task.name.clone
  366.     x = 0
  367.     y = @tasks.index(task) * 32
  368.     # 限制文字处理
  369.     begin
  370.       last_text = text.clone
  371.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  372.     end until text == last_text
  373.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  374.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  375.     end
  376.     # 为了方便、将 "\\\\" 变换为 "\000"
  377.     text.gsub!(/\\\\/) { "\000" }
  378.     # "\\C" 变为 "\001"
  379.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  380.     # "\I" 变为 "\002"
  381.     text.gsub!(/\\[Ii]/) { "\002" }
  382.     # "\P" 变为 "\003"
  383.     text.gsub!(/\\[Pp]/) { "\003" }
  384.     # c 获取 1 个字 (如果不能取得文字就循环)
  385.     while ((c = text.slice!(/./m)) != nil)
  386.       # \\ 的情况下
  387.       if c == "\000"
  388.         # 还原为本来的文字
  389.         c = "\\"
  390.       end
  391.       # \C[n] 的情况下
  392.       if c == "\001"
  393.         # 更改文字色
  394.         text.sub!(/\[([0-9]+)\]/, "")
  395.         color = $1.to_i
  396.         if color >= 0 and color <= 7
  397.           self.contents.font.color = text_color(color)
  398.         elsif color == 8
  399.           self.contents.font.color = disabled_color
  400.         elsif color == 9
  401.           self.contents.font.color = system_color
  402.         end
  403.         # 下面的文字
  404.         next
  405.       end
  406.       # 图标的情况下
  407.       if c == "\002"
  408.         icon_name = ''
  409.         while ((cha = text.slice!(/./m)) != ']')
  410.           next if cha == '['
  411.           icon_name += cha
  412.         end
  413.         icon = RPG::Cache.icon(icon_name)
  414.         if x + icon.width > self.contents.width
  415.           x = 0
  416.           y += [32, min_y].max
  417.           min_y = 0
  418.         end
  419.         self.contents.blt(x + 4, y + 4, icon, Rect.new(0, 0, 24, 24))
  420.         x += 28
  421.         next
  422.       end
  423.       # 图片的情况下
  424.       if c == "\003"
  425.         pic_name = ''
  426.         while ((cha = text.slice!(/./m)) != ']')
  427.           next if cha == '['
  428.           pic_name += cha
  429.         end
  430.         pic = RPG::Cache.picture(pic_name)
  431.         if x + pic.width > self.contents.width
  432.           x = 0
  433.           y += [32, min_y].max
  434.           min_y = 0
  435.         end
  436.         self.contents.blt(x + 4, y, pic, Rect.new(0, 0, pic.width, pic.height))
  437.         x += pic.width
  438.         next
  439.       end
  440.       # 描绘文字
  441.       self.contents.draw_text(4 + x, y, 40, 32, c)
  442.       # x 为要描绘文字的加法运算
  443.       x += self.contents.text_size(c).width
  444.     end
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # ● 描绘空行
  448.   #--------------------------------------------------------------------------
  449.   def draw_blank
  450.     self.contents.font.color = disabled_color
  451.     rect = Rect.new(4, 0, self.contents.width - 8, 32)
  452.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  453.     self.contents.draw_text(rect, '当前没有任何任务')
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 获取任务
  457.   #--------------------------------------------------------------------------
  458.   def task
  459.     return @tasks[self.index]
  460.   end
  461. end
  462.   
  463. #==============================================================================
  464. # ■ Window_Task
  465. #------------------------------------------------------------------------------
  466. #  任务内容显示窗口。
  467. #==============================================================================

  468. class Window_Task < Window_Base
  469.   #--------------------------------------------------------------------------
  470.   # ● 初始化对像
  471.   #--------------------------------------------------------------------------
  472.   def initialize(task_id)
  473.     super(240, 0, 400, 480)
  474.     refresh(task_id)
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● 刷新内容
  478.   #--------------------------------------------------------------------------
  479.   def refresh(task_id)
  480.     self.oy = 0
  481.     self.visible = true
  482.     return if task_id.nil?
  483.     task = $game_party.tasks_info[task_id]
  484.     if !task.nil?
  485.       self.contents = Bitmap.new(self.width - 32, task.height)
  486.     else
  487.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  488.       return
  489.     end
  490.     self.contents.font.color = normal_color
  491.     # 描绘任务内容
  492.     draw_task_info(task)
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 描绘任务内容
  496.   #--------------------------------------------------------------------------
  497.   def draw_task_info(task)
  498.     # 记录文字x坐标
  499.     x = 0
  500.     # 记录文字y坐标
  501.     y = 0
  502.     # 记录换行时y坐标最小加值
  503.     min_y = 0
  504.     self.contents.font.color = normal_color
  505.     # 描绘任务简介
  506.     text = task.briefing.clone
  507.     # 限制文字处理
  508.     begin
  509.       last_text = text.clone
  510.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  511.     end until text == last_text
  512.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  513.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  514.     end
  515.     # 为了方便、将 "\\\\" 变换为 "\000"
  516.     text.gsub!(/\\\\/) { "\000" }
  517.     # "\C" 变为 "\001"
  518.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  519.     # "\I" 变为 "\002"
  520.     text.gsub!(/\\[Ii]/) { "\002" }
  521.     # "\P" 变为 "\003"
  522.     text.gsub!(/\\[Pp]/) { "\003" }
  523.     # c 获取 1 个字 (如果不能取得文字就循环)
  524.     while ((c = text.slice!(/./m)) != nil)
  525.       # \\ 的情况下
  526.       if c == "\000"
  527.         # 还原为本来的文字
  528.         c = "\\"
  529.       end
  530.       # \C[n] 的情况下
  531.       if c == "\001"
  532.         # 更改文字色
  533.         text.sub!(/\[([0-9]+)\]/, "")
  534.         color = $1.to_i
  535.         if color >= 0 and color <= 7
  536.           self.contents.font.color = text_color(color)
  537.         elsif color == 8
  538.           self.contents.font.color = disabled_color
  539.         elsif color == 9
  540.           self.contents.font.color = system_color
  541.         end
  542.         # 下面的文字
  543.         next
  544.       end
  545.       # 图标的情况下
  546.       if c == "\002"
  547.         icon_name = ''
  548.         while ((cha = text.slice!(/./m)) != ']')
  549.           next if cha == '['
  550.           icon_name += cha
  551.         end
  552.         icon = RPG::Cache.icon(icon_name)
  553.         if x + icon.width > self.contents.width
  554.           x = 0
  555.           y += [32, min_y].max
  556.           min_y = 0
  557.         end
  558.         self.contents.blt(x + 4, y + 4, icon, Rect.new(0, 0, 24, 24))
  559.         x += 28
  560.         next
  561.       end
  562.       # 图片的情况下
  563.       if c == "\003"
  564.         pic_name = ''
  565.         while ((cha = text.slice!(/./m)) != ']')
  566.           next if cha == '['
  567.           pic_name += cha
  568.         end
  569.         pic = RPG::Cache.picture(pic_name)
  570.         if x + pic.width > self.contents.width
  571.           x = 0
  572.           y += [32, min_y].max
  573.           min_y = 0
  574.         end
  575.         self.contents.blt(x + 4, y, pic, Rect.new(0, 0, pic.width, pic.height))
  576.         x += pic.width
  577.         min_y = [pic.height, 32].max
  578.         next
  579.       end
  580.       # 另起一行文字的情况下
  581.       if c == "\n"
  582.         y += [32, min_y].max
  583.         min_y = 0
  584.         x = 0
  585.         # 下面的文字
  586.         next
  587.       end
  588.       # 自动换行处理
  589.       if x + self.contents.text_size(c).width > self.contents.width
  590.         y += [32, min_y].max
  591.         min_y = 0
  592.         x = 0
  593.       end
  594.       # 描绘文字
  595.       self.contents.draw_text(4 + x, y, 40, 32, c)
  596.       # x 为要描绘文字的加法运算
  597.       x += self.contents.text_size(c).width
  598.     end
  599.   end
  600. end

  601. #==============================================================================
  602. # ■ Scene_Task
  603. #------------------------------------------------------------------------------
  604. #  处理任务画面的类。
  605. #==============================================================================

  606. class Scene_Task
  607.   #--------------------------------------------------------------------------
  608.   # ● 主处理
  609.   #--------------------------------------------------------------------------
  610.   def main
  611.     # 刷新任务资料
  612.     $game_party.get_tasks_info
  613.     # 生成任务名称窗口
  614.     @task_names_window = Window_Task_Name.new($game_party.current_tasks)
  615.     @task_names_window.active = true
  616.     if $game_party.current_tasks != []
  617.       @task_names_window.index = $game_party.current_tasks.index($game_party.latest_task)
  618.     end
  619.     # 生成任务内容窗口
  620.     @task_info_window = Window_Task.new($game_party.latest_task)
  621.     @task_info_window.active = true
  622.     # 执行过渡
  623.     Graphics.transition
  624.     # 主循环
  625.     loop do
  626.       # 刷新游戏画面
  627.       Graphics.update
  628.       # 刷新输入信息
  629.       Input.update
  630.       # 刷新画面
  631.       update
  632.       # 如果画面被切换的话就中断循环
  633.       if $scene != self
  634.         break
  635.       end
  636.     end
  637.     # 准备过渡
  638.     Graphics.freeze
  639.     # 释放窗口
  640.     @task_names_window.dispose
  641.     @task_info_window.dispose
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● 刷新画面
  645.   #--------------------------------------------------------------------------
  646.   def update
  647.     # 刷新窗口
  648.     @task_names_window.update
  649.     @task_info_window.update
  650.     update_task_names_window
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ● 刷新任务名称窗口
  654.   #--------------------------------------------------------------------------
  655.   def update_task_names_window
  656.     # 按下 B 键的情况下
  657.     if Input.trigger?(Input::B)
  658.       # 演奏取消 SE
  659.       $game_system.se_play($data_system.cancel_se)
  660.       # 这里设置返回的场景,返回地图是Scene_Map.new,菜单是Scene_Menu.new(任务界面index)
  661.       $scene = Scene_Map.new
  662.       return
  663.     end
  664.     # 按下 C 键的情况下
  665.     if Input.trigger?(Input::C)
  666.       # 无任务可显示的话
  667.       if @task_names_window.task == nil
  668.         # 演奏冻结 SE
  669.         $game_system.se_play($data_system.buzzer_se)
  670.         return
  671.       end
  672.       # 如果光标没有移动的话,翻页
  673.       if $game_party.latest_task == @task_names_window.task.id
  674.         if @task_info_window.oy + @task_info_window.height - 32 > @task_info_window.contents.height
  675.           @task_info_window.oy = 0
  676.         else
  677.           @task_info_window.oy += 480-32
  678.         end
  679.         if @task_info_window.contents.height > @task_info_window.height - 32
  680.           # 演奏翻页 SE
  681.           Audio.se_play(CHANGE_PAGE_SE)
  682.         end
  683.       else
  684.         @task_info_window.refresh(@task_names_window.task.id)
  685.         $game_party.latest_task = @task_names_window.task.id
  686.         # 演奏确定 SE
  687.         $game_system.se_play($data_system.decision_se)
  688.       end
  689.     end
  690.   end
  691. end
复制代码

博客:我的博客
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-2-20 10:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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