private ICodeHashGenerator GenerateInternal() { if (LastResult != null) { if (HashGenerated != null) { HashGenerated.Invoke(LastResult); } return(this); } currentWorker = null; #if UNITY_EDITOR #if UNITY_ANDROID || UNITY_STANDALONE_WIN Debug.LogWarning(ACTkConstants.LogPrefix + "CodeHashGenerator does not work in Editor. Please use it at runtime only.\n" + "This message is harmless."); #else Debug.LogError(ACTkConstants.LogPrefix + "CodeHashGenerator works only in Android and Windows Standalone runtimes (both Mono and IL2CPP)."); #endif return(this); #else #if ACTK_ANDROID_DEVICE currentWorker = new AndroidWorker(); #elif UNITY_STANDALONE_WIN currentWorker = new StandaloneWindowsWorker(); #endif currentWorker.Execute(); StartCoroutine(CalculationAwaiter()); return(this); #endif }
private IEnumerator CalculationAwaiter() { while (currentWorker.IsBusy) { yield return(cachedWaitForSeconds); } LastResult = currentWorker.Result; if (HashGenerated != null) { HashGenerated.Invoke(LastResult); } }
protected virtual void OnHashGenerated() { HashGenerated?.Invoke(_lastComputedHash); }