private void OnClickm_LoginB(ButtonScript obj, object args, int param1, int param2) { if (string.IsNullOrEmpty(userName_)) { if (GlobalValue.IsDebugMode) { inputGroup_.SetActive(true); } else { game.GameUser.getInstance().login(); } } else { if (string.IsNullOrEmpty(GameManager.ServName_) && !GlobalValue.IsDebugMode) { MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("SelectServ"), null, true); return; } SelectServPanel ssp = selectServPanel_.GetComponent <SelectServPanel>(); string host = "127.0.0.1"; //ssp.Host(GameManager.ServName_);//"121.69.36.174";"testmhflc.tanyu.mobi";//"120.26.58.230"; int port = 28000; // ssp.Port(GameManager.ServName_);//20101;20401 ApplicationEntry.Instance.ConnectToWorld(host, port); string localSaveServInfo = GameManager.ServName_ + ":" + GameManager.ServId_; PlayerPrefs.SetString(servSaveStr, localSaveServInfo); if (!string.IsNullOrEmpty(host)) { loginGroup_.SetActive(false); } ErrorTipsUI.ShowMe("连接中...请稍候..."); TransferRate._Inst.Send("Connect World Begin"); } }
public void OnSpeedUpBtn(ButtonScript obj, object args, int param1, int param2) { if (GamePlayer.Instance.isInBattle == false) { // tips return; } if (TeamSystem.IsInTeam()) { ErrorTipsUI.ShowMe("组队中不可加速"); return; } if (speedUpBtn_.normalSprite.Equals(speedUpImg)) { speedUpBtn_.normalSprite = normalImg; if (OnSpeedUp != null) { OnSpeedUp(false); } } else { speedUpBtn_.normalSprite = speedUpImg; if (OnSpeedUp != null) { OnSpeedUp(true); } } }
void CheckReconnection(string sceneName) { if (ScenePreloader.Instance.isPreLoading) { Debug.Log("CheckReconnection : ScenePreloader.Instance.isPreLoading"); return; } StageMgr.OnSceneLoaded -= CheckReconnection; GlobalInstanceFunction.Instance.Invoke(() => { //if(AppPauseBeforeScene.Equals(StageMgr.Scene_name)) // return; if (!Application.loadedLevelName.Equals("LoginScene") && !Application.loadedLevelName.Equals("ReturnScene")) { if (NetConnection.Instance.IsShutDown) { Debug.Log("SocketHandler"); SocketHandler(555666); } else { if (AppPauseBeforeScene.Equals(StageMgr.Scene_name) && GlobalValue.isFBScene(StageMgr.Scene_name)) { return; } bool needSync = NetConnection.Instance.discard() || (isLoadingScene && GlobalValue.isBattleScene(StageMgr.Scene_name)); if (needSync) { //NetConnection.Instance.discard(); Debug.Log("requestPhoto"); ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("dataSyncing")); GameManager.Instance.ClearCurrentState(); NetConnection.Instance.requestPhoto(); } } } }, 1); }
void FirstConnectCallBack(System.IAsyncResult ar) { if (ar != null) { if (!isChcekFile) { ConfigLoader.Instance.parseDataFin_ += ApplicationEntry.Instance.ParseDataFinish; ConfigLoader.Instance.LoadAndParseData(); LoadNessaryAssets(); } else { ConfigLoader.Instance.finishDownFileEvent(1); } //CancelInvoke("CheckNetWorkState"); InvokeRepeating("CheckNetWorkState", 0f, 5f); } else { ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("NetworkNoReach")); } }
void ReconnectCallBack(System.IAsyncResult ar) { if (ar != null) { //不是登录界面或重登录界面则返回重登录界面 if (!string.IsNullOrEmpty(StageMgr.Scene_name) && !StageMgr.Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) { ReturnToLogin(); } else { ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("connectionSuccess")); } } else { if (!string.IsNullOrEmpty(StageMgr.Scene_name) && !StageMgr.Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) { ReturnToLogin(); } ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("connectionFailed")); } netStatusWarning_ = false; }
void SocketHandler(int errCode) { ClientLog.Instance.Log(errCode + " " + netStatusWarning_); if (netStatusWarning_ && UIManager.Instance.isOpen(UIASSETS_ID.UIASSETS_MessageBoxPanel)) { return; } else { netStatusWarning_ = false; } NetConnection.Instance.discard(); netStatusWarning_ = true; switch (errCode) { case 90090: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("pullServInfoFailed"), () => { netStatusWarning_ = false; }, true, null, null, "", "", 4001); break; case 999001: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("NetworkNoReach"), () => { NetConnection.Instance.connect(host_, port_, ReconnectCallBack); netStatusWarning_ = false; }, true, null, null, "", "", 4001); break; case 2333: ReconnectCallBack(null); //NetConnection.Instance.connect(host_, port_, ReconnectCallBack); UILoginPanel.userName_ = ""; GameManager.Instance.loginInfo_ = null; netStatusWarning_ = false; break; case 99001: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("connectionTimeout"), () => { NetConnection.Instance.connect(host_, port_, FirstConnectCallBack); netStatusWarning_ = false; }, true, null, null, "", "", 4001); break; case 555666: if (NetConnection.Instance.IsShutDown) { ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("NetworkLag")); NetConnection.Instance.connect(host_, port_, ReconnectCallBack); } //MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("NetworkLag"), () => //{ // NetConnection.Instance.connect(host_, port_, ReconnectCallBack); // netStatusWarning_ = false; //}, true, null, null, "", "", 4001); break; case 10058: if (!string.IsNullOrEmpty(GameManager.ServName_)) { MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("NetworkShutdown"), () => { if (!string.IsNullOrEmpty(host_)) { NetConnection.Instance.connect(host_, port_, ReconnectCallBack); } netStatusWarning_ = false; }, true, null, null, LanguageManager.instance.GetValue("reconnect"), "", 4001); } break; case 10061: if (!string.IsNullOrEmpty(GameManager.ServName_)) { MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("serverShutdown"), () => { //Application.Quit(); netStatusWarning_ = false; }, true, null, null, "", "", 4001); } break; case 57557: //MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("BattleInitErr"), () => //{ // ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("dataSyncing")); // GameManager.Instance.ClearCurrentState(); // NetConnection.Instance.requestPhoto(); // //if (NetConnection.Instance.connect(host_, port_)) // //{ // // //不是登录界面或重登录界面则返回重登录界面 // // if (!string.IsNullOrEmpty(StageMgr.Scene_name) && !StageMgr.Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) // // ReturnToLogin(); // // else // // ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("connectionSuccess")); // //} // netStatusWarning_ = false; //}, true, null, null, "", "", 4001); //break; case 57558: ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("dataSyncing")); GameManager.Instance.ClearCurrentState(); NetConnection.Instance.requestPhoto(); //MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("BattleSceneInitErr"), () => //{ // ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("dataSyncing")); // GameManager.Instance.ClearCurrentState(); // NetConnection.Instance.requestPhoto(); // netStatusWarning_ = false; //}, true, null, null, "", "", 4001); break; case 88888: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("RPCErr"), () => { Application.Quit(); netStatusWarning_ = false; }, true, null, null, "", "", 4001); break; case 11001: case 10051: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("NetworkNoReach") /* + errCode.ToString()*/, () => { NetConnection.Instance.connect(host_, port_, ReconnectCallBack); }, true, null, null, "", "", 4001); break; case 1234: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("sdkInitError"), () => { GameObject.FindObjectOfType <gameHandler>().Reinit(); }, true, null, null, LanguageManager.instance.GetValue("reconnect"), "", 4001); break; case 2345: MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("loginFailed"), () => { game.GameUser.getInstance().login(); }, true, null, null, LanguageManager.instance.GetValue("reconnect"), "", 4001); break; default: //MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("connectionErr")/* + errCode.ToString()*/, () => //{ if (!string.IsNullOrEmpty(host_)) { NetConnection.Instance.connect(host_, port_, ReconnectCallBack); } //}, true, null, null, "", "", 4001); break; } }