public Clock Create(Clock.ClockParams value, System.Action callBack) { var clock = new Clock(value, callBack); clocks.Add(clock); return(clock); }
private void OnVersionCheckResult(bool ok, string result) { if (ok) { this.versionInfo = JsonMapper.ToObject <VersionInfo>(result); if (this.versionInfo.VersionCount > 0) { var version = this.versionInfo.GetLatestVersion(); var remoteURL = version.download_url; switch (Application.platform) { case RuntimePlatform.Android: var fileName = Path.GetFileName(remoteURL); this.apkLocalURL = StringUtil.Contact(this.androidRoot, "/", fileName); if (File.Exists(this.apkLocalURL)) { this.step = Step.ApkExist; } else { this.step = Step.DownLoadPrepared; } break; case RuntimePlatform.IPhonePlayer: this.step = Step.DownLoadPrepared; break; default: this.step = Step.Completed; break; } } else { this.step = Step.Completed; var apkFiles = new DirectoryInfo(AssetPath.ExternalStorePath).GetFiles("*.apk"); for (int i = apkFiles.Length - 1; i >= 0; i--) { File.Delete(apkFiles[i].FullName); } } } else { this.step = Step.None; var clockSetting = new Clock.ClockParams() { type = Clock.ClockType.UnityRealTimeClock, second = 1, }; ClockUtil.Instance.Create(clockSetting, this.RequestVersionCheck); } }
public override void Enter() { PleaseWait.Instance.Show(PleaseWait.WaitType.NetLink, 0f); isOverTime = false; var param = new Clock.ClockParams() { type = Clock.ClockType.UnityRealTimeClock, second = OVER_TIME, }; clock = ClockUtil.Instance.Create(param, () => { isOverTime = true; }); }
void OnApplicationUnPause() { if (detectClock != null) { detectClock.Stop(); } var param = new Clock.ClockParams() { type = Clock.ClockType.UnityRealTimeClock, second = 3, }; detectClock = ClockUtil.Instance.Create(param, () => { isDisconnected = GameNet.Instance.connected; }); }
private static void OnGetAssetVersionFile(bool ok, string result) { Debug.LogFormat("获取资源版本文件结果:时间 {0},结果 {1}", DateTime.Now, ok); if (ok) { var assetVersions = ParseAssetVersions(result); foreach (var assetVersion in assetVersions.Values) { if (!assetVersion.CheckLocalFileValid()) { priorDownLoadAssetVersions.Add(assetVersion); assetVersion.localValid = false; } else { assetVersion.localValid = true; } } m_PriorAssetDownLoadDone = priorDownLoadAssetVersions.Count <= 0; m_UnPriorAssetDownLoadDone = unpriorDownLoadAssetVersions.Count <= 0; if (!m_PriorAssetDownLoadDone) { BeginDownLoad(true); } } else { var clockSetting = new Clock.ClockParams() { type = Clock.ClockType.UnityRealTimeClock, second = 1, }; ClockUtil.Instance.Create(clockSetting, GetAssetVersionFile); } }
public void Show(int bossId, float delay = 0f) { this.bossId = bossId; if (delay == 0f) { DisplayBaseInfo(); } else { if (delayClock != null && !delayClock.end) { delayClock.Stop(); } var setting = new Clock.ClockParams() { type = Clock.ClockType.UnityTimeClock, second = 0.3f, }; delayClock = ClockUtil.Instance.Create(setting, OnDelayShow); } }