//各种游戏人数情况下的本地位置配置
mb.LOCAL_POS_LIST = {
2 : [0, 2],
3 : [0, 1, 3],
4 : [0, 1, 2, 3]
};
/*--------------------------------------本地玩家位置跟服务器玩家位置转换相关----------------------------------------------*/
mb.local2serverPos = {};
mb.server2localPos = {};
mb.transferServerPos = function(posServerSelf, posLocalList)
{
mb.local2serverPos = {};
mb.server2localPos = {};
posLocalList = posLocalList || mb.LOCAL_POS_LIST[4];
var playerCount = posLocalList.length;
for(var i = 0; i < playerCount; ++i)
{
var posLocal = posLocalList[i];
var posServer = (i + posServerSelf) % playerCount;
mb.local2serverPos[posLocal] = posServer;
mb.server2localPos[posServer] = posLocal;
}
// jx.utils.dumpObject(mb.local2serverPos);
};
mb.getServerPos = function(posLocal)
{
return mb.local2serverPos[posLocal];
};
mb.getLocalPos = function(posServer)
{
return mb.server2localPos[posServer];
};
mb.isSelf = function(posServer)
{
return 0 == mb.getLocalPos(posServer);
};
/*--------------------------------------本地玩家位置跟服务器玩家位置转换相关 end----------------------------------------------*/