赞 | 2 |
VIP | 2 |
好人卡 | 4 |
积分 | 1 |
经验 | 96076 |
最后登录 | 2015-12-27 |
在线时间 | 93 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 93 小时
- 注册时间
- 2008-5-16
- 帖子
- 745
|
第一个问题还是把图给放上去吧
第二个问题将该脚本放Main前
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Window_Selectable
- if @self_alias == nil
- alias self_update update
- @self_alias = true
- end
- def update
- #self.cursor_rect.empty
- 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 0...@item_max
- @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
- # row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
- self.top_row +=1
- end
- # 当前行被显示末尾行之后的情况下
- if self.top_row > 0 and Mouse.press?(Mouse::LEFT) and mouse_y<=self.y+self.height/2#self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.top_row -=1
- end
- @index = index_var
- if self.is_a?(Window_Target)
- @index=-3
- end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.cursor_rect.empty
- return
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.cursor_rect.empty
- return
- 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
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|