赞 | 7 |
VIP | 20 |
好人卡 | 0 |
积分 | 16 |
经验 | 11472 |
最后登录 | 2024-7-10 |
在线时间 | 526 小时 |
Lv3.寻梦者 宛若
- 梦石
- 0
- 星屑
- 1568
- 在线时间
- 526 小时
- 注册时间
- 2007-8-19
- 帖子
- 1493
|
- module TIP
- COUNT = 10
- end
- class Sprite_Tip < Sprite
- attr :tip,true
- def initialize
- super
- @tip = ""
- @old_tip = @tip
- @tip_count = TIP::COUNT
- self.z = 99998
- self.bitmap = Bitmap.new(640,480)
- self.visible = false
- end
- def update
- super
- xy = Mouse.get_mouse_pos
- if @old_tip != @tip
- @old_tip = @tip
- self.bitmap.clear
- r = self.bitmap.text_size(@tip)
- self.bitmap.fill_rect(r, Color.new(0,0,0,128))
- self.bitmap.draw_text(0,0,r.width,r.height,@tip)
- end
- @tip_count -= 1
- if @tip_count <= 0
- self.visible = true
- else
- self.visible = false
- end
- if self.x != xy[0] or self.y != xy[1]
- self.x = xy[0]
- self.y = xy[1]
- @tip_count = TIP::COUNT
- end
- end
- end
- class Sprite
- alias diyrpg_initialize initialize
- def initialize(vp = nil,tip = false)
- diyrpg_initialize(vp)
- if tip
- @tip_sprite = Sprite_Tip.new
- end
- end
- def tip
- return @tip_sprite.tip
- end
- def tip=(v)
- @tip_sprite.tip = v
- end
- alias diyrpg_update update
- def update
- diyrpg_update
- @tip_sprite.update if on? && @tip_sprite.is_a?(Sprite_Tip)
- end
- def on?
- unless self.bitmap.is_a?(Bitmap)
- return false
- end
- xy = Mouse.get_mouse_pos
- return xy[0] >= self.x &&xy[0] <= self.x+self.bitmap.width && xy[1] >= self.y && xy[1] <= self.y + self.bitmap.height
- end
- end
- class Sprite_Picture
- def initialize(viewport, picture)
- super(viewport,true)
- @picture = picture
- update
- end
- alias diyrpg_update_s update
- def update
- diyrpg_update_s
- self.tip = @picture.tip
- end
- end
- class Game_Picture
- attr :tip,true
- alias diyrpg_initialize initialize
- def initialize(*arg)
- diyrpg_initialize(*arg)
- @tip = ""
- end
- end
复制代码 需要有注释的图片在事件中写:
a = "TEST中文测试"
$game_screen.pictures[图片编号].tip = a |
评分
-
查看全部评分
|