using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
using Sog.Gate;
namespace Account
{
public static class AccountServerRoute
{
///
/// 判断是否需要路由到别的account进程,多进程部署的时候需要这个功能
/// 帐号是和account进程绑定的,所以运营过程中不支持动态添加account进程,有点不灵活,但是简单,
/// 实际游戏运营的时候不需要动态分配,这个一旦决定了很少会变
///
///
///
///
public static bool CheckAndRouteLoginReq(PlayerSession playerSession, StructPacket packet)
{
return false;
////没有开启多account功能
//int accountServerCount = AccountServerUtils.GetServerConfig().accountServerCount;
//if (accountServerCount <= 1)
//{
// return false;
//}
//ref CSAccountAuthReq accountAuthReq = ref packet.GetMessage();
//string accountID = accountAuthReq.Account.AccountID.GetString();
//int accountIndex = AccountUtils.CalcAccountIndexByTotalCount(accountAuthReq.Account.AccountType
// , accountID
// , accountServerCount);
////帐号服务器instance 是accountIndex+1
//uint shouldAccountServerID = ServerIDUtils.GetLevel0ServerIDByType((int)ServerType.Account, accountIndex + 1);
//if (shouldAccountServerID == AccountServerUtils.GetAppID())
//{
// return false;
//}
//MessageData messageData = new MessageData();
//messageData.Header.Type = packet.MsgID;
//messageData.Header.Length = 0;
//messageData.Header.ObjectID = packet.ObjectID;
//messageData.Header.ServerID = 0;
//bool bRet = ProtoPackerFactory.Instance.GetProtoCSStructPacker().PackMessage(ref accountAuthReq, ref messageData);
//if (bRet == false)
//{
// //
// TraceLog.Error("AccountServerRoute.CheckAndRouteLoginReq PackMessage iID {0}", packet.ObjectID);
// return true;
//}
//TraceLog.Debug("AccountServerRoute.CheckAndRouteLoginReq session {0} accountType {1} accountID {2} route to AccountServer {3}"
// , playerSession.SessionID
// , accountAuthReq.Account.AccountType
// , accountID
// , ServerIDUtils.IDToString(shouldAccountServerID));
//GateService.RouteBackEndServer(AccountServerUtils.GetApp().GetCluster()
// , playerSession.GateServerID
// , playerSession.SessionID
// , messageData
// , shouldAccountServerID);
////路由到别的服务器去,这个session没有用了,删除
//AccountServerUtils.GetPlayerTableOp().RemoveSession(playerSession.SessionID);
//return true;
}
}
}