| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 1870 | 
 
| 最后登录 | 2015-11-25 | 
 
| 在线时间 | 34 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 34 小时
 
        - 注册时间
 - 2010-10-7
 
        - 帖子
 - 58
 
 
 
 | 
	
你看这样可以么?- #==============================================================================
 
 - # ◎ GPRA_Window_Message
 
 - #------------------------------------------------------------------------------
 
 - # ◎ 显示文章的信息窗口加强。
 
 - #------------------------------------------------------------------------------
 
 - # 制作者:绿梨子红苹果
 
 - # 个人主页:vbgm.9126.com
 
 - # E-Mail:[email protected]
 
 - # QQ:42378361
 
 - #==============================================================================
 
  
- class Window_Message < Window_Selectable
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 初始化状态
 
 -   #--------------------------------------------------------------------------
 
 -   def initialize
 
 -     super(80, 304, 480, 160)
 
 -     self.contents = Bitmap.new(width - 32, height - 32)
 
 -     self.visible = false
 
 -     self.z = 9998
 
 -     @fade_in = false
 
 -     @fade_out = false
 
 -     @contents_showing = false
 
 -     @cursor_width = 0
 
 -     @op = 255 # 不透明度
 
 -     @head_bmp = nil # 装载头像用
 
 -     @head_file = nil # 头像文件名
 
 -     @text = nil # 记录所处理文字
 
 -     @skip = false # 记录是否跳过此次对话
 
 -     @auto_close = -1 # 默认不打开自动关闭
 
 -     @show_head = false # 记录是否显示头像了
 
 -     @type_mode=-1 # 打字模式
 
 -     @auto_newline=false # 默认不开启自动换行功能
 
 -     @delay=-1 # 等待n帧标志
 
 -     @finish=false # 记录文字处理是否结束
 
 -     @ts = TextStream.new # 创建一个新的TXT读取流
 
 -     @is_read_txt =false # 默认不是在读取txt文件
 
 -     @pic = nil # 显示图片用
 
 -     @pic_x = 0 # 显示图片的X坐标
 
 -     @pic_y = 0 # 显示图片的Y坐标
 
 -     self.active = false
 
 -     self.index = -1
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 释放
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose
 
 -     terminate_message
 
 -     $game_temp.message_window_showing = false
 
 -     if @input_number_window != nil
 
 -       @input_number_window.dispose
 
 -     end
 
 -     super
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 处理信息结束
 
 -   #--------------------------------------------------------------------------
 
 -   def terminate_message
 
 -     self.active = false
 
 -     self.pause = false
 
 -     self.index = -1
 
 -     self.contents.clear
 
 -     # 清除显示中标志
 
 -     @contents_showing = false
 
 -     # 呼叫信息调用
 
 -     if $game_temp.message_proc != nil
 
 -       $game_temp.message_proc.call
 
 -     end
 
 -     # 清除文章、选择项、输入数值的相关变量
 
 -     $game_temp.message_text = nil
 
 -     $game_temp.message_proc = nil
 
 -     $game_temp.choice_start = 99
 
 -     $game_temp.choice_max = 0
 
 -     $game_temp.choice_cancel_type = 0
 
 -     $game_temp.choice_proc = nil
 
 -     $game_temp.num_input_start = 99
 
 -     $game_temp.num_input_variable_id = 0
 
 -     $game_temp.num_input_digits_max = 0
 
 -     # 开放金钱窗口
 
 -     if @gold_window != nil
 
 -       @gold_window.dispose
 
 -       @gold_window = nil
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新
 
 -   #--------------------------------------------------------------------------
 
 -   def refresh
 
 -     # 清空原先内容
 
 -     self.contents.clear
 
 -     # 恢复一般字色
 
 -     self.contents.font.color = normal_color
 
 -     # 恢复字体大小
 
 -     self.contents.font.size = 20
 
 -     # 绘制文字位置初始化
 
 -     @x = @y = 0
 
 -     # 字体高度记录
 
 -     @height = 32
 
 -     # 文字不透明度设定为255
 
 -     @op = 255
 
 -     # 默认不显示头像
 
 -     @show_head = false
 
 -     # 头像默认显示在右边
 
 -     @right = true
 
 -     # 头像默认显示一般表情
 
 -     @face = nil
 
 -     # 默认显示角色姓名
 
 -     @name = nil
 
 -     # 默认是不显示图片的
 
 -     @pic = nil
 
 -     # 默认不跳过此次对话
 
 -     @skip = false
 
 -     # 从变量读取自动关闭设置
 
 -     @auto_close = $game_variables[2]
 
 -     # 从变量读取打字模式设置
 
 -     @type_mode=$game_variables[3]
 
 -     # 从变量读取自动换行设置
 
 -     @auto_newline= ($game_variables[6]==0 ? false : true)
 
 -     # 默认不等待
 
 -     @delay=-1
 
 -     # 设定文字没有处理结束
 
 -     @finish=false 
 
 -     # 光标宽度初始化为零
 
 -     @cursor_width = 0
 
 -     # 到选择项的下一行字
 
 -     if $game_temp.choice_start == 0
 
 -       @x = 16
 
 -     end
 
 -     # 有等待显示的文字的情况下
 
 -     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
 
 -     if $game_temp.message_text != nil
 
 -       # @text 功能改进
 
 -       if @text==nil or @text==""
 
 -         @text = $game_temp.message_text.dup
 
 -       else
 
 -         @text = @text + $game_temp.message_text
 
 -       end
 
 -       
 
 -       # 最先必须要将 "\\\\" 变换为 "\000"
 
 -       @text.gsub!(/\\\\/)                { "\000" }
 
 -       
 
 -       # 在TXT模式还没有打开的时候
 
 -       if !@is_read_txt
 
 -         # TXT读取模式打开
 
 -         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
 
 -           # 打开文件,成功打开后再进入后面部分
 
 -           if @ts.open($1,$2)
 
 -             if @auto_newline==true
 
 -               #自动换行时只打开一行文字
 
 -               @text =  @ts.get_text(1)
 
 -             else
 
 -               # 根据显示模式确定需要打开行数
 
 -               case $game_variables[4]
 
 -               when 0 # 正常模式
 
 -                 @text =  @ts.get_text(4)
 
 -               when 1 # 图书模式
 
 -                 @text =  @ts.get_text(12)
 
 -               when 2 # 全屏模式
 
 -                 @text =  @ts.get_text(15)
 
 -               end
 
 -             end
 
 -             # 如果包含[END]
 
 -             if @text.gsub!(/\[END\]/){""}!=nil
 
 -               #退出TXT读取模式
 
 -               @is_read_txt=false
 
 -             else
 
 -               #否则设置正在读取标志
 
 -               @is_read_txt=true
 
 -             end
 
 -           end
 
 -         else
 
 -           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
 
 -             # 打开文件,成功打开后再进入后面部分
 
 -             if @ts.open($1,"")
 
 -               if @auto_newline==true
 
 -                 #自动换行时只打开一行文字
 
 -                 @text =  @ts.get_text(1)
 
 -               else
 
 -                 # 根据显示模式确定需要打开行数
 
 -                 case $game_variables[4]
 
 -                 when 0 # 正常模式
 
 -                   @text =  @ts.get_text(4)
 
 -                 when 1 # 图书模式
 
 -                   @text =  @ts.get_text(12)
 
 -                 when 2 # 全屏模式
 
 -                   @text =  @ts.get_text(15)
 
 -                 end
 
 -               end
 
 -               # 如果包含[END]
 
 -               if @text.gsub!(/\[END\]/){""}!=nil
 
 -                 #退出TXT读取模式
 
 -                 @is_read_txt=false
 
 -               else
 
 -                 #否则设置正在读取标志
 
 -                 @is_read_txt=true
 
 -               end
 
 -             end
 
 -           end
 
 -         end
 
 -       end
 
 -         
 
 -       # 如果取得的字符含"\\~"时
 
 -       if @text.slice!(/\\~/)!=nil
 
 -         # 跳过此次对话
 
 -         terminate_message
 
 -         # 设置跳过此次对话标志
 
 -         @skip = true
 
 -         # 直接返回等待连接后面部分
 
 -         return
 
 -       end
 
 -       
 
 -       # 限制文字处理(注:这里是默认功能。)
 
 -       begin
 
 -         last_text = @text.clone
 
 -         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
 
 -       end until @text == last_text
 
 -       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
 
 -         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
 
 -       end
 
 -       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
 
 -       # 为了方便将 "\\C" 变为 "\001"
 
 -       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
 
 -       # "\\G" 变为 "\002"
 
 -       @text.gsub!(/\\[Gg]/)              { "\002" }
 
 -       
 
 -       # ========================增强功能========================
 
 -       
 
 -       # 在自动换行模式下,首先删除所有换行符号,然后"\/"用于强制换行
 
 -       if @auto_newline
 
 -         # 删除原来的所有换行。
 
 -         @text.gsub!(/\n/) {""}
 
 -         # 然后"\/"替换成强制换行
 
 -         @text.gsub!(/\\\//) {"\n"}
 
 -       # 在非自动换行模式下,"\/"用于删除多于的换行符号
 
 -       else
 
 -         # "\\/" 删除行尾换行符号
 
 -         @text.gsub!(/\\\/\n/) {""}
 
 -         # 去掉不在行尾的"\\/"符号,防止出错
 
 -         @text.gsub!(/\\\//) {""}
 
 -       end
 
 -         
 
 -       # "\\I" 物品图标+名称显示
 
 -       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
 
 -       # "\\K" 技能图标+名称显示
 
 -       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
 
 -       # "\\W" 武器图标+名称显示
 
 -       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
 
 -       # "\\A" 防具图标+名称显示
 
 -       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
 
 -       
 
 -       # 注:大量显示图片将是游戏的速度大大减慢
 
 -       # "\\I1" 物品图标显示
 
 -       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
 
 -       # "\\K1" 技能图标显示
 
 -       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
 
 -       # "\\W1" 武器图标显示
 
 -       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
 
 -       # "\\A1" 防具图标显示
 
 -       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
 
 -       
 
 -       # "\\I2" 物品名称显示
 
 -       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
 
 -       # "\\K2" 技能名称显示
 
 -       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
 
 -       # "\\W2" 武器名称显示
 
 -       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
 
 -       # "\\A2" 防具名称显示
 
 -       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
 
 -       
 
 -       # "\\S" 字体大小(只修改第一个"\\S")
 
 -       # 这里首先删掉能找到的第一个"\\S"
 
 -       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
 
 -         # 当找了"\\S"时满足上述条件,就设置文字大小
 
 -         self.set_font_size($1.to_i)
 
 -       end
 
 -       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
 
 -       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
 
 -         self.set_font_op($1.to_i)
 
 -       end
 
  
-       # "\\=" 停顿固定帧(延时)
 
 -       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
 
 -       # "\\." 停顿3帧
 
 -       @text.gsub!(/\\\./)               { "\024[3]" }
 
 -       # "\\_" 停顿1秒(30帧)
 
 -       @text.gsub!(/\\_/)                { "\024[30]" }
 
 -       
 
 -       # "\\L" 指定头像左边显示
 
 -       if @text.slice!(/\\[Ll]/)!=nil
 
 -         # 设定头像居右标志为假
 
 -         @right=true
 
 -         # 顺便要设置@x=104,文字在右边显示
 
 -         @x=104
 
 -       end
 
 -       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
 
 -       # 首先是寻找有没有带参数的"\\X"
 
 -       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
 
 -         # 找到的话将参数赋予@name
 
 -         @name=$1
 
 -       # 没有找到的话
 
 -       else
 
 -         # 再去寻找有没有不带参数的"\\X"
 
 -         if @text.slice!(/\\[Xx]/)!=nil
 
 -           # 找到的话就将姓名变成"???"
 
 -           @name="???"
 
 -         end
 
 -       end
 
 -       # "\\F" 指定表情(Face 用来指定表情啦)
 
 -       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
 
 -       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
 
 -         # 找到的话就设定表情
 
 -         @face=$1
 
 -       end
 
 -       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
 
 -       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
 
 -       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
 
 -         # 显示了头像,将标记记录为真
 
 -         @show_head = true
 
 -         @right=false
 
 -         # 顺便要设置@x=104,文字在右边显示
 
 -         @x=104
 
 -         # 找到的话就提到字符串最前面
 
 -         @text="\030[#{$1}]"+@text
 
 -       end
 
 -       # "\\Pic" 显示图片,用来在报刊等场合添加图片
 
 -       if @text.slice!(/\\[Pp][Ii][Cc]\[([0-9]+)\]\[([0-9]+)\]\[(\w+)\]/)!=nil
 
 -         # 找到的话就提到字符串最前面
 
 -         @text="\031"+@text
 
 -         # 载入要显示的图片
 
 -         @pic = RPG::Cache.picture($3)
 
 -         # 然后要记录显示图片的坐标
 
 -         @pic_x=$1.to_i
 
 -         @pic_y=$2.to_i
 
 -       end
 
 -       
 
 -       # ================ 分析部分结束,下面是显示部分 ================
 
 -     
 
 -       # 在此调用过程完成,因为在update部分也会有相同代码
 
 -       self.refresh_
 
 -  
 
 -     end
 
 -     # 选择项的情况
 
 -     if $game_temp.choice_max > 0
 
 -       @item_max = $game_temp.choice_max
 
 -       self.active = true
 
 -       self.index = 0
 
 -     end
 
 -     # 输入数值的情况
 
 -     if $game_temp.num_input_variable_id > 0
 
 -       digits_max = $game_temp.num_input_digits_max
 
 -       number = $game_variables[$game_temp.num_input_variable_id]
 
 -       @input_number_window = Window_InputNumber.new(digits_max)
 
 -       @input_number_window.number = number
 
 -       @input_number_window.x = self.x + 8
 
 -       @input_number_window.y = self.y + $game_temp.num_input_start * 32
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设置窗口位置与不透明度
 
 -   #--------------------------------------------------------------------------
 
 -   def reset_window
 
 -     # 判断现在的显示模式
 
 -     case $game_variables[4]
 
 -     when 0 # 普通模式
 
 -       self.width=480
 
 -       self.height=160
 
 -       self.contents = Bitmap.new(width - 32, height - 32)
 
 -       self.x = 80
 
 -       if $game_temp.in_battle
 
 -         self.y = 16
 
 -       else
 
 -         case $game_system.message_position
 
 -         when 0  # 上
 
 -           self.y = 16
 
 -         when 1  # 中
 
 -           self.y = 160
 
 -         when 2  # 下
 
 -           self.y = 304
 
 -         end
 
 -       end
 
 -     when 1 # 图书模式
 
 -       self.width=532
 
 -       self.height=416
 
 -       self.contents = Bitmap.new(width - 32, height - 32)
 
 -       self.x = 54
 
 -       self.y = 32
 
 -     when 2 # 全屏模式
 
 -       self.width=672
 
 -       self.height=512
 
 -       self.contents = Bitmap.new(width - 32, height - 32)
 
 -       self.x = -16
 
 -       self.y = -16
 
 -     end
 
 -     if $game_system.message_frame == 0
 
 -       self.opacity = 255
 
 -     else
 
 -       self.opacity = 0
 
 -     end
 
 -     self.back_opacity = 192
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新画面
 
 -   #--------------------------------------------------------------------------
 
 -   def update
 
 -     super
 
 -     # 渐变的情况下
 
 -     if @fade_in
 
 -       # 脚本在这里设定透明度
 
 -       self.contents_opacity += @op/8
 
 -       if @input_number_window != nil
 
 -         @input_number_window.contents_opacity += 32
 
 -       end
 
 -       if self.contents_opacity >= @op
 
 -         @fade_in = false
 
 -       end
 
 -       return
 
 -     end
 
 -     # 输入数值的情况下
 
 -     if @input_number_window != nil
 
 -       @input_number_window.update
 
 -       # 确定
 
 -       if Input.trigger?(Input::C)
 
 -         $game_system.se_play($data_system.decision_se)
 
 -         $game_variables[$game_temp.num_input_variable_id] =
 
 -           @input_number_window.number
 
 -         $game_map.need_refresh = true
 
 -         # 释放输入数值窗口
 
 -         @input_number_window.dispose
 
 -         @input_number_window = nil
 
 -         terminate_message
 
 -       end
 
 -       return
 
 -     end
 
 -     # 显示信息中的情况下
 
 -     if @contents_showing
 
 -       # 刷新文本
 
 -       self.refresh_
 
 -       # 如果不是在显示选择项中就显示暂停标志
 
 -       if $game_temp.choice_max == 0
 
 -         self.pause = true
 
 -       end
 
 -       # 取消
 
 -       if Input.trigger?(Input::B)
 
 -         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
 
 -           $game_system.se_play($data_system.cancel_se)
 
 -           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
 
 -           terminate_message
 
 -         end
 
 -       end
 
 -       # @auto_close自减计数
 
 -       @auto_close-=1 
 
 -       # 确定或者自动关闭
 
 -       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
 
 -         # 文字还没有处理完的时候
 
 -         if !@finish and @auto_close!=0
 
 -           # 删除所有停顿效果
 
 -           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
 
 -           # 删除当前延迟效果
 
 -           @delay = 0
 
 -           # 关闭打字效果
 
 -           @type_mode=-1
 
 -           # 一次处理完所有的字
 
 -           self.refresh_
 
 -         else
 
 -           # 有选择项的情况
 
 -           if $game_temp.choice_max > 0
 
 -             $game_system.se_play($data_system.decision_se)
 
 -             $game_temp.choice_proc.call(self.index)
 
 -           end
 
 -           # 清空文字
 
 -           terminate_message
 
 -           # 在读取TXT的模式下,需要继续打开文字
 
 -           if @is_read_txt
 
 -             if @auto_newline==true
 
 -               #自动换行时只打开一行文字
 
 -               $game_temp.message_text =  @ts.get_text(1)
 
 -             else
 
 -               # 根据显示模式确定需要打开行数
 
 -               case $game_variables[4]
 
 -               when 0 # 正常模式
 
 -                 $game_temp.message_text =  @ts.get_text(4)
 
 -               when 1 # 图书模式
 
 -                 $game_temp.message_text =  @ts.get_text(12)
 
 -               when 2 # 全屏模式
 
 -                 $game_temp.message_text =  @ts.get_text(15)
 
 -               end
 
 -             end
 
 -             # 如果包含[END]则退出TXT读取模式
 
 -             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
 
 -               @is_read_txt=false
 
 -             end
 
 -           end
 
 -         end
 
 -       end
 
 -       return
 
 -     end
 
 -     # 在渐变以外的状态下有等待显示的信息与选择项的场合
 
 -     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
 
 -       @contents_showing = true
 
 -       $game_temp.message_window_showing = true
 
 -       reset_window
 
 -       refresh
 
 -       Graphics.frame_reset
 
 -       # 当不跳过对话时才进行淡入操作
 
 -       if !@skip
 
 -         self.visible = true
 
 -         self.contents_opacity = 0
 
 -         if @input_number_window != nil
 
 -           @input_number_window.contents_opacity = 0
 
 -         end
 
 -         @fade_in = true
 
 -       end
 
 -       return
 
 -     end
 
 -     # 没有可以显示的信息、但是窗口为可见的情况下
 
 -     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
 
 -       end
 
 -       return
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新光标矩形
 
 -   #--------------------------------------------------------------------------
 
 -   def update_cursor_rect
 
 -     if @index >= 0
 
 -       n = $game_temp.choice_start + @index
 
 -       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
 
 -     else
 
 -       self.cursor_rect.empty
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设定字体大小
 
 -   #--------------------------------------------------------------------------
 
 -   def set_font_size(size=20)
 
 -     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
 
 -     if size>96
 
 -       size=96
 
 -     end
 
 -     # 设定字的大小
 
 -     self.contents.font.size = size
 
 -     # 如果字太大了就要加高每行文字高度。
 
 -     if size > 28
 
 -       @height=size+4
 
 -     else
 
 -       @height=32
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设定文字透明
 
 -   #--------------------------------------------------------------------------
 
 -   def set_font_op(op=255)
 
 -     # 限制透明度为0-255
 
 -     if op>255
 
 -       op=255
 
 -     elsif op<0
 
 -       op=0
 
 -     end
 
 -     # 这里设定文字透明是没有用的,设定透明在update过程开始
 
 -     @op = op
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 显示文字/头像过程
 
 -   #--------------------------------------------------------------------------
 
 -   def refresh_
 
 -     # 处理已经结束的情况下直接return
 
 -     if @finish
 
 -       return
 
 -     end
 
 -     # 延时处理
 
 -     @delay-=1
 
 -     if @delay<=0
 
 -       # 每次处理i个标志,这里i就设置为@type_mode了
 
 -       i=@type_mode
 
 -       # c 获取 1 个字 (如果不能取得文字就循环)
 
 -       while ((c = @text.slice!(/./m)) != nil)
 
 -         # ======================== 默认功能 ========================
 
 -         # \\ 的情况下
 
 -         if c == "\000"
 
 -           # 还原为本来的文字
 
 -           c = "\\"
 
 -         end
 
 -         # \C[n] 的情况下
 
 -         if c == "\001"
 
 -           # 取得字色编码
 
 -           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
 
 -           # 如果是设定RGB颜色
 
 -           if $1[0,1]=="#"
 
 -             # 先拷贝一下文字
 
 -             c=$1.dup
 
 -             # 分3段分别取出R,G,B颜色
 
 -             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
 
 -             # 设定文字颜色
 
 -             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
 
 -             next
 
 -           else
 
 -             # 记录到变量 color
 
 -             color = $1.to_i
 
 -             # 字色0~7是有效的
 
 -             if color >= 0 and color <= 7
 
 -               # 设置文字颜色
 
 -               self.contents.font.color = text_color(color)
 
 -             end
 
 -           end
 
 -           # 进行下次循环
 
 -           next
 
 -         end
 
 -         # 显示金钱窗口,这个……不用说了吧……
 
 -         if c == "\002"
 
 -           if @gold_window == nil
 
 -             @gold_window = Window_Gold.new
 
 -             @gold_window.x = 560 - @gold_window.width
 
 -             if $game_temp.in_battle
 
 -               @gold_window.y = 192
 
 -             else
 
 -               @gold_window.y = self.y >= 128 ? 32 : 384
 
 -             end
 
 -             @gold_window.opacity = self.opacity
 
 -             @gold_window.back_opacity = self.back_opacity
 
 -           end
 
 -           next
 
 -         end
 
 -         # 另起一行文字的情况下
 
 -         if c == "\n"
 
 -           # 刷新选择项及光标的高
 
 -           if @y >= $game_temp.choice_start
 
 -             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
 
 -           end
 
 -           # y 加 1
 
 -           @y += 1
 
 -           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
 
 -           if @y>=self.contents.height/@height
 
 -             # 删除@text剩余的所有内容
 
 -             @text=nil
 
 -             # 然后返回
 
 -             break
 
 -           end
 
 -           # 因为头像的缘故,这里需要改写
 
 -           if @right
 
 -             # 头像右边显示的时候是0
 
 -             @x=0
 
 -           else
 
 -             # 头像靠左显示时@x要留出绘制头像空间
 
 -             @x=104
 
 -           end
 
 -           # 移动到选择项的下一行
 
 -           if @y >= $game_temp.choice_start
 
 -             @x=16
 
 -           end
 
 -           # 下面的文字
 
 -           next
 
 -         end
 
 -         
 
 -         # ======================== 加强功能 ========================
 
 -         
 
 -         # 显示物品图标
 
 -         if c == "\003"
 
 -           # 取得物品ID
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
 
 -           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
 
 -           # 绘制这个图标
 
 -           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
 
 -           # 将x值增加24
 
 -           @x+=24
 
 -           # 执行下一次循环
 
 -           next
 
 -         end
 
 -         # 显示技能图标(因为类似物品图标显示,所以省略注释)
 
 -         if c == "\004"
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
 
 -           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
 
 -           @x+=24
 
 -           next
 
 -         end
 
 -         # 显示武器图标(因为类似物品图标显示,所以省略注释)
 
 -         if c == "\005"
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
 
 -           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
 
 -           @x+=24
 
 -           next
 
 -         end
 
 -         # 显示防具图标(因为类似物品图标显示,所以省略注释)
 
 -         if c == "\006"
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
 
 -           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
 
 -           @x+=24
 
 -           next
 
 -         end
 
 -         
 
 -         # 等待n帧
 
 -         if c == "\024"
 
 -           # 取得参数(需要等待多少帧)
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           # 设定@delay标志
 
 -           @delay = $1.to_i
 
 -           # 退出此次循环
 
 -           break
 
 -         end
 
 -         
 
 -         # 显示头像
 
 -         if c == "\030"
 
 -           #暂时记录文字大小,用于显示完头像恢复
 
 -           size=self.contents.font.size
 
 -           # 设定为正常的20号字
 
 -           self.contents.font.size=20
 
 -           # 设定系统字色,为写名字做准备的
 
 -           self.contents.font.color = system_color
 
 -           # 取得"[]"内的字符并从原字串中删除这一部分
 
 -           @text.sub!(/\[([0-9]+)\]/, "")
 
 -           # 记录到head变量
 
 -           head=$1
 
 -           # 判断头像和原来的是不是一样的
 
 -           if @face == nil
 
 -             # 不一样
 
 -             if @head_file != head
 
 -               # 改变成现在的头像文件名
 
 -               @head_file = head
 
 -               # 不一样的话再重新载入头像
 
 -               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
 
 -             end
 
 -           else
 
 -             # 当表情不是空的时候需要考虑表情的
 
 -             if @head_file != head + "_" + @face
 
 -               # 改变成现在的头像文件名
 
 -               @head_file = head + "_" + @face
 
 -               # 不一样的话再重新载入头像
 
 -               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
 
 -             end
 
 -           end
 
 -           # 显示头像,分左右两种情况
 
 -           if @right
 
 -             # 绘制头像图片
 
 -             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
 
 -             # 显示角色姓名
 
 -             if @name==nil
 
 -               # 取得角色姓名到变量 c
 
 -               c = $game_actors[head.to_i].name
 
 -               # 描绘角色的姓名
 
 -               self.contents.draw_text_s(348,104,100,24,c,1)
 
 -             else
 
 -               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
 
 -               c = @name
 
 -               # 描绘角色的姓名
 
 -               self.contents.draw_text_s(348,104,100,24,c,1)
 
 -             end
 
 -           else
 
 -             # 绘制头像图片
 
 -             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
 
 -             # 显示角色姓名
 
 -             if @name==nil
 
 -               # 取得角色姓名到变量 c
 
 -               c = $game_actors[head.to_i].name
 
 -               # 描绘角色的姓名
 
 -               self.contents.draw_text_s(0,104,100,24,c,1)
 
 -             else
 
 -               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
 
 -               c = @name
 
 -               # 描绘角色的姓名
 
 -               self.contents.draw_text_s(0,104,100,24,c,1)
 
 -             end
 
 -           end
 
 -           # 恢复默认字色
 
 -           self.contents.font.color = normal_color
 
 -           # 恢复字体大小
 
 -           self.contents.font.size=size
 
 -           # 进行下一次循环
 
 -           next
 
 -         end
 
 -         
 
 -         # 显示图片!只需要绘图而已。
 
 -         if c == "\031"
 
 -           self.contents.blt(@pic_x,@pic_y,@pic,@pic.rect)
 
 -           next
 
 -         end
 
 -         
 
 -         # ======================== 以上加强部分 ========================
 
 -         
 
 -         # 自动换行模式
 
 -         if @auto_newline
 
 -           # 计算应该换行的最大X坐标
 
 -           max_x = self.contents.width - 4
 
 -           # 在右侧显示头像的时候,坐标应该左移让出头像的位置
 
 -           if @right&&@show_head
 
 -             max_x -= 104
 
 -           end
 
 -           # 并且文字已经超出了显示宽度
 
 -           if @x+self.contents.text_size(c).width+4 > max_x
 
 -             # 增加一个换行符号,并且将本次准备显示的字符放到下一行
 
 -             @text = "\n" + c + @text
 
 -             # 跳过这次绘制文字
 
 -             next
 
 -           end
 
 -         end
 
 -         
 
 -         # 描绘文字
 
 -         self.contents.draw_text_s(4+@x,@height*@y, @height, @height, c)
 
 -         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
 
 -         @x += self.contents.text_size(c).width
 
 -           
 
 -         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
 
 -         i-=1
 
 -         if i==0
 
 -           break
 
 -         end
 
 -       
 
 -       end
 
 -     end
 
 -     
 
 -     # 如果@text处理结束了
 
 -     if @text==nil or @text==""
 
 -       # 设置结束标志
 
 -       @finish=true
 
 -     end
 
 -   end
 
 - end
 
 
  复制代码 |   
 
 
 
 |