Inheritance: MonoBehaviour
Exemple #1
0
 private void OnTutorialDisabled()
 {
     if (gameObject.activeInHierarchy)
     {
         CoroutineStarter.Start(StartBuilderMusic());
     }
 }
 void OnAvatarEditorMusicStop()
 {
     if (tutorialMusic.source.isPlaying)
     {
         CoroutineStarter.Start(tutorialMusic.FadeIn(2.5f));
     }
 }
Exemple #3
0
        protected override void OnCancelLoading()
        {
            if (loadCoroutine != null)
            {
                CoroutineStarter.Stop(loadCoroutine);
                loadCoroutine = null;
            }

            if (assetBundleRequest != null && !assetBundleRequest.isDone)
            {
                assetBundleRequest.Abort();
                assetBundleRequest.Dispose();
                assetBundleRequest = null;
            }

            for (int i = 0; i < dependencyPromises.Count; i++)
            {
                dependencyPromises[i].Unload();
            }

            dependencyPromises.Clear();

            if (asset != null)
            {
                asset.CancelShow();
            }

            UnregisterConcurrentRequest();
        }
Exemple #4
0
    /// <summary>
    /// Dispose HUD controller
    /// </summary>
    public void Dispose()
    {
        ReportMuteStatuses();

        if (updateMuteStatusRoutine != null)
        {
            CoroutineStarter.Stop(updateMuteStatusRoutine);
        }

        otherPlayersStatus.OnAdded   -= OnOtherPlayersStatusAdded;
        otherPlayersStatus.OnRemoved -= OnOtherPlayerStatusRemoved;

        CommonScriptableObjects.rendererState.OnChange -= OnRendererStateChanged;
        profile.OnUpdate -= OnUserProfileUpdate;

        if (usersListView != null)
        {
            usersListView.OnRequestMuteUser   -= OnMuteUser;
            usersListView.OnRequestMuteGlobal -= OnMuteAll;
            usersListView.OnGoToCrowdPressed  -= OnGoToCrowd;
            usersListView.OnOpen -= OnListOpen;

            usersListView.Dispose();
        }

        if (usersButtonView != null)
        {
            usersButtonView.OnClick -= ToggleVisibility;
        }
    }
 public void Cleanup()
 {
     if (isRoutineRunning)
     {
         CoroutineStarter.Stop(routine);
     }
 }
 private void OnDestroy()
 {
     if (changeAlphaCoroutine != null)
     {
         CoroutineStarter.Stop(changeAlphaCoroutine);
     }
 }
Exemple #7
0
        public void Initialize()
        {
            sceneSortDirty = true;
            positionDirty  = true;
            lastSortFrame  = 0;
            enabled        = true;

            Environment.i.platform.debugController.OnDebugModeSet += OnDebugModeSet;

            // We trigger the Decentraland logic once SceneController has been instanced and is ready to act.
            WebInterface.StartDecentraland();

            if (deferredMessagesDecoding)                                               // We should be able to delete this code
            {
                deferredDecodingCoroutine = CoroutineStarter.Start(DeferredDecoding()); //
            }
            DCLCharacterController.OnCharacterMoved += SetPositionDirty;

            CommonScriptableObjects.sceneID.OnChange += OnCurrentSceneIdChange;

            //TODO(Brian): Move those subscriptions elsewhere.
            PoolManager.i.OnGet -= Environment.i.platform.physicsSyncController.MarkDirty;
            PoolManager.i.OnGet += Environment.i.platform.physicsSyncController.MarkDirty;

            PoolManager.i.OnGet -= Environment.i.platform.cullingController.objectsTracker.MarkDirty;
            PoolManager.i.OnGet += Environment.i.platform.cullingController.objectsTracker.MarkDirty;
        }
Exemple #8
0
        protected IEnumerator LoadAssetBundleWithDeps(string baseUrl, string hash, Action OnSuccess, Action OnFail)
        {
            if (!DependencyMapLoadHelper.dependenciesMap.ContainsKey(hash))
            {
                CoroutineStarter.Start(DependencyMapLoadHelper.GetDepMap(baseUrl, hash));
            }

            yield return(DependencyMapLoadHelper.WaitUntilDepMapIsResolved(hash));

            if (DependencyMapLoadHelper.dependenciesMap.ContainsKey(hash))
            {
                using (var it = DependencyMapLoadHelper.dependenciesMap[hash].GetEnumerator())
                {
                    while (it.MoveNext())
                    {
                        var dep     = it.Current;
                        var promise = new AssetPromise_AB(baseUrl, dep);
                        AssetPromiseKeeper_AB.i.Keep(promise);
                        dependencyPromises.Add(promise);
                        yield return(promise);
                    }
                }
            }

            yield return(WaitForConcurrentRequestsSlot());

            RegisterConcurrentRequest();
            yield return(LoadAssetBundle(baseUrl + hash, OnSuccess, OnFail));

            UnregisterConcurrentRequest();
        }
Exemple #9
0
 public void CancelShow()
 {
     if (showCoroutine != null)
     {
         CoroutineStarter.Stop(showCoroutine);
     }
 }
Exemple #10
0
 private void OnTutorialEnabled()
 {
     if (inWorldController.isBuilderInWorldActivated)
     {
         CoroutineStarter.Start(eventBuilderMusic.FadeOut(MUSIC_FADE_OUT_TIME_ON_TUTORIAL));
     }
 }
Exemple #11
0
 private void OnTutorialDisabled()
 {
     if (inWorldController.isBuilderInWorldActivated)
     {
         CoroutineStarter.Start(StartBuilderMusic());
     }
 }
 public OpenSeaRequestGroup(float delayRequest, Action <OpenSeaRequestGroup> onGroupClosed, Func <float> getRetryDelay)
 {
     isOpen             = true;
     this.onGroupClosed = onGroupClosed;
     this.getRetryDelay = getRetryDelay;
     fetchRoutine       = CoroutineStarter.Start(Fetch(delayRequest));
 }
Exemple #13
0
        public void LoadDirectAssets(CoroutineStarter starter, string folderPath, string guid, string[] dependancies, string[] loadFirst, string[] loadAny, string[] loadLast)
        {
            foreach (string bundleFirst in loadFirst)
            {
                if (!string.IsNullOrEmpty(bundleFirst))
                {
                    starter(StartAssetLoadDirect(folderPath, bundleFirst, guid, dependancies, LoadOrderType.LoadFirst, false));
                }
            }

            foreach (string bundleAny in loadAny)
            {
                if (!string.IsNullOrEmpty(bundleAny))
                {
                    starter(StartAssetLoadDirect(folderPath, bundleAny, guid, dependancies, LoadOrderType.LoadUnordered, false));
                }
            }

            foreach (string bundleLast in loadLast)
            {
                if (!string.IsNullOrEmpty(bundleLast))
                {
                    starter(StartAssetLoadDirect(folderPath, bundleLast, guid, dependancies, LoadOrderType.LoadLast, false));
                }
            }
        }
Exemple #14
0
        public void ApplyModel(AvatarModel model, Action onSuccess, Action onFail)
        {
            this.model = model;

            Action onSuccessWrapper = null;
            Action onFailWrapper    = null;

            onSuccessWrapper = () => { onSuccess?.Invoke(); this.OnSuccessEvent -= onSuccessWrapper; };
            onFailWrapper    = () => { onFail?.Invoke(); this.OnFailEvent -= onFailWrapper; };

            this.OnSuccessEvent += onSuccessWrapper;
            this.OnFailEvent    += onFailWrapper;

            isLoading = false;

            StopLoadingCoroutines();

            if (this.model == null)
            {
                ResetAvatar();
                this.OnSuccessEvent?.Invoke();
                return;
            }

            isLoading     = true;
            loadCoroutine = CoroutineStarter.Start(LoadAvatar());
        }
Exemple #15
0
    private IEnumerator UsherApproachToPlayerCoroutine()
    {
        yield return(new WaitForSeconds(2.5f));

        foreach (Light light in Lights)
        {
            yield return(CoroutineStarter.Run(FlickerAndGoOff(light)));
        }

        float maxDist = Vector3.Distance(Player.transform.position, Usher.transform.position);

        AudioSource_EndSpook.Play();

        while (true)
        {
            if (Player == null)
            {
                break; // endgame
            }

            float curDist = Vector3.Distance(Player.transform.position, Usher.transform.position);
            AudioSource_EndSpook.volume = Mathf.Lerp(0f, 1f, 1f - (curDist / maxDist));

            Vector3 toPlayer = (Player.transform.position - Usher.transform.position).normalized;
            Usher.transform.position += toPlayer * 1.3f * Time.deltaTime;
            yield return(null);
        }
    }
Exemple #16
0
        public void Show(bool useMaterialTransition, System.Action OnFinish)
        {
            if (showCoroutine != null)
            {
                CoroutineStarter.Stop(showCoroutine);
            }

            if (!visible)
            {
                OnFinish?.Invoke();
                return;
            }

            bool renderingEnabled = CommonScriptableObjects.rendererState.Get();

            if (!renderingEnabled || !useMaterialTransition)
            {
                container.SetActive(true);
                OnFinish?.Invoke();
                return;
            }

            container.SetActive(false);
            showCoroutine = CoroutineStarter.Start(ShowCoroutine(OnFinish));
        }
Exemple #17
0
 void OnConfirmUnpublish()
 {
     BIWAnalytics.PlayerUnpublishScene(source.ToString(), coordinates);
     DataStore.i.dataStoreBuilderInWorld.unpublishSceneResult.OnChange += OnSceneUnpublished;
     WebInterface.UnpublishScene(coordinates);
     fakeProgressRoutine = CoroutineStarter.Start(ProgressRoutine());
 }
Exemple #18
0
 protected virtual void Awake()
 {
     onLevelVictory      = Harmony.Finder.OnLevelVictory;
     onLevelFailed       = Harmony.Finder.OnLevelFailed;
     onLevelChange       = Harmony.Finder.OnLevelChange;
     onCampaignFailed    = Harmony.Finder.OnCampaignFailed;
     levelLoader         = Harmony.Finder.LevelLoader;
     saveController      = Harmony.Finder.SaveController;
     gameController      = Harmony.Finder.GameController;
     gameSettings        = Harmony.Finder.GameSettings;
     grid                = Harmony.Finder.GridController;
     cinematicController = GetComponent <CinematicController>();
     computerPlayer      = new ComputerPlayer(Harmony.Finder.GameController.ChoiceRange);
     humanPlayer         = new HumanPlayer();
     levelName           = gameObject.scene.name;
     endGameCredits      = GetComponentInChildren <EndGameCreditsController>();
     uiController        = Harmony.Finder.UIController;
     if (protagonistGameObject == null)
     {
         Debug.LogError("Missing ProtagonistGameObject in LevelController!");
     }
     if (endGameCredits != null)
     {
         endGameCredits.gameObject.SetActive(false);
     }
     coroutineStarter      = Harmony.Finder.CoroutineStarter;
     enemyRangeController  = Harmony.Finder.EnemyRangeController;
     achievementController = Harmony.Finder.AchievementController;
 }
Exemple #19
0
    private void AddToCache(string url, string result)
    {
        cache[url] = result;

        // NOTE: remove from cache after CACHE_TIME time passed
        CoroutineStarter.Start(RemoveCache(url, CACHE_TIME));
    }
Exemple #20
0
 public void Stop()
 {
     if (entitiesCheckRoutine != null)
     {
         CoroutineStarter.Stop(entitiesCheckRoutine);
     }
 }
 public void Stop()
 {
     if (removeEntitiesCoroutine != null)
     {
         CoroutineStarter.Stop(removeEntitiesCoroutine);
     }
 }
Exemple #22
0
        public Task(string name,
                    CoroutineStarter coroutineRunner,
                    Condition[] conditions = null,
                    Condition[] rules      = null)
        {
            taskName = name;
            taskCouroutineStarter = coroutineRunner;
            if (conditions == null)
            {
                preConditionsList = EmptyCondition;
            }
            else
            {
                preConditionsList = new Condition[conditions.Length];
                conditions.CopyTo(preConditionsList, 0);
            }

            if (rules == null)
            {
                integrityRules = EmptyCondition;
            }
            else
            {
                integrityRules = new Condition[rules.Length];
                rules.CopyTo(integrityRules, 0);
            }

            taskStatus = TaskStatus.Planned;
        }
Exemple #23
0
    public void OpenNftInfoDialog(NFTPromptModel model, NFTPromptModel prevModel)
    {
        if (!view.IsActive())
        {
            HideOwnersTooltip(true);
            HideOwnersPopup(true);

            if (fetchNFTRoutine != null)
            {
                CoroutineStarter.Stop(fetchNFTRoutine);
            }

            if (lastNFTInfo != null && lastNFTInfo.Value.Equals(model.contactAddress, model.tokenId))
            {
                SetNFT(lastNFTInfo.Value, model.comment, false);
                return;
            }

            view.SetLoading();

            fetchNFTRoutine = CoroutineStarter.Start(NFTHelper.FetchNFTInfoSingleAsset(model.contactAddress, model.tokenId,
                                                                                       (nftInfo) => SetNFT(nftInfo, model.comment, true),
                                                                                       (error) => view.OnError(error)
                                                                                       ));
        }
    }
Exemple #24
0
        public override void Dispose()
        {
            Settings.i.OnGeneralSettingsChanged           -= OnSettingsChanged;
            CommonScriptableObjects.playerCoords.OnChange -= OnPlayerCoordsChanged;
            if (scene != null)
            {
                scene.OnEntityRemoved -= OnEntityRemoved;
            }
            if (texturePlayerUpdateRoutine != null)
            {
                CoroutineStarter.Stop(texturePlayerUpdateRoutine);
                texturePlayerUpdateRoutine = null;
            }

            if (texturePlayer != null)
            {
                texturePlayer.Dispose();
                texturePlayer = null;
            }

            if (isTest && texture != null)
            {
                UnityEngine.Object.Destroy(texture);
            }

            texture = null;
            base.Dispose();
        }
 void OnAvatarEditorMusicPlay()
 {
     if (tutorialMusic.source.isPlaying)
     {
         fadeOut = CoroutineStarter.Start(tutorialMusic.FadeOut(1.5f, false));
     }
 }
Exemple #26
0
    public static TextMesh CreateDisplay(TextAnchor position)
    {
        Transform displayTransform = new GameObject("Display").transform;

        displayTransform.parent        = Camera.main.transform;
        displayTransform.localPosition = new Vector3(0, -.2f, .5f);
        displayTransform.localRotation = Quaternion.identity;
        displayTransform.localScale    = Vector3.one * .01f;
        TextMesh display = displayTransform.gameObject.AddComponent <TextMesh>();

        display.fontSize = 30;

        // Start waiting for a valid cam or send a display to the valid cam.
        if (!HasValidCam())
        {
            display.gameObject.SetActive(false);
            CoroutineStarter.StartCoroutine(DisplayWaitForCamRoutine(display, position));
        }
        else
        {
            display.transform.parent = Camera.main.transform;
            SetupDisplayAtPosition(display, position);
        }
        return(display);
    }
 internal void KillTooltipCoroutine()
 {
     if (changeAlphaCoroutine != null)
     {
         CoroutineStarter.Stop(changeAlphaCoroutine);
     }
 }
Exemple #28
0
 protected override void OnTriggered()
 {
     RenderSettings.ambientLight = AmbientColor;
     AudioSource_MovieStartsNow.Play();
     FindObjectOfType <PlayerMotor>().MaxSpeedAlongOneDimension *= 0.2f;
     CoroutineStarter.Run(UsherApproachToPlayerCoroutine());
 }
 public void CloseCatalog()
 {
     if (gameObject.activeSelf)
     {
         CoroutineStarter.Start(CloseCatalogAfterOneFrame());
     }
 }
Exemple #30
0
 private void OnTutorialEnabled()
 {
     if (gameObject.activeInHierarchy)
     {
         CoroutineStarter.Start(eventBuilderMusic.FadeOut(MUSIC_FADE_OUT_TIME_ON_TUTORIAL));
     }
 }