/// <summary> /// 登陆时服务器的操作 /// </summary> /// <param name="role"></param> /// <param name="buffer"></param> private void OnLoginGameServer(byte[] buffer) { Account_LoginGameServerReqProto proto = Account_LoginGameServerReqProto.GetProto(buffer); //玩家帐号 int accountId = proto.AccountId; int gameServerId = proto.GameServerId; //role.AccountId = accountId; LoginGameServerResp(accountId, gameServerId); }
public static Account_LoginGameServerReqProto GetProto(byte[] buffer) { Account_LoginGameServerReqProto proto = new Account_LoginGameServerReqProto(); using (MemoryStreamUtil ms = new MemoryStreamUtil(buffer)) { proto.AccountId = ms.ReadInt(); proto.GameServerId = ms.ReadInt(); } return(proto); }
/// <summary> /// 向服务器请求当前AccountId下的所有RoleId /// </summary> private void LoginGameServer() { Account_LoginGameServerReqProto proto = new Account_LoginGameServerReqProto(); #if UNITY_EDITOR proto.AccountId = 2; //开发阶段测试数据 proto.GameServerId = GlobalCache.Instance.Account_LastLoginServerId; //20.07.10Ich新增区服判断 #else proto.AccountId = GlobalCache.Instance.Account_CurrentId; //参数是当前登陆的AccountId proto.GameServerId = GlobalCache.Instance.Account_LastLoginServerId; //20.07.10Ich新增区服判断 #endif SocketManager.Instance.SendMessageToLocalServer(proto.ToArray()); //向服务器发送一个登陆信息的协议 }