赞 | 8 |
VIP | 14 |
好人卡 | 35 |
积分 | 31 |
经验 | 46931 |
最后登录 | 2025-2-7 |
在线时间 | 1435 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3121
- 在线时间
- 1435 小时
- 注册时间
- 2009-7-27
- 帖子
- 1452
|
本帖最后由 爆焰 于 2012-1-28 19:02 编辑
就是这个脚本,要如何改成到达最后一个选项再按右键就跳回第一个选项?在第一个选项按左键又变回最后一个选项?- #==============================================================================
- # ■ Window_Command1
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- #Scene_Title 第40行改成:
- #@command_window = Window_Command1.new(392, [s1, s2, s3])
- class Window_Command1 < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # width : 窗口的宽
- # commands : 命令字符串序列
- #--------------------------------------------------------------------------
- def initialize(width, commands)
- # 由命令的个数计算出窗口的高
- super(0, 0, width, 64)
- @item_max = commands.size
- @commands = commands
- @column_max = commands.size
- self.contents = Bitmap.new(width - 32, 64- 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
- # 计算光标的宽
- cursor_width = width / @column_max - 32
- # 计算光标坐标
- x = index % @column_max * (cursor_width + 32)
- #y = @index / @column_max * 32 - self.oy
- rect = Rect.new(x, 0, cursor_width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index], 1)
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
复制代码 |
|