那个仿网游系统怎么去掉那个打字框?
#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
查看全部评分
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-12 21:25
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.