Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        private IEnumerator CalculationAwaiter()
        {
            while (currentWorker.IsBusy)
            {
                yield return(cachedWaitForSeconds);
            }

            LastResult = currentWorker.Result;

            if (HashGenerated != null)
            {
                HashGenerated.Invoke(LastResult);
            }
        }
Exemplo n.º 3
0
 protected virtual void OnHashGenerated()
 {
     HashGenerated?.Invoke(_lastComputedHash);
 }