设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1013|回复: 0
打印 上一主题 下一主题

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
跳转到指定楼层
1
发表于 2023-4-18 17:11:25 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
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.     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.     # 可以移动光标的情况下
  40.     if self.active and @item_max >= 0 and @index >= 0
  41.       # 方向键下被按下的情况下
  42.       if Input.repeat?(Input::LEFT)#DOWN上
  43.         # 光标向下移动
  44.         $game_system.se_play($data_system.cursor_se)
  45.         @index = (@index-1+@item_max) % @item_max if @item_max != 0
  46.         update_help
  47.       end
  48.       # 方向键上被按下的情况下
  49.       if Input.repeat?(Input::RIGHT)#UP下
  50.         # 光标向上移动
  51.         $game_system.se_play($data_system.cursor_se)
  52.         @index = (@index+1+@item_max) % @item_max if @item_max != 0
  53.         update_help
  54.       end
  55.  
  56.       end
  57.     # 可以移动光标的情况下
  58.      if self.active and @item_max > 0 and @item_max <= 40 #and @index >= 0
  59.       # 方向键下被按下的情况下
  60.       if Input.repeat?(Input::DOWN)#DOWN上
  61.         # 光标向下移动
  62.         $game_system.se_play($data_system.cursor_se)
  63.         @index +=4 #(@index+1+@item_max) % @item_max if @item_max != 0
  64.         update_help
  65.       end
  66.     end
  67.       # 方向键上被按下的情况下
  68.       if self.active and @item_max <= 43 and @index<=40#@item_max
  69.       if Input.repeat?(Input::UP)#UP下
  70.         # 光标向上移动
  71.         $game_system.se_play($data_system.cursor_se)
  72.         @index -=4 #(@index-1+@item_max) % @item_max if @item_max != 0
  73.         update_help
  74.       end
  75.  
  76.     end

12人.png (600.71 KB, 下载次数: 2)

12人.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 00:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表