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

Project1

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

[已经解决] 亲们,我改了个等待标志符,为啥对话完了直接留画面上.?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2013-4-28
帖子
32
跳转到指定楼层
1
发表于 2013-5-2 23:14:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 hcm 于 2013-5-13 19:04 编辑
  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章的信息窗口。
  5. #==============================================================================

  6. class Window_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化状态
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(80, 304, 480, 160)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.visible = false
  14.     self.z = 9998
  15.     self.windowskin = Bitmap.new(1,1)
  16.     @fade_in = false
  17.     @fade_out = false
  18.     @contents_showing = false
  19.     @cursor_width = 0
  20.     @wait_bmp = Sprite.new
  21.     @wait_bmp.z = 10000
  22.     @wait_bmp.bitmap = Bitmap.new(40,40)
  23.     [url=home.php?mod=space&uid=36110]@Wait[/url] = 0
  24.     [url=home.php?mod=space&uid=32215]@show[/url] = 0
  25.     @bmp = nil
  26.     self.active = false
  27.     self.index = -1
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 释放
  31.   #--------------------------------------------------------------------------
  32.   def dispose
  33.     terminate_message
  34.     $game_temp.message_window_showing = false
  35.     if @input_number_window != nil
  36.       @input_number_window.dispose
  37.     end
  38.     @wait_bmp.bitmap.dispose
  39.     @wait_bmp.dispose
  40.     @bmp.dispose
  41.     super
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 处理信息结束
  45.   #--------------------------------------------------------------------------
  46.   def terminate_message
  47.     self.active = false
  48.     self.pause = false
  49.     self.index = -1
  50.     self.contents.clear
  51.     # 清除显示中标志
  52.     @contents_showing = false
  53.     # 呼叫信息调用
  54.     if $game_temp.message_proc != nil
  55.       $game_temp.message_proc.call
  56.     end
  57.     # 清除文章、选择项、输入数值的相关变量
  58.     $game_temp.message_text = nil
  59.     $game_temp.message_proc = nil
  60.     $game_temp.choice_start = 99
  61.     $game_temp.choice_max = 0
  62.     $game_temp.choice_cancel_type = 0
  63.     $game_temp.choice_proc = nil
  64.     $game_temp.num_input_start = 99
  65.     $game_temp.num_input_variable_id = 0
  66.     $game_temp.num_input_digits_max = 0
  67.     # 开放金钱窗口
  68.     if @gold_window != nil
  69.       @gold_window.dispose
  70.       @gold_window = nil
  71.     end

  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 刷新
  75.   #--------------------------------------------------------------------------
  76.   def refresh
  77.     self.contents.clear
  78.     self.contents.fill_rect (0,0,width - 32,height - 32,Color.new(169,169,255,150))#填充矩形
  79.     self.contents.font.color = normal_color
  80.     x = y = 0
  81.     @cursor_width = 0
  82.     # 到选择项的下一行字
  83.     if $game_temp.choice_start == 0
  84.       x = 8
  85.     end
  86.     # 有等待显示的文字的情况下
  87.     if $game_temp.message_text != nil
  88.       text = $game_temp.message_text
  89.       # 限制文字处理
  90.       begin
  91.         last_text = text.clone
  92.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  93.       end until text == last_text
  94.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  95.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  96.       end
  97.       # 为了方便、将 "\\\\" 变换为 "\000"
  98.       text.gsub!(/\\\\/) { "\000" }
  99.       # "\\C" 变为 "\001" に、"\\G" 变为 "\002"
  100.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  101.       text.gsub!(/\\[Gg]/) { "\002" }
  102.       # c 获取 1 个字 (如果不能取得文字就循环)
  103.       while ((c = text.slice!(/./m)) != nil)
  104.         # \\ 的情况下
  105.         if c == "\000"
  106.           # 还原为本来的文字
  107.           c = "\\"
  108.         end
  109.         # \C[n] 的情况下
  110.         if c == "\001"
  111.           # 更改文字色
  112.           text.sub!(/\[([0-9]+)\]/, "")
  113.           color = $1.to_i
  114.           if color >= 0 and color <= 7
  115.             self.contents.font.color = text_color(color)
  116.           end
  117.           # 下面的文字
  118.           next
  119.         end
  120.         # \G 的情况下
  121.         if c == "\002"
  122.           # 生成金钱窗口
  123.           if @gold_window == nil
  124.             @gold_window = Window_Gold.new
  125.             @gold_window.x = 560 - @gold_window.width
  126.             if $game_temp.in_battle
  127.               @gold_window.y = 192
  128.             else
  129.               @gold_window.y = self.y >= 128 ? 32 : 384
  130.             end
  131.             @gold_window.opacity = self.opacity
  132.             @gold_window.back_opacity = self.back_opacity
  133.           end
  134.           # 下面的文字
  135.           next
  136.         end
  137.         # 另起一行文字的情况下
  138.         if c == "\n"
  139.           # 刷新选择项及光标的高
  140.           if y >= $game_temp.choice_start
  141.             @cursor_width = [@cursor_width, x].max
  142.           end
  143.           # y 加 1
  144.           y += 1
  145.           x = 0
  146.           # 移动到选择项的下一行
  147.           if y >= $game_temp.choice_start
  148.             x = 8
  149.           end
  150.           # 下面的文字
  151.           next
  152.         end
  153.         # 描绘文字
  154.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  155.         # x 为要描绘文字的加法运算
  156.         x += self.contents.text_size(c).width
  157.       end
  158.     end
  159.     # 选择项的情况
  160.     if $game_temp.choice_max > 0
  161.       @item_max = $game_temp.choice_max
  162.       self.active = true
  163.       self.index = 0
  164.     end
  165.     # 输入数值的情况
  166.     if $game_temp.num_input_variable_id > 0
  167.       digits_max = $game_temp.num_input_digits_max
  168.       number = $game_variables[$game_temp.num_input_variable_id]
  169.       @input_number_window = Window_InputNumber.new(digits_max)
  170.       @input_number_window.number = number
  171.       @input_number_window.x = self.x + 8
  172.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 设置窗口位置与不透明度
  177.   #--------------------------------------------------------------------------
  178.   def reset_window
  179.     if $game_temp.in_battle
  180.       self.y = 16
  181.     else
  182.       case $game_system.message_position
  183.       when 0  # 上
  184.         self.y = 16
  185.       when 1  # 中
  186.         self.y = 160
  187.       when 2  # 下
  188.         self.y = 304
  189.       end
  190.     end
  191.     if $game_system.message_frame == 0
  192.       self.opacity = 255
  193.     else
  194.       self.opacity = 0
  195.     end
  196.     self.back_opacity = 160
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● 刷新画面
  200.   #--------------------------------------------------------------------------
  201.   def update
  202.     super
  203.     # 渐变的情况下
  204.     if @fade_in
  205.       self.contents_opacity += 24
  206.       if @input_number_window != nil
  207.         @input_number_window.contents_opacity += 24
  208.       end
  209.       if self.contents_opacity == 255
  210.         @fade_in = false
  211.       end
  212.       return
  213.     end
  214.     # 输入数值的情况下
  215.     if @input_number_window != nil
  216.       @input_number_window.update
  217.       # 确定
  218.       if Input.trigger?(Input::C)
  219.         $game_system.se_play($data_system.decision_se)
  220.         $game_variables[$game_temp.num_input_variable_id] =
  221.           @input_number_window.number
  222.         $game_map.need_refresh = true
  223.         # 释放输入数值窗口
  224.         @input_number_window.dispose
  225.         @input_number_window = nil
  226.         terminate_message
  227.       end
  228.       return
  229.     end
  230.     # 显示信息中的情况下
  231.     if @contents_showing
  232.       # 如果不是在显示选择项中就显示暂停标志
  233.       if $game_temp.choice_max == 0
  234.         self.pause = true
  235.       end
  236.       # 取消
  237.       if Input.trigger?(Input::B)
  238.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  239.           $game_system.se_play($data_system.cancel_se)
  240.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  241.           terminate_message
  242.         end
  243.       end
  244.       # 确定
  245.       if Input.trigger?(Input::C)
  246.         if $game_temp.choice_max > 0
  247.           $game_system.se_play($data_system.decision_se)
  248.           $game_temp.choice_proc.call(self.index)
  249.         end
  250.         terminate_message
  251.       end
  252.       if @bmp == nil
  253.          @bmp = RPG::Cache.windowskin("deef.png")
  254.        end
  255.        if
  256.        @wait_bmp.y != self.y + 110
  257.        @wait_bmp.x = self.x + 420
  258.        @wait_bmp.y = self.y + 110
  259.        end
  260.       if
  261.       @wait % 4 == 0
  262.       @show += 1
  263.       rect = Rect.new(@bmp.width/12 *(@show % 12), 0 , @bmp.width/12 , @bmp.height)
  264.       @wait_bmp.bitmap.clear
  265.       @wait_bmp.bitmap.blt(0,0,@bmp,rect)
  266.     end
  267.     @wait += 1
  268.       return
  269.     end
  270.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  271.     if @fade_out == false and $game_temp.message_text != nil
  272.       @contents_showing = true
  273.       $game_temp.message_window_showing = true
  274.       reset_window
  275.       refresh
  276.       Graphics.frame_reset
  277.       self.visible = true
  278.       self.contents_opacity = 0
  279.       if @input_number_window != nil
  280.         @input_number_window.contents_opacity = 0
  281.       end
  282.       @fade_in = true
  283.       return
  284.     end
  285.     # 没有可以显示的信息、但是窗口为可见的情况下
  286.     if self.visible
  287.       @fade_out = true
  288.       self.opacity -= 48
  289.       if self.opacity == 0
  290.         self.visible = false
  291.         @fade_out = false
  292.         $game_temp.message_window_showing = false
  293.       end
  294.       return
  295.     end
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 刷新光标矩形
  299.   #--------------------------------------------------------------------------
  300.   def update_cursor_rect
  301.     if @index >= 0
  302.       n = $game_temp.choice_start + @index
  303.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  304.     else
  305.       self.cursor_rect.empty
  306.     end
  307.   end
  308. end
