Beispiel #1
0
 protected override void AwakeWrapped()
 {
     fadeAnimator         = new AnimatorByScript <FadeAnimation>(new FadeAnimation(this, gameObject.GetComponent <SpriteRendererContainer>()), this);
     blinkingLoopAnimator = new AnimatorByScript <BlinkingLoopAnimation>(new BlinkingLoopAnimation(this, gameObject.GetComponent <SpriteRendererContainer>()), this);
     lifeCycleRoutineInfo = CreateCoroutineContainer();
     lifeCycleRoutineInfo.OnCoroutineAlreadyStarted += () => Debug.LogWarning("Уже запущена!");
 }
Beispiel #2
0
        public Synchronizer(SuperMonoBehaviour superMonoBehaviour, IModelInteraction <T> model, ReaderWriter <T> readerWriter)
            : base(superMonoBehaviour)
        {
            this.model        = model ?? throw new ArgumentNullException(nameof(model));
            this.readerWriter = readerWriter ?? throw new ArgumentNullException(nameof(readerWriter));

            ChooseDataInfo = superMonoBehaviour.CreateCoroutineContainer();
        }
Beispiel #3
0
    protected override void AwakeSingleton()
    {
        waitForRewardedAdAnsweringInfo       = CreateCoroutineContainer();
        checkInternetConnectionAndShowAdInfo = CreateCoroutineContainer();

        commandQueueHandler = gameObject.GetComponent <CommandQueueMainThreadExecutor>();
        rewardedAdLoader    = new RewardedAdLoader(this, commandQueueHandler);
        InitializeRewardAdActions();
    }
Beispiel #4
0
        /// <summary>
        /// Останавливает все корутины на объекте.
        /// </summary>
        /// <param name="coroutineInfo"></param>
        public void BreakAllCoroutines()
        {
            for (int i = 0; i < allCoroutineContainers.Count; i++)
            {
                ICoroutineContainer coroutineContainer = allCoroutineContainers[i];

                BreakCoroutine(coroutineContainer);
            }
        }
Beispiel #5
0
 protected override void AwakeSingleton()
 {
     PlayerSettingsStorage.InitializedInstance += (Instance) =>
     {
         SetLanguageSettings(Instance.PlayerSettings);
         loadLocalizedTextInfo = CreateCoroutineContainer();
         LoadLocalizedText();
     };
 }
Beispiel #6
0
    private void OnEnable()
    {
        StarGenerator.InitializedInstance += (Instance) => Instance.NumberOfActiveStars++;

        lifeCoroutineInfo = CreateCoroutineContainer();
        ExecuteCoroutineContinuously(lifeCoroutineInfo, LifeEnumerator());

        lifeTime = Random.Range(minLifeTime, maxLifeTime);
    }
Beispiel #7
0
 public GooglePlayStorage(SuperMonoBehaviour superMonoBehaviour,
                          string fileName,
                          string fileExtension,
                          IJsonConvertor <T> jsonConvertor)
     : base(superMonoBehaviour,
            "Облачное хранилище google play-я",
            fileName,
            fileExtension,
            jsonConvertor)
 {
     loadDataInfo = superMonoBehaviour.CreateCoroutineContainer();
 }
Beispiel #8
0
        /// <summary>
        /// Перед запуском корутины останавливает её, если она выполнялась на данный момент.
        /// </summary>
        /// <param name="enumerator">IEnumerator для выполнения</param>
        /// <returns></returns>
        public void ReStartCoroutineExecution(ICoroutineContainer coroutineInfo, IEnumerator enumerator)
        {
            if (enumerator == null)
            {
                throw new ArgumentNullException(nameof(enumerator));
            }

            CoroutineWithData coroutineWithData = (CoroutineWithData)coroutineInfo;

            coroutineWithData.SetEnumerator(enumerator);

            if (coroutineInfo.IsExecuting)
            {
                BreakCoroutine(coroutineInfo);
            }

            StartNewCoroutine(coroutineWithData);
        }
