棋牌游戏服务端座位号转本地座位号


棋牌游戏都会用到服务器座位号转客户端座位号,因为每个客户端自己的座位号永远是1

 -- 根据服务器坐标获取本地坐标
    function ScqpGoldDouNiuRoomLayer:getLocalIndexForServerIndex( serverIndex )
        if serverIndex == nil then
            return -1;
        end
        local selfSeatIndex = self.selfSeatIndex;
        if selfSeatIndex == nil then
            return -1;
        end
        -- (最大座位数 - 自己的真实座位号 + 需要转换的真实座位号) % 最大座位数 + 1
        return (((MAX_PLAYER - (selfSeatIndex+1) + (serverIndex+1) ) % MAX_PLAYER + 1));
    end

相关文章:

  • 2021-04-10
  • 2021-06-09
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2021-05-13
猜你喜欢
  • 2022-12-23
  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案