/// <summary> /// BS通知有客户端登陆 /// </summary> private ErrorCode MsgOneUserLoginTokenHandler(byte[] data, int offset, int size, int msgID) { BSToGS.OneUserLoginToken reportAllClientInf = new BSToGS.OneUserLoginToken(); reportAllClientInf.MergeFrom(data, offset, size); GS.instance.gsStorage.AddUserToken(reportAllClientInf.UserName, reportAllClientInf.Token); //回应BS客户端家已经登陆GS this.owner.SendMsgToSession(this.id, reportAllClientInf, ( int )GSToBS.MsgID.EMsgToBsfromGsOneUserLoginTokenRet); return(ErrorCode.Success); }
/// <summary> /// GS回应客户端已登陆 /// </summary> private ErrorCode MsgHandleOneUserLoginTokenRet(byte[] data, int offset, int size, int msgID) { if (!BS.instance.bsConfig.allGsInfo.TryGetValue(this.logicID, out OneGsInfo _)) { Logger.Error("can not find GS for loginer."); return(ErrorCode.GSNotFound); } BSToGS.OneUserLoginToken msg = new BSToGS.OneUserLoginToken(); msg.MergeFrom(data, offset, size); BSToGC.AskGateAddressRet msgSend = new BSToGC.AskGateAddressRet { UserName = msg.UserName, Token = msg.Token, //这是网关的地址 Ip = msg.Ip, Port = msg.Port }; //通知客户端GS的地址 this.owner.SendMsgToSession(( uint )msg.Gateclient, msgSend, ( int )BSToGC.MsgID.EMsgToGcfromBsAskGateAddressRet); return(ErrorCode.Success); }