赞 | 404 |
VIP | 0 |
好人卡 | 11 |
积分 | 400 |
经验 | 242285 |
最后登录 | 2025-8-8 |
在线时间 | 5810 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 39973
- 在线时间
- 5810 小时
- 注册时间
- 2006-11-10
- 帖子
- 6683
|
光标在window_item的父类里,把下面这个脚本塞到window_item最下面。然后改self.cursor_rect.set(x, y, cursor_width, 32) 括号里的(X坐标,Y坐标,宽,高)
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = self.width / @column_max - 32
# 计算光标坐标
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# 更新国标矩形
self.cursor_rect.set(x, y, cursor_width, 32)
end
|
|