复制代码
望指正,好让小弟学习学习!

Lv1.梦旅人

梦石
0
星屑
50
在线时间
84 小时
注册时间
2013-4-5
帖子
152
2
发表于 2013-5-3 00:57:25 | 只看该作者
脚本啊 ··· 好难呀
话说 是不是 哪个图标 放上去了N 你值清除了N-1次呀
单独刷出来的 要单独清理它 ················
我在说什么啊 搞得好很懂的样子 ········
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2013-4-28
帖子
32
3
 楼主| 发表于 2013-5-3 01:02:29 | 只看该作者
这脚本我能看懂一半就不错了,半斤八两,我都闹心死了,图标释放了,就是整不下去
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2013-4-28
帖子
32
4
 楼主| 发表于 2013-5-3 01:36:33 | 只看该作者
大神们, 我自己琢磨在处理信息结束最后加一个@wait_bmp.bitmap.clear
可是没有全部解决问题啊,大部分时候能清除,可是有时候还是会留下,这失灵时不灵是咋回事啊?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2013-4-28
帖子
32
5
 楼主| 发表于 2013-5-3 02:40:47 | 只看该作者
地图上残留个小图标,很是恶心啊!!!!!!!!!!!!!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
84 小时
注册时间
2013-4-5
帖子
152
6
发表于 2013-5-3 07:39:42 | 只看该作者
本帖最后由 光の異形 于 2013-5-3 08:05 编辑

    # 没有可以显示的信息、但是窗口为可见的情况下
    if self.visible
      @fade_out = true
      self.opacity -= 48
      if self.opacity == 0
        self.visible = false
        @fade_out = false
        $game_temp.message_window_showing = false
        @wait_bmp.bitmap.clear         #加在这里可以解决你的问题 我刚刚试过了~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!!
      end
      return
    end
  end

评分

参与人数 1星屑 +120 收起 理由
hcm + 120 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
43 小时
注册时间
2013-4-28
帖子
32
7
 楼主| 发表于 2013-5-3 23:40:48 | 只看该作者
光の異形 发表于 2013-5-3 07:39
# 没有可以显示的信息、但是窗口为可见的情况下
    if self.visible
      @fade_out = true

太给劲了,你比士力架还厉害!!!!!!!!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-4 07:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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