棋牌游戏都会用到服务器座位号转客户端座位号,因为每个客户端自己的座位号永远是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
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