private void CleanupCallbacks() { m_OnCheckNeedUpdateInfoEvent = null; m_OnDownloadAppProgressChangedEvent = null; m_OnDownloadAppStateChangedEvent = null; m_OnDownloadYYBProgressChangedEvent = null; m_OnDownloadYYBStateChangedEvent = null; }
/// <summary> /// /// </summary> /// <param name="timeout">超时时长</param> /// <param name="result">value_0: 有结果(即未超时), value_1~n: 各个结果</param> /// <returns></returns> private IEnumerable CheckNeedUpdateCoroutine(Single timeout, ReturnTuple<Boolean, Int64, String, Int64, Int32, String, Int32> result) { result.value_0 = false; CheckNeedUpdate(); Boolean bHasResult = false; m_OnCheckNeedUpdateInfoEvent = (newApkSize, newFeature, patchSize, status, updateDownloadUrl, updateMethod) => { result.value_1 = newApkSize; result.value_2 = newFeature; result.value_3 = patchSize; result.value_4 = status; result.value_5 = updateDownloadUrl; result.value_6 = updateMethod; bHasResult = true; }; Single startTime = Time.realtimeSinceStartup; while (!bHasResult) //等结果 { if (Time.realtimeSinceStartup - startTime > timeout) //超时了 { m_OnCheckNeedUpdateInfoEvent = null; yield break; } yield return null; } result.value_0 = true; }