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

Project1

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

[已经解决] 窗口后面加一张图片

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
跳转到指定楼层
1
发表于 2009-8-16 13:39:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 「旅」 于 2009-8-16 13:46 编辑

怎么在这个窗口后面加一张图片啊???
  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号角色名字
  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.     # 示例任务1:沙漠中的五叶花
  99.     #-----------------------------
  100.     名称 = "\\c[6]沙漠中的五叶花"
  101.     简介 = "\\c[6]沙漠中的五叶花

  102. \\c[5]任务目标:
  103. 获得5朵五叶花,交给西露达

  104. \\c[9]五叶花数目:\\v[2]/5

  105. 西露达:
  106. 人家等着你的花哦~"
  107.     #-讲解-
  108.     # 每个任务最后一定要加上:
  109.     # @tasks_info[任务ID] = Game_Task.new(名称, 简介)
  110.     # 接受任务和完成任务都是用这个任务ID来索引
  111.     #----
  112.     @tasks_info[1] = Game_Task.new(名称, 简介)
  113.    
  114.     #-----------------------------
  115.     # 示例任务2:克萝莉亚的药瓶
  116.     #-----------------------------
  117.     名称 = "\\c[6]克萝莉亚的药瓶"
  118.     #-讲解-
  119.     # 这里使用了字符串相加,例如 s = "a" + "b" ,s 就是 "ab"
  120.     # 还用了内嵌表达式,$game_party.item_number(38) 就是38号物品的数量
  121.     #----
  122.     简介 = 名称 + "
  123.    
  124. \\c[9]任务目标:
  125. 问克萝莉亚要一个药瓶,交给西露达

  126. \\c[0]药瓶:#{$game_party.item_number(38)}/1

  127. 西露达:
  128. 克萝莉亚就在西边的屋子里"
  129.     @tasks_info[2] = Game_Task.new(名称, 简介)
  130.    
  131.     #-----------------------------
  132.     # 示例任务3:灵魂线
  133.     #-----------------------------
  134.     #-讲解-
  135.     # 这里用了条件判断,当3号变量大于等于1时,加上“完成”字样,同时变色
  136.     #----
  137.     if $game_variables[3] >= 1
  138.       名称 = "\\c[8]灵魂线(完成)"
  139.       item = "\\c[8]灵魂线:#{$game_variables[3]}/1 (完成)"
  140.     else
  141.       名称 = "\\c[2]灵魂线"
  142.       item = "\\c[0]灵魂线:#{$game_variables[3]}/1"
  143.     end
  144.     #-讲解-
  145.     # 预先定义变量,用内嵌表达式插入
  146.     # 最后用了显示图标
  147.     #----
  148.     简介 = "#{名称}
  149.    
  150. \\c[9]任务目标:
  151. 找到埋起来的灵魂线,交给克萝莉亚

  152. #{item}

  153. \\c[0]克萝莉亚:
  154. 灵魂线就埋在其中一棵树下,给我好好找\\i[046-Skill03]"
  155.     @tasks_info[3] = Game_Task.new(名称, 简介)
  156.    
  157.   end
  158. end
  159.    
  160. #==============================================================================
  161. # ■ Interpreter
  162. #------------------------------------------------------------------------------
  163. #  执行事件命令的解释器。本类在 Game_System 类
  164. # 与 Game_Event 类的内部使用。
  165. #==============================================================================

  166. class Interpreter
  167.   #--------------------------------------------------------------------------
  168.   # ● 接受任务
  169.   #--------------------------------------------------------------------------
  170.   def get_task(id)
  171.     task = $game_party.tasks_info[id]
  172.     return true if (task.nil? or $game_party.current_tasks.include?(task.id))
  173.     $game_party.current_tasks.unshift(task.id)
  174.     return true
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 获得全部任务
  178.   #--------------------------------------------------------------------------
  179.   def get_all_task
  180.     # 清空当前任务
  181.     $game_party.current_tasks.clear
  182.     for task in $game_party.tasks_info
  183.       next if task.nil?
  184.       $game_party.current_tasks.unshift(task.id)
  185.     end
  186.     return true
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 完成/放弃任务
  190.   #--------------------------------------------------------------------------
  191.   def finish_task(id)
  192.     task = $game_party.tasks_info[id]
  193.     return true if task.nil?
  194.     $game_party.current_tasks.delete(task.id)
  195.     return true
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 删除全部任务
  199.   #--------------------------------------------------------------------------
  200.   def finish_all_task
  201.     $game_party.current_tasks.clear
  202.     return true
  203.   end
  204. end

  205. #==============================================================================
  206. # ■ Game_Party
  207. #------------------------------------------------------------------------------
  208. #  处理同伴的类。包含金钱以及物品的信息。本类的实例
  209. # 请参考 $game_party。
  210. #==============================================================================

  211. class Game_Party
  212.   #--------------------------------------------------------------------------
  213.   # ● 定义实例变量
  214.   #--------------------------------------------------------------------------
  215.   attr_writer     :latest_task                  # 上次查看的任务
  216.   #--------------------------------------------------------------------------
  217.   # ● 取得任务资料
  218.   #--------------------------------------------------------------------------
  219.   def tasks_info
  220.     if @tasks_info.nil?
  221.       get_tasks_info
  222.     end
  223.     return @tasks_info
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 取得当前任务
  227.   #--------------------------------------------------------------------------
  228.   def current_tasks
  229.     if @current_tasks.nil?
  230.       @current_tasks = []
  231.     end
  232.     return @current_tasks
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 上次查看的任务
  236.   #--------------------------------------------------------------------------
  237.   def latest_task
  238.     if !current_tasks.include?(@latest_task)
  239.       @latest_task = current_tasks[0]
  240.     end
  241.     return @latest_task
  242.   end
  243. end

  244. #==============================================================================
  245. # ■ Game_Task
  246. #------------------------------------------------------------------------------
  247. #  处理任务的类。包含任务的信息。
  248. #==============================================================================

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

  347. #==============================================================================
  348. # ■ Window_Task_Name
  349. #------------------------------------------------------------------------------
  350. #  任务名称显示窗口。
  351. #==============================================================================

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

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

  621. #==============================================================================
  622. # ■ Scene_Task
  623. #------------------------------------------------------------------------------
  624. #  处理任务画面的类。
  625. #==============================================================================

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


