赞 | 0 |
VIP | 37 |
好人卡 | 0 |
积分 | 1 |
经验 | 48662 |
最后登录 | 2012-11-14 |
在线时间 | 3 小时 |
Lv1.梦旅人 SB們大家好<
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 3 小时
- 注册时间
- 2008-1-7
- 帖子
- 457
|
啊,如果早看到这个帖子的话……
不过貌似水的脚本不够完善呢,这是偶超级繁琐的版本,用偶的VX版临时改的
,不过没有键盘问题,鼠标点击窗口上下方的箭头翻页。
以下覆盖鼠标脚本中 class Window_Selectable部分
- class Window_Selectable
-
- if @self_alias == nil
- alias self_update update
- @self_alias = true
- end
- def update
- self_update
-
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in (top_row * @column_max)...[@item_max ,top_row * @column_max + page_item_max].min
- @index = i
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- $game_system.se_play($data_system.cursor_se)
- end
- break
- end
- end
- if mouse_not_in_rect
- @index = index_var
- update_cursor_rect
- Mouse.click_lock
- if Mouse.kk_trigger?(Mouse::LEFT)
- x1 = self.x + self.contents.width / 2 + 8
- y1 = self.y + self.contents.height - 16
- y2 = self.y - 4
- rect_down = Rect.new(x1,y1,24,24)
- rect_up = Rect.new(x1,y2,24,24)
- #p Mouse.get_mouse_pos , rect_down
- if Mouse.in?(rect_down)
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # 光标向后移动一页
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- if Mouse.in?(rect_up)
- if self.top_row > 0
- # 光标向前移动一页
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- else
- Mouse.click_unlock
- end
- end
- end
- end
复制代码
以下放进Mouse 类 def self.press?(mouse_code) 之上
- def self.kk_trigger?(mouse_code)
- if mouse_code == LEFT
- return @left_trigger
- elsif mouse_code == RIGHT
- return @right_trigger
- else
- return false
- end
- end
-
- def self.in?(rect)
- mouse_x, mouse_y = Mouse.get_mouse_pos
- return (mouse_x > rect.x and mouse_x < rect.x + rect.width and mouse_y > rect.y and mouse_y < rect.y + rect.height)
- end
复制代码 |
|