def update_cursor_rect #@back.bitmap = RPG::Cache.menu("item_command"+type.to_s) # 光标位置不满 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 @right.y = self.y+12+self.top_row.to_f*120.0*(3*120)/(@item_max.to_f*120) # 计算光标的宽度 cursor_width = 240 # 计算光标坐标 x = @index%4*86+2 y = @index/4-self.oy/120 # 更新光标矩形 self.cursor_rect.set(@index%4*84+2,(@index/4-self.oy/120)*120-1,85,120) #self.cursor_rect.set(x, y, 86, 120) end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update super # 可以移动光标的情况下 if self.active and @item_max >= 0 and @index >= 0 # 方向键下被按下的情况下 if Input.repeat?(Input::LEFT)#DOWN上 # 光标向下移动 $game_system.se_play($data_system.cursor_se) @index = (@index-1+@item_max) % @item_max if @item_max != 0 update_help end # 方向键上被按下的情况下 if Input.repeat?(Input::RIGHT)#UP下 # 光标向上移动 $game_system.se_play($data_system.cursor_se) @index = (@index+1+@item_max) % @item_max if @item_max != 0 update_help end end # 可以移动光标的情况下 if self.active and @item_max > 0 and @item_max <= 40 #and @index >= 0 # 方向键下被按下的情况下 if Input.repeat?(Input::DOWN)#DOWN上 # 光标向下移动 $game_system.se_play($data_system.cursor_se) @index +=4 #(@index+1+@item_max) % @item_max if @item_max != 0 update_help end end # 方向键上被按下的情况下 if self.active and @item_max <= 43 and @index<=40#@item_max if Input.repeat?(Input::UP)#UP下 # 光标向上移动 $game_system.se_play($data_system.cursor_se) @index -=4 #(@index-1+@item_max) % @item_max if @item_max != 0 update_help end end
12人.png (600.71 KB, 下载次数: 3)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |