查看: 2048|回复: 0

[已经过期] 向下超过最大值无底线求约束

[复制链接]
梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2023-4-18 17:11:25 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
  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.     row = @index/@column_max
  11.     # 当前行被显示开头行前面的情况下
  12.     if row < self.top_row
  13.       # 从当前行向开头行滚动
  14.       self.top_row = row
  15.     end
  16.     # 当前行被显示末尾行之后的情况下
  17.     if row > self.top_row + (self.page_row_max - 1)
  18.       # 从当前行向末尾滚动
  19.       self.top_row = row - (self.page_row_max - 1)
  20.     end
  21.    
  22.     @right.y = self.y+12+self.top_row.to_f*120.0*(3*120)/(@item_max.to_f*120)
  23.    
  24.     # 计算光标的宽度
  25.     cursor_width = 240
  26.     # 计算光标坐标
  27.     x = @index%4*86+2
  28.     y = @index/4-self.oy/120
  29.     # 更新光标矩形
  30.     self.cursor_rect.set(@index%4*84+2,(@index/4-self.oy/120)*120-1,85,120)
  31.     #self.cursor_rect.set(x, y, 86, 120)
  32.   end
  33. #--------------------------------------------------------------------------
  34.   # ● 刷新画面
  35.   #--------------------------------------------------------------------------
  36.   def update
  37.     super

  38.     # 可以移动光标的情况下
  39.     if self.active and @item_max >= 0 and @index >= 0
  40.       # 方向键下被按下的情况下
  41.       if Input.repeat?(Input::LEFT)#DOWN上
  42.         # 光标向下移动
  43.         $game_system.se_play($data_system.cursor_se)
  44.         @index = (@index-1+@item_max) % @item_max if @item_max != 0
  45.         update_help
  46.       end
  47.       # 方向键上被按下的情况下
  48.       if Input.repeat?(Input::RIGHT)#UP下
  49.         # 光标向上移动
  50.         $game_system.se_play($data_system.cursor_se)
  51.         @index = (@index+1+@item_max) % @item_max if @item_max != 0
  52.         update_help
  53.       end
  54.       
  55.       end
  56.     # 可以移动光标的情况下
  57.      if self.active and @item_max > 0 and @item_max <= 40 #and @index >= 0
  58.       # 方向键下被按下的情况下
  59.       if Input.repeat?(Input::DOWN)#DOWN上
  60.         # 光标向下移动
  61.         $game_system.se_play($data_system.cursor_se)
  62.         @index +=4 #(@index+1+@item_max) % @item_max if @item_max != 0
  63.         update_help
  64.       end
  65.     end
  66.       # 方向键上被按下的情况下
  67.       if self.active and @item_max <= 43 and @index<=40#@item_max
  68.       if Input.repeat?(Input::UP)#UP下
  69.         # 光标向上移动
  70.         $game_system.se_play($data_system.cursor_se)
  71.         @index -=4 #(@index-1+@item_max) % @item_max if @item_max != 0
  72.         update_help
  73.       end
  74.       
  75.     end
复制代码
12人.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部