赞 | 14 |
VIP | 0 |
好人卡 | 4 |
积分 | 24 |
经验 | 30333 |
最后登录 | 2024-3-12 |
在线时间 | 912 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2385
- 在线时间
- 912 小时
- 注册时间
- 2014-10-14
- 帖子
- 1331

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#使用手冊! #在Main 裏的14行增加 Mess_Text.ini # #============================================================================== # ■ module Mess_Text #------------------------------------------------------------------------------ # 在地图上显示文章的模块。 #============================================================================== module Mess_Text MAX_LINE = 5 # 最大的行数 MAX_TIME = 210 # 文字的维持时间 #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def self.ini @text_sprite = Sprite.new @text_sprite.bitmap = Bitmap.new(350,290) @text_sprite.x = 10 @text_sprite.y = 236 + 124 @text_sprite.z = 100 [url=home.php?mod=space&uid=401263]@line[/url] = 0 [url=home.php?mod=space&uid=134219]@Time[/url] = MAX_TIME end #-------------------------------------------------------------------------- # ● 设置可见度 #-------------------------------------------------------------------------- def self.visible=(v) @text_sprite.visible = v end #-------------------------------------------------------------------------- # ● 获取可见度 #-------------------------------------------------------------------------- def self.visible return @text_sprite.disposed? ? false : @text_sprite.visible end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def self.dispose @text_sprite.dispose end #-------------------------------------------------------------------------- # ● 清空 #-------------------------------------------------------------------------- def self.clear @text_sprite.bitmap.clear @line = 0 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def self.update if @time > 0 @time -= 1 end if @time <= 0 @text_sprite.bitmap.clear @line = 0 end end def self.write(str) if @line >= MAX_LINE @text_sprite.bitmap.clear @line = 0 end @text_sprite.bitmap.font.size = 16 text_color(2) cw = @text_sprite.bitmap.text_size(str).width @text_sprite.bitmap.draw_text(0, @line * @text_sprite.bitmap.font.size, cw, 20, str) @line += 1 @time = MAX_TIME end #-------------------------------------------------------------------------- # ● 获取文字色 # n : 文字色编号 (0~7) #-------------------------------------------------------------------------- def self.text_color(n) case n when 0 return Color.new(255, 255, 255, 255) when 1 return Color.new(128, 128, 255, 255) when 2 return Color.new(255, 128, 128, 255) when 3 return Color.new(128, 255, 128, 255) when 4 return Color.new(128, 255, 255, 255) when 5 return Color.new(255, 128, 255, 255) when 6 return Color.new(255, 255, 128, 255) when 7 return Color.new(192, 192, 192, 255) else normal_color end end #-------------------------------------------------------------------------- # ● 获取普通文字色 #-------------------------------------------------------------------------- def self.normal_color return Color.new(255, 255, 255, 255) end end
#使用手冊!
#在Main 裏的14行增加 Mess_Text.ini
#
#==============================================================================
# ■ module Mess_Text
#------------------------------------------------------------------------------
# 在地图上显示文章的模块。
#==============================================================================
module Mess_Text
MAX_LINE = 5 # 最大的行数
MAX_TIME = 210 # 文字的维持时间
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def self.ini
@text_sprite = Sprite.new
@text_sprite.bitmap = Bitmap.new(350,290)
@text_sprite.x = 10
@text_sprite.y = 236 + 124
@text_sprite.z = 100
[url=home.php?mod=space&uid=401263]@line[/url] = 0
[url=home.php?mod=space&uid=134219]@Time[/url] = MAX_TIME
end
#--------------------------------------------------------------------------
# ● 设置可见度
#--------------------------------------------------------------------------
def self.visible=(v)
@text_sprite.visible = v
end
#--------------------------------------------------------------------------
# ● 获取可见度
#--------------------------------------------------------------------------
def self.visible
return @text_sprite.disposed? ? false : @text_sprite.visible
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def self.dispose
@text_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 清空
#--------------------------------------------------------------------------
def self.clear
@text_sprite.bitmap.clear
@line = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def self.update
if @time > 0
@time -= 1
end
if @time <= 0
@text_sprite.bitmap.clear
@line = 0
end
end
def self.write(str)
if @line >= MAX_LINE
@text_sprite.bitmap.clear
@line = 0
end
@text_sprite.bitmap.font.size = 16
text_color(2)
cw = @text_sprite.bitmap.text_size(str).width
@text_sprite.bitmap.draw_text(0, @line * @text_sprite.bitmap.font.size, cw, 20, str)
@line += 1
@time = MAX_TIME
end
#--------------------------------------------------------------------------
# ● 获取文字色
# n : 文字色编号 (0~7)
#--------------------------------------------------------------------------
def self.text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
#--------------------------------------------------------------------------
# ● 获取普通文字色
#--------------------------------------------------------------------------
def self.normal_color
return Color.new(255, 255, 255, 255)
end
end
|
|