void OnApplicationPause(bool isPause) { if (isPause) { _isPause = true; /*if (UIManager.IsWinShow(UIName.BATTLE_MAIN_WIN)) * { * ClientNetwork.Instance.HeartBeastSwitch(false); * ClientNetwork.Instance.CloseSocket(); * } * else if (!UIManager.IsWinShow(UIName.LOGIN_INPUT)) * { * //非登录界面时,暂停心跳包 * ClientNetwork.Instance.HeartBeastSwitch(false); * }*/ UIManager.CallLuaFuncCall("OnApplicationFocus", gameObject); Utils.LogSys.LogWarning("游戏已经游戏暂停"); _pauseTime = UtilTools.GetClientTime(); UIManager.DestroyWin(UIName.SHOP_RECHARGE_OTHER_WIN); if (ClientNetwork.Instance.IsConnected()) { ClientNetwork.Instance.HeartBeastSwitch(false); } Utils.LogSys.Log("游戏暂停 一切停止"); // 缩到桌面的时候触发 } else { Utils.LogSys.Log("游戏开始 万物生机"); //回到游戏的时候触发 最晚 } }
protected override void ReplaceAwake() { _ctrl = UIManager.GetControler <RegisterBindingController>(); _btnClose = FindGameObject("Container/bg/btnClose"); _phoneInput = FindComponent <UIInput>("Container/phone/Sprite"); _passwordInput = FindComponent <UIInput>("Container/password/Sprite"); _verifyInput = FindComponent <UIInput>("Container/verify/Sprite"); _btnGetverifyCode = FindGameObject("Container/verify/btnVerify"); _btnGetverifyCodeGray = FindGameObject("Container/verify/btnVerifyGray"); _btnGetverifyCodeLb = FindComponent <UILabel>("Container/verify/btnVerifyGray/Label"); _btnSure = FindGameObject("Container/btnSure"); //_verifyBtnSpr = _btnGetverifyCode.GetComponent<UISprite>(); // _phoneInput.activeTextColor = new Color(dc661f); _phoneInput.defaultText = GameText.GetStr("login_name_default"); _passwordInput.defaultText = GameText.GetStr("reset_passWord_default"); _verifyInput.defaultText = GameText.GetStr("verify_default"); if (_ctrl.cooldownEndTime - UtilTools.GetClientTime() > 0) { _bUpdateCooldwon = true; SetVerifyShow(true); } else { SetVerifyShow(false); } }
void InitData_Step6() { //SDK初始化 SDKManager.getInstance().init(); noticeUrl = sdk.SDKManager.NoticeUrl + "?p=" + UtilTools.GetClientTime(); StartCoroutine(GetNoticeXml()); // ServerSimulation.getInstance().Init(); }
public void OnMsgHeartBeat(object proto) { NowTime = (int)((sc_common_heartbeat_reply)proto).now_time; heartBeatReplyWaiting = false; int clientTime = UtilTools.GetClientTime();//时间戳表达 OffsetTime = clientTime - NowTime; Utils.LogSys.Log(NowTime + "=========OnMsgHeartBeat:===========" + OffsetTime); }
IEnumerator GetServerList() { //判断网址是否为空(Trim:移除所有前导空白字符和尾部空白字符) string serverlistUrl = sdk.SDKManager.ServerListUrl + "?p=" + UtilTools.GetClientTime(); if (serverlistUrl == null || "".Equals(serverlistUrl.Trim())) { Utils.LogSys.Log("can not find server"); yield break; } //下载ServerList.xml WWW www = new WWW(serverlistUrl); yield return(www); if (www.error != null) { //下载ServerList.xml www = new WWW(serverlistUrl); yield return(www); } if (www.error != null) { //下载ServerList.xml www = new WWW(serverlistUrl); yield return(www); } if (www.error != null) { Utils.LogSys.LogError(www.error); if (!isReGet) { isReGet = true; StartCoroutine(GetServerList()); } UtilTools.MessageDialog(GameText.GetStr("loadingServerFail"), okCallbackFunc: ReLoadingServerList); } else { ParseXml(www.text); } www.Dispose(); _initOKStep = 5; Utils.LogSys.Log("ApplicationMgr DataInit Step5 OK----->" + (Time.realtimeSinceStartup - _lastLogTime).ToString()); _lastLogTime = Time.realtimeSinceStartup; InitData_Step6(); }
IEnumerator GetUrlXml() { string xml_path = new StringBuilder(url_paths).AppendFormat("?p={0}", UtilTools.GetClientTime()).ToString(); //下载ServerList.xml WWW www = new WWW(xml_path); yield return(www); if (www.error != null) { www.Dispose(); yield return(new WaitForSeconds(1f)); //下载ServerList.xml www = new WWW(xml_path); yield return(www); } if (www.error != null) { www.Dispose(); yield return(new WaitForSeconds(1f)); //下载ServerList.xml www = new WWW(xml_path); yield return(www); } if (www == null) { ExecuteLoadCallback(false, 1);//失败(下载www创建失败) } else if (www.error != null) { ExecuteLoadCallback(false, 2);//失败(下载的XML失败) Utils.LogSys.LogError("Load SDKManager.xml Error:" + www.error); } else if (www.text.Length == 0) { ExecuteLoadCallback(false, 3);//失败(下载的XML是空的) } else { //解释版本列表xml。 ParseUrlXML(www.text); } www.Dispose(); }
public override void onSuccessAbstract(string statusCode, string filePath, string msg) { //UtilTools.MessageDialog("上传头像成功。。。statusCode="+statusCode+" filePath = "+filePath+" msg = "+msg);+ Debug.Log("onsuccess:PicCount=" + GameDataMgr.PLAYER_DATA.PicCount); var count = int.Parse(GameDataMgr.PLAYER_DATA.PicCount) + 1; if (count > 1) { count = 0; } string iconUrl = BaseConfig.HeadSaveImgUrl + GameDataMgr.PLAYER_DATA.Account + count + ".png"; Debug.Log("onsuccess:iconUrl=" + iconUrl); GameDataMgr.PLAYER_DATA.Icon = iconUrl + "?time=" + UtilTools.GetClientTime(); //选择玩家头像下载下来 Debug.Log("onsuccess:icon=" + GameDataMgr.PLAYER_DATA.Icon); Invoke("DelayLoadIcon", 1.3f); }
void Update() { if (_bUpdateCooldwon) { int cur_time = UtilTools.GetClientTime(); if (_ctrl.cooldownEndTime == 0) //未赋值 { SetVerifyShow(false); } else if (_ctrl.cooldownEndTime - cur_time <= 0) //倒计时结束 { SetVerifyShow(false); _ctrl.cooldownEndTime = 0; _bUpdateCooldwon = false; } else //倒计时 { SetVerifyShow(true); _btnGetverifyCodeLb.text = GameText.Format("verify_wait", _ctrl.cooldownEndTime - cur_time); } } }
private int _lostTime = 300;//5分钟后掉线 void OnApplicationFocus(bool isFocus) { Utils.LogSys.Log("--------OnApplicationPause---" + isFocus + " _isPause = " + _isPause); if (isFocus) { if (_isPause) { _isPause = false; int nowTime = UtilTools.GetClientTime(); if (_pauseTime > 0 && nowTime - _pauseTime > _lostTime) { Utils.LogSys.Log("--------OnApplicationPause--- _isLeaveTooLong"); _isLeaveTooLong = true; //UIManager.CallLuaFuncCall("OnApplicationFocus", gameObject); OnOKButton(); //UtilTools.ErrorMessageDialog(GameText.GetStr("leave_long_time"), "614d46", "Center", OnOKButton); //UIManager.CallLuaFuncCall("OnApplicationFocusReconnect", gameObject); } else if (ClientNetwork.Instance.IsConnected()) { Utils.LogSys.Log("--------OnApplicationPause--- 1111"); ClientNetwork.Instance.HeartBeastSwitch(true); UIManager.CallLuaFuncCall("OnApplicationFocus", gameObject); } else if (!UIManager.IsWinShow(UIName.LOGIN_INPUT_WIN)) { Utils.LogSys.Log("--------OnApplicationPause--- 2222"); _isLeaveTooLong = true; OnOKButton(); } } } else { // ClientNetwork.Instance.HeartBeastSwitch(false); // _pauseTime = UtilTools.GetClientTime(); Utils.LogSys.Log("离开游戏 激活推送"); // 返回游戏的时候触发 执行顺序 1 } }
void Update() { if (_bUpdateCooldwon && _resetPassWordContainer.activeSelf) { int cur_time = UtilTools.GetClientTime(); if (_registerBindingCtrl.cooldownEndTime == 0) //未赋值 { SetVerifyShow(false); } else if (_registerBindingCtrl.cooldownEndTime - cur_time <= 0) //倒计时结束 { SetVerifyShow(false); _registerBindingCtrl.cooldownEndTime = 0; _bUpdateCooldwon = false; } else //倒计时 { SetVerifyShow(true); _getVerificationGrayLb.text = GameText.Format("verify_wait", _registerBindingCtrl.cooldownEndTime - cur_time); } } }
public object doHotScript(string file) { LuaState ls = _luaSvr.luaState; if (ls == null) { return(null); } WWW www = new WWW(hotScriptUrl() + file + "?p=" + UtilTools.GetClientTime()); while (!www.isDone) { } ; object obj; if (ls.doBuffer(www.bytes, "@" + file, out obj)) { return(obj); } return(null); }
private void Update() { if (textLabel == null) { return; } if (isTicket) { if (end_time == 0) { return; } int nowTime = isServerTime ? UtilTools.GetServerTime() : UtilTools.GetClientTime(); long lastTime = (long)end_time - (long)nowTime; if (lastTime <= 0) { textLabel.text = "0"; if (OnComplete != null) { OnComplete(gameObject); } } else { if (cooldownSound > 0 && lastTime <= cooldownSound && preTime != lastTime) { UtilTools.PlaySoundEffect("Sounds/RichCar/start", 1f); preTime = lastTime; } textLabel.text = lastTime.ToString();//isNoHour ? string.Format("{0:T}", ts).Substring(3) : string.Format("{0:T}", ts); if (OnUpdate != null) { OnUpdate(); } } return; } if (isCooldown) { //倒计时表现 if (end_time == 0) { return; } int nowTime = isServerTime ? UtilTools.GetServerTime() : UtilTools.GetClientTime(); long lastTime = (long)end_time - (long)nowTime; if (lastTime <= 0) { textLabel.text = isNoHour ? "00:00" : "00:00:00"; end_time = 0; if (OnComplete != null) { OnComplete(gameObject); } } else { if (cooldownSound > 0 && lastTime <= cooldownSound && preTime != lastTime) { UtilTools.PlaySoundEffect("Sounds/clock", 1f); preTime = lastTime; } TimeSpan ts = new TimeSpan(0, 0, (int)lastTime); textLabel.text = timeStr(ts);//isNoHour ? string.Format("{0:T}", ts).Substring(3) : string.Format("{0:T}", ts); if (OnUpdate != null) { OnUpdate(); } } } else { //正计时表现 if (start_time == 0) { return; } int nowTime = isServerTime ? UtilTools.GetServerTime() : UtilTools.GetClientTime(); long countTime = (long)nowTime - (long)start_time; if (countTime <= 0) { textLabel.text = isNoHour ? "00:00" : "00:00:00"; } else { TimeSpan ts = new TimeSpan(0, 0, (int)countTime); textLabel.text = timeStr(ts);//isNoHour ? string.Format("{0:T}", ts).Substring(3) : string.Format("{0:T}", ts); } } }
public void Init() { _strVersionXMLUrl = sdk.SDKManager.VersionXMLUrl + "?p=" + UtilTools.GetClientTime(); _strDownloadUrl = sdk.SDKManager.VersionDownloadUrl + ClientDefine.LOCAL_PROGRAM_VERSION + "/"; }
void Update() { if (string.IsNullOrEmpty(Out_Path)) { Out_Path = string.Format("{0}/{1}/{2}({3})", sPath, ClientDefine.LOCAL_PROGRAM_VERSION, System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm"), ClientDefine.LOCAL_SOURCE_VERSION); } //打包单个 if (!string.IsNullOrEmpty(_key)) { logTime = UtilTools.GetClientTime(); _log = string.Format("正在打包:{0}.apk(0/1)", _packageName); bool rlt = BulidTarget(_key, _packageName); if (rlt) { logTime = UtilTools.GetClientTime() - logTime; _log = string.Format("打包花费时间: {0} 秒", logTime.ToString()); Debug.Log(_log); EditorUtility.RevealInFinder(Path.GetFullPath(Out_Path)); } else { } _key = ""; _packageName = ""; } //打包选中项 else if (_bPackageAll) { _bPackageAll = false; logTime = UtilTools.GetClientTime(); Dictionary <string, bool> .Enumerator en = _dicEnumSelect.GetEnumerator(); int count = 0; List <string> listSelect = new List <string>(); for (int i = 0; i < _dicEnumSelect.Count; i++) { if (en.MoveNext()) { if (en.Current.Value) { listSelect.Add(en.Current.Key); } } } for (int i = 0; i < listSelect.Count; i++) { string skey = listSelect[i]; string apk_name = _listPlatform[skey]; _log = string.Format("正在打包:{0}.apk({1}/{2})", apk_name, (i + 1).ToString(), listSelect.Count.ToString()); bool rlt = BulidTarget(skey, apk_name); if (!rlt) { break; } } if (listSelect.Count == 0) { Debug.Log("未选中渠道"); } else { logTime = UtilTools.GetClientTime() - logTime; _log = string.Format("打包花费时间: {0} 秒", logTime.ToString()); Debug.Log(_log); EditorUtility.RevealInFinder(Path.GetFullPath(Out_Path)); } } }