Ejemplo n.º 1
0
        public IEnumerator TrackTranslationCoroutine(NameTranslationCoroutine translationCoroutine,
            NameScope scope, string trackedKey, params TranslationResultHandler[] handlers)
        {
            lock (GetLock(scope))
            {
                if (TryAddHandlers(scope, trackedKey, handlers)) yield break;
                TrackKey(scope, trackedKey, handlers);
            }

            void CallbackHandler(ITranslationResult result)
            {
                CallHandlers(scope, trackedKey, result);
            }

            yield return null; // allow requests later this frame to batch onto this one
            var tmp = translationCoroutine(new TranslationResultHandler[] {CallbackHandler});
            _outstandingCoroutines.Add(tmp);
            yield return TranslationHelper.Instance.StartCoroutine(tmp.AppendCo(() =>
                _outstandingCoroutines.Remove(tmp)));
        }
Ejemplo n.º 2
0
 public IEnumerator TrackTranslationCoroutine(NameTranslationCoroutine translationCoroutine,
     NameScope scope, string trackedKey, IEnumerable<TranslationResultHandler> handlers)
 {
     return TrackTranslationCoroutine(translationCoroutine, scope, trackedKey, handlers.ToArray());
 }