void HanldeGateSeverRes(byte[] pMsg, int len) { int iOffset = 0; NetMsg.ClientServerResDef msg = new NetMsg.ClientServerResDef(); iOffset = msg.parseBytes(pMsg, iOffset); //连接游戏服务器 switch (MahjongLobby_AH.SDKManager.Instance.IsConnectNetWork) { case 1: NetworkMgr.Instance.GameServer.Init(msg.szIP, msg.iPort); break; case 2: NetworkMgr.Instance.GameServer.Init(NetComm.NetSocket.Hostname2ip(msg.domain), msg.iPort); break; default: break; } Disconnect(); Debug.LogWarning("===========================0"); NetworkMgr.Instance.GameServer.Connect(); }
/// <summary> /// 网关回应消息处理 /// </summary> /// <param name="pMsg"></param> /// <param name="len"></param> void HanldeGateSeverRes(byte[] pMsg, int len) { int iOffset = 0; NetMsg.ClientServerResDef msg = new NetMsg.ClientServerResDef(); iOffset = msg.parseBytes(pMsg, iOffset); msg.NormalizeMarshaledString(); if (msg.iError != 0) { Debug.LogError("请求大厅服务器失败,错误ID:" + msg.iError); return; } //连接游戏服务器 switch (SDKManager.Instance.IsConnectNetWork) { case 1: NetworkMgr.Instance.LobbyServer.Init(msg.szIP, msg.usPort); break; case 2: NetworkMgr.Instance.LobbyServer.Init(NetComm.NetSocket.Hostname2ip(msg.domain), msg.usPort); break; case 3: NetworkMgr.Instance.LobbyServer.Init(LobbyContants.LOBBY_GATEWAY_IP, msg.usPort); break; default: break; } Disconnect(); //Debug.LogError("请求大厅服务器回应消息处理========================,ip:" + msg.szIP+ ",usPort:" + msg.usPort); NetworkMgr.Instance.LobbyServer.Connect(); }