/* 消息发送 */ public void AskLoginToLoginServer() { GCToLS.AskLogin msg = new GCToLS.AskLogin(); msg.platform = (uint)GameServerData.Instance.ServerPlatform; msg.uin = GameServerData.Instance.ServerUin; msg.sessionid = GameServerData.Instance.ServerSessionId; NetworkManager.Instance.SendMsg(msg, (int)msg.msgid); }
private ErrorCode MsgInitHandler(byte[] data, int offset, int size, int msgID) { //收到第1消息:请求登录,放入登录队列 GCToLS.AskLogin login = new GCToLS.AskLogin(); login.MergeFrom(data, offset, size); LS.instance.sdkAsynHandler.CheckLogin(login, ( int )GCToLS.MsgID.EMsgToLsfromGcAskLogin, this.id); this.SetInited(true, true); return(ErrorCode.Success); }
public ErrorCode CheckLogin(GCToLS.AskLogin askLogin, int msgID, uint gcnetID) { UserPlatform platform = ( UserPlatform )askLogin.Platform; UserLoginData loginData = new UserLoginData { platFrom = askLogin.Platform, sessionid = askLogin.Sessionid, uin = askLogin.Uin }; lock (this._userLoginDataMapMutex) { if (this._userLoginDataMap.ContainsKey(gcnetID)) { Logger.Warn($"client({askLogin.Uin}) login multiple times, but the server data has not been returned to the client"); return(ErrorCode.Success); } this._userLoginDataMap[gcnetID] = loginData; } Logger.Log($"GC Try To Login with uin:{askLogin.Uin}({gcnetID}), sessionid:{askLogin.Sessionid}, platform:{platform}"); string sendData = string.Empty; switch (platform) { case UserPlatform.PC: sendData = "PCTest"; break; default: this.PostToLoginFailQueue(ErrorCode.UnknowPlatform, gcnetID); break; } Logger.Log($"{sendData}"); this.PostMsg(sendData, msgID, gcnetID, platform); return(0); }