| 赞 | 24 |
| VIP | |
| 好人卡 | |
| 积分 | 62 |
| 经验 | |
| 最后登录 | 2023-9-6 |
| 在线时间 | 3077 小时 |
聪仔
- 梦石
- 0
- 星屑
- 6187
- 在线时间
- 3077 小时
- 注册时间
- 2013-12-26
- 回帖
- 3076
|
发表于 2014-10-4 13:12:54
|
显示全部楼层
图示:
有效选项
无效选项图标变灰
可以下载范例工程:
Project1.rar
(329 KB, 下载次数: 57)
也用下面这个脚本替换原来的Window_Command类...
- #==============================================================================
- # ■ Window_Command
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- class Window_Command < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :commands # 命令
- # 图标ID请在下面按照菜单项目的顺序设置...
- Command_Icon = {0 => 144, 1 => 63, 2 => 40, 3 =>133 , 4 => 159, 5 => 137}
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- # width : 窗口宽度
- # height : 窗口高度
- # spacing : 横向排列时栏间空格
- #--------------------------------------------------------------------------
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- if row_max == 0
- row_max = (commands.size + column_max - 1) / column_max
- end
- super(0, 0, width, row_max * WLH + 32, spacing)
- @commands = commands
- @item_max = commands.size
- @column_max = column_max
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- # index : 项目位置
- # enabled : 有效标志,false时项目半透明化
- #--------------------------------------------------------------------------
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- if $scene.is_a?(Scene_Menu)
- self.draw_icon(Command_Icon[index], rect.x, rect.y, enabled)
- rect.x += 24
- self.contents.draw_text(rect, @commands[index])
- else
- self.contents.draw_text(rect, @commands[index])
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|