Project1

标题: 【已解决】如何让光标第四个就往标记的5走 [打印本页]

作者: 金芒芒    时间: 2023-4-11 16:28
标题: 【已解决】如何让光标第四个就往标记的5走
本帖最后由 金芒芒 于 2023-4-11 21:23 编辑

RUBY 代码复制
  1. def update_cursor_rect
  2.     #@back.bitmap = RPG::Cache.menu("item_command"+type.to_s)
  3.     # 光标位置不满 0 的情况下
  4.     if @index < 0
  5.       self.cursor_rect.empty
  6.       return
  7.     end
  8.  
  9.     # 获取当前的行
  10.     column = @index
  11.     # 当前行被显示开头行前面的情况下
  12.     if column < self.top_column
  13.       # 从当前行向开头行滚动
  14.       self.top_column = column
  15.     end
  16.     # 当前行被显示末尾行之后的情况下
  17.     if column > self.top_column + (self.page_column_max - 1)
  18.       # 从当前行向末尾滚动
  19.       self.top_column = column - (self.page_column_max - 1)
  20.     end
  21.  
  22.     @right.x = self.x+72+self.top_column.to_f*66.0*(4*66)/(@item_max.to_f*66)
  23.  
  24.     # 计算光标的宽度
  25.     cursor_width = 1200
  26.     # 计算光标坐标
  27.     x =32+ @index*66 - self.ox-1# 8 #
  28.     y = 4 #@index*20 - self.oy-1
  29.     # 更新光标矩形
  30.     self.cursor_rect.set(x, y, 66 ,80)
  31.   end

4-5.png (404.09 KB, 下载次数: 9)

4-5.png

作者: 金芒芒    时间: 2023-4-11 21:21
  1.     cursor_width = 1200
  2.     # 计算光标坐标
  3. #   x = 4 + index % 2 * (288 + 32)
  4.   #  y = index / 2 * 32
  5.   #x =32+ @index*66 - self.ox-1# 8 #
  6.      x =16 +@index% 4 * (66 + 5)
  7.      y = @index/ 4 * 88
  8.     #y = 14 #@index*20 - self.oy-1
  9.     # 更新光标矩形
  10.     self.cursor_rect.set(x, y, 66 ,80)
  11.   end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1