| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2022-2-23 |
| 在线时间 | 65 小时 |
- 梦石
- 0
- 星屑
- 115
- 在线时间
- 65 小时
- 注册时间
- 2013-1-18
- 回帖
- 14
|
发表于 2013-12-8 13:47:45
|
显示全部楼层
显示提示框
- # 使用方法:在事件中输入脚本 tip("提示内容") 即可
- $提示框弹出时间 = 20
- class Window_Tip < Window_Base
- def initialize
- super(0,300,128,64)
- self.contents_opacity = 0
- self.opacity = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.z = 9999
-
- @p = 0
- end
- def refresh
- text = $game_temp.tipping
- self.x = (580-(text.to_s.size / 3 * 32))/2
- self.width = (text.to_s.size / 3 * 32)+32
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.draw_text(0, -2, (text.to_s.size / 3 * 32), 32, text,1)
- self.opacity=160
- case @p
- when 0..40
- self.opacity += 10
- self.contents_opacity += 10
- when (40 + $提示框弹出时间)..(70 + $提示框弹出时间)
- self.opacity -= 10
- self.contents_opacity -= 10
- when (71 + $提示框弹出时间)
- $game_temp.tipping = nil
- self.opacity = 0
- self.contents_opacity = 0
- @p = -1
- end
- @p += 1
- end
- end
- class Game_Temp
- attr_accessor :tipping
- end
- class Interpreter
- def tip(text)
- $game_temp.tipping = text
- end
- end
- class Scene_Map
- alias b_m main
- def main
- @tip = Window_Tip.new
- b_m
- @tip.dispose
- end
- alias u update
- def update
- @tip.refresh if $game_temp.tipping
- u
- end
- end
复制代码 |
|