查看: 1823|回复: 0

[已经过期] 光标左右方向正常,上下不能用

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

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

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

×
本帖最后由 金芒芒 于 2023-4-12 17:12 编辑

[pre lang="ruby"]  def update_cursor_rect
    #@back.bitmap = RPG::Cache.menu("item_command"+type.to_s)
    # 光标位置不满 0 的情况下
    if @index < 0
      self.cursor_rect.empty
      return
    end
   
    # 获取当前的行
    column = @index
    # 当前行被显示开头行前面的情况下
    if column < self.top_column
      # 从当前行向开头行滚动
      self.top_column = column
    end
    # 当前行被显示末尾行之后的情况下
    if column > self.top_column + (self.page_column_max - 1)
      # 从当前行向末尾滚动
      self.top_column = column - (self.page_column_max - 1)
    end
  #   row = @index
    # 当前行被显示开头行前面的情况下
#    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.x = self.x+72+self.top_column.to_f*66.0*(4*66)/(@item_max.to_f*66)
   
    # 计算光标的宽度
    cursor_width = 1200
    # 计算光标坐标
#   x = 4 + index % 2 * (288 + 32)
  #  y = index / 2 * 32
  #x =32+ @index*66 - self.ox-1# 8 #
     x =10 +@index% 4 * (84 + 1)
     y =5+ @index/ 4 * 120
     z = 1999
    #y = 14 #@index*20 - self.oy-1
    # 更新光标矩形
    self.cursor_rect.set(x, y, 84 ,120)
  end[/pre]
[pre lang="ruby"]#--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
   # (Input::UP)  (Input::DOWN)  (Input::RIGHT) (Input::LEFT)
    # 可以移动光标的情况下
    if self.active and @item_max >= 0 and @index >= 0
      # 方向键下被按下的情况下
      if Input.repeat?(Input::RIGHT)
        # 光标向左移动
        $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::LEFT)
        # 光标向右移动
        $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 @index >= 0
      # 方向键下被按下的情况下
      if Input.repeat?(Input::UP)
        # 光标向左移动
        $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::DOWN)
        # 光标向右移动
        $game_system.se_play($data_system.cursor_se)
        @index = (@index-1+@item_max) / @item_max if @item_max != 0
        update_help
      end
#-------------------------------------------------------------------------      
    end
   
    # 刷新帮助文本 (update_help 定义了继承目标)
    if @help_window != nil and @ajsdgfshfajklshfa == nil
      update_help
      update_help
      @ajsdgfshfajklshfa = true
    end

    # 刷新光标矩形
    update_cursor_rect
  end
  

  
  def now_selected_troop
    return @all_fighters[@index]
  end[/pre]
1下一页.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部