//CDKey验证请求 public bool VerifyCDKeyReq() { Debug.Log("-------------VerifyCDKeyReq"); uint ID = LoginIDManager.GetPlatServerID(); VerifyCDKey verifyCDKey = new VerifyCDKey(); #if IOS_SDK || ANDROID_SDK if (string.IsNullOrEmpty(cdKey)) { // 如果cdKey 为null时候,不处理 return(false); } verifyCDKey.authorization_code = cdKey; #else verifyCDKey.authorization_code = authorizationCode; #endif verifyCDKey.server_id = ID; verifyCDKey.game_ver = GlobalConst.GAME_VERSION; verifyCDKey.res_ver = GlobalConst.RES_VERSION; verifyCDKey.mac_add = SystemInfo.deviceUniqueIdentifier; GameSystem.Instance.mNetworkManager.m_loginConn.SendPack <VerifyCDKey>(0, verifyCDKey, MsgID.VerifyCDKeyID); return(true); }
static int GetPlatServerID(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 0); uint o = LoginIDManager.GetPlatServerID(); LuaScriptMgr.Push(L, o); return(1); }
public void SetLastLoginInfo(List <ServerListInfo> serverLis) { uint lastServerId = LoginIDManager.GetPlatServerID(); string lastServer = LoginIDManager.GetPlatServerName(); uint lastServerLevel = LoginIDManager.GetLastLevel(); //uint lastServerLoad = LoginIDManager.GetServerState(); Debug.Log("lastServerId = " + lastServerId); Debug.Log("lastServer = " + lastServer); Debug.Log("lastServerLevel = " + lastServerLevel); if (lastServerId > 0) { ServerListInfo lastInfo = serverLis.Find((ServerListInfo info) => { return(info.server_id == lastServerId); }); if (lastInfo != null) { lastServerArea.text = string.Format(CommonFunction.GetConstString("LOGIN_SEVER_AREA"), lastInfo.display_server_id); } } else { NGUITools.SetActive(lastServerArea.gameObject, false); NGUITools.SetActive(lastServerName.gameObject, false); NGUITools.SetActive(lastLevel.gameObject, false); NGUITools.SetActive(lastLoad.gameObject, false); } if (lastServer != null && lastServer != "") { lastServerName.text = lastServer; } if (lastServerLevel > 0) { lastLevel.text = CommonFunction.GetConstString("UI_HALL_LEVEL_1") + lastServerLevel.ToString(); } //if (currentLoadState == (uint)ServerState.SS_BUSY) //{ // lastLoad.spriteName = "login_login_Orange"; //} //else if (currentLoadState == (uint)ServerState.SS_CLOSE) //{ // lastLoad.spriteName = "login_login_Gray"; //} //else if (currentLoadState == (uint)ServerState.SS_FULL) //{ // lastLoad.spriteName = "login_login_Red"; //} //else if (currentLoadState == (uint)ServerState.SS_IDLE) //{ // lastLoad.spriteName = "login_login_Green"; //} //else // NGUITools.SetActive(lastLoad.gameObject, false); }
public void OnEvent(NetworkConn.NetworkEvent nEvent, NetworkConn sender) { Debug.Log("Network Event -- sender.m_type: " + sender.m_type + " nEvent: " + nEvent); switch (sender.m_type) { case NetworkConn.Type.eLoginServer: { if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connLogin) { connLogin = false; } UIWait.StopWait(); } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connLogin == false) { connLogin = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.eLoginServer); } #if IOS_SDK || ANDROID_SDK Debug.Log("IsReconnecting: " + isReconnecting); Debug.Log("MainPlayer.Instance.SDkLogin +" + MainPlayer.Instance.SDKLogin); Debug.Log("LoginNetwork.Instance.isVerifySDK =" + LoginNetwork.Instance.isVerifySDK); if (isReconnecting) { LoginNetwork.Instance.VerifyCDKeyReq(); } else if (MainPlayer.Instance.SDKLogin && !LoginNetwork.Instance.isVerifySDK) { Debug.Log("VerifySDK in NetworkManger"); LoginNetwork.Instance.isVerifySDK = true; LoginNetwork.Instance.VerifySDKReq(); } #else if (GameSystem.Instance.mClient.mUIManager.LoginCtrl.isGetServerList || LoginIDManager.GetPlatServerID() == 0) { LoginNetwork.Instance.ServerInfoReq(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.isGetServerList = false; } else if (GameSystem.Instance.mClient.mUIManager.LoginCtrl.isSetLastServer) { LoginNetwork.Instance.ServerInfoReq(); GameSystem.Instance.mClient.mUIManager.LoginCtrl.isSetLastServer = false; } else { LoginNetwork.Instance.VerifyCDKeyReq(); } #endif } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connLogin = false; OnConnectFailed(sender); if (GameSystem.Instance.mClient.mUIManager.LoginCtrl != null) { GameSystem.Instance.mClient.mUIManager.LoginCtrl.OnLoginFailed(); } } } break; case NetworkConn.Type.ePlatformServer: { UIWait.StopWait(); Debug.Log("connPlat:" + connPlat); if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connPlat) { connPlat = false; OnDisconnected(sender); if (PlatNetwork.Instance.onDisconnected != null) { PlatNetwork.Instance.onDisconnected(); } } } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connPlat == false) { connPlat = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.ePlatformServer); } PlatNetwork.Instance.EnterPlatReq(); } else { Debug.Log("Warning: Platform server already connected."); } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connPlat = false; OnConnectFailed(sender); } } break; case NetworkConn.Type.eVirtualServer: case NetworkConn.Type.eGameServer: { UIWait.StopWait(); Debug.Log("connGS:" + connGS); if (nEvent == NetworkConn.NetworkEvent.disconnected) { if (connGS) { connGS = false; } } else if (nEvent == NetworkConn.NetworkEvent.connected) { if (connGS == false) { connGS = true; if (onServerConnected != null) { onServerConnected(NetworkConn.Type.eGameServer); } } else { Debug.Log("Warning: GameServer server already connected."); } } else if (nEvent == NetworkConn.NetworkEvent.connectFail) { connGS = false; } } break; } }