| 赞 | 289 |
| VIP | |
| 好人卡 | |
| 积分 | 85 |
| 经验 | |
| 最后登录 | 2019-7-14 |
| 在线时间 | 775 小时 |
- 梦石
- 0
- 星屑
- 8498
- 在线时间
- 775 小时
- 注册时间
- 2017-11-10
- 回帖
- 1074
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
复写了一段自己用的脚本,发现出现了问题。
就是当某些选项无效的时候,无法在选中时显示该选项无效的颜色。
估计是描绘判断出现了问题。请教各位前辈该如何去修改这段脚本?
暂时无逻辑思路的说...
[pre lang="ruby"]#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的命令选择行窗口。
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(width, commands)
# 由命令的个数计算出窗口的高
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
@putcommand = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if i != self.index
draw_item_put(i)
else
draw_item(i, normal_color)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目(选中时处理)
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item_put(index)
self.contents.font.size -= 2
rect = Rect.new(4 + 8, 32 * index, self.contents.width - 16, 32)
self.contents.draw_text(rect, @commands[index])
self.contents.font.size += 2
end
#--------------------------------------------------------------------------
# ● 描绘项目(一般时处理)
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
if self.index != @putcommand
@putcommand = self.index
refresh
end
end
end
[/pre] |
评分
-
查看全部评分
|