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

Project1

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

[已经解决] 66加强整和对话框怎样添加文字动态增大?

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
344
在线时间
185 小时
注册时间
2007-9-2
帖子
168
跳转到指定楼层
1
发表于 2009-6-13 02:07:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 zhli667 于 2009-7-25 01:38 编辑

非常喜欢"文字动态增大"的效果,高手帮帮忙给添加进66加强整和对话框里....{/mg}{/mg}{/mg}
----------------文字动态增大部分脚本-------------------------
#--------------------------------------------------------------------------
  # ○ 决定窗口尺寸并生成窗口
  #--------------------------------------------------------------------------
  def refresh_create
  
    unless @no_term_stop
      @pic_skin.dispose if @pic_skin != nil
    end
      @kkme_name = ""
      begin
        @kkme_name = $game_temp.message_text.split(":")[0] if $game_temp.message_text.split(":")[1] != nil
        if @kkme_name != ""
          jiajia = '\c[1]【' + @kkme_name + '】\c[0]'
          $game_temp.message_text = jiajia + $game_temp.message_text[@kkme_name.size + 2,$game_temp.message_text.size]
        else
          $game_temp.message_text = '\c[0]' + $game_temp.message_text
        end      
      rescue
      end
    unless @no_term_stop
      self.contents.clear
      self.contents.font.color = Color.new(0, 0, 0, 255)
      self.contents.font.size = FUKI::MES_FONT_SIZE
      # 取得窗口尺寸
      get_windowsize
      w = @w + 32 + 8
      h = @h * (self.contents.font.size + 6) + 26
      # 生成呼出窗口   
      # 生成角色名字窗口
      set_fukidasi(self.x, self.y, w, h)
      set_namewindow
      pic_back
    end
    # 初始化信息表示使用的变量
    @dx = @save_x # 0
    @dy = @save_y # 0
    @cursor_width = 0
    @contents_drawing = true
    update
    # 瞬间表示的情况下
    if $mes_speed == 0
      # 循环信息描绘处理
      while $game_temp.message_text != ""
        draw_massage
      end
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    else
      # 一个一个描绘文字
      refresh_drawtext
    end   
  end
  
  #--------------------------------------------------------------------------
  # ○ 一个一个描绘文字
  #--------------------------------------------------------------------------
  def refresh_drawtext
    if $game_temp.message_text != nil
      if @wait > 0
        @wait -= 1
      elsif @wait == 0
        #$game_system.se_play($data_system.cursor_se)
        # 描绘处理
        draw_massage
        @wait = $mes_speed
      end
    end
    # 描绘结束
    if $game_temp.message_text == ""
      draw_opt_text
      @contents_showing_end = true
      @contents_drawing = false
    end
  end
  
  #--------------------------------------------------------------------------
  # ○ 取得窗口尺寸
  #--------------------------------------------------------------------------
  def get_windowsize
    x = y = 0
    @h = @w = 0
    @cursor_width = 0
    # 有选择项的话,处理字的缩进
    if $game_temp.choice_start == 0
      x = 16
    end
    # 有等待显示的文字的情况下
    if $game_temp.message_text != nil
    text = $game_temp.message_text.clone
      # 限制文字处理
      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
      # 为了方便、将 "\\\\" 变换为 "\000"
      text.gsub!(/\\\\/) { "\000" }
      # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # c 获取 1 个字 (如果不能取得文字就循环)
      while ((c = text.slice!(/./m)) != nil)
        # \\ 的情况下
        if c == "\000"
          # 还原为本来的文字
          c = "\\"
        end
        # \C[n] 或者 \G 的情况下
        if c == "\001" or c == "\002"
          # 下面的文字
          next
        end
        # 另起一行文字的情况下
        if c == "\n"
          # y 累加 1
          y += 1
          # 取得纵横尺寸
          @h = y
          @w = x > @w ? x : @w
          if y >= $game_temp.choice_start
            @w = x + 8 > @w ? x + 8 : @w
          end
          x = 0
          # 移动到选择项的下一行
          if y >= $game_temp.choice_start
            x = 8
          end
          # 下面的文字
          next
        end
        # x 为要描绘文字的宽度加法运算
        x += self.contents.text_size(c).width
      end
    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]
      @h += 1
      x = digits_max * self.contents.font.size + 16
      @w = x > @w ? x : @w
    end
  end
  
  #--------------------------------------------------------------------------
  # ○ 描绘信息处理
  #--------------------------------------------------------------------------
  def draw_massage
    # 有等待显示的文字的情况下
    if $game_temp.message_text != nil or @old_text_info != nil
      text = $game_temp.message_text
      # 限制文字处理
      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
      # 为了方便、将 "\\\\" 变换为 "\000"
      text.gsub!(/\\\\/) { "\000" }
      # "\\C" 变为 "\001"、"\\G" 变为 "\002"
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # c 获取 1 个字
      c = text.slice!(/./m)
      # 选择项的情况
      if @dy >= $game_temp.choice_start
        # 处理字的缩进
        @dx = 8
        # 描绘文字
        font_size = self.contents.font.size
        self.contents.draw_text(4 + @dx, (font_size+5)*@dy, 40, 32, c)
        # x 为要描绘文字宽度的加法运算
        @dx += self.contents.text_size(c).width
        # 循环
        while ((c = text.slice!(/./m)) != "\n")
          # 描绘文字
          self.contents.draw_text(4 + @dx, (font_size+5)*@dy, 40, 32, c)
          # x 为要描绘文字宽度的加法运算
          @dx += self.contents.text_size(c).width
        end
        if c == "\n"
          # 更新光标宽度
          @cursor_width = [@cursor_width, @dx].max
          # dy 累加 1
          @dy += 1
          @dx = 0
        end
        return
      end
      # \\ 的情况下
      if c == "\000"
        # 还原为本来的文字
        c = "\\"
      end
      #\C[n] 的情况下
      if c == "\001"
        # 更改文字色
        text.sub!(/\[([0-9]+)\]/, "")
        color = $1.to_i
        if color >= 0 and color <= 7
          self.contents.font.color = text_color(color)
        end
      end
      # \G 的情况下
      if c == "\002"
        # ★生成金钱窗口★
        @contents_showing_end = true
        @contents_drawing = false
        terminate_messageX
        @save_x = @dx
        @save_y = @dy
      end
      # 另起一行文字的情况下
      if c == "\n"
        # dy 累加 1
        @dy += 1
        @dx = 0
      end
      # 描绘文字
      
      size_zy = 4 # 设定文字动态增大——别问我这么重要的参数为什么放在这里而不放在顶部,有特殊原因的。
      
      
      unless @old_text_info == []
        self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+5-size_zy)*@old_text_info[1] - size_zy/2 ,@old_text_info[2],@old_text_info[2],Color.new(0,0,0,0))
        col = self.contents.font.color.clone
        self.contents.font.color = @old_text_info[3].clone
        self.contents.font.size = @old_text_info[2] -= size_zy
        self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2]+5 )*@old_text_info[1],@old_text_info[2],@old_text_info[2],@old_text_info[4])
        self.contents.font.color = col
        begin
          Audio.se_play("Audio/se/"+@kkme_name,60,100)
        rescue
          begin
            Audio.se_play("Audio/se/"+$mes_name,60,100)
          rescue
            Audio.se_play("Audio/se/001-system01",60,100)
          end
        end
        @old_text_info = []
      end
      if c != nil
        self.contents.font.size = FUKI::MES_FONT_SIZE
        font_size = self.contents.font.size += size_zy
        @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c)
        self.contents.draw_text(4+@dx, (font_size+5-size_zy )*@dy - size_zy/2, font_size, font_size, c)
        self.contents.font.size -= size_zy
        # dx 为要描绘文字的宽度加法运算
        @dx += self.contents.text_size(c).width
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # ○ 选择项和输入数值的情况下
  #--------------------------------------------------------------------------
  def draw_opt_text
    # 选择项的情况下
    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 pic_back
    @pic_skin.dispose if @pic_skin != nil
    @pic_skin = Sprite.new
    @pic_skin.opacity = 0 unless @no_term_stop
    @pic_skin.bitmap = Bitmap.new(self.width + 32, self.height + 32)
    @pic_skin.x = self.x + 2
    @pic_skin.y = self.y + 2
    @pic_skin.z = self.z
    @pic_skin.bitmap.blt(0, 1, RPG::Cache.icon("message_左上"),  RPG::Cache.icon("message_左上").rect)
    @pic_skin.bitmap.blt(self.width - 32, 1, RPG::Cache.icon("message_右上"),  RPG::Cache.icon("message_右上").rect)
    @pic_skin.bitmap.blt(0, self.height - 31, RPG::Cache.icon("message_左下"),  RPG::Cache.icon("message_左下").rect)
    @pic_skin.bitmap.blt(self.width - 32, self.height - 31, RPG::Cache.icon("message_右下"),  RPG::Cache.icon("message_右下").rect)
    @pic_skin.bitmap.stretch_blt(Rect.new(0,33,32,self.height-64), RPG::Cache.icon("message_左"), RPG::Cache.icon("message_左").rect)
    @pic_skin.bitmap.stretch_blt(Rect.new(self.width - 32,33,32,self.height-64), RPG::Cache.icon("message_右"), RPG::Cache.icon("message_右").rect)
    @pic_skin.bitmap.stretch_blt(Rect.new(32,0,self.width-64,32), RPG::Cache.icon("message_上"), RPG::Cache.icon("message_上").rect)
    @pic_skin.bitmap.stretch_blt(Rect.new(32,self.height-32,self.width-64,32), RPG::Cache.icon("message_下"), RPG::Cache.icon("message_下").rect)
    @pic_skin.bitmap.stretch_blt(Rect.new(32,32,self.width-64,self.height-64), RPG::Cache.icon("message_中"), RPG::Cache.icon("message_中").rect)
  end[/code]
66加强整和对话框http://rpg.blue/web/htm/news569.htm
新手作品:《幻想》———缓慢制作中———
   
合击技能!哇哈哈~~~                                                                     金山寺求宝~~~

Lv1.梦旅人

梦·贤者

梦石
0
星屑
50
在线时间
1141 小时
注册时间
2007-12-15
帖子
4100
2
发表于 2009-6-13 02:14:48 | 只看该作者
据说RM在draw_text的时候,很掉fps的说= =
http://rpg.blue/home.php?mod=space&uid=34951&do=blog&id=12799
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2009-7-13
帖子
29
3
发表于 2009-7-27 12:02:53 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 16:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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