赞 | 1 |
VIP | 246 |
好人卡 | 87 |
积分 | 1 |
经验 | 34142 |
最后登录 | 2015-1-15 |
在线时间 | 323 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 323 小时
- 注册时间
- 2010-8-21
- 帖子
- 666
|
回复 毛欢 的帖子
脚本默认Window_Commad是竖着显示的,我们可以对他进行修改就可实现横着选择...
比如:- #==============================================================================
- # ■ Window_Command
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- class Window_Command < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # width : 窗口的宽
- # commands : 命令字符串序列
- #--------------------------------------------------------------------------
- def initialize(width, commands, column_max=1)
- # 由命令的个数计算出窗口的高
- super(0, 0, width, (commands.size / column_max.to_f).ceil*32 + 32)
- @item_max = commands.size
- @commands = commands
- @column_max = column_max
- self.contents = Bitmap.new(width - 32, (@item_max.to_f/column_max).ceil* 32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4+index%@column_max*self.width/@column_max,
- 32 * (index/@column_max), self.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
- end
复制代码 试着看看吧....使用方法:比如
你的@command_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6])
改为:
@command_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6], 6)
就是一行显示6个,改为3就是一行3个... |
评分
-
查看全部评分
|