| 赞 | 300 |
| VIP | |
| 好人卡 | |
| 积分 | 244 |
| 经验 | |
| 最后登录 | 2026-11-19 |
| 在线时间 | 9572 小时 |
- 梦石
- 1
- 星屑
- 23371
- 在线时间
- 9572 小时
- 注册时间
- 2012-6-19
- 回帖
- 7021
 
|
发表于 2014-8-3 12:49:41
|
显示全部楼层
本帖最后由 喵呜喵5 于 2014-8-3 12:52 编辑
case的用法搞错了,你原本的代码中只有case when 0的时候才执行第二个draw_text方法,代码改成下面这样- def refresh
- self.contents.clear
- self.contents.draw_text(0, 0, 100, 24, "第#{$game_variables[98]}天")
- case $game_variables[99]
- when 3
- a1 = "深夜"
- when 2
- a1 = "夜晚"
- when 1
- a1 = "下午"
- when 0
- a1 = "上午"
- else
- a1 = nil
- end
- self.contents.draw_text(0, 32, 100, 24, a1) if a1
- end
复制代码 或者这样
- def refresh
- self.contents.clear
- self.contents.draw_text(0, 0, 100, 24, "第#{$game_variables[98]}天")
- case $game_variables[99]
- when 3
- a1 = "深夜"
- self.contents.draw_text(0, 32, 100, 24, a1)
- when 2
- a1 = "夜晚"
- self.contents.draw_text(0, 32, 100, 24, a1)
- when 1
- a1 = "下午"
- self.contents.draw_text(0, 32, 100, 24, a1)
- when 0
- a1 = "上午"
- self.contents.draw_text(0, 32, 100, 24, a1)
- end
- end
复制代码
另外描绘文字需要花费一定的时间,因此refresh不建议放到update里面实时刷新,只有当这两个变量发生改变的时候再刷新 |
评分
-
查看全部评分
|