| 
 
| 赞 | 61 |  
| VIP | 321 |  
| 好人卡 | 140 |  
| 积分 | 64 |  
| 经验 | 179075 |  
| 最后登录 | 2025-2-24 |  
| 在线时间 | 1275 小时 |  
 Lv4.逐梦者 (版主) 百合控 
	梦石0 星屑6448 在线时间1275 小时注册时间2013-8-21帖子3657 
 | 
| 用这个替换原Game_MapChat 下次直接去找原作者,或者发脚本,要不是我正好看到过这东西,谁知道你说的是什么
 
 #encoding:utf-8#==============================================================================# ■ Game_MapChat#------------------------------------------------------------------------------#  处理地图Chat的类。#============================================================================== class Game_MapChat   DataLine = 8   def initialize    @viewport = Viewport.new(0, Graphics.height - (16 * DataLine + 18), 256, 16 * DataLine + 18)    @chatdata = Sprite.new(@viewport)    @chatdata.bitmap = Bitmap.new(@viewport.rect.width, 16 * DataLine)    @chatdata.bitmap.font.shadow = true    @chatdata_pos = 0    @chatdatas = []  end   def dispose    @viewport.dispose    @chatdata.dispose  end   def update  end   def refresh    @chatdata.bitmap.clear    @chatdata.bitmap.font.color.set(255, 255, 255, 255)    for i in @chatdata_pos...(@chatdata_pos+ 1)      break unless i < @chatdatas.size      x = 2      data = ""      text = @chatdatas[i].clone      while char = text.slice!(/./m)        case char        when "\001"          color_string = ""          while c = text.slice!(/./m)            case c            when "["              next            when "]"              break            else              color_string += c              next            end          end          color_string = color_string.split(/,/)          r = (color_string[0] || 255).to_i          g = (color_string[1] || 255).to_i          b = (color_string[2] || 255).to_i          a = (color_string[3] || 255).to_i          @chatdata.bitmap.font.color.set(r, g, b, a)          next        end        @chatdata.bitmap.draw_text(x, (i - @chatdata_pos) * 16, 230, 16, char)        x += @chatdata.bitmap.text_size(char).width      end    end  end   def add(text)    x = 2    y = 0    data = []    last_color = Color.new(255, 255, 255, 255)    text = "\001[255, 255, 255, 255]" + text    text.gsub!(/\\[Cc]/) { "\001" }    while char = text.slice!(/./m)      case char      when "\001"        data[y] ||= ""        data[y] += char        color_string = ""        while c = text.slice!(/./m)          data[y] += c          case c          when "["            next          when "]"            break          else            color_string += c            next          end        end        color_string = color_string.split(/,/)        r = (color_string[0] || 255).to_i        g = (color_string[1] || 255).to_i        b = (color_string[2] || 255).to_i        a = (color_string[3] || 255).to_i        last_color.set(r, g, b, a)        next      else        if x >= @chatdata.bitmap.width - 8          x = @chatdata.bitmap.text_size("    ").width          y += 1        end        case char        when "\n"          x = @chatdata.bitmap.text_size("    ").width          y += 1          next        end        x += @chatdata.bitmap.text_size(char).width      end       unless (data[y] ||= "").size > 0        color = last_color        char = "\001[#{color.red}, #{color.green}, #{color.blue}, #{color.alpha}]    " + char      end      data[y] += char    end    @chatdatas += data  end    def send(message, type = 2)    case type    when 0      message = "\001[255, 128, 128][RubyCode] " + message    when 1      message = "\001[255, 255, 255][附近] " + message    when 2      message = "\001[128, 192, 255]" + message    end    add(message)    @chatdata_pos = [0, @chatdatas.size - 1].max    refresh  endend
#encoding:utf-8 
#============================================================================== 
# ■ Game_MapChat 
#------------------------------------------------------------------------------ 
#  处理地图Chat的类。 
#============================================================================== 
  
class Game_MapChat 
  
  DataLine = 8 
  
  def initialize 
    @viewport = Viewport.new(0, Graphics.height - (16 * DataLine + 18), 256, 16 * DataLine + 18) 
    @chatdata = Sprite.new(@viewport) 
    @chatdata.bitmap = Bitmap.new(@viewport.rect.width, 16 * DataLine) 
    @chatdata.bitmap.font.shadow = true 
    @chatdata_pos = 0 
    @chatdatas = [] 
  end 
  
  def dispose 
    @viewport.dispose 
    @chatdata.dispose 
  end 
  
  def update 
  end 
  
  def refresh 
    @chatdata.bitmap.clear 
    @chatdata.bitmap.font.color.set(255, 255, 255, 255) 
    for i in @chatdata_pos...(@chatdata_pos+ 1) 
      break unless i < @chatdatas.size 
      x = 2 
      data = "" 
      text = @chatdatas[i].clone 
      while char = text.slice!(/./m) 
        case char 
        when "\001" 
          color_string = "" 
          while c = text.slice!(/./m) 
            case c 
            when "[" 
              next 
            when "]" 
              break 
            else 
              color_string += c 
              next 
            end 
          end 
          color_string = color_string.split(/,/) 
          r = (color_string[0] || 255).to_i 
          g = (color_string[1] || 255).to_i 
          b = (color_string[2] || 255).to_i 
          a = (color_string[3] || 255).to_i 
          @chatdata.bitmap.font.color.set(r, g, b, a) 
          next 
        end 
        @chatdata.bitmap.draw_text(x, (i - @chatdata_pos) * 16, 230, 16, char) 
        x += @chatdata.bitmap.text_size(char).width 
      end 
    end 
  end 
  
  def add(text) 
    x = 2 
    y = 0 
    data = [] 
    last_color = Color.new(255, 255, 255, 255) 
    text = "\001[255, 255, 255, 255]" + text 
    text.gsub!(/\\[Cc]/) { "\001" } 
    while char = text.slice!(/./m) 
      case char 
      when "\001" 
        data[y] ||= "" 
        data[y] += char 
        color_string = "" 
        while c = text.slice!(/./m) 
          data[y] += c 
          case c 
          when "[" 
            next 
          when "]" 
            break 
          else 
            color_string += c 
            next 
          end 
        end 
        color_string = color_string.split(/,/) 
        r = (color_string[0] || 255).to_i 
        g = (color_string[1] || 255).to_i 
        b = (color_string[2] || 255).to_i 
        a = (color_string[3] || 255).to_i 
        last_color.set(r, g, b, a) 
        next 
      else 
        if x >= @chatdata.bitmap.width - 8 
          x = @chatdata.bitmap.text_size("    ").width 
          y += 1 
        end 
        case char 
        when "\n" 
          x = @chatdata.bitmap.text_size("    ").width 
          y += 1 
          next 
        end 
        x += @chatdata.bitmap.text_size(char).width 
      end 
  
      unless (data[y] ||= "").size > 0 
        color = last_color 
        char = "\001[#{color.red}, #{color.green}, #{color.blue}, #{color.alpha}]    " + char 
      end 
      data[y] += char 
    end 
    @chatdatas += data 
  end 
  
  
  def send(message, type = 2) 
    case type 
    when 0 
      message = "\001[255, 128, 128][RubyCode] " + message 
    when 1 
      message = "\001[255, 255, 255][附近] " + message 
    when 2 
      message = "\001[128, 192, 255]" + message 
    end 
    add(message) 
    @chatdata_pos = [0, @chatdatas.size - 1].max 
    refresh 
  end 
end 
 | 
 评分
查看全部评分
 |