public static void OnMessage_LGPKG_LOGIN_ACK(CliProto.LGPKG_LOGIN_ACK refMSG) { client.DisConnect(); if (refMSG.m_AckType == CliProto.LG_FAIL) { sdUICharacter.Instance.ShowLoginMsg(SGDP.ErrorString((uint)refMSG.m_Reply.m_Fail.m_ErrCode)); if (sdGameLevel.instance.levelType == sdGameLevel.LevelType.Login) { SDNetGlobal.connectState = -1; } return; } SDGlobal.Log("received"); Gate_IP = refMSG.m_Reply.m_Succ.m_GateInfo.m_ListenIP; Gate_Port = refMSG.m_Reply.m_Succ.m_GateInfo.m_ListenPort; byte[] session = refMSG.m_Reply.m_Succ.m_SessionID; username = new byte[refMSG.m_Reply.m_Succ.m_Username.Length]; for (int i = 0; i < refMSG.m_Reply.m_Succ.m_Username.Length; i++) { username[i] = refMSG.m_Reply.m_Succ.m_Username[i]; } for (int i = 0; i < 8; i++) { gateSession[i] = session[i]; } doGateLogin(false); Thread threadHeart = new Thread(new ThreadStart(HeartBeatMain)); threadHeart.Start(); }
private void OnMessage_LGID_LOGIN_ACK(int iMsgID, ref CMessage msg) { SDGlobal.Log("login ack"); CliProto.LGPKG_LOGIN_ACK refMSG = (CliProto.LGPKG_LOGIN_ACK)msg; SDNetGlobal.OnMessage_LGPKG_LOGIN_ACK(refMSG); string tmp = System.Text.Encoding.UTF8.GetString(refMSG.m_Reply.m_Succ.m_BundleInfo.m_Path); BundleGlobal.Instance.infoPath = ""; int count = 0; while (count < tmp.Length && tmp[count] != '\0') { BundleGlobal.Instance.infoPath += tmp[count]; count++; } //Debug.Log("infoPath: " + BundleGlobal.Instance.infoPath); uint cdnCount = refMSG.m_Reply.m_Succ.m_BundleInfo.m_CDNCount; BundleGlobal.Instance.cdn = new string[cdnCount]; for (int i = 0; i < cdnCount; i++) { tmp = System.Text.Encoding.UTF8.GetString(refMSG.m_Reply.m_Succ.m_BundleInfo.m_CDN[i].m_Path); //endIndex = BundleGlobal.Instance.cdn[i].IndexOf('\0'); //BundleGlobal.Instance.cdn[i].Remove(endIndex); BundleGlobal.Instance.cdn[i] = ""; count = 0; while (count < tmp.Length && tmp[count] != '\0') { BundleGlobal.Instance.cdn[i] += tmp[count]; count++; } } m_bLoginAckReceived = true; }