Exemple #1
0
    IEnumerator MuteStateUpdateRoutine()
    {
        yield return(WaitForSecondsCache.Get(MUTE_STATUS_UPDATE_INTERVAL));

        ReportMuteStatuses();
        updateMuteStatusRoutine = null;
    }
Exemple #2
0
        public IEnumerator UpdateRoutine()
        {
            while (isPlaying)
            {
                yield return(WaitForSecondsCache.Get(currentTimeDelay));

                currentTextureIdx++;

                if (currentTextureIdx >= gifTextures.Count)
                {
                    currentLoopCount++;

                    if (maxLoopCount > 0 && currentLoopCount >= maxLoopCount)
                    {
                        isPlaying = false;
                        break;
                    }

                    currentTextureIdx = 0;
                }

                currentTimeDelay = gifTextures[currentTextureIdx].m_delaySec;
                OnFrameTextureChanged?.Invoke(texture);
            }
        }
        public IEnumerator ProgressAndCompleteSequence()
        {
            Vector3 scale = progress.transform.localScale;

            if (Math.Abs(scale.x - progressTarget) > Mathf.Epsilon)
            {
                progressBarIncrementAudioEvent.Play();
            }
            while (Math.Abs(scale.x - progressTarget) > Mathf.Epsilon)
            {
                scale.x = Mathf.MoveTowards(scale.x, progressTarget, Time.deltaTime);
                progress.transform.localScale = scale;
                yield return(null);
            }
            if (progressTarget < 1)
            {
                yield break;
            }

            //Dont play completed animation if is already playing
            if (animator.GetCurrentAnimatorClipInfo(0).All(x => x.clip.name != TASK_COMPLETED_ANIMATION_NAME))
            {
                yield return(WaitForSecondsCache.Get(0.5f));

                animator.SetTrigger(COMPLETED_ANIMATOR_TRIGGER);
                taskCompleteAudioEvent.Play();
                yield return(null); // Wait for the animator to update its clipInfo
            }

            yield return(new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.95f));

            OnDestroyed?.Invoke(task.id);
            Destroy(gameObject);
        }
Exemple #4
0
        private IEnumerator RefreshProfilingData()
        {
            while (true)
            {
                var currentPos = Utils.WorldToGridPosition(DCLCharacterController.i.characterPosition.worldPosition);

                IWorldState worldState = Environment.i.world.state;

                ParcelScene activeScene = worldState.loadedScenes.Values.FirstOrDefault(
                    x => x.sceneData.parcels != null &&
                    x.sceneData.parcels.Any(y => y == currentPos)) as ParcelScene;

                if (activeScene != null && activeScene.metricsController != null)
                {
                    var metrics = activeScene.metricsController.GetModel();
                    var limits  = activeScene.metricsController.GetLimits();
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.CURRENT_SCENE, $"{activeScene.sceneData.id}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.POLYGONS_VS_LIMIT, $"{metrics.triangles} of {limits.triangles}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.TEXTURES_VS_LIMIT, $"{metrics.textures} of {limits.textures}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.MATERIALS_VS_LIMIT, $"{metrics.materials} of {limits.materials}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.ENTITIES_VS_LIMIT, $"{metrics.entities} of {limits.entities}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.MESHES_VS_LIMIT, $"{metrics.meshes} of {limits.meshes}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.BODIES_VS_LIMIT, $"{metrics.bodies} of {limits.bodies}");
                    statsPanel.SetCellText((int)Columns.VALUE, (int)Rows.COMPONENT_OBJECTS_COUNT, activeScene.disposableComponents.Count + activeScene.entities.Select(x => x.Value.components.Count).Sum().ToString());
                }

                yield return(WaitForSecondsCache.Get(0.2f));
            }
        }
        public IEnumerator Sequence()
        {
            sequenceState = SequenceState.ProgressingOngoingTasks;

            ClearTaskRoutines();

            List <QuestsTrackerTask> visibleTasks = new List <QuestsTrackerTask>();
            List <QuestsTrackerTask> newTasks     = new List <QuestsTrackerTask>();

            foreach (QuestsTrackerTask task in taskEntries.Values)
            {
                if (task.gameObject.activeSelf)
                {
                    visibleTasks.Add(task);
                }
                else
                {
                    newTasks.Add(task);
                }
            }

            //Progress of currently visible tasks
            for (int i = 0; i < visibleTasks.Count; i++)
            {
                tasksRoutines.Add(StartCoroutine(visibleTasks[i].ProgressAndCompleteSequence()));
            }
            yield return(WaitForTaskRoutines());

            OnLayoutRebuildRequested?.Invoke();

            sequenceState = SequenceState.ShowingNewTasks;

            //Play "new task" sound
            if (newTasks.Count > 0)
            {
                newTaskAudioEvent.Play();
            }

            //Show and progress of new tasks
            for (int i = 0; i < newTasks.Count; i++)
            {
                newTasks[i].gameObject.SetActive(true);
                newTasks[i].SetIsNew(true);
                tasksRoutines.Add(StartCoroutine(newTasks[i].ProgressAndCompleteSequence()));
            }
            OnLayoutRebuildRequested?.Invoke();

            yield return(WaitForTaskRoutines());

            if (taskEntries.Count == 0)
            {
                animator.SetTrigger(ANIMATION_TRIGGER_OUT);
                yield return(WaitForSecondsCache.Get(0.5f));

                Destroy(gameObject);
                OnDestroyed?.Invoke(section.id);
            }
            sequenceState = SequenceState.Finished;
        }
        private IEnumerator DestroyRoutine()
        {
            containerAnimator.SetTrigger(OUT_ANIM_TRIGGER);
            yield return(WaitForSecondsCache.Get(DELAY_TO_DESTROY));

            OnLayoutRebuildRequested?.Invoke();
            Destroy(gameObject);
        }
