幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1946|回复: 5

[RMVX] 如何在对话框上显示人物头像

[复制链接]

1

主题

1

帖子

13

积分

②入门

积分
13
发表于 2007-11-9 21:34:41 | 显示全部楼层 |阅读模式
如题
本人新手
向前辈们虚心请教
回复

使用道具 举报

80

主题

263

帖子

2817

积分

⑥精研

我从地狱的沉睡中醒了

积分
2817
QQ
发表于 2007-11-9 21:53:01 | 显示全部楼层
我也是新手,但是我想说的是,如果你把这个版块置顶的那几张帖子看一下的话,你肯定能找到解决的方法.否则你每次这样问,会花费更多的时间的.我个人的建议.
健康游戏,快乐游戏。
回复 支持 反对

使用道具 举报

10

主题

128

帖子

1410

积分

⑥精研

积分
1410
发表于 2007-11-9 22:24:49 | 显示全部楼层
可以使用苹果梨的加强脚本,建议你去下原来的教程。(MS66RPG有下)
#==============================================================================
# ◎ GPRA_Window_Message
#------------------------------------------------------------------------------
# ◎ 显示文章的信息窗口加强。
#------------------------------------------------------------------------------
# 制作者:绿梨子红苹果
# 个人主页:vbgm.9126.com
# E-Mail:xhy.01@163.com
# 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 # 默认不打开自动关闭
    @type_mode=-1 # 打字模式
    @delay=-1 # 等待n帧标志
    @finish=false # 记录文字处理是否结束
    @ts = TextStream.new # 创建一个新的TXT读取流
    @is_read_txt =false # 默认不是在读取txt文件
    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
    # 头像默认显示在右边
    @right = true
    # 头像默认显示一般表情
    @face = nil
    # 默认显示角色姓名
    @name = nil
    # 默认不跳过此次对话
    @skip = false
    # 从变量读取自动关闭设置
    @auto_close = $game_variables[2]
    # 从变量读取打字模式设置
    @type_mode=$game_variables[3]
    # 默认不等待
    @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)
            # 根据显示模式确定需要打开行数
            case $game_variables[1]
            when 0 # 正常模式
              @text =  @ts.get_text(4)
            when 1 # 图书模式
              @text =  @ts.get_text(12)
            when 2 # 全屏模式
              @text =  @ts.get_text(15)
            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,"")
              # 根据显示模式确定需要打开行数
              case $game_variables[1]
              when 0 # 正常模式
                @text =  @ts.get_text(4)
              when 1 # 图书模式
                @text =  @ts.get_text(12)
              when 2 # 全屏模式
                @text =  @ts.get_text(15)
              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" }
      
      # ========================增强功能========================
      
      # "\\\\/" 删除行尾换行符号
      @text.gsub!(/\\\\\\/\\n/) {""}
      # 去掉不在行尾的"\\\\/"符号,防止出错
      @text.gsub!(/\\\\\\//) {""}
      
      # "\\\\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=false
        # 顺便要设置@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
        # 找到的话就提到字符串最前面
        @text="\\030[#{$1}]"+@text
      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[1]
    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
          # 删除所有停顿效果
          @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
            # 根据显示模式确定需要打开行数
            case $game_variables[1]
            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]则退出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(348,104,100,24,c,1)
            else
              # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
              c = @name
              # 描绘角色的姓名
              self.contents.draw_text(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(0,104,100,24,c,1)
            else
              # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
              c = @name
              # 描绘角色的姓名
              self.contents.draw_text(0,104,100,24,c,1)
            end
          end
          # 恢复默认字色
          self.contents.font.color = normal_color
          # 恢复字体大小
          self.contents.font.size=size
          # 进行下一次循环
          next
        end
        
        # ======================== 以上加强部分 ========================
        
        # 描绘文字
        self.contents.draw_text(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
郁闷中……
回复 支持 反对

使用道具 举报

0

主题

1

帖子

13

积分

②入门

积分
13
发表于 2007-11-10 00:53:33 | 显示全部楼层
顶一下楼上的,我用的就是这个,蛮好用的~
回复 支持 反对

使用道具 举报

1

主题

25

帖子

277

积分

③业余

积分
277
发表于 2007-11-10 16:42:07 | 显示全部楼层
其实直接显示图片就可以的拉..................
~~~~~~~~~~无视我鄙视我把```````````````
回复 支持 反对

使用道具 举报

1

主题

9

帖子

101

积分

③业余

积分
101
QQ
发表于 2007-11-17 13:05:24 | 显示全部楼层
看不懂。。我是用直接显示图片。。。 [s:2]
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-21 06:06 , Processed in 0.015527 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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