请注意版规,标题已修改。
noShade>

Lv3.寻梦者

小柯的徒弟

梦石
0
星屑
1440
在线时间
1157 小时
注册时间
2008-5-24
帖子
3085

贵宾

2
发表于 2009-8-16 13:44:44 | 只看该作者
  1. class Scene_Task
  2.   #——图片路径
  3.   LV_SPRITE_NAME = "Graphics/囧"
  4.   #--------------------------------------------------------------------------
  5.   # ● 主处理
  6.   #--------------------------------------------------------------------------
  7.   def main
  8.     # 刷新任务资料
  9.     $game_party.get_tasks_info
  10.     # 生成任务名称窗口
  11.     @task_names_window = Window_Task_Name.new($game_party.current_tasks)
  12.     @task_names_window.active = true
  13.     if $game_party.current_tasks != []
  14.       @task_names_window.index = $game_party.current_tasks.index($game_party.latest_task)
  15.     end
  16.     # 生成任务内容窗口
  17.     @task_info_window = Window_Task.new($game_party.latest_task)
  18.     @task_info_window.active = true
  19.     #——世界真鞋盒
  20.     @task_info_window.opacity = 0
  21.     @task_names_window.opacity = 0
  22.     @sprite_lv = Sprite.new
  23.     @sprite_lv.bitmap = Bitmap.new(LV_SPRITE_NAME)
  24.     # 执行过渡
  25.     Graphics.transition
  26.     # 主循环
  27.     loop do
  28.       # 刷新游戏画面
  29.       Graphics.update
  30.       # 刷新输入信息
  31.       Input.update
  32.       # 刷新画面
  33.       update
  34.       # 如果画面被切换的话就中断循环
  35.       if $scene != self
  36.         break
  37.       end
  38.     end
  39.     # 准备过渡
  40.     Graphics.freeze
  41.     # 释放窗口
  42.     @task_names_window.dispose
  43.     @task_info_window.dispose
  44.     @sprite_lv.dispose
  45.   end
  46. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

℃ake

梦石
0
星屑
50
在线时间
8 小时
注册时间
2009-6-6
帖子
787
3
发表于 2009-8-16 13:47:24 | 只看该作者
#——世界真鞋盒
囧,我看到这个了。

另外,提示楼主一下,想改图片坐标的话。
可以在@sprite_lv.bitmap = Bitmap.new(LV_SPRITE_NAME)
这句下面加@sprite_lv.x = 囧
@sprite_lv.y = 囧
我爱66RPG,但我讨厌66.
回复 支持 反对

使用道具 举报

Lv1.梦旅人

℃ake

梦石
0
星屑
50
在线时间
8 小时
注册时间
2009-6-6
帖子
787
4
发表于 2009-8-16 13:47:35 | 只看该作者
#——世界真鞋盒
囧,我看到这个了。

另外,提示楼主一下,想改图片坐标的话。
可以在@sprite_lv.bitmap = Bitmap.new(LV_SPRITE_NAME)
这句下面加@sprite_lv.x = 囧
@sprite_lv.y = 囧
我爱66RPG,但我讨厌66.
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2009-1-1
帖子
263
5
发表于 2009-8-16 13:51:17 | 只看该作者
显示图片……bitmap = Bitmap.new("图片路径")
最好修改一下Z值 否则可能挡住窗口?
插入到521行后面就OK了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-15 20:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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