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

Project1

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

谁能帮我做超简易增强对话框

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2007-5-31
帖子
89
跳转到指定楼层
1
发表于 2007-6-17 00:35:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
\n[1]:显示1号角色的姓名
\m[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
\m[\n[1]]:显示一号人物名子的方框

我只要这几种功能就好,其他不要
  1. #==============================================================================
  2. # ◎ GPRA_Window_Message
  3. #------------------------------------------------------------------------------
  4. # ◎ 显示文章的信息窗口加强。
  5. #------------------------------------------------------------------------------
  6. class Window_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化状态
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11. #    super(60, 304, 520, 160)
  12.     super(135, 304, 500, 160)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.visible = false
  15.     self.z = 9998
  16.     @fade_in = false
  17.     @fade_out = false
  18.     @contents_showing = false
  19.     @cursor_width = 0
  20.     @op = 255 # 不透明度
  21.     @head_bmp = nil # 装载头像用
  22.     @head_file = nil # 头像文件名
  23.     @text = nil # 记录所处理文字
  24.     @skip = false # 记录是否跳过此次对话
  25.     @auto_close = -1 # 默认不打开自动关闭
  26.     @type_mode=-1 # 打字模式
  27.     @delay=-1 # 等待n帧标志
  28.     @finish=false # 记录文字处理是否结束
  29.     @is_read_txt =false # 默认不是在读取txt文件
  30.     self.active = false
  31.     self.index = -1
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 释放
  35.   #--------------------------------------------------------------------------
  36.   def dispose
  37.     terminate_message
  38.     $game_temp.message_window_showing = false
  39.     if @input_number_window != nil
  40.       @input_number_window.dispose
  41.     end
  42.     super
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 处理信息结束
  46.   #--------------------------------------------------------------------------
  47.   def terminate_message
  48.    
  49. #以下为增加姓名框处理
  50.     if @name_window_frame != nil
  51.       @name_window_frame.dispose
  52.       @name_window_frame = nil
  53.     end
  54.     if @name_window_text != nil
  55.       @name_window_text.dispose
  56.       @name_window_text = nil
  57.     end
  58. #以上为增加姓名框处理

  59.     self.active = false
  60.     self.pause = false
  61.     self.index = -1
  62.     self.contents.clear
  63.     # 清除显示中标志
  64.     @contents_showing = false
  65.     # 呼叫信息调用
  66.     if $game_temp.message_proc != nil
  67.       $game_temp.message_proc.call
  68.     end
  69.     # 清除文章、选择项、输入数值的相关变量
  70.     $game_temp.message_text = nil
  71.     $game_temp.message_proc = nil
  72.     $game_temp.choice_start = 99
  73.     $game_temp.choice_max = 0
  74.     $game_temp.choice_cancel_type = 0
  75.     $game_temp.choice_proc = nil
  76.     $game_temp.num_input_start = 99
  77.     $game_temp.num_input_variable_id = 0
  78.     $game_temp.num_input_digits_max = 0
  79.     # 开放金钱窗口
  80.     if @gold_window != nil
  81.       @gold_window.dispose
  82.       @gold_window = nil
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 刷新
  87.   #--------------------------------------------------------------------------
  88.   def refresh
  89.     # 清空原先内容
  90.     self.contents.clear
  91.     # 恢复一般字色
  92.     self.contents.font.color = normal_color
  93.     # 恢复字体大小
  94.     self.contents.font.size = 20
  95.     # 绘制文字位置初始化
  96.     @x = @y = 0
  97.     # 字体高度记录
  98.     @height = 32
  99.     # 文字不透明度设定为255
  100.     @op = 255
  101.     # 头像默认显示在右边
  102.     @right = true
  103.     # 头像默认显示一般表情
  104.     @face = nil
  105.     # 默认显示角色姓名
  106.     @name = nil
  107.     # 默认不跳过此次对话
  108.     @skip = false
  109.     # 从变量读取自动关闭设置
  110.     @auto_close = $game_variables[102]
  111.     # 从变量读取打字模式设置
  112.     @type_mode=$game_variables[103]
  113.     # 默认不等待
  114.     @delay=-1
  115.     # 设定文字没有处理结束
  116.     @finish=false
  117.     # 光标宽度初始化为零
  118.     @cursor_width = 0
  119.     # 到选择项的下一行字
  120.     if $game_temp.choice_start == 0
  121.       @x = 16
  122.     end
  123.     # 有等待显示的文字的情况下
  124.     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
  125.     if $game_temp.message_text != nil
  126. #      # @text 功能改进
  127. #      if @text==nil or @text==""
  128. #      @text = $game_temp.message_text.dup
  129. #      else
  130. #        @text = @text + $game_temp.message_text
  131. #      end



  132. #以下为对话记录
  133.       clue = $game_temp.message_text.split(/@clu/)[1]
  134.       if clue != nil
  135.         if @text==nil
  136.           @text = $game_temp.message_text.split(/@/)[0]
  137.         else
  138.           @text = @text + $game_temp.message_text.split(/@/)[0]
  139.         end
  140.        # @text = $game_temp.message_text.split(/@/)[0]
  141.       
  142.         if $game_variables[36].include?($game_variables[3])==false
  143.           $game_variables[36][$game_variables[3]]={}
  144.         end#当前魔塔编号不存在就创建它
  145.         if $game_variables[36][$game_variables[3]].include?($game_variables[2])==false
  146.           $game_variables[36][$game_variables[3]][$game_variables[2]]=[]
  147.         end#当前魔塔编号当前楼层不存在就创建它
  148.         if $game_variables[36][0].include?($game_variables[3])==false
  149.           $game_variables[36][0][$game_variables[3]]=0
  150.         end#当前魔塔编号对话记录次数不存在就创建它
  151.         if $game_variables[36][$game_variables[3]][1000]==nil
  152.           $game_variables[36][$game_variables[3]][1000]=[]
  153.         end#当前魔塔编号对话记录顺序排列不存在就创建它

  154. #       p $game_temp.message_text.split(/@/)[0]
  155. #       p $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])
  156.         if $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])==false
  157.           $game_variables[36][$game_variables[3]][$game_variables[2]].push ($game_temp.message_text.split(/@/)[0])


  158.           $game_variables[36][0][$game_variables[3]]+=1# 已知的对话条数
  159.           @j=0
  160.           for i in 0...$game_variables[2]+1
  161.             if $game_variables[36][$game_variables[3]].include?(i)
  162.               @j+=$game_variables[36][$game_variables[3]][i].size
  163.             end
  164.           end
  165.           @j-=1
  166.           @j=0 if @j<=0

  167.           $game_variables[36][$game_variables[3]][1000].insert @j,[$game_variables[2],$game_variables[36][$game_variables[3]][$game_variables[2]][$game_variables[36][$game_variables[3]][$game_variables[2]].size-1]]
  168.         end
  169.       else
  170.         if @text==nil
  171.           @text = $game_temp.message_text.dup
  172.         else
  173.           @text = @text + $game_temp.message_text
  174.         end
  175. #        @text = $game_temp.message_text
  176.       end
  177. #以上为对话记录      
  178.       
  179.       # 最先必须要将 "\\\\" 变换为 "\000"
  180.       @text.gsub!(/\\\\/)                { "\000" }
  181.       
  182.       # 在TXT模式还没有打开的时候
  183.       if !@is_read_txt
  184.         # TXT读取模式打开
  185.         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
  186.           # 打开文件,成功打开后再进入后面部分
  187.           if @ts.open($1,$2)
  188.             # 根据显示模式确定需要打开行数
  189.             case $game_variables[1]
  190.             when 0 # 正常模式
  191.               @text =  @ts.get_text(4)
  192.             when 1 # 图书模式
  193.               @text =  @ts.get_text(12)
  194.             when 2 # 全屏模式
  195.               @text =  @ts.get_text(15)
  196.             end
  197.             # 如果包含[END]
  198.             if @text.gsub!(/\[END\]/){""}!=nil
  199.               #退出TXT读取模式
  200.               @is_read_txt=false
  201.             else
  202.               #否则设置正在读取标志
  203.               @is_read_txt=true
  204.             end
  205.           end
  206.         else
  207.           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
  208.             # 打开文件,成功打开后再进入后面部分
  209.             if @ts.open($1,"")
  210.               # 根据显示模式确定需要打开行数
  211.               case $game_variables[101]
  212.               when 0 # 正常模式
  213.                 @text =  @ts.get_text(4)
  214.               when 1 # 图书模式
  215.                 @text =  @ts.get_text(12)
  216.               when 2 # 全屏模式
  217.                 @text =  @ts.get_text(15)
  218.               end
  219.               # 如果包含[END]
  220.               if @text.gsub!(/\[END\]/){""}!=nil
  221.                 #退出TXT读取模式
  222.                 @is_read_txt=false
  223.               else
  224.                 #否则设置正在读取标志
  225.                 @is_read_txt=true
  226.               end
  227.             end
  228.           end
  229.         end
  230.       end
  231.         
  232.       # 如果取得的字符含"\\~"时
  233.       if @text.slice!(/\\~/)!=nil
  234.         # 跳过此次对话
  235.         terminate_message
  236.         # 设置跳过此次对话标志
  237.         @skip = true
  238.         # 直接返回等待连接后面部分
  239.         return
  240.       end
  241.       
  242.       # 限制文字处理(注:这里是默认功能。)
  243.       begin
  244.         last_text = @text.clone
  245.         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  246.       end until @text == last_text
  247.       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  248.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  249.       end
  250.       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
  251.       # 为了方便将 "\\C" 变为 "\001"
  252.       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
  253.       # "\\G" 变为 "\002"
  254.       @text.gsub!(/\\[Gg]/)              { "\002" }
  255.       
  256.       # ========================增强功能========================
  257.       
  258.       #对话加强      
  259.       @now_text=$game_temp.message_text
  260.       name_window_set = false#\m[姓名]在对话框上增加姓名
  261.       if (/\\[Mm]\[(.+?)\]/.match(@now_text)) != nil
  262. #        name_window_set = true
  263.         name_text = $1
  264.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  265.       end

  266.       @text.gsub!(/\\[Mm]\[(.+?)\]/) do
  267.         name_window_set = true
  268.         name_text = $1
  269.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  270.       end
  271.       #对话加强
  272.       
  273.       
  274.       # "\\/" 删除行尾换行符号
  275.       @text.gsub!(/\\\/\n/) {""}
  276.       # 去掉不在行尾的"\\/"符号,防止出错
  277.       @text.gsub!(/\\\//) {""}
  278.       
  279.       # "\\I" 物品图标+名称显示
  280.       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
  281.       # "\\K" 技能图标+名称显示
  282.       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
  283.       # "\\W" 武器图标+名称显示
  284.       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
  285.       # "\\A" 防具图标+名称显示
  286.       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
  287.       
  288.       # 注:大量显示图片将是游戏的速度大大减慢
  289.       # "\\I1" 物品图标显示
  290.       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
  291.       # "\\K1" 技能图标显示
  292.       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
  293.       # "\\W1" 武器图标显示
  294.       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
  295.       # "\\A1" 防具图标显示
  296.       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
  297.       
  298.       # "\\I2" 物品名称显示
  299.       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
  300.       # "\\K2" 技能名称显示
  301.       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
  302.       # "\\W2" 武器名称显示
  303.       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
  304.       # "\\A2" 防具名称显示
  305.       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
  306.       
  307.       # "\\S" 字体大小(只修改第一个"\\S")
  308.       # 这里首先删掉能找到的第一个"\\S"
  309.       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
  310.         # 当找了"\\S"时满足上述条件,就设置文字大小
  311.         self.set_font_size($1.to_i)
  312.       end
  313.       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
  314.       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
  315.         self.set_font_op($1.to_i)
  316.       end

  317.       # "\\=" 停顿固定帧(延时)
  318.       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
  319.       # "\\." 停顿3帧
  320.       @text.gsub!(/\\\./)               { "\024[3]" }
  321.       # "\\_" 停顿1秒(30帧)
  322.       @text.gsub!(/\\_/)                { "\024[30]" }
  323.       
  324.       # "\\L" 指定头像左边显示
  325.       if @text.slice!(/\\[Ll]/)!=nil
  326.         # 设定头像居右标志为假
  327.         @right=false
  328.         # 顺便要设置@x=104,文字在右边显示
  329.         @x=104
  330.       end
  331.       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
  332.       # 首先是寻找有没有带参数的"\\X"
  333.       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
  334.         # 找到的话将参数赋予@name
  335.         @name=$1
  336.       # 没有找到的话
  337.       else
  338.         # 再去寻找有没有不带参数的"\\X"
  339.         if @text.slice!(/\\[Xx]/)!=nil
  340.           # 找到的话就将姓名变成"???"
  341.           @name="???"
  342.         end
  343.       end
  344.       # "\\F" 指定表情(Face 用来指定表情啦)
  345.       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
  346.       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
  347.         # 找到的话就设定表情
  348.         @face=$1
  349.       end
  350.       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
  351.       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
  352.       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
  353.         # 找到的话就提到字符串最前面
  354.         @text="\030[#{$1}]"+@text
  355.       end
  356.       
  357.       # ================ 分析部分结束,下面是显示部分 ================
  358.    
  359.       # 在此调用过程完成,因为在update部分也会有相同代码
  360.       self.refresh_

  361.     end
  362.     # 选择项的情况
  363.     if $game_temp.choice_max > 0
  364.       @item_max = $game_temp.choice_max
  365.       self.active = true
  366.       self.index = 0
  367.     end
  368.     # 输入数值的情况
  369.     if $game_temp.num_input_variable_id > 0
  370.       digits_max = $game_temp.num_input_digits_max
  371.       number = $game_variables[$game_temp.num_input_variable_id]
  372.       @input_number_window = Window_InputNumber.new(digits_max)
  373.       @input_number_window.number = number
  374.       @input_number_window.x = self.x + 8
  375.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  376.     end
  377.    
  378. #对话加强
  379. #    reset_window
  380.     if name_window_set
  381.       off_x = 0
  382.       off_y = -40
  383.       space = 2
  384.       x = self.x + off_x - space / 2
  385.       y = self.y + off_y - space / 2
  386.       w = self.contents.text_size(name_text).width + 26 + space
  387.       h = 40 + space
  388.       @name_window_frame = Window_Frame.new(x, y, w, h)
  389.       @name_window_frame.z = self.z + 1
  390.       x = self.x + off_x + 4
  391.       y = self.y + off_y
  392.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  393.       @name_window_text.z = self.z + 2
  394.     end
  395. #对话加强

  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● 设置窗口位置与不透明度
  399.   #--------------------------------------------------------------------------
  400.   def reset_window
  401.     # 判断现在的显示模式
  402.     case $game_variables[101]
  403.     when 0 # 普通模式
  404.       self.width=480
  405.       self.height=160
  406.       self.contents = Bitmap.new(width - 32, height - 32)
  407. #      self.x = 80
  408.       self.x = 145
  409.       if $game_temp.in_battle
  410. #        self.y = 16
  411.         self.y = 50
  412.       else
  413.         case $game_system.message_position
  414.         when 0  # 上
  415. #          self.y = 16
  416.           self.y = 50
  417.         when 1  # 中
  418.           self.y = 160
  419.         when 2  # 下
  420.           self.y = 304
  421.         end
  422.       end
  423.     when 1 # 图书模式
  424.       self.width=532
  425.       self.height=416
  426.       self.contents = Bitmap.new(width - 32, height - 32)
  427.       self.x = 54
  428.       self.y = 32
  429.     when 2 # 全屏模式
  430.       self.width=672
  431.       self.height=512
  432.       self.contents = Bitmap.new(width - 32, height - 32)
  433.       self.x = -16
  434.       self.y = -16
  435.     end
  436.     if $game_system.message_frame == 0
  437.       self.opacity = 255
  438.     else
  439.       self.opacity = 0
  440.     end
  441.     self.back_opacity = 192
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 刷新画面
  445.   #--------------------------------------------------------------------------
  446.   def update
  447.     super
  448.     # 渐变的情况下
  449.     if @fade_in
  450.       # 脚本在这里设定透明度
  451.       self.contents_opacity += @op/8
  452.       if @input_number_window != nil
  453.         @input_number_window.contents_opacity += 32
  454.       end
  455.       if self.contents_opacity >= @op
  456.         @fade_in = false
  457.       end
  458.       return
  459.     end
  460.     # 输入数值的情况下
  461.     if @input_number_window != nil
  462.       @input_number_window.update
  463.       
  464. #取消-使输入框可以被取消
  465.       if Input.trigger?(Input::B)
  466.         $game_switches[44]=true
  467.         $game_system.se_play($data_system.cancel_se)
  468.         @input_number_window.dispose
  469.         @input_number_window = nil
  470.         terminate_message
  471.       end#以上为增加的功能
  472.       
  473.       # 确定
  474.       if Input.trigger?(Input::C)
  475.         $game_system.se_play($data_system.decision_se)
  476.         $game_variables[$game_temp.num_input_variable_id] =
  477.           @input_number_window.number
  478.         $game_map.need_refresh = true
  479.         # 释放输入数值窗口
  480.         @input_number_window.dispose
  481.         @input_number_window = nil
  482.         terminate_message
  483.       end
  484.       return
  485.     end
  486.     # 显示信息中的情况下
  487.     if @contents_showing
  488.       # 刷新文本
  489.       self.refresh_
  490.       # 如果不是在显示选择项中就显示暂停标志
  491.       if $game_temp.choice_max == 0
  492.         self.pause = true
  493.       end
  494.       # 取消
  495.       if Input.trigger?(Input::B)
  496.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  497.           $game_system.se_play($data_system.cancel_se)
  498.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  499.           terminate_message
  500.         end
  501.       end
  502.       # @auto_close自减计数
  503.       @auto_close-=1
  504.       # 确定或者自动关闭
  505.       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
  506.         # 文字还没有处理完的时候
  507.         if !@finish
  508.           # 删除所有停顿效果
  509.           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
  510.           # 删除当前延迟效果
  511.           @delay = 0
  512.           # 关闭打字效果
  513.           @type_mode=-1
  514.           # 一次处理完所有的字
  515.           self.refresh_
  516.         else
  517.           # 有选择项的情况
  518.           if $game_temp.choice_max > 0
  519.             $game_system.se_play($data_system.decision_se)
  520.             $game_temp.choice_proc.call(self.index)
  521.           end
  522.           # 清空文字
  523.           terminate_message
  524.           # 在读取TXT的模式下,需要继续打开文字
  525.           if @is_read_txt
  526.             # 根据显示模式确定需要打开行数
  527.             case $game_variables[101]
  528.             when 0 # 正常模式
  529.               $game_temp.message_text =  @ts.get_text(4)
  530.             when 1 # 图书模式
  531.               $game_temp.message_text =  @ts.get_text(12)
  532.             when 2 # 全屏模式
  533.               $game_temp.message_text =  @ts.get_text(15)
  534.             end
  535.             # 如果包含[END]则退出TXT读取模式
  536.             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
  537.               @is_read_txt=false
  538.             end
  539.           end
  540.         end
  541.       end
  542.       return
  543.     end
  544.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  545.     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
  546.       @contents_showing = true
  547.       $game_temp.message_window_showing = true
  548.       reset_window
  549.       refresh
  550.       Graphics.frame_reset
  551.       # 当不跳过对话时才进行淡入操作
  552.       if !@skip
  553.         self.visible = true
  554.         self.contents_opacity = 0
  555.         if @input_number_window != nil
  556.           @input_number_window.contents_opacity = 0
  557.         end
  558.         @fade_in = true
  559.       end
  560.       return
  561.     end
  562.     # 没有可以显示的信息、但是窗口为可见的情况下
  563.     if self.visible
  564.       @fade_out = true
  565.       self.opacity -= 48
  566.       if self.opacity == 0
  567.         self.visible = false
  568.         @fade_out = false
  569.         $game_temp.message_window_showing = false
  570.       end
  571.       return
  572.     end
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 刷新光标矩形
  576.   #--------------------------------------------------------------------------
  577.   def update_cursor_rect
  578.     if @index >= 0
  579.       n = $game_temp.choice_start + @index
  580.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  581.     else
  582.       self.cursor_rect.empty
  583.     end
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 设定字体大小
  587.   #--------------------------------------------------------------------------
  588.   def set_font_size(size=20)
  589.     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
  590.     if size>96
  591.       size=96
  592.     end
  593.     # 设定字的大小
  594.     self.contents.font.size = size
  595.     # 如果字太大了就要加高每行文字高度。
  596.     if size > 28
  597.       @height=size+4
  598.     else
  599.       @height=32
  600.     end
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 设定文字透明
  604.   #--------------------------------------------------------------------------
  605.   def set_font_op(op=255)
  606.     # 限制透明度为0-255
  607.     if op>255
  608.       op=255
  609.     elsif op<0
  610.       op=0
  611.     end
  612.     # 这里设定文字透明是没有用的,设定透明在update过程开始
  613.     @op = op
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 显示文字/头像过程
  617.   #--------------------------------------------------------------------------
  618.   def refresh_
  619.     # 处理已经结束的情况下直接return
  620.     if @finish
  621.       return
  622.     end
  623.     # 延时处理
  624.     @delay-=1
  625.     if @delay<=0
  626.       # 每次处理i个标志,这里i就设置为@type_mode了
  627.       i=@type_mode
  628.       # c 获取 1 个字 (如果不能取得文字就循环)
  629.       while ((c = @text.slice!(/./m)) != nil)
  630.         # \\ 的情况下
  631.         if c == "\000"
  632.           # 还原为本来的文字
  633.           c = "\\"
  634.         end
  635.         # \C[n] 的情况下
  636.         if c == "\001"
  637.           # 取得字色编码
  638.           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
  639.           # 如果是设定RGB颜色
  640.           if $1[0,1]=="#"
  641.             # 先拷贝一下文字
  642.             c=$1.dup
  643.             # 分3段分别取出R,G,B颜色
  644.             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
  645.             # 设定文字颜色
  646.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
  647.             next
  648.           else
  649.             # 记录到变量 color
  650.             color = $1.to_i
  651.             # 字色0~7是有效的
  652.             if color >= 0 and color <= 7
  653.               # 设置文字颜色
  654.               self.contents.font.color = text_color(color)
  655.             end
  656.           end
  657.           # 进行下次循环
  658.           next
  659.         end
  660.         # 显示金钱窗口,这个……不用说了吧……
  661.         if c == "\002"
  662.           if @gold_window == nil
  663.             @gold_window = Window_Gold.new
  664.             @gold_window.x = 560 - @gold_window.width
  665.             if $game_temp.in_battle
  666.               @gold_window.y = 192
  667.             else
  668.               @gold_window.y = self.y >= 128 ? 32 : 384
  669.             end
  670.             @gold_window.opacity = self.opacity
  671.             @gold_window.back_opacity = self.back_opacity
  672.           end
  673.           next
  674.         end
  675.         # 另起一行文字的情况下
  676.         if c == "\n"
  677.           # 刷新选择项及光标的高
  678.           if @y >= $game_temp.choice_start
  679.             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
  680.           end
  681.           # y 加 1
  682.           @y += 1
  683.           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
  684.           if @y>=self.contents.height/@height
  685.             # 删除@text剩余的所有内容
  686.             @text=nil
  687.             # 然后返回
  688.             break
  689.           end
  690.           # 因为头像的缘故,这里需要改写
  691.           if @right
  692.             # 头像右边显示的时候是0
  693.             @x=0
  694.           else
  695.             # 头像靠左显示时@x要留出绘制头像空间
  696.             @x=104
  697.           end
  698.           # 移动到选择项的下一行
  699.           if @y >= $game_temp.choice_start
  700.             @x=16
  701.           end
  702.           # 下面的文字
  703.           next
  704.         end
  705.         # 显示物品图标
  706.         if c == "\003"
  707.           # 取得物品ID
  708.           @text.sub!(/\[([0-9]+)\]/, "")
  709.           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
  710.           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  711.           # 绘制这个图标
  712. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  713. #          # 将x值增加24
  714. #          @x+=24
  715.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  716.           @x+=40
  717.           # 执行下一次循环
  718.           next
  719.         end
  720.         # 显示技能图标(因为类似物品图标显示,所以省略注释)
  721.         if c == "\004"
  722.           @text.sub!(/\[([0-9]+)\]/, "")
  723.           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  724. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  725. #          # 将x值增加24
  726. #          @x+=24
  727.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  728.           @x+=40
  729.           next
  730.         end
  731.         # 显示武器图标(因为类似物品图标显示,所以省略注释)
  732.         if c == "\005"
  733.           @text.sub!(/\[([0-9]+)\]/, "")
  734.           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  735. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  736. #          # 将x值增加24
  737. #          @x+=24
  738.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  739.           @x+=40
  740.           next
  741.         end
  742.         # 显示防具图标(因为类似物品图标显示,所以省略注释)
  743.         if c == "\006"
  744.           @text.sub!(/\[([0-9]+)\]/, "")
  745.           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  746. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  747. #          # 将x值增加24
  748. #          @x+=24
  749.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  750.           @x+=40
  751.           next
  752.         end
  753.         
  754.         # 等待n帧
  755.         if c == "\024"
  756.           # 取得参数(需要等待多少帧)
  757.           @text.sub!(/\[([0-9]+)\]/, "")
  758.           # 设定@delay标志
  759.           @delay = $1.to_i
  760.           # 退出此次循环
  761.           break
  762.         end
  763.         
  764.         # 显示头像
  765.         if c == "\030"
  766.           #暂时记录文字大小,用于显示完头像恢复
  767.           size=self.contents.font.size
  768.           # 设定为正常的20号字
  769.           self.contents.font.size=20
  770.           # 设定系统字色,为写名字做准备的
  771.           self.contents.font.color = system_color
  772.           # 取得"[]"内的字符并从原字串中删除这一部分
  773.           @text.sub!(/\[([0-9]+)\]/, "")
  774.           # 记录到head变量
  775.           head=$1
  776.           # 判断头像和原来的是不是一样的
  777.           if @face == nil
  778.             # 不一样
  779.             if @head_file != head
  780.               # 改变成现在的头像文件名
  781.               @head_file = head
  782.               # 不一样的话再重新载入头像
  783.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  784.             end
  785.           else
  786.             # 当表情不是空的时候需要考虑表情的
  787.             if @head_file != head + "_" + @face
  788.               # 改变成现在的头像文件名
  789.               @head_file = head + "_" + @face
  790.               # 不一样的话再重新载入头像
  791.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  792.             end
  793.           end
  794.           # 显示头像,分左右两种情况
  795.           if @right
  796.             # 绘制头像图片
  797.             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
  798.             # 显示角色姓名
  799.             if @name==nil
  800.               # 取得角色姓名到变量 c
  801.               c = $game_actors[head.to_i].name
  802.               # 描绘角色的姓名
  803.               self.contents.draw_text(348,104,100,24,c,1)
  804.             else
  805.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  806.               c = @name
  807.               # 描绘角色的姓名
  808.               self.contents.draw_text(348,104,100,24,c,1)
  809.             end
  810.           else
  811.             # 绘制头像图片
  812.             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
  813.             # 显示角色姓名
  814.             if @name==nil
  815.               # 取得角色姓名到变量 c
  816.               c = $game_actors[head.to_i].name
  817.               # 描绘角色的姓名
  818.               self.contents.draw_text(0,104,100,24,c,1)
  819.             else
  820.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  821.               c = @name
  822.               # 描绘角色的姓名
  823.               self.contents.draw_text(0,104,100,24,c,1)
  824.             end
  825.           end
  826.           # 恢复默认字色
  827.           self.contents.font.color = normal_color
  828.           # 恢复字体大小
  829.           self.contents.font.size=size
  830.           # 进行下一次循环
  831.           next
  832.         end
  833.         # 描绘文字
  834.         self.contents.draw_text(4+@x,@height*@y, @height, @height, c)
  835.         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
  836.         @x += self.contents.text_size(c).width
  837.         
  838.         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
  839.         i-=1
  840.         if i==0
  841.           break
  842.         end
  843.       
  844.       end
  845.     end
  846.     # 如果@text处理结束了,就设置结束标志
  847.     if @text==nil or @text==""
  848.       @finish=true
  849.     end
  850.   end
  851. end
  852. #==============================================================================
  853. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  854. #==============================================================================
  855. class Window_Frame < Window_Base
  856.   #--------------------------------------------------------------------------
  857.   # ● オブジェクト初期化
  858.   #--------------------------------------------------------------------------
  859.   def initialize(x, y, width, height)
  860.     super(x, y, width, height)
  861.     self.contents = nil
  862.     self.back_opacity =200
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # ● 解放
  866.   #--------------------------------------------------------------------------
  867.   def dispose
  868.     super
  869.     end
  870.   end
  871. #==============================================================================
  872. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  873. #==============================================================================
  874. class Air_Text < Window_Base
  875.   #--------------------------------------------------------------------------
  876.   # ● オブジェクト初期化
  877.   #--------------------------------------------------------------------------
  878.   def initialize(x, y, designate_text)
  879.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  880.     self.opacity = 0
  881.     self.back_opacity = 0
  882.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  883.     w = self.contents.width
  884.     h = self.contents.height
  885.     self.contents.draw_text(0, 0, w, h, designate_text)
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● 解放
  889.   #--------------------------------------------------------------------------
  890.   def dispose
  891.     self.contents.clear
  892.     super
  893.   end
  894. end
复制代码

本贴由论坛斑竹叶舞枫结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2007-5-31
帖子
89
2
 楼主| 发表于 2007-6-17 00:35:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
\n[1]:显示1号角色的姓名
\m[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
\m[\n[1]]:显示一号人物名子的方框

我只要这几种功能就好,其他不要
  1. #==============================================================================
  2. # ◎ GPRA_Window_Message
  3. #------------------------------------------------------------------------------
  4. # ◎ 显示文章的信息窗口加强。
  5. #------------------------------------------------------------------------------
  6. class Window_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化状态
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11. #    super(60, 304, 520, 160)
  12.     super(135, 304, 500, 160)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.visible = false
  15.     self.z = 9998
  16.     @fade_in = false
  17.     @fade_out = false
  18.     @contents_showing = false
  19.     @cursor_width = 0
  20.     @op = 255 # 不透明度
  21.     @head_bmp = nil # 装载头像用
  22.     @head_file = nil # 头像文件名
  23.     @text = nil # 记录所处理文字
  24.     @skip = false # 记录是否跳过此次对话
  25.     @auto_close = -1 # 默认不打开自动关闭
  26.     @type_mode=-1 # 打字模式
  27.     @delay=-1 # 等待n帧标志
  28.     @finish=false # 记录文字处理是否结束
  29.     @is_read_txt =false # 默认不是在读取txt文件
  30.     self.active = false
  31.     self.index = -1
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 释放
  35.   #--------------------------------------------------------------------------
  36.   def dispose
  37.     terminate_message
  38.     $game_temp.message_window_showing = false
  39.     if @input_number_window != nil
  40.       @input_number_window.dispose
  41.     end
  42.     super
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 处理信息结束
  46.   #--------------------------------------------------------------------------
  47.   def terminate_message
  48.    
  49. #以下为增加姓名框处理
  50.     if @name_window_frame != nil
  51.       @name_window_frame.dispose
  52.       @name_window_frame = nil
  53.     end
  54.     if @name_window_text != nil
  55.       @name_window_text.dispose
  56.       @name_window_text = nil
  57.     end
  58. #以上为增加姓名框处理

  59.     self.active = false
  60.     self.pause = false
  61.     self.index = -1
  62.     self.contents.clear
  63.     # 清除显示中标志
  64.     @contents_showing = false
  65.     # 呼叫信息调用
  66.     if $game_temp.message_proc != nil
  67.       $game_temp.message_proc.call
  68.     end
  69.     # 清除文章、选择项、输入数值的相关变量
  70.     $game_temp.message_text = nil
  71.     $game_temp.message_proc = nil
  72.     $game_temp.choice_start = 99
  73.     $game_temp.choice_max = 0
  74.     $game_temp.choice_cancel_type = 0
  75.     $game_temp.choice_proc = nil
  76.     $game_temp.num_input_start = 99
  77.     $game_temp.num_input_variable_id = 0
  78.     $game_temp.num_input_digits_max = 0
  79.     # 开放金钱窗口
  80.     if @gold_window != nil
  81.       @gold_window.dispose
  82.       @gold_window = nil
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 刷新
  87.   #--------------------------------------------------------------------------
  88.   def refresh
  89.     # 清空原先内容
  90.     self.contents.clear
  91.     # 恢复一般字色
  92.     self.contents.font.color = normal_color
  93.     # 恢复字体大小
  94.     self.contents.font.size = 20
  95.     # 绘制文字位置初始化
  96.     @x = @y = 0
  97.     # 字体高度记录
  98.     @height = 32
  99.     # 文字不透明度设定为255
  100.     @op = 255
  101.     # 头像默认显示在右边
  102.     @right = true
  103.     # 头像默认显示一般表情
  104.     @face = nil
  105.     # 默认显示角色姓名
  106.     @name = nil
  107.     # 默认不跳过此次对话
  108.     @skip = false
  109.     # 从变量读取自动关闭设置
  110.     @auto_close = $game_variables[102]
  111.     # 从变量读取打字模式设置
  112.     @type_mode=$game_variables[103]
  113.     # 默认不等待
  114.     @delay=-1
  115.     # 设定文字没有处理结束
  116.     @finish=false
  117.     # 光标宽度初始化为零
  118.     @cursor_width = 0
  119.     # 到选择项的下一行字
  120.     if $game_temp.choice_start == 0
  121.       @x = 16
  122.     end
  123.     # 有等待显示的文字的情况下
  124.     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
  125.     if $game_temp.message_text != nil
  126. #      # @text 功能改进
  127. #      if @text==nil or @text==""
  128. #      @text = $game_temp.message_text.dup
  129. #      else
  130. #        @text = @text + $game_temp.message_text
  131. #      end



  132. #以下为对话记录
  133.       clue = $game_temp.message_text.split(/@clu/)[1]
  134.       if clue != nil
  135.         if @text==nil
  136.           @text = $game_temp.message_text.split(/@/)[0]
  137.         else
  138.           @text = @text + $game_temp.message_text.split(/@/)[0]
  139.         end
  140.        # @text = $game_temp.message_text.split(/@/)[0]
  141.       
  142.         if $game_variables[36].include?($game_variables[3])==false
  143.           $game_variables[36][$game_variables[3]]={}
  144.         end#当前魔塔编号不存在就创建它
  145.         if $game_variables[36][$game_variables[3]].include?($game_variables[2])==false
  146.           $game_variables[36][$game_variables[3]][$game_variables[2]]=[]
  147.         end#当前魔塔编号当前楼层不存在就创建它
  148.         if $game_variables[36][0].include?($game_variables[3])==false
  149.           $game_variables[36][0][$game_variables[3]]=0
  150.         end#当前魔塔编号对话记录次数不存在就创建它
  151.         if $game_variables[36][$game_variables[3]][1000]==nil
  152.           $game_variables[36][$game_variables[3]][1000]=[]
  153.         end#当前魔塔编号对话记录顺序排列不存在就创建它

  154. #       p $game_temp.message_text.split(/@/)[0]
  155. #       p $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])
  156.         if $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])==false
  157.           $game_variables[36][$game_variables[3]][$game_variables[2]].push ($game_temp.message_text.split(/@/)[0])


  158.           $game_variables[36][0][$game_variables[3]]+=1# 已知的对话条数
  159.           @j=0
  160.           for i in 0...$game_variables[2]+1
  161.             if $game_variables[36][$game_variables[3]].include?(i)
  162.               @j+=$game_variables[36][$game_variables[3]][i].size
  163.             end
  164.           end
  165.           @j-=1
  166.           @j=0 if @j<=0

  167.           $game_variables[36][$game_variables[3]][1000].insert @j,[$game_variables[2],$game_variables[36][$game_variables[3]][$game_variables[2]][$game_variables[36][$game_variables[3]][$game_variables[2]].size-1]]
  168.         end
  169.       else
  170.         if @text==nil
  171.           @text = $game_temp.message_text.dup
  172.         else
  173.           @text = @text + $game_temp.message_text
  174.         end
  175. #        @text = $game_temp.message_text
  176.       end
  177. #以上为对话记录      
  178.       
  179.       # 最先必须要将 "\\\\" 变换为 "\000"
  180.       @text.gsub!(/\\\\/)                { "\000" }
  181.       
  182.       # 在TXT模式还没有打开的时候
  183.       if !@is_read_txt
  184.         # TXT读取模式打开
  185.         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
  186.           # 打开文件,成功打开后再进入后面部分
  187.           if @ts.open($1,$2)
  188.             # 根据显示模式确定需要打开行数
  189.             case $game_variables[1]
  190.             when 0 # 正常模式
  191.               @text =  @ts.get_text(4)
  192.             when 1 # 图书模式
  193.               @text =  @ts.get_text(12)
  194.             when 2 # 全屏模式
  195.               @text =  @ts.get_text(15)
  196.             end
  197.             # 如果包含[END]
  198.             if @text.gsub!(/\[END\]/){""}!=nil
  199.               #退出TXT读取模式
  200.               @is_read_txt=false
  201.             else
  202.               #否则设置正在读取标志
  203.               @is_read_txt=true
  204.             end
  205.           end
  206.         else
  207.           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
  208.             # 打开文件,成功打开后再进入后面部分
  209.             if @ts.open($1,"")
  210.               # 根据显示模式确定需要打开行数
  211.               case $game_variables[101]
  212.               when 0 # 正常模式
  213.                 @text =  @ts.get_text(4)
  214.               when 1 # 图书模式
  215.                 @text =  @ts.get_text(12)
  216.               when 2 # 全屏模式
  217.                 @text =  @ts.get_text(15)
  218.               end
  219.               # 如果包含[END]
  220.               if @text.gsub!(/\[END\]/){""}!=nil
  221.                 #退出TXT读取模式
  222.                 @is_read_txt=false
  223.               else
  224.                 #否则设置正在读取标志
  225.                 @is_read_txt=true
  226.               end
  227.             end
  228.           end
  229.         end
  230.       end
  231.         
  232.       # 如果取得的字符含"\\~"时
  233.       if @text.slice!(/\\~/)!=nil
  234.         # 跳过此次对话
  235.         terminate_message
  236.         # 设置跳过此次对话标志
  237.         @skip = true
  238.         # 直接返回等待连接后面部分
  239.         return
  240.       end
  241.       
  242.       # 限制文字处理(注:这里是默认功能。)
  243.       begin
  244.         last_text = @text.clone
  245.         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  246.       end until @text == last_text
  247.       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  248.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  249.       end
  250.       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
  251.       # 为了方便将 "\\C" 变为 "\001"
  252.       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
  253.       # "\\G" 变为 "\002"
  254.       @text.gsub!(/\\[Gg]/)              { "\002" }
  255.       
  256.       # ========================增强功能========================
  257.       
  258.       #对话加强      
  259.       @now_text=$game_temp.message_text
  260.       name_window_set = false#\m[姓名]在对话框上增加姓名
  261.       if (/\\[Mm]\[(.+?)\]/.match(@now_text)) != nil
  262. #        name_window_set = true
  263.         name_text = $1
  264.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  265.       end

  266.       @text.gsub!(/\\[Mm]\[(.+?)\]/) do
  267.         name_window_set = true
  268.         name_text = $1
  269.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  270.       end
  271.       #对话加强
  272.       
  273.       
  274.       # "\\/" 删除行尾换行符号
  275.       @text.gsub!(/\\\/\n/) {""}
  276.       # 去掉不在行尾的"\\/"符号,防止出错
  277.       @text.gsub!(/\\\//) {""}
  278.       
  279.       # "\\I" 物品图标+名称显示
  280.       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
  281.       # "\\K" 技能图标+名称显示
  282.       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
  283.       # "\\W" 武器图标+名称显示
  284.       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
  285.       # "\\A" 防具图标+名称显示
  286.       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
  287.       
  288.       # 注:大量显示图片将是游戏的速度大大减慢
  289.       # "\\I1" 物品图标显示
  290.       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
  291.       # "\\K1" 技能图标显示
  292.       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
  293.       # "\\W1" 武器图标显示
  294.       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
  295.       # "\\A1" 防具图标显示
  296.       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
  297.       
  298.       # "\\I2" 物品名称显示
  299.       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
  300.       # "\\K2" 技能名称显示
  301.       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
  302.       # "\\W2" 武器名称显示
  303.       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
  304.       # "\\A2" 防具名称显示
  305.       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
  306.       
  307.       # "\\S" 字体大小(只修改第一个"\\S")
  308.       # 这里首先删掉能找到的第一个"\\S"
  309.       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
  310.         # 当找了"\\S"时满足上述条件,就设置文字大小
  311.         self.set_font_size($1.to_i)
  312.       end
  313.       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
  314.       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
  315.         self.set_font_op($1.to_i)
  316.       end

  317.       # "\\=" 停顿固定帧(延时)
  318.       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
  319.       # "\\." 停顿3帧
  320.       @text.gsub!(/\\\./)               { "\024[3]" }
  321.       # "\\_" 停顿1秒(30帧)
  322.       @text.gsub!(/\\_/)                { "\024[30]" }
  323.       
  324.       # "\\L" 指定头像左边显示
  325.       if @text.slice!(/\\[Ll]/)!=nil
  326.         # 设定头像居右标志为假
  327.         @right=false
  328.         # 顺便要设置@x=104,文字在右边显示
  329.         @x=104
  330.       end
  331.       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
  332.       # 首先是寻找有没有带参数的"\\X"
  333.       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
  334.         # 找到的话将参数赋予@name
  335.         @name=$1
  336.       # 没有找到的话
  337.       else
  338.         # 再去寻找有没有不带参数的"\\X"
  339.         if @text.slice!(/\\[Xx]/)!=nil
  340.           # 找到的话就将姓名变成"???"
  341.           @name="???"
  342.         end
  343.       end
  344.       # "\\F" 指定表情(Face 用来指定表情啦)
  345.       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
  346.       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
  347.         # 找到的话就设定表情
  348.         @face=$1
  349.       end
  350.       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
  351.       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
  352.       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
  353.         # 找到的话就提到字符串最前面
  354.         @text="\030[#{$1}]"+@text
  355.       end
  356.       
  357.       # ================ 分析部分结束,下面是显示部分 ================
  358.    
  359.       # 在此调用过程完成,因为在update部分也会有相同代码
  360.       self.refresh_

  361.     end
  362.     # 选择项的情况
  363.     if $game_temp.choice_max > 0
  364.       @item_max = $game_temp.choice_max
  365.       self.active = true
  366.       self.index = 0
  367.     end
  368.     # 输入数值的情况
  369.     if $game_temp.num_input_variable_id > 0
  370.       digits_max = $game_temp.num_input_digits_max
  371.       number = $game_variables[$game_temp.num_input_variable_id]
  372.       @input_number_window = Window_InputNumber.new(digits_max)
  373.       @input_number_window.number = number
  374.       @input_number_window.x = self.x + 8
  375.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  376.     end
  377.    
  378. #对话加强
  379. #    reset_window
  380.     if name_window_set
  381.       off_x = 0
  382.       off_y = -40
  383.       space = 2
  384.       x = self.x + off_x - space / 2
  385.       y = self.y + off_y - space / 2
  386.       w = self.contents.text_size(name_text).width + 26 + space
  387.       h = 40 + space
  388.       @name_window_frame = Window_Frame.new(x, y, w, h)
  389.       @name_window_frame.z = self.z + 1
  390.       x = self.x + off_x + 4
  391.       y = self.y + off_y
  392.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  393.       @name_window_text.z = self.z + 2
  394.     end
  395. #对话加强

  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● 设置窗口位置与不透明度
  399.   #--------------------------------------------------------------------------
  400.   def reset_window
  401.     # 判断现在的显示模式
  402.     case $game_variables[101]
  403.     when 0 # 普通模式
  404.       self.width=480
  405.       self.height=160
  406.       self.contents = Bitmap.new(width - 32, height - 32)
  407. #      self.x = 80
  408.       self.x = 145
  409.       if $game_temp.in_battle
  410. #        self.y = 16
  411.         self.y = 50
  412.       else
  413.         case $game_system.message_position
  414.         when 0  # 上
  415. #          self.y = 16
  416.           self.y = 50
  417.         when 1  # 中
  418.           self.y = 160
  419.         when 2  # 下
  420.           self.y = 304
  421.         end
  422.       end
  423.     when 1 # 图书模式
  424.       self.width=532
  425.       self.height=416
  426.       self.contents = Bitmap.new(width - 32, height - 32)
  427.       self.x = 54
  428.       self.y = 32
  429.     when 2 # 全屏模式
  430.       self.width=672
  431.       self.height=512
  432.       self.contents = Bitmap.new(width - 32, height - 32)
  433.       self.x = -16
  434.       self.y = -16
  435.     end
  436.     if $game_system.message_frame == 0
  437.       self.opacity = 255
  438.     else
  439.       self.opacity = 0
  440.     end
  441.     self.back_opacity = 192
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 刷新画面
  445.   #--------------------------------------------------------------------------
  446.   def update
  447.     super
  448.     # 渐变的情况下
  449.     if @fade_in
  450.       # 脚本在这里设定透明度
  451.       self.contents_opacity += @op/8
  452.       if @input_number_window != nil
  453.         @input_number_window.contents_opacity += 32
  454.       end
  455.       if self.contents_opacity >= @op
  456.         @fade_in = false
  457.       end
  458.       return
  459.     end
  460.     # 输入数值的情况下
  461.     if @input_number_window != nil
  462.       @input_number_window.update
  463.       
  464. #取消-使输入框可以被取消
  465.       if Input.trigger?(Input::B)
  466.         $game_switches[44]=true
  467.         $game_system.se_play($data_system.cancel_se)
  468.         @input_number_window.dispose
  469.         @input_number_window = nil
  470.         terminate_message
  471.       end#以上为增加的功能
  472.       
  473.       # 确定
  474.       if Input.trigger?(Input::C)
  475.         $game_system.se_play($data_system.decision_se)
  476.         $game_variables[$game_temp.num_input_variable_id] =
  477.           @input_number_window.number
  478.         $game_map.need_refresh = true
  479.         # 释放输入数值窗口
  480.         @input_number_window.dispose
  481.         @input_number_window = nil
  482.         terminate_message
  483.       end
  484.       return
  485.     end
  486.     # 显示信息中的情况下
  487.     if @contents_showing
  488.       # 刷新文本
  489.       self.refresh_
  490.       # 如果不是在显示选择项中就显示暂停标志
  491.       if $game_temp.choice_max == 0
  492.         self.pause = true
  493.       end
  494.       # 取消
  495.       if Input.trigger?(Input::B)
  496.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  497.           $game_system.se_play($data_system.cancel_se)
  498.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  499.           terminate_message
  500.         end
  501.       end
  502.       # @auto_close自减计数
  503.       @auto_close-=1
  504.       # 确定或者自动关闭
  505.       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
  506.         # 文字还没有处理完的时候
  507.         if !@finish
  508.           # 删除所有停顿效果
  509.           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
  510.           # 删除当前延迟效果
  511.           @delay = 0
  512.           # 关闭打字效果
  513.           @type_mode=-1
  514.           # 一次处理完所有的字
  515.           self.refresh_
  516.         else
  517.           # 有选择项的情况
  518.           if $game_temp.choice_max > 0
  519.             $game_system.se_play($data_system.decision_se)
  520.             $game_temp.choice_proc.call(self.index)
  521.           end
  522.           # 清空文字
  523.           terminate_message
  524.           # 在读取TXT的模式下,需要继续打开文字
  525.           if @is_read_txt
  526.             # 根据显示模式确定需要打开行数
  527.             case $game_variables[101]
  528.             when 0 # 正常模式
  529.               $game_temp.message_text =  @ts.get_text(4)
  530.             when 1 # 图书模式
  531.               $game_temp.message_text =  @ts.get_text(12)
  532.             when 2 # 全屏模式
  533.               $game_temp.message_text =  @ts.get_text(15)
  534.             end
  535.             # 如果包含[END]则退出TXT读取模式
  536.             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
  537.               @is_read_txt=false
  538.             end
  539.           end
  540.         end
  541.       end
  542.       return
  543.     end
  544.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  545.     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
  546.       @contents_showing = true
  547.       $game_temp.message_window_showing = true
  548.       reset_window
  549.       refresh
  550.       Graphics.frame_reset
  551.       # 当不跳过对话时才进行淡入操作
  552.       if !@skip
  553.         self.visible = true
  554.         self.contents_opacity = 0
  555.         if @input_number_window != nil
  556.           @input_number_window.contents_opacity = 0
  557.         end
  558.         @fade_in = true
  559.       end
  560.       return
  561.     end
  562.     # 没有可以显示的信息、但是窗口为可见的情况下
  563.     if self.visible
  564.       @fade_out = true
  565.       self.opacity -= 48
  566.       if self.opacity == 0
  567.         self.visible = false
  568.         @fade_out = false
  569.         $game_temp.message_window_showing = false
  570.       end
  571.       return
  572.     end
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 刷新光标矩形
  576.   #--------------------------------------------------------------------------
  577.   def update_cursor_rect
  578.     if @index >= 0
  579.       n = $game_temp.choice_start + @index
  580.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  581.     else
  582.       self.cursor_rect.empty
  583.     end
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 设定字体大小
  587.   #--------------------------------------------------------------------------
  588.   def set_font_size(size=20)
  589.     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
  590.     if size>96
  591.       size=96
  592.     end
  593.     # 设定字的大小
  594.     self.contents.font.size = size
  595.     # 如果字太大了就要加高每行文字高度。
  596.     if size > 28
  597.       @height=size+4
  598.     else
  599.       @height=32
  600.     end
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 设定文字透明
  604.   #--------------------------------------------------------------------------
  605.   def set_font_op(op=255)
  606.     # 限制透明度为0-255
  607.     if op>255
  608.       op=255
  609.     elsif op<0
  610.       op=0
  611.     end
  612.     # 这里设定文字透明是没有用的,设定透明在update过程开始
  613.     @op = op
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 显示文字/头像过程
  617.   #--------------------------------------------------------------------------
  618.   def refresh_
  619.     # 处理已经结束的情况下直接return
  620.     if @finish
  621.       return
  622.     end
  623.     # 延时处理
  624.     @delay-=1
  625.     if @delay<=0
  626.       # 每次处理i个标志,这里i就设置为@type_mode了
  627.       i=@type_mode
  628.       # c 获取 1 个字 (如果不能取得文字就循环)
  629.       while ((c = @text.slice!(/./m)) != nil)
  630.         # \\ 的情况下
  631.         if c == "\000"
  632.           # 还原为本来的文字
  633.           c = "\\"
  634.         end
  635.         # \C[n] 的情况下
  636.         if c == "\001"
  637.           # 取得字色编码
  638.           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
  639.           # 如果是设定RGB颜色
  640.           if $1[0,1]=="#"
  641.             # 先拷贝一下文字
  642.             c=$1.dup
  643.             # 分3段分别取出R,G,B颜色
  644.             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
  645.             # 设定文字颜色
  646.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
  647.             next
  648.           else
  649.             # 记录到变量 color
  650.             color = $1.to_i
  651.             # 字色0~7是有效的
  652.             if color >= 0 and color <= 7
  653.               # 设置文字颜色
  654.               self.contents.font.color = text_color(color)
  655.             end
  656.           end
  657.           # 进行下次循环
  658.           next
  659.         end
  660.         # 显示金钱窗口,这个……不用说了吧……
  661.         if c == "\002"
  662.           if @gold_window == nil
  663.             @gold_window = Window_Gold.new
  664.             @gold_window.x = 560 - @gold_window.width
  665.             if $game_temp.in_battle
  666.               @gold_window.y = 192
  667.             else
  668.               @gold_window.y = self.y >= 128 ? 32 : 384
  669.             end
  670.             @gold_window.opacity = self.opacity
  671.             @gold_window.back_opacity = self.back_opacity
  672.           end
  673.           next
  674.         end
  675.         # 另起一行文字的情况下
  676.         if c == "\n"
  677.           # 刷新选择项及光标的高
  678.           if @y >= $game_temp.choice_start
  679.             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
  680.           end
  681.           # y 加 1
  682.           @y += 1
  683.           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
  684.           if @y>=self.contents.height/@height
  685.             # 删除@text剩余的所有内容
  686.             @text=nil
  687.             # 然后返回
  688.             break
  689.           end
  690.           # 因为头像的缘故,这里需要改写
  691.           if @right
  692.             # 头像右边显示的时候是0
  693.             @x=0
  694.           else
  695.             # 头像靠左显示时@x要留出绘制头像空间
  696.             @x=104
  697.           end
  698.           # 移动到选择项的下一行
  699.           if @y >= $game_temp.choice_start
  700.             @x=16
  701.           end
  702.           # 下面的文字
  703.           next
  704.         end
  705.         # 显示物品图标
  706.         if c == "\003"
  707.           # 取得物品ID
  708.           @text.sub!(/\[([0-9]+)\]/, "")
  709.           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
  710.           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  711.           # 绘制这个图标
  712. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  713. #          # 将x值增加24
  714. #          @x+=24
  715.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  716.           @x+=40
  717.           # 执行下一次循环
  718.           next
  719.         end
  720.         # 显示技能图标(因为类似物品图标显示,所以省略注释)
  721.         if c == "\004"
  722.           @text.sub!(/\[([0-9]+)\]/, "")
  723.           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  724. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  725. #          # 将x值增加24
  726. #          @x+=24
  727.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  728.           @x+=40
  729.           next
  730.         end
  731.         # 显示武器图标(因为类似物品图标显示,所以省略注释)
  732.         if c == "\005"
  733.           @text.sub!(/\[([0-9]+)\]/, "")
  734.           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  735. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  736. #          # 将x值增加24
  737. #          @x+=24
  738.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  739.           @x+=40
  740.           next
  741.         end
  742.         # 显示防具图标(因为类似物品图标显示,所以省略注释)
  743.         if c == "\006"
  744.           @text.sub!(/\[([0-9]+)\]/, "")
  745.           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  746. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  747. #          # 将x值增加24
  748. #          @x+=24
  749.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  750.           @x+=40
  751.           next
  752.         end
  753.         
  754.         # 等待n帧
  755.         if c == "\024"
  756.           # 取得参数(需要等待多少帧)
  757.           @text.sub!(/\[([0-9]+)\]/, "")
  758.           # 设定@delay标志
  759.           @delay = $1.to_i
  760.           # 退出此次循环
  761.           break
  762.         end
  763.         
  764.         # 显示头像
  765.         if c == "\030"
  766.           #暂时记录文字大小,用于显示完头像恢复
  767.           size=self.contents.font.size
  768.           # 设定为正常的20号字
  769.           self.contents.font.size=20
  770.           # 设定系统字色,为写名字做准备的
  771.           self.contents.font.color = system_color
  772.           # 取得"[]"内的字符并从原字串中删除这一部分
  773.           @text.sub!(/\[([0-9]+)\]/, "")
  774.           # 记录到head变量
  775.           head=$1
  776.           # 判断头像和原来的是不是一样的
  777.           if @face == nil
  778.             # 不一样
  779.             if @head_file != head
  780.               # 改变成现在的头像文件名
  781.               @head_file = head
  782.               # 不一样的话再重新载入头像
  783.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  784.             end
  785.           else
  786.             # 当表情不是空的时候需要考虑表情的
  787.             if @head_file != head + "_" + @face
  788.               # 改变成现在的头像文件名
  789.               @head_file = head + "_" + @face
  790.               # 不一样的话再重新载入头像
  791.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  792.             end
  793.           end
  794.           # 显示头像,分左右两种情况
  795.           if @right
  796.             # 绘制头像图片
  797.             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
  798.             # 显示角色姓名
  799.             if @name==nil
  800.               # 取得角色姓名到变量 c
  801.               c = $game_actors[head.to_i].name
  802.               # 描绘角色的姓名
  803.               self.contents.draw_text(348,104,100,24,c,1)
  804.             else
  805.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  806.               c = @name
  807.               # 描绘角色的姓名
  808.               self.contents.draw_text(348,104,100,24,c,1)
  809.             end
  810.           else
  811.             # 绘制头像图片
  812.             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
  813.             # 显示角色姓名
  814.             if @name==nil
  815.               # 取得角色姓名到变量 c
  816.               c = $game_actors[head.to_i].name
  817.               # 描绘角色的姓名
  818.               self.contents.draw_text(0,104,100,24,c,1)
  819.             else
  820.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  821.               c = @name
  822.               # 描绘角色的姓名
  823.               self.contents.draw_text(0,104,100,24,c,1)
  824.             end
  825.           end
  826.           # 恢复默认字色
  827.           self.contents.font.color = normal_color
  828.           # 恢复字体大小
  829.           self.contents.font.size=size
  830.           # 进行下一次循环
  831.           next
  832.         end
  833.         # 描绘文字
  834.         self.contents.draw_text(4+@x,@height*@y, @height, @height, c)
  835.         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
  836.         @x += self.contents.text_size(c).width
  837.         
  838.         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
  839.         i-=1
  840.         if i==0
  841.           break
  842.         end
  843.       
  844.       end
  845.     end
  846.     # 如果@text处理结束了,就设置结束标志
  847.     if @text==nil or @text==""
  848.       @finish=true
  849.     end
  850.   end
  851. end
  852. #==============================================================================
  853. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  854. #==============================================================================
  855. class Window_Frame < Window_Base
  856.   #--------------------------------------------------------------------------
  857.   # ● オブジェクト初期化
  858.   #--------------------------------------------------------------------------
  859.   def initialize(x, y, width, height)
  860.     super(x, y, width, height)
  861.     self.contents = nil
  862.     self.back_opacity =200
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # ● 解放
  866.   #--------------------------------------------------------------------------
  867.   def dispose
  868.     super
  869.     end
  870.   end
  871. #==============================================================================
  872. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  873. #==============================================================================
  874. class Air_Text < Window_Base
  875.   #--------------------------------------------------------------------------
  876.   # ● オブジェクト初期化
  877.   #--------------------------------------------------------------------------
  878.   def initialize(x, y, designate_text)
  879.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  880.     self.opacity = 0
  881.     self.back_opacity = 0
  882.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  883.     w = self.contents.width
  884.     h = self.contents.height
  885.     self.contents.draw_text(0, 0, w, h, designate_text)
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● 解放
  889.   #--------------------------------------------------------------------------
  890.   def dispose
  891.     self.contents.clear
  892.     super
  893.   end
  894. end
复制代码

本贴由论坛斑竹叶舞枫结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^

Lv1.梦旅人

Dancer-

梦石
0
星屑
55
在线时间
76 小时
注册时间
2006-11-9
帖子
3551

开拓者贵宾

3
发表于 2007-6-18 22:21:03 | 只看该作者
重帖冻结
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-9-21 02:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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