Beispiel #9
0
        /// <summary>
        /// Останавливает корутину.
        /// </summary>
        /// <param name="coroutineInfo"></param>
        public void BreakCoroutine(ICoroutineContainer coroutineInfo)
        {
            if (coroutineInfo == null)
            {
                throw new ArgumentNullException(nameof(coroutineInfo));
            }

            CoroutineWithData coroutineWithData = (CoroutineWithData)coroutineInfo;

            if (coroutineWithData.IsExecuting)
            {
                monoBehaviour.StopCoroutine(coroutineWithData.Coroutine);

                SetNullToCoroutineAndRemove(coroutineWithData);
            }
            else
            {
                coroutineWithData.OnCoroutineIsAlreadyStopped?.Invoke();
            }

            coroutineWithData.OnStopCoroutine?.Invoke();
        }
Beispiel #10
0
        /// <summary>
        /// Запускает корутину в том случае, если она НЕ выполняется в данный момент.
        /// </summary>
        /// <param name="enumerator">IEnumerator для выполнения</param>
        /// <returns></returns>
        public void ExecuteCoroutineContinuously(ICoroutineContainer coroutineInfo, IEnumerator enumerator)
        {
            if (coroutineInfo == null)
            {
                throw new ArgumentNullException(nameof(coroutineInfo));
            }
            if (enumerator == null)
            {
                throw new ArgumentNullException(nameof(enumerator));
            }

            CoroutineWithData coroutineWithData = (CoroutineWithData)coroutineInfo;

            coroutineWithData.SetEnumerator(enumerator);

            if (!coroutineWithData.IsExecuting)
            {
                StartNewCoroutine(coroutineWithData);
            }
            else
            {
                coroutineWithData.OnCoroutineAlreadyStarted?.Invoke();
            }
        }
Beispiel #11
0
 /// <summary>
 /// Перед запуском корутины останавливает её, если она выполнялась на данный момент.
 /// </summary>
 public void ReStartCoroutineExecution(ICoroutineContainer coroutineInfo, IEnumerator enumerator)
 {
     coroutineExecutor.ReStartCoroutineExecution(coroutineInfo, enumerator);
 }
Beispiel #12
0
 /// <summary>
 /// Запускает корутину в том случае, если она НЕ выполняется в данный момент.
 /// </summary>
 public void ExecuteCoroutineContinuously(ICoroutineContainer coroutineInfo, IEnumerator enumerator)
 {
     coroutineExecutor.ExecuteCoroutineContinuously(coroutineInfo, enumerator);
 }
Beispiel #13
0
 public CloudDataStorage(SuperMonoBehaviour superMonoBehaviour) : base(superMonoBehaviour)
 {
     loadDataInfo = this.superMonoBehaviour.CreateCoroutineContainer();
 }
Beispiel #14
0
 protected override void AwakeWrapped()
 {
     base.AwakeWrapped();
     stopBlinkingInfo = CreateCoroutineContainer();
 }
Beispiel #15
0
 public DeviceDataLoader(SuperMonoBehaviour superMonoBehaviour, string filePath) : base(superMonoBehaviour)
 {
     this.filePath = filePath;
     loadDataInfo  = superMonoBehaviour.CreateCoroutineContainer();
 }
Beispiel #16
0
 /// <summary>
 /// Останавливает корутину.
 /// </summary>
 public void BreakCoroutine(ICoroutineContainer coroutineInfo)
 {
     coroutineExecutor.BreakCoroutine(coroutineInfo);
 }
Beispiel #17
0
 protected override void AwakeWrapped()
 {
     InitializeAnimations();
     playerTactics = GameObjectsHolder.Instance.PlayerPresenter.PlayerTactics;
     CheckingIfTutorialNeedsToBeShownRoutineInfo = CreateCoroutineContainer();
 }
Beispiel #18
0
 protected override void StartWrapped()
 {
     lifeCycleInfo = CreateCoroutineContainer();
     ExecuteCoroutineContinuously(lifeCycleInfo, LifeCycleEnumerator());
 }