Esempio n. 1
0
 private void Show()
 {
     menuCanvas.DOKill();
     menuCanvas.DOFade(1f, tweenDuration).SetEase(tweenEase);
     menuCanvas.blocksRaycasts = true;
     menuCanvas.interactable   = true;
 }
Esempio n. 2
0
 protected void OnDestroy()
 {
     waitingForTransition?.Cancel();
     transitioning.ForEach(it => it.Cancel());
     transitioning.Clear();
     canvasGroup.DOKill();
 }
Esempio n. 3
0
        public void SetActiveCanvasGroup(bool enable, float fadeTime = 0.0f)
        {
            if (canvasGroup == null)
            {
                PreInit();
            }

            canvasGroup.DOKill();

            if (_isNotChangeGroupSetting == false)
            {
                canvasGroup.interactable = enable;
            }

            if (fadeTime > 0f)
            {
                canvasGroup.DOFade(enable ? 1f : 0f, fadeTime);
            }
            else
            {
                canvasGroup.alpha = enable ? 1f : 0f;
            }

            if (_isNotChangeGroupSetting == false)
            {
                canvasGroup.blocksRaycasts = enable;
            }
        }
    public virtual void hide(float duration, OnCompleteDelegate completeEvent = null)
    {
        if (!canvasGroup)
        {
            canvasGroup = GetComponentsInChildren <CanvasGroup>(true)[0];
        }

        if (canvasGroup)
        {
            canvasGroup.alpha = 1;
            canvasGroup.DOKill(true);
            canvasGroup.DOFade(0, duration).OnComplete(
                () => {
                if (completeEvent != null)
                {
                    completeEvent();
                }
                gameObject.SetActive(false);
//                    print(name+"hide complete");
            });
        }
        else
        {
            Debug.LogError(name + "CanvasGroup not exist");
        }
    }
Esempio n. 5
0
        public void Show()
        {
            SetData();

            canvasGroup.DOKill();
            canvasGroup.alpha = 0;
            gameObject.SetActive(true);
            canvasGroup.DOFade(1, 0.5f);
        }
Esempio n. 6
0
 public virtual void Show(float delay = 1)
 {
     m_CanvasGroup.DOKill(true);
     m_CanvasGroup.DOFade(m_StartAlpha, delay).OnComplete(() =>
     {
         m_CanvasGroup.interactable   = true;
         m_CanvasGroup.blocksRaycasts = true;
     });
 }
Esempio n. 7
0
 public void Reset()
 {
     suspected.enabled    = false;
     gridImage.sprite     = themeManager.iconUnknownTool.sprite;
     gridCollider.enabled = true;
     gridCanvas.DOKill();
     gridCanvas.alpha = alphaUnknown;
     gridInfo         = 0;
     isExplored       = false;
     isSuspected      = false;
 }
Esempio n. 8
0
    public override void Show()
    {
        this.transform.SetAsLastSibling();
        cg.DOKill();
        cg.blocksRaycasts = true;
        cg.interactable   = true;
        //cg.DOFade(1f, 0.3f);
        Tweener tweener = transform.DOMoveY(showY, 0.3f);

        tweener.SetEase(Ease.InBounce);
    }
Esempio n. 9
0
    public void Select()
    {
        if (isSelected)
        {
            return;
        }

        isSelected = true;

        selectedCanvas.DOKill();
        selectedCanvas.DOFade(1f, tweenDuration).SetEase(tweenEase);
    }
Esempio n. 10
0
    public void Show()
    {
        if (isShown)
        {
            return;
        }

        isShown = true;

        contentCanvas.DOKill();
        contentCanvas.DOFade(1f, tweenDuration).SetEase(tweenEase);
    }
Esempio n. 11
0
 public void SetVisible(bool isVisible)
 {
     CanvasGroup.DOKill();
     if (isVisible)
     {
         CanvasGroup.alpha = 1;
     }
     else
     {
         CanvasGroup.alpha = 0;
     }
 }
Esempio n. 12
0
    public void Focus()
    {
        isFocused = true;
        transform.DOKill();
        transform.DOScale(1.1f * Vector3.one, 0.5f);

        canvas.DOKill();
        canvas.DOFade(1f, 0.5f);
        canvas.interactable = true;

        EventSystem.current.SetSelectedGameObject(DefaultSelector);
    }
Esempio n. 13
0
 private async UniTask Enter()
 {
     canvas.enabled             = true;
     canvas.overrideSorting     = true;
     canvas.sortingOrder        = NavigationSortingOrder.RewardOverlay;
     canvasGroup.enabled        = true;
     canvasGroup.blocksRaycasts = true;
     canvasGroup.interactable   = true;
     canvasGroup.DOKill();
     canvasGroup.DOFade(1, 0.4f).SetEase(Ease.OutCubic);
     Context.SetMajorCanvasBlockRaycasts(false);
     await UniTask.Delay(TimeSpan.FromSeconds(0.4f));
 }
 public virtual void HidePopup()
 {
     canvasGroup.DOKill();
     if (rect == null)
     {
         rect = GetComponent <RectTransform>();
     }
     transform.DOScale(0f, 0.65f).SetEase(Ease.InOutBack).OnComplete(() => gameObject.SetActive(false));
     if (canvasGroup != null)
     {
         canvasGroup.DOFade(0, 0.4f).SetEase(Ease.OutSine);
     }
 }
Esempio n. 15
0
    public void FadeOut(Action complete = null, bool instant = false)
    {
        m_fadeCanvasGroup.DOKill();

        m_fadeCanvasGroup.blocksRaycasts = true;

        m_fadeCanvasGroup
        .DOFade(1f, instant ? 0f : m_fadeDuration)
        .SetEase(Ease.InOutQuad)
        .OnComplete(() =>
        {
            complete?.Invoke();
        });
    }
Esempio n. 16
0
        public void SetVisible(bool visiable)
        {
            if (this.visiable != visiable)
            {
                this.visiable = visiable;
                gameObject.SetActive(visiable);

                if (visiable)
                {
                    canvasGroup.DOKill();
                    canvasGroup.alpha = 1;
                }
            }
        }
Esempio n. 17
0
    public void Invulnerability()
    {
        invulnerabilityTimer = 0;
        invulnerability      = true;
        YellowColor();
        UiShield.DecreaseFillValue(invulnerabilityDuration);

        //Invu Vignette
        invuVignette.alpha = 1;
        invuVignette.DOKill();
        invuVignette.DOFade(0.5f, invulnerabilityDuration).OnComplete(() =>
        {
            invuVignette.DOFade(0f, 1);
        });
    }
Esempio n. 18
0
        public void Play(int centerId, float targetAlpha)
        {
            if (centerId == _centerId || _id == centerId || (_lastCenterId == centerId && _canvasGroup.alpha == targetAlpha) || myItem.IsCenter)
            {
                return;
            }
            _lastCenterId = _centerId;
            _centerId     = centerId;
            if (_getItem(centerId).GetDistance(myItem) <= _radius)
            {
                if (targetAlpha == 0)
                {
                    myItem.MyImage.raycastTarget = false;
                }
                else
                {
                    myItem.MyImage.raycastTarget = true;
                }
                _canvasGroup.DOKill();
                _canvasGroup.DOFade(targetAlpha, 0.5f).OnComplete(() =>
                {
                    _lastCenterId = _centerId;
                    _centerId     = -1;
                });

                StartCoroutine(WaitFade(centerId, targetAlpha));
            }
        }
Esempio n. 19
0
    public async UniTask <int> PostCardAnimation()
    {
        int swipeStep = Services.data.swipeCount;

        unitPanel.SetActive(swipeStep >= 2);

        if (swipeStep == 0)
        {
            myEnergy.SetActive(true);
            CanvasGroup group = myEnergy.GetComponent <CanvasGroup> ();
            group.alpha = 0;
            await group.DOFade(1f, 0.7f).AsyncWaitForCompletion();

            group.DOKill();
        }
        else if (swipeStep == 2)
        {
            unitPanel.SetActive(true);
            CanvasGroup group = unitPanel.GetComponent <CanvasGroup> ();
            group.alpha = 0;
            await group.DOFade(1f, 0.7f).AsyncWaitForCompletion();

            group.DOKill();
        }

        return(1);
    }
Esempio n. 20
0
    public void OnFirstTutorial(CanvasGroup canvasGroup)
    {
        currentCanvasGroup.DOKill();
        currentCanvasGroup.interactable   = false;
        currentCanvasGroup.blocksRaycasts = false;
        float setsDel = 0;

        if (canvasGroup.transform.name == "T (7)")
        {
            setsDel = 0;
            currentCanvasGroup.DOFade(0, .3f).SetDelay(0);
        }
        else
        {
            setsDel = .3f;
            currentCanvasGroup.DOFade(0, .3f).SetDelay(.1f);
        }
        canvasGroup.DOKill();
        canvasGroup.DOFade(1, .3f).OnComplete(delegate
        {
            canvasGroup.interactable   = true;
            canvasGroup.blocksRaycasts = true;
            currentCanvasGroup         = canvasGroup;
        });
        if (canvasGroup.transform.name == "T (7)" || canvasGroup.transform.name == "T (5)")
        {
            bbqs.DOFade(0, .5f);
        }
        else if (canvasGroup.transform.name != "T (7)" && canvasGroup.transform.name != "T (5)" && canvasGroup.transform.name != "MainTutorial")
        {
            bbqs.DOFade(1, .5f);
        }
    }
        public Tween SetAlpha(float alpha, float duration)
        {
            CreateTweenerSettingsIfNull(ref FadeTweenSettings);

            // If the alpha is greater than 0 enable the gameobject
            if (alpha > 0 && !CanvasGroup.gameObject.activeSelf)
            {
                CanvasGroup.gameObject.SetActive(true);
            }

            CanvasGroup.DOKill();

            // If instant just set the values
            if (duration == 0)
            {
                CanvasGroup.alpha = alpha;
                if (DisableGameObjectWhenInvisible && alpha == 0)
                {
                    CanvasGroup.gameObject.SetActive(false);
                }
            }
            else                 // If not instant then tween
            {
                fadeTween = CanvasGroup.DOFade(alpha, duration).ApplySettings(FadeTweenSettings).SetUpdate(true);
                fadeTween = CanvasGroup.DOFade(alpha, duration).ApplySettings(FadeTweenSettings).SetUpdate(true);
                if (DisableGameObjectWhenInvisible && alpha == 0)
                {
                    fadeTween.onComplete += () => canvasGroup.gameObject.SetActive(false);
                }
            }

            return(fadeTween);
        }
Esempio n. 22
0
 private void OnEnable()
 {
     background.color = Color.white;
     cg.alpha         = 0f;
     cg.DOKill();
     cg.DOFade(1f, 0.25f);
 }
Esempio n. 23
0
    public void show(float duration, OnCompleteDelegate completeEvent = null)
    {
        print(name + " show start");
        if (canvasGroup == null)
        {
            canvasGroup = GetComponent <CanvasGroup>();
        }
        canvasGroup.DOKill(true);
        canvasGroup.alpha = 0;
        activate();
        if (canvasGroup)
        {
            canvasGroup.DOFade(1, duration).OnComplete(
                () => {
                print(name + "show complete");

                if (completeEvent != null)
                {
                    completeEvent();
                }
            });
        }
        else
        {
            Debug.LogError("No canvas Group!");
        }
    }
Esempio n. 24
0
        public void SetVisibilityInstant(bool show)
        {
            Init();

            if (show)
            {
                Visible = true;
            }
            else
            {
                Visible = false;
            }

            rt.DOKill();
            Vector2 move;

            if (!show)
            {
                move  = MoveVectors[(int)moveInType];
                move *= distance;
                rt.anchoredPosition = homePosition - move;
            }
            else
            {
                move  = MoveVectors[(int)moveOutType];
                move *= distance;
                rt.anchoredPosition = homePosition;
            }

            if (canvasGroup == null)
            {
                return;
            }

            canvasGroup.interactable   = show;
            canvasGroup.blocksRaycasts = show;

            canvasGroup.DOKill();
            if (!show)
            {
                canvasGroup.alpha = 0;
            }
            else
            {
                canvasGroup.alpha = 1;
            }
        }
    public void Open(TweenCallback onComplete)
    {
        if (isOpen)
        {
            return;
        }
        isOpen = true;
        bgTr.gameObject.SetActive(true);

        if (bgImage != null)
        {
            bgImage.DOKill();
            bgImage.DOFade(bgImageAlpha, openTime * 0.75f).SetUpdate(true);
        }

        if (backBg != null)
        {
            backBg.gameObject.SetActive(true);
            backBg.DOKill();
            backBg.DOFade(backBgAlpha, openTime).SetUpdate(true);
        }

        if (content != null)
        {
            content.gameObject.SetActive(true);


            bgTr.DOKill();
            bgTr.DOSizeDelta(bigV, openTime).SetEase(openEase).SetUpdate(true);

            content.DOKill();
            content.DOFade(1, openTime).SetDelay(openTime * 0.75f).SetEase(openEase).OnComplete(delegate()
            {
                content.blocksRaycasts = true;
                if (onComplete != null)
                {
                    onComplete.Invoke();
                }
            }).SetUpdate(true);
        }
        else
        {
            bgTr.DOKill();
            bgTr.DOSizeDelta(bigV, openTime).SetEase(openEase).OnComplete(onComplete).SetUpdate(true);
        }
    }
Esempio n. 26
0
 private async UniTask Enter()
 {
     backdropImage.DOKill();
     backdropImage.SetAlpha(0.7f);
     IsActive                   = true;
     canvas.enabled             = true;
     canvas.overrideSorting     = true;
     canvas.sortingOrder        = NavigationSortingOrder.DialogueOverlay;
     canvasGroup.enabled        = true;
     canvasGroup.blocksRaycasts = true;
     canvasGroup.interactable   = true;
     canvasGroup.DOKill();
     canvasGroup.DOFade(1, 0.4f).SetEase(Ease.OutCubic);
     parent.SetActive(true);
     Context.SetMajorCanvasBlockRaycasts(false);
     await UniTask.Delay(TimeSpan.FromSeconds(0.4f));
 }
Esempio n. 27
0
    public void Fadeout(GameObject go, TweenCallback fun = null, float duration = 0.2f)
    {
        CanvasGroup group = Get <CanvasGroup>(go);

        group.alpha = 1.0f;
        go.SetActive(true);
        group.DOKill();
        group.DOFade(0.0f, duration).OnComplete(fun);
    }
Esempio n. 28
0
 public void Click_Start()
 {
     buttonStart.DOKill();
     buttonStart.DOFade(0f, 0f);
     buttonStart.DOFade(1f, 0.2f).SetEase(Ease.Linear).SetLoops(6, LoopType.Yoyo).OnComplete(() =>
     {
         PlayManager.Instance.LoadScene(Data.scene_home);
     });
 }
Esempio n. 29
0
 public void ShowPanel(CanvasGroup canvasGroup)
 {
     canvasGroup.blocksRaycasts = false;
     canvasGroup.DOKill();
     canvasGroup.DOFade(0, 0.3f).OnComplete(() =>
     {
         canvasGroup.DOFade(1, 0.5f).OnComplete(() => canvasGroup.blocksRaycasts = true);
     });
 }
Esempio n. 30
0
        public void Close(TweenCallback onComplete = null)
        {
            if (!isOpen)
            {
                if (onComplete != null)
                    onComplete.Invoke();
            }

            isOpen = false;

            float delay = content == null || instantHideContent ? 0 : exitTime * 0.75f;

            //Le content se fade-out en premier
            if (content != null)
            {
                content.DOKill();
                if (instantHideContent)
                    content.alpha = 0;
                else
                    content.DOFade(0, exitTime * 0.75f).SetEase(exitEase).SetUpdate(true);
                content.blocksRaycasts = false;
            }

            //Le reste a du délai (potentiellement)
            if (bgImage != null)
            {
                bgImage.DOKill();
                bgImage.DOFade(fadeStart, exitTime).SetDelay(delay).SetUpdate(true);
            }

            if (backBg != null)
            {
                backBg.DOKill();
                backBg.DOFade(0, exitTime + delay).SetUpdate(true);//.SetDelay(delay);
            }

            bgTr.DOKill();
            bgTr.DOSizeDelta(smallV, exitTime).SetDelay(delay).SetEase(exitEase).OnComplete(delegate ()
            {
                bgTr.gameObject.SetActive(false);
                if (onComplete != null)
                    onComplete.Invoke();
            }).SetUpdate(true);
        }