public void Load(string sceneName, Action cb = null) { if (string.IsNullOrEmpty(sceneName)) { return; } if (IsLoading) { return; } if (CurrentScene.name == sceneName) { return; } _sceneToLoad = sceneName; Debug.Log("load scene: " + _sceneToLoad); IsLoading = true; _loadCallback = cb; _loadingProgress = 0f; visible = true; IsSceneReady = false; SetProgress(0f); StartCoroutine(_loadingScreen.FadeTo(0f, 1f, 0.2f)); StartCoroutine(_loadingScreenRtf.LocalScaleTo(0f, 1f)); StartCoroutine(LoadAsync()); StartCoroutine(AnimatingProgressBar()); }
override public IEnumerator Select() { yield return(new WaitForSeconds(0.2f)); yield return(StartCoroutine(_selectorGroup.FadeTo(0f, 1f, 0.3f))); _openendTime = Time.time; _selectorGroup.interactable = true; _selectorGroup.blocksRaycasts = true; selector.gameObject.SetActive(true); while (SelectedKind == null && ElapsedTime < _limitTime) { yield return(new WaitForSeconds(0.1f)); } _selectorGroup.interactable = false; _selectorGroup.blocksRaycasts = false; if (SelectedKind == null) { SelectedKind = Random.Range(0, 3) + 1; } yield break; }
private void Start() { if (In) { CanvasGroup.alpha = 1f; CanvasGroup.FadeTo(0f, Duration, EasingTypes.Linear); } }
/// <summary> /// UIGroup 컴포넌트의 alpha 를 fade /// </summary> public static IEnumerator FadeTo(this CanvasGroup self, float toA, float duration = 0.2f, Action cb = null) { float fromA = self.alpha; yield return(self.FadeTo(fromA, toA, duration, cb)); }
public void SetStatus(bool status, bool overrideCheck = false) { if (!overrideCheck && status == Active) { return; } Active = status; _canvasgroup.interactable = status; _canvasgroup.blocksRaycasts = status; _canvasgroup.FadeTo(status ? 1 : 0, 0.5f, EasingTypes.SinusoidalInOut, true); }
public void OpenMenu() { if (_animating != null) { return; } bool inGame = Game.GameActive; var bgColor = Color.black; bgColor.a = inGame ? 155 : 255; _background.color = bgColor; _animating = _canvasGroup.FadeTo(1, _transitionLength * 0.5f, EasingTypes.SinusoidalOut, true, Tween.TweenRepeat.Once, () => _animating = null); _canvasGroup.interactable = _canvasGroup.blocksRaycasts = true; Game.PauseAndUnlockCursor("UIMainMenu"); LoadMainMenu(0); EventSystem.current.SetSelectedGameObject(_layoutGroups[IndexMain].transform.GetChild(1).gameObject); if (!inGame && _menuMusic != null) { TimeManager.StartUnscaled(FadeMusic(true, 0.5f)); } }
public Coroutine fade(float target, float length, EasingTypes fadingEasing, System.Action onComplete = null) { if (!initialized) { initialize(); } return(cgroup.FadeTo(Mathf.Clamp01(target), length, easing, true, Tween.TweenRepeat.Once, () => { blockingCheck(); if (onComplete != null) { onComplete(); } })); }
public void SetStatus(bool status) { if (status == Active || _animate != null) { return; } if (status) { Game.CursorUnlock("Map"); } else { Game.RemoveCursorUnlock("Map"); } //if (!status && RiftsMap.CanChangeCurrent) { // RiftsMap.SetCanChange(false); //} Active = status; _animate = _canvas.FadeTo(status ? 1 : 0, _fadeLength, EasingTypes.SinusoidalInOut, true, Tween.TweenRepeat.Once, () => _animate = null); SetCamStatus(status); }
// This animates the menu to the Open state private IEnumerator ScaleIn() { // Set our initial state m_Root.gameObject.SetActive(true); m_Root.SetAnchorPos(0, Axis.XY); m_Root.SetScale(m_StartingScale, Axis.XY); m_Root.SetRotation(0, Axis.Z); m_RootGroup.alpha = 0; m_RootGroup.interactable = false; // Perform the animation yield return(Routine.Combine( m_Root.ScaleTo(1, m_ScaleUpSettings, Axis.XY), // Scale to 1 m_RootGroup.FadeTo(1, m_ScaleUpSettings.Time) // Fade in )); // Allow the user to interact m_RootGroup.interactable = true; m_ButtonSpinAnimation.Replace(this, ButtonCallToAction()); }
public void FadeIn() { TimeManager.PauseFor(_loadPause, true, () => { _canvasGroup.FadeTo(0, _fadeTime, EasingTypes.SinusoidalInOut, true); }); }
private void animate(Action OnFinished, float alphatarget) { cgroup.FadeTo(alphatarget, length, easing, unscaled, Tween.TweenRepeat.Once, OnFinished); }