Exemple #7
0
 IEnumerator IntervalRoutine()
 {
     while (true)
     {
         WebInterface.FetchBalanceOfMANA();
         yield return(WaitForSecondsCache.Get(FETCH_INTERVAL));
     }
 }
 private IEnumerator CheckLandsAccess()
 {
     while (true)
     {
         UpdateLandsWithAccess();
         yield return(WaitForSecondsCache.Get(BIWSettings.REFRESH_LANDS_WITH_ACCESS_INTERVAL));
     }
 }
Exemple #9
0
    IEnumerator RefreshDataInterval()
    {
        while (true)
        {
            yield return(WaitForSecondsCache.Get(REFRESH_INTERVAL));

            FetchLandsAndScenes();
        }
    }
Exemple #10
0
        private IEnumerator UpdateRoutine()
        {
            while (isPlaying)
            {
                yield return(WaitForSecondsCache.Get(currentTimeDelay));

                UpdateFrame();
            }
        }
 private IEnumerator ShowRandomTipsRoutine()
 {
     while (true)
     {
         tipIndex = (tipIndex + 1) % randomizedTips.Count;
         SetTip(randomizedTips[tipIndex]);
         yield return(WaitForSecondsCache.Get(secondsBetweenTips));
     }
 }
        private IEnumerator DestroySequence()
        {
            AudioScriptableObjects.fadeOut.Play();
            containerAnimator.SetTrigger(OUT_ANIM_TRIGGER);
            yield return(WaitForSecondsCache.Get(DELAY_TO_DESTROY));

            OnLayoutRebuildRequested?.Invoke();
            Destroy(gameObject);
        }
Exemple #13
0
    IEnumerator SetRecordingRoutine(bool isRecording)
    {
        if (isRecording)
        {
            recordingGO.SetActive(true);
            yield break;
        }
        yield return(WaitForSecondsCache.Get(USER_NOT_RECORDING_THROTTLING));

        recordingGO.SetActive(false);
    }
        private IEnumerator SetFacialFeaturesVisibleRoutine()
        {
            while (true)
            {
                yield return(WaitForSecondsCache.Get(DISABLE_FACIAL_FEATURES_DISTANCE_DELAY));

                Vector3 position         = lastAvatarPosition ?? (entity.gameObject.transform.position + CommonScriptableObjects.worldOffset);
                float   distanceToPlayer = Vector3.Distance(CommonScriptableObjects.playerWorldPosition, position);
                avatarRenderer.SetFacialFeaturesVisible(distanceToPlayer <= DISABLE_FACIAL_FEATURES_DISTANCE);
            }
        }
Exemple #15
0
 private IEnumerator RemoveEntriesRoutine()
 {
     while (true)
     {
         var entriesToRemove = currentEntries.Where(x => x.Value.isReadyForDisposal).Select(x => x.Key).ToArray();
         foreach (string questId in entriesToRemove)
         {
             RemoveEntry(questId);
         }
         yield return(WaitForSecondsCache.Get(0.25f));
     }
 }
Exemple #16
0
 private IEnumerator RemoveEntriesRoutine()
 {
     while (true)
     {
         var entriesToRemove = lastUpdateTimestamp.Where(x => (DateTime.Now - x.Value) > TimeSpan.FromSeconds(3)).Select(x => x.Key).ToArray();
         foreach (string questId in entriesToRemove)
         {
             RemoveEntry(questId);
         }
         yield return(WaitForSecondsCache.Get(0.25f));
     }
 }
Exemple #17
0
        IEnumerator ScheduleTaskRoutine()
        {
            while (scheduledRequests.Count > 0)
            {
                float waitTime = Mathf.Clamp(REQUEST_DELAY - (Time.unscaledTime - lastRequestSentTime), 0, REQUEST_DELAY);
                yield return(WaitForSecondsCache.Get(waitTime));

                SendRequest(scheduledRequests[0]);
                scheduledRequests.RemoveAt(0);
            }

            scheduleTask = null;
        }
Exemple #18
0
        IEnumerator MockLoadingCoroutine(Action OnSuccess, Action OnFail)
        {
            yield return(WaitForSecondsCache.Get(loadTime));

            if (forceFail)
            {
                OnFail?.Invoke();
            }
            else
            {
                OnSuccess?.Invoke();
            }
        }
    IEnumerator ShowPopupDelayed(float seconds)
    {
        isPopupRoutineRunning = true;
        yield return(new WaitUntil(() => CommonScriptableObjects.rendererState.Get()));

        yield return(WaitForSecondsCache.Get(seconds));

        yield return(new WaitUntil(() => CommonScriptableObjects.rendererState.Get()));

        yield return(new WaitUntil(() => !waitForEndOfTutorial));

        SetVisibility(true);
        isPopupRoutineRunning = false;
    }
        private IEnumerator ProcessSectionsNotificationQueue()
        {
            while (true)
            {
                if (notificationsQueue.Count > 0)
                {
                    GameObject notificationGO = notificationsQueue.Dequeue();
                    notificationGO.gameObject.SetActive(true);
                    yield return(WaitForSecondsCache.Get(SECTION_NOTIFICATION_DURATION));

                    Destroy(notificationGO);
                }

                yield return(WaitForSecondsCache.Get(NOTIFICATIONS_SEPARATION));
            }
        }
Exemple #21
0
        private IEnumerator ProcessSectionsNotificationQueue()
        {
            while (true)
            {
                if (notificationsQueue.Count > 0)
                {
                    IQuestNotification notification = notificationsQueue.Dequeue();
                    notification.Show();
                    yield return(notification.Waiter());

                    notification.Dispose();
                }

                yield return(WaitForSecondsCache.Get(NOTIFICATIONS_SEPARATION));
            }
        }
Exemple #22
0
    private IEnumerator ShowPopupDelayed(float seconds)
    {
        isPopupRoutineRunning = true;
        view.Initialize(OnConfirmPressed, OnClosePressed, config);

        yield return(new WaitUntil(() => CommonScriptableObjects.rendererState.Get()));

        yield return(new WaitUntil(() => !CommonScriptableObjects.tutorialActive.Get()));

        yield return(new WaitUntil(() => !CommonScriptableObjects.emailPromptActive.Get()));

        yield return(WaitForSecondsCache.Get(seconds));

        yield return(new WaitUntil(() => CommonScriptableObjects.rendererState.Get()));

        SetVisibility(true);
        isPopupRoutineRunning = false;
    }
        public override IEnumerator OnStepExecute()
        {
            yield return(welcomeTooltip.ShowAndHideRoutine());

            yield return(new WaitUntil(() => claimNamePanelClosed));

            yield return(WaitForSecondsCache.Get(3));

            controlsTooltip.Show(autoHide: false);
            characterMoved      = false;
            characterTeleported = false;

#if UNITY_EDITOR
            if (DCLCharacterController.i == null)
            {
                characterMoved = true;
            }
#endif

            yield return(new WaitUntil(() => characterMoved));

            yield return(WaitIdleTime());

            controlsTooltip.Hide();

            yield return(WaitForSecondsCache.Get(3));

            yield return(cameraTooltip.ShowAndHideRoutine());

            yield return(WaitIdleTime());

            HUDController.i?.minimapHud.SetVisibility(true);
            yield return(minimapTooltip.ShowAndHideRoutine());

#if UNITY_EDITOR
            if (TutorialController.i.debugRunTutorialOnStart)
            {
                characterTeleported = true;
            }
#endif

            yield return(new WaitUntil(() => characterTeleported == true));
        }
Exemple #24
0
    private IEnumerator RemoveCache(string url, float delay)
    {
        yield return(WaitForSecondsCache.Get(delay));

        cache?.Remove(url);
    }
 public IEnumerator Waiter()
 {
     yield return(WaitForSecondsCache.Get(QuestsNotificationsController.DEFAULT_NOTIFICATION_DURATION));
 }
        private IEnumerator RefreshProfilingData()
        {
            while (true)
            {
                int sharedCount       = 0;
                int sharedAttachCount = 0;
                int componentCount    = 0;
                int entityCount       = 0;
                int materialCount     = 0;
                int meshesCount       = 0;

                foreach (var v in SceneController.i.loadedScenes)
                {
                    if (v.Value.metricsController != null)
                    {
                        meshesCount   += v.Value.metricsController.GetModel().meshes;
                        materialCount += v.Value.metricsController.GetModel().materials;
                    }

                    sharedCount += v.Value.disposableComponents.Count;

                    foreach (var e in v.Value.disposableComponents)
                    {
                        sharedAttachCount += e.Value.attachedEntities.Count;
                    }

                    entityCount += v.Value.entities.Count;

                    foreach (var e in v.Value.entities)
                    {
                        componentCount += e.Value.components.Count;
                    }
                }

                statsPanel.SetCellText(1, (int)Rows.SHARED_OBJECTS_COUNT, sharedCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.COMPONENT_OBJECTS_COUNT, componentCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.ENTITY_OBJECTS_COUNT, entityCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.MATERIAL_COUNT, materialCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.MESHES_COUNT, meshesCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.GLTF_BEING_LOADED, UnityGLTF.GLTFComponent.downloadingCount.ToString() + " / " + UnityGLTF.GLTFComponent.queueCount.ToString());

                string busesLog = "";
                Dictionary <string, int> pendingMessagesCount = new Dictionary <string, int>();
                Dictionary <string, int> messagesReplaced     = new Dictionary <string, int>();

                using (var controllersIter = MessagingControllersManager.i.messagingControllers.GetEnumerator())
                {
                    while (controllersIter.MoveNext())
                    {
                        using (var iterator = controllersIter.Current.Value.messagingBuses.GetEnumerator())
                        {
                            while (iterator.MoveNext())
                            {
                                //access to pair using iterator.Current
                                string       key = iterator.Current.Key;
                                MessagingBus bus = controllersIter.Current.Value.messagingBuses[key];

                                if (!pendingMessagesCount.ContainsKey(key))
                                {
                                    pendingMessagesCount[key] = 0;
                                }

                                if (!messagesReplaced.ContainsKey(key))
                                {
                                    messagesReplaced[key] = 0;
                                }

                                pendingMessagesCount[key] += bus.pendingMessagesCount;
                                messagesReplaced[key]     += bus.unreliableMessagesReplaced;
                            }
                        }
                    }
                }

                busesLog += $"{MessagingBusId.UI} bus: {pendingMessagesCount[MessagingBusId.UI]} replaced: {messagesReplaced[MessagingBusId.UI]}\n";
                busesLog += $"{MessagingBusId.INIT} bus: {pendingMessagesCount[MessagingBusId.INIT]} replaced: {messagesReplaced[MessagingBusId.INIT]}\n";
                busesLog += $"{MessagingBusId.SYSTEM} bus: {pendingMessagesCount[MessagingBusId.SYSTEM]} replaced: {messagesReplaced[MessagingBusId.SYSTEM]}\n";

                statsPanel.SetCellText(1, (int)Rows.MESSAGE_BUSES, busesLog);

                yield return(WaitForSecondsCache.Get(0.2f));
            }
        }
        private IEnumerator RefreshProfilingData()
        {
            while (true)
            {
                int sharedCount       = 0;
                int sharedAttachCount = 0;
                int componentCount    = 0;
                int entityCount       = 0;
                int materialCount     = 0;
                int meshesCount       = 0;

                var loadedScenes = Environment.i.world.state.loadedScenes;

                foreach (var v in loadedScenes)
                {
                    if (v.Value.metricsController != null)
                    {
                        meshesCount   += v.Value.metricsController.GetModel().meshes;
                        materialCount += v.Value.metricsController.GetModel().materials;
                    }

                    sharedCount += v.Value.disposableComponents.Count;

                    foreach (var e in v.Value.disposableComponents)
                    {
                        sharedAttachCount += e.Value.attachedEntities.Count;
                    }

                    entityCount += v.Value.entities.Count;

                    foreach (var e in v.Value.entities)
                    {
                        componentCount += e.Value.components.Count;
                    }
                }

                statsPanel.SetCellText(1, (int)Rows.SHARED_OBJECTS_COUNT, sharedCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.COMPONENT_OBJECTS_COUNT, componentCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.ENTITY_OBJECTS_COUNT, entityCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.MATERIAL_COUNT, materialCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.MESHES_COUNT, meshesCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.GLTF_BEING_LOADED, UnityGLTF.GLTFComponent.downloadingCount.ToString() + " ... In Queue: " + UnityGLTF.GLTFComponent.queueCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.AB_BEING_LOADED, AssetPromise_AB.downloadingCount.ToString() + " ...  In Queue: " + AssetPromise_AB.queueCount.ToString());
                statsPanel.SetCellText(1, (int)Rows.RENDERER_UNLOCK_SEGS, RenderingController.firstActivationTime.ToString(CultureInfo.InvariantCulture));

                string busesLog = "";
                Dictionary <string, int> pendingMessagesCount = new Dictionary <string, int>();
                Dictionary <string, int> messagesReplaced     = new Dictionary <string, int>();

                MessagingControllersManager messagingManager = Environment.i.messaging.manager as MessagingControllersManager;

                using (var controllersIter = messagingManager.messagingControllers.GetEnumerator())
                {
                    while (controllersIter.MoveNext())
                    {
                        using (var iterator = controllersIter.Current.Value.messagingBuses.GetEnumerator())
                        {
                            while (iterator.MoveNext())
                            {
                                //access to pair using iterator.Current
                                MessagingBusType key = iterator.Current.Key;
                                MessagingBus     bus = controllersIter.Current.Value.messagingBuses[key];

                                string keyString = key.ToString();

                                if (!pendingMessagesCount.ContainsKey(keyString))
                                {
                                    pendingMessagesCount[keyString] = 0;
                                }

                                if (!messagesReplaced.ContainsKey(keyString))
                                {
                                    messagesReplaced[keyString] = 0;
                                }

                                pendingMessagesCount[keyString] += bus.pendingMessagesCount;
                                messagesReplaced[keyString]     += bus.unreliableMessagesReplaced;
                            }
                        }
                    }
                }

                busesLog += $"{MessagingBusType.UI.ToString()} bus: {pendingMessagesCount[MessagingBusType.UI.ToString()]} replaced: {messagesReplaced[MessagingBusType.UI.ToString()]}\n";
                busesLog += $"{MessagingBusType.INIT.ToString()} bus: {pendingMessagesCount[MessagingBusType.INIT.ToString()]} replaced: {messagesReplaced[MessagingBusType.INIT.ToString()]}\n";
                busesLog += $"{MessagingBusType.SYSTEM.ToString()} bus: {pendingMessagesCount[MessagingBusType.SYSTEM.ToString()]} replaced: {messagesReplaced[MessagingBusType.SYSTEM.ToString()]}\n";

                statsPanel.SetCellText(1, (int)Rows.MESSAGE_BUSES, busesLog);

                yield return(WaitForSecondsCache.Get(0.2f));
            }
        }
        IEnumerator BatchOpenTimeOut(float openTime)
        {
            yield return(WaitForSecondsCache.Get(openTime));

            CloseBatch();
        }
Exemple #29
0
    private IEnumerator TimerCoroutine(float timer)
    {
        yield return(WaitForSecondsCache.Get(timer));

        Dismiss();
    }