查看: 2397|回复: 1

[已经解决] 关于黑色笔记的那个仿网游系统

[复制链接]
梦石
0
星屑
50
在线时间
11 小时
注册时间
2013-10-5
回帖
9
发表于 2013-11-2 17:29:44 | 显示全部楼层 |阅读模式

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

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

×
那个仿网游系统怎么去掉那个打字框?
QQ图片20131102172757.jpg

百合控

梦石
0
星屑
6548
在线时间
1275 小时
注册时间
2013-8-21
回帖
3522

开拓者

发表于 2013-11-2 21:35:06 | 显示全部楼层
用这个替换原Game_MapChat
下次直接去找原作者,或者发脚本,要不是我正好看到过这东西,谁知道你说的是什么
[pre lang="ruby" line="1"]#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.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
[/pre]

评分

参与人数 1梦石 +1 收起 理由
Sion + 1 认可答案

查看全部评分

萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部