Esempio n. 1
0
    private void GameManager_OnGamestateChange(EGameStates Param1)
    {
        if (Param1 != EGameStates.GameOver)
        {
            return;
        }
        childGameover.SetActive(true);
        canvasGroup?.DOFade(1, fadeTime).OnComplete(() =>
        {
            Destroy(canvasGroup);

            bCanRestart = true;
        });
    }
    private void GameManager_OnGamestateChange(EGameStates Param1)
    {
        switch (Param1)
        {
        case EGameStates.MainMenu:
            break;

        case EGameStates.GameBegin:
            break;

        case EGameStates.GameOver:
            canvasGroup?.DOFade(0, fadeTime).OnComplete(() =>
            {
                gameObject.SetActive(false);
            });
            break;

        case EGameStates.RoundOver:
            break;

        default:
            break;
        }
    }
Esempio n. 3
0
 public void OnOK()
 {
     FindObjectOfType <Sound>().PlaySound(FX.Click);
     fader.DOFade(0, .5f).OnComplete(() =>
     {
         callback?.Invoke(true);
         gameObject.SetActive(false);
         dynamicCard?.gameObject.SetActive(false);
         dynamicMissionCard?.gameObject.SetActive(false);
     });
     cg?.DOFade(0, .2f);
     cg2?.DOFade(0, .2f);
     transform.GetChild(1).DOScale(.85f, .5f).SetEase(Ease.OutExpo);
     transform.GetChild(2)?.DOScale(.85f, .5f).SetEase(Ease.OutExpo);
 }
    private void BeginGame()
    {
        if (bClicked)
        {
            return;
        }
        bClicked = true;

        GameManager.Instance.ChangeGameState(EGameStates.GameBegin);
        canvasGroup?.DOFade(0, fadeTime).OnComplete(() =>
        {
            Destroy(canvasGroup);

            gameObject.SetActive(false);
        });
    }
Esempio n. 5
0
    //ユニットアイコンを消す
    void UnitIconFadeOut()
    {
        CanvasGroup battlerCanvasGroup = battler.GetComponent <CanvasGroup> ();

        battlerCanvasGroup.DOFade(0, 0.3f);
    }
Esempio n. 6
0
 private void ShowController()
 {
     controller.DOFade(1, 0.5f);
     controller.interactable   = true;
     controller.blocksRaycasts = true;
 }
    void Update()
    {
        if (planet.Harvested)
        {
            Destroy(gameObject);
            return;
        }

        if (!generatedSeeds)
        {
            for (int i = 0; i < planet.SeedYield; ++i)
            {
                Instantiate(DisplaySeed, SeedIndicatorRegion);
            }
            generatedSeeds = true;
        }

        transform.position = planet.transform.position + Camera.main.transform.up * (planet.Bounds.extents.x + 0.25f);

        Vector3 camOffset = transform.position - Camera.main.transform.position;

        transform.rotation = Quaternion.LookRotation(camOffset, Camera.main.transform.up);

        if (Application.isPlaying)
        {
            float dist = camOffset.magnitude;

            var m = (PlayerControl.SceneInstance.ActiveControllable as MonoBehaviour);
            if (m != null && m.transform != null)
            {
                dist = Mathf.Min(
                    Vector3.Distance(transform.position, (PlayerControl.SceneInstance.ActiveControllable as MonoBehaviour).transform.position),
                    dist
                    );
            }

            if (visible && dist < VanishLimit)
            {
                if (visibilityTween != null)
                {
                    visibilityTween.Kill();
                }

                visibilityTween = GraphicRoot.DOFade(0f, 0.2f);
                visible         = false;
            }
            else if (!visible && dist > VanishLimit)
            {
                if (visibilityTween != null)
                {
                    visibilityTween.Kill();
                }

                visibilityTween = GraphicRoot.DOFade(1f, 0.2f);
                visible         = true;
            }
        }
        else
        {
            if (GraphicRoot != null)
            {
                GraphicRoot.alpha = 1f;
            }
        }
    }
Esempio n. 8
0
 public void Show(float duration = 0)
 {
     canvasGroup.blocksRaycasts = true;
     canvasGroup.DOFade(1, duration);
     OnShow = true;
 }
Esempio n. 9
0
 /// <summary>
 /// Static method to animated a canvas group, as a fade effect
 /// </summary>
 /// <param name="canvasGroup">the canvas group to be animated</param>
 /// <param name="objectiveAlpha">the objective to get to as de alpha value, it starts from the value it already has</param>
 /// <param name="animationDuration">the duration of the fading</param>
 /// <param name="onceFinishAnimation">once the animation is finished</param>
 /// <param name="animEase">the type of animation ease</param>
 public static void AnimateAlpha(CanvasGroup canvasGroup, float objectiveAlpha, float animationDuration = 0.5f, TweenCallback onceFinishAnimation = null, Ease animEase = Ease.Unset)
 {
     canvasGroup.alpha = Mathf.Abs(1f - objectiveAlpha);
     canvasGroup.DOFade(objectiveAlpha, animationDuration).SetEase(animEase).OnComplete(onceFinishAnimation);
 }
Esempio n. 10
0
    IEnumerator FadeOut()
    {
        yield return(new WaitForSeconds(lifespan));

        cg.DOFade(0, fadeDuration).SetAutoKill();
    }
Esempio n. 11
0
 public void Init()
 {
     (group = GetComponent <CanvasGroup>()).alpha = 0;
     transform.localScale = Vector3.zero;
     group.DOFade(1, 0.5f);
 }
Esempio n. 12
0
 private Tween GetFadeTween()
 {
     return(m_canvasGroup.DOFade(0, m_collectTime));
 }
Esempio n. 13
0
 private void Awake()
 {
     canvasGroup       = GetComponent <CanvasGroup>();
     canvasGroup.alpha = 0;
     canvasGroup.DOFade(1, fadeDuration);
 }
Esempio n. 14
0
 public void Begin()
 {
     m_canvas.DOFade(1, 0.3f);
 }
    private void runAnimation(SceneAnimatorObject animation, SceneAnimatorData sad)
    {
//        Debug.Log("animate! " +xtarget+"x"+ytarget);
        _animating       = true;
        CurrentAnimation = animation;

        if (animation.inScene != null && sad.InObject != null && animation.inScene.gameobject)
        {
            //   RKLog.Log(animation.inScene.ToString());
            // RKLog.Log("SceneAnimator runanimation inscene: " + animation.inScene, "sceneanimator");


            SceneLoader.Instance.Show(animation.inScene.State);
            animation.inScene.gameobject.absolutePosition(new Vector2(sad.InObject.Xfrom, sad.InObject.Yfrom));
            beforeTransitionIn(animation.inScene.State);
            xyid.x = animation.inScene.gameobject.GetComponent <RectTransform>().anchoredPosition.x;
            xyid.y = animation.inScene.gameobject.GetComponent <RectTransform>().anchoredPosition.y;

            DOTween.Kill(animation.inScene.gameobject.GetComponent <RectTransform>());

            animation.inScene.gameobject.GetComponent <RectTransform>().DOAnchorPos(new Vector2(sad.InObject.Xto, sad.InObject.Yto), animation.speed).OnComplete(completeAnimation).SetEase(animation.ease).OnUpdate(UpdateTween);

            // RKLog.Log("SceneAnimator runanimation inscene: x" + sad.InObject.Xfrom +" x2: "+ sad.InObject.Xto, "sceneanimator");
            //return;
            if (sad.InObject.ForceToTop)
            {
                animation.inScene.gameobject.transform.SetAsLastSibling();
            }


            if (sad.InObject.ScaleFrom != sad.InObject.ScaleTo)
            {
                animation.inScene.gameobject.transform.localScale = new Vector2(sad.InObject.ScaleFrom, sad.InObject.ScaleFrom);
                animation.inScene.gameobject.transform.DOScale(sad.InObject.ScaleTo, animation.speed).SetEase(Ease.OutExpo);
            }

            CanvasGroup cg = animation.inScene.gameobject.GetComponent <CanvasGroup>();
            if (sad.InObject.AlphaFrom != sad.InObject.AlphaTo)
            {
                if (cg)
                {
                    cg.alpha = sad.InObject.AlphaFrom;
                    cg.DOFade(sad.InObject.AlphaTo, animation.speed);
                }
            }
            else
            {
                if (cg)
                {
                    cg.alpha = 1;
                }
            }
        }
        else
        {
            completeAnimation();
        }

        if (animation.outScene != null && animation.outScene.gameobject != null)
        {
            float x = sad.OutObject.Xto;
            float y = sad.OutObject.Yto;
            //  RKLog.Log("SceneAnimator runanimation outscene: " + animation.outScene, "sceneanimator");

            if (sad.OutObject.ForceToTop)
            {
                animation.outScene.gameobject.transform.SetAsLastSibling();
            }

            if (animation.inScene == null)
            {
                DOTween.Kill(animation.outScene.gameobject.GetComponent <RectTransform>());
                animation.outScene.gameobject.GetComponent <RectTransform>().DOAnchorPos(new Vector2(x, y), animation.speed).SetEase(animation.ease).OnComplete(completeAnimation);
            }
            else
            {
                DOTween.Kill(animation.outScene.gameobject.GetComponent <RectTransform>());
                animation.outScene.gameobject.GetComponent <RectTransform>().DOAnchorPos(new Vector2(x, y), animation.speed).SetEase(animation.ease);
            }

            if (sad.OutObject.ScaleFrom != sad.OutObject.ScaleTo)
            {
                animation.outScene.gameobject.transform.localScale = new Vector2(sad.OutObject.ScaleFrom, sad.OutObject.ScaleFrom);
                animation.outScene.gameobject.transform.DOScale(sad.OutObject.ScaleTo, animation.speed);
            }

            CanvasGroup cg = animation.outScene.gameobject.GetComponent <CanvasGroup>();
            if (sad.OutObject.AlphaFrom != sad.OutObject.AlphaTo)
            {
                if (cg)
                {
                    cg.alpha = sad.OutObject.AlphaFrom;
                    cg.DOFade(sad.OutObject.AlphaTo, animation.speed);
                }
            }
            else
            {
                if (cg)
                {
                    cg.alpha = 1;
                }
            }
        }
        else
        {
            completeAnimation();
        }
    }
 public static Tween Show(this CanvasGroup canvasGroup, float duration = FadeDuration)
 {
     canvasGroup.gameObject.SetActive(true);
     canvasGroup.blocksRaycasts = true;
     return(canvasGroup.DOFade(NoFade, duration).From(ClearFade, true));
 }
 public static Tween Hide(this CanvasGroup canvasGroup, float duration = FadeDuration, bool turnOffObject = true)
 {
     canvasGroup.blocksRaycasts = false;
     return(canvasGroup.DOFade(ClearFade, duration).OnComplete(() => canvasGroup.gameObject.SetActive(!turnOffObject)));
 }
Esempio n. 18
0
 public void OnBtnClose()
 {
     group.DOFade(0, 0.5f).onComplete = () => Destroy(gameObject);
 }
Esempio n. 19
0
 public void FadeOut()
 {
     canvasGroup.blocksRaycasts = true;
     canvasGroup.DOFade(1, fadeTime)
     .OnComplete(() => canvasGroup.blocksRaycasts = false);
 }
Esempio n. 20
0
 // Use this for initialization
 void tenmetu()
 {
     canvasGroup.DOFade(0.0f, 0.5f).SetEase(this.EaseType).SetLoops(-1, LoopType.Yoyo);
 }
Esempio n. 21
0
 private void OnEnable()
 {
     _panelCanvasGroup.alpha = 0.0f;
     _panelCanvasGroup.DOFade(1.0f, _panelFadeDuration);
     GameTime.isPaused = true;
 }
Esempio n. 22
0
    public void OnLoginSuccess( )
    {
        CommonCanvasManager.GetInstance().ShowMessage("Login succees", null, 0.5f);
        GameObject  matchUICanvas    = GameObject.Find("match ui");
        Sequence    seq              = DOTween.Sequence();
        CanvasGroup loginCanvasGroup = GetComponent <CanvasGroup>();
        CanvasGroup matchCanvasGroup = matchUICanvas.GetComponent <CanvasGroup>();

        seq.Append(transform.DOScale(0.5f, 0.2f)).Join(loginCanvasGroup.DOFade(0, 0.2f)).Join(matchCanvasGroup.DOFade(1, 0.2f)).AppendCallback(() =>
        {
            matchCanvasGroup.interactable = true;
            Destroy(transform.parent.gameObject);
        });
    }
Esempio n. 23
0
 // Use this for initialization
 void Start()
 {
     container.DOFade(1, 0.5f).OnComplete(() => StartLoading()).SetDelay(0.5f).Play();
 }
 public void OnPointerEnter(PointerEventData eventData)
 {
     canvasGroup.DOFade(1.0f, 0.25f).SetEase(Ease.OutSine).OnComplete(() => { canvasGroup.interactable = true; });
 }
Esempio n. 25
0
 public void SetScoreText(string text)
 {
     scoreGroup.DOFade(1f, 1f);
     scoreText.text = text;
     Invoke("HideScoreText", 5f);
 }
Esempio n. 26
0
 public void FadeIn()
 {
     bg.DOFade(1, 0.5f);
 }
Esempio n. 27
0
    IEnumerator CountDownHide()
    {
        yield return(new WaitForSeconds(popDuration));

        fadeTween = canvasGroup.DOFade(0f, popDuration);
    }
Esempio n. 28
0
    public void FadeIn()
    {
        Show();

        canvasGroup.DOFade(1f, duration);
    }
Esempio n. 29
0
 // Use this for initialization
 void Start()
 {
     gameObject.AddComponent <CanvasGroup>();
     canvas = gameObject.GetComponent <CanvasGroup>();
     canvas.DOFade(0.0f, 1.0f).SetEase(Ease.InSine).SetLoops(-1, LoopType.Yoyo);
 }
Esempio n. 30
0
    public void BackPositionAction()
    {
        if (_backEffect == DragBackEffect.Keep)
        {
            return;
        }

        if (null != OnTweenStartAction)
        {
            OnTweenStartAction.Invoke(this);
        }

        switch (_backEffect)
        {
        case DragBackEffect.Destroy:
            Destroy(_tool.gameObject);
            break;

        case DragBackEffect.TweenPosition:
            this.enabled = false;
            _canDrag     = false;
            if (_prevParent)
            {
                _tool.SetParent(_prevParent);
            }
            _tool.DOLocalRotate(_toolCacheRotation, _backDuring).SetEase(_tweenEase);
            _tool.DOScale(_toolCacheScale, _backDuring).SetEase(_tweenEase);

            Canvas canvas = BackKeepTop();
            _tool.DOLocalMove(_toolCachePosition, _backDuring).SetEase(_tweenEase).OnComplete(() =>
            {
                if (canvas && _tool.GetComponent <GraphicRaycaster>() == null)
                {
                    Destroy(canvas);
                }
                this.enabled = true;
                _canDrag     = true;
                _tool.SetSiblingIndex(_toolCacheIndex);
                OnTweenOver();
            });
            break;

        case DragBackEffect.TweenScale:
            this.enabled = false;
            _canDrag     = false;
            if (_prevParent)
            {
                _tool.SetParent(_prevParent);
            }
            _tool.localPosition    = _toolCachePosition;
            _tool.localScale       = Vector3.zero;
            _tool.localEulerAngles = _toolCacheRotation;

            canvas = BackKeepTop();
            _tool.DOScale(_toolCacheScale, _backDuring).SetEase(_tweenEase).OnComplete(() =>
            {
                if (canvas && _tool.GetComponent <GraphicRaycaster>() == null)
                {
                    Destroy(canvas);
                }
                this.enabled = true;
                _canDrag     = true;
                _tool.SetSiblingIndex(_toolCacheIndex);
                OnTweenOver();
            });
            break;

        case DragBackEffect.ScaleDestroy:
            this.enabled = false;
            _canDrag     = false;
            _tool.DOScale(Vector3.zero, _backDuring).SetEase(_tweenEase).OnComplete(() =>
            {
                Destroy(_tool.gameObject);
                OnTweenOver();
            });
            break;

        case DragBackEffect.FadeOutDestroy:
            this.enabled = false;
            _canDrag     = false;
            CanvasGroup group = _tool.gameObject.AddComponent <CanvasGroup>();
            group.blocksRaycasts = false;
            group.DOFade(0f, _backDuring).SetEase(_tweenEase).OnComplete(() =>
            {
                Destroy(_tool.gameObject);
                OnTweenOver();
            });
            break;

        default:
            if (_prevParent)
            {
                _tool.SetParent(_prevParent);
            }
            _tool.localPosition    = _toolCachePosition;
            _tool.localScale       = _toolCacheScale;
            _tool.localEulerAngles = _toolCacheRotation;
            _tool.SetSiblingIndex(_toolCacheIndex);
            _canDrag    = true;
            _isDown     = false;
            _isDragging = false;
            Canvas canvas2 = _tool.gameObject.GetComponent <Canvas>();
            if (canvas2 && _tool.GetComponent <GraphicRaycaster>() == null)
            {
                Destroy(canvas2);
            }
            break;
        }
    }