public override void build(SequenceControl seq, Track track, int index, UnityEngine.Object target)
        {
            PropertyTrack propTrack = track as PropertyTrack;

            if (endFrame == -1 && canTween && propTrack.canTween)
            {
                return;
            }

            PropertyTrack.ValueType valueType = propTrack.valueType;

            //get component and fill the cached method info
            Component comp = propTrack.GetTargetComp(target as GameObject);

            if (comp == null)
            {
                return;
            }

            string varName = propTrack.getMemberName();

            int frameRate = seq.take.frameRate;

            //change to use setvalue track in AMSequence
            if (!string.IsNullOrEmpty(varName))
            {
                propTrack.RefreshData(comp);

                //allow tracks with just one key
                if (!propTrack.canTween || !canTween || track.keys.Count == 1)
                {
                    seq.Insert(this, GenerateSingleValueTweener(seq, propTrack, frameRate, comp));
                }
                else
                {
                    //grab end frame
                    var endKey = track.keys[index + 1] as PropertyKey;

                    if (targetsAreEqual(valueType, endKey))
                    {
                        return;
                    }

                    Tweener tween = null;

                    PropertyInfo propInfo = propTrack.GetCachedPropertyInfo();
                    if (propInfo != null)
                    {
                        switch (valueType)
                        {
                        case PropertyTrack.ValueType.Integer:
                            tween = DOTween.To(new IntPlugin(), () => System.Convert.ToInt32(propInfo.GetValue(comp, null)), (x) => propInfo.SetValue(comp, x, null), System.Convert.ToInt32(endKey.val), getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Float:
                            tween = DOTween.To(new FloatPlugin(), () => System.Convert.ToSingle(propInfo.GetValue(comp, null)), (x) => propInfo.SetValue(comp, x, null), System.Convert.ToSingle(endKey.val), getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Double:
                            tween = DOTween.To(new DoublePlugin(), () => System.Convert.ToDouble(propInfo.GetValue(comp, null)), (x) => propInfo.SetValue(comp, x, null), endKey.val, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Long:
                            tween = DOTween.To(new LongPlugin(), () => System.Convert.ToInt64(propInfo.GetValue(comp, null)), (x) => propInfo.SetValue(comp, x, null), System.Convert.ToInt64(endKey.val), getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Vector2:
                            tween = DOTween.To(TweenPluginFactory.CreateVector2(), () => (Vector2)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.vect2, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Vector3:
                            tween = DOTween.To(TweenPluginFactory.CreateVector3(), () => (Vector3)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.vect3, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Color:
                            tween = DOTween.To(TweenPluginFactory.CreateColor(), () => (Color)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.color, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Rect:
                            tween = DOTween.To(new RectPlugin(), () => (Rect)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.rect, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Vector4:
                            tween = DOTween.To(TweenPluginFactory.CreateVector4(), () => (Vector4)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.vect4, getTime(frameRate)); break;

                        case PropertyTrack.ValueType.Quaternion:
                            tween = DOTween.To(new PureQuaternionPlugin(), () => (Quaternion)propInfo.GetValue(comp, null), (x) => propInfo.SetValue(comp, x, null), endKey.quat, getTime(frameRate)); break;
                        }
                    }
                    else
                    {
                        FieldInfo fieldInfo = propTrack.GetCachedFieldInfo();
                        if (fieldInfo != null)
                        {
                            switch (valueType)
                            {
                            case PropertyTrack.ValueType.Integer:
                                tween = DOTween.To(new IntPlugin(), () => System.Convert.ToInt32(fieldInfo.GetValue(comp)), (x) => fieldInfo.SetValue(comp, x), System.Convert.ToInt32(endKey.val), getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Float:
                                tween = DOTween.To(new FloatPlugin(), () => System.Convert.ToSingle(fieldInfo.GetValue(comp)), (x) => fieldInfo.SetValue(comp, x), System.Convert.ToSingle(endKey.val), getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Double:
                                tween = DOTween.To(new DoublePlugin(), () => System.Convert.ToDouble(fieldInfo.GetValue(comp)), (x) => fieldInfo.SetValue(comp, x), endKey.val, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Long:
                                tween = DOTween.To(new LongPlugin(), () => System.Convert.ToInt64(fieldInfo.GetValue(comp)), (x) => fieldInfo.SetValue(comp, x), System.Convert.ToInt64(endKey.val), getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Vector2:
                                tween = DOTween.To(TweenPluginFactory.CreateVector2(), () => (Vector2)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.vect2, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Vector3:
                                tween = DOTween.To(TweenPluginFactory.CreateVector3(), () => (Vector3)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.vect3, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Color:
                                tween = DOTween.To(TweenPluginFactory.CreateColor(), () => (Color)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.color, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Rect:
                                tween = DOTween.To(new RectPlugin(), () => (Rect)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.rect, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Vector4:
                                tween = DOTween.To(TweenPluginFactory.CreateVector4(), () => (Vector4)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.vect4, getTime(frameRate)); break;

                            case PropertyTrack.ValueType.Quaternion:
                                tween = DOTween.To(new PureQuaternionPlugin(), () => (Quaternion)fieldInfo.GetValue(comp), (x) => fieldInfo.SetValue(comp, x), endKey.quat, getTime(frameRate)); break;
                            }
                        }
                    }

                    if (tween != null)
                    {
                        if (hasCustomEase())
                        {
                            tween.SetEase(easeCurve);
                        }
                        else
                        {
                            tween.SetEase((Ease)easeType, amplitude, period);
                        }

                        seq.Insert(this, tween);
                    }
                }
            }
            else
            {
                Debug.LogError("Animator: No FieldInfo or PropertyInfo set.");
            }

            return;
        }
Exemplo n.º 2
0
    public void SlowMo(float targetSpeed, float timeToGetToSpeed, float durationOfSlow)
    {
        Tween myTween = DOTween.To(() => Time.timeScale, x => Time.timeScale = x, targetSpeed, timeToGetToSpeed);

        StartCoroutine(StopSlowMo(timeToGetToSpeed, durationOfSlow, myTween));
    }
        Tweener GenerateSingleValueTweener(SequenceControl seq, PropertyTrack propTrack, float frameRate, Component comp)
        {
            float numFrames = endFrame == -1 ? 1f : (float)(endFrame - frame);
            float time      = numFrames / frameRate;

            switch (propTrack.valueType)
            {
            case PropertyTrack.ValueType.Integer: {
                int _val  = System.Convert.ToInt32(val);
                var tween = DOTween.To(new TweenPlugValueSet <int>(), GenerateGetter <int>(propTrack, comp), GenerateSetter <int>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Float: {
                float _val  = System.Convert.ToSingle(val);
                var   tween = DOTween.To(new TweenPlugValueSet <float>(), GenerateGetter <float>(propTrack, comp), GenerateSetter <float>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Double: {
                var tween = DOTween.To(new TweenPlugValueSet <double>(), GenerateGetter <double>(propTrack, comp), GenerateSetter <double>(propTrack, comp), val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Long: {
                long _val  = System.Convert.ToInt64(val);
                var  tween = DOTween.To(new TweenPlugValueSet <long>(), GenerateGetter <long>(propTrack, comp), GenerateSetter <long>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Vector2: {
                Vector2 _val  = vect2;
                var     tween = DOTween.To(new TweenPlugValueSet <Vector2>(), GenerateGetter <Vector2>(propTrack, comp), GenerateSetter <Vector2>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Vector3: {
                Vector3 _val  = vect3;
                var     tween = DOTween.To(new TweenPlugValueSet <Vector3>(), GenerateGetter <Vector3>(propTrack, comp), GenerateSetter <Vector3>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Color: {
                Color _val  = color;
                var   tween = DOTween.To(new TweenPlugValueSet <Color>(), GenerateGetter <Color>(propTrack, comp), GenerateSetter <Color>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Rect: {
                Rect _val  = rect;
                var  tween = DOTween.To(new TweenPlugValueSet <Rect>(), GenerateGetter <Rect>(propTrack, comp), GenerateSetter <Rect>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Vector4: {
                var tween = DOTween.To(new TweenPlugValueSet <Vector4>(), GenerateGetter <Vector4>(propTrack, comp), GenerateSetter <Vector4>(propTrack, comp), vect4, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Quaternion: {
                Quaternion _val  = quat;
                var        tween = DOTween.To(new TweenPlugValueSet <Quaternion>(), GenerateGetter <Quaternion>(propTrack, comp), GenerateSetter <Quaternion>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Bool: {
                bool _val  = valb;
                var  tween = DOTween.To(new TweenPlugValueSet <bool>(), GenerateGetter <bool>(propTrack, comp), GenerateSetter <bool>(propTrack, comp), _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.String: {
                var tween = DOTween.To(new TweenPlugValueSet <string>(), GenerateGetter <string>(propTrack, comp), GenerateSetter <string>(propTrack, comp), valString, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Sprite: {
                var spriteRenderer = comp as SpriteRenderer;
                var _val           = valObj as Sprite;
                var tween          = DOTween.To(new TweenPlugValueSet <Sprite>(), () => spriteRenderer.sprite, (x) => spriteRenderer.sprite = x, _val, time);
                return(tween);
            }

            case PropertyTrack.ValueType.Enum: {
                System.Type infType = propTrack.GetCachedInfoType(seq.target);
                object      enumVal = infType != null?System.Enum.ToObject(infType, (int)val) : null;

                if (enumVal != null)
                {
                    var tween = DOTween.To(new TweenPlugValueSet <object>(), GenerateGetter <object>(propTrack, comp), GenerateSetter <object>(propTrack, comp), enumVal, time);
                    return(tween);
                }
                else
                {
                    Debug.LogError("Invalid enum value.");
                    break;
                }
            }
            }
            return(null); //no type match
        }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     DOTween.Init();
     NetworkManager.Instance.Init();
     BattleManager.Instance.Init(mObj);
 }
Exemplo n.º 5
0
 public void Set_Pos_Level_Parts_Tweens()
 {
     DOTween.KillAll();
     Level_Parts_Home.transform.localPosition = Initial_Level_Parts;
 }
 // Start is called before the first frame update
 void Start()
 {
     DOTween.Init(true, false, LogBehaviour.ErrorsOnly);
     blurMaterial = blurRenderer.material;
 }
Exemplo n.º 7
0
 public void Hide()
 {
     DOTween.To(() => lift, (x) => lift = x, maxLift, liftTime).SetEase(Ease.OutQuad).OnComplete(() => { gameObject.SetActive(false); });
 }
Exemplo n.º 8
0
    void Awake()
    {
        //DOTween.Init();
        //DOTween.defaultAutoPlay = AutoPlay.None;

        //初期位置設定
        Button.transform.localPosition = new Vector3(0, -100f, 0);
        Button.SetActive(false);
        TextSaved.gameObject.SetActive(true);
        TextSaved.localScale = new Vector3(0f, 0f, 1f);
        TextSavedColor.color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheck.gameObject.SetActive(true);
        ContinueCheck.localScale    = new Vector3(0f, 0f, 1f);
        ContinueCheckColor[0].color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheckColor[1].color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheckColor[1].text  = CountStartNumber.ToString();
        ThankyouMessage.color       = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);


        //セーブ完了

        StartTween.Insert(3f, DOVirtual.DelayedCall(3f, () => {
            TextSaved.DOScale(new Vector3(1f, 1f, 1f), 0.5f).SetEase(Ease.OutQuint);
            DOTween.ToAlpha(() => TextSavedColor.color,
                            color => TextSavedColor.color = color, 1f, 0.5f
                            );
        }));

        StartTween.Insert(4f, DOVirtual.DelayedCall(5f, () => {
            TextSaved.DOScale(new Vector3(1.5f, 1.5f, 1f), 0.5f).SetEase(Ease.OutQuint);
            DOTween.ToAlpha(() => TextSavedColor.color,
                            color => TextSavedColor.color = color, 0f, 0.5f
                            );
        }));

        //コンティニュー確認
        StartTween.Insert(5f, DOVirtual.DelayedCall(6f, () => {
            DOTween.ToAlpha(() => ContinueCheckColor[0].color,
                            color => ContinueCheckColor[0].color = color, 1f, 1f
                            );
            DOTween.ToAlpha(() => ContinueCheckColor[1].color,
                            color => ContinueCheckColor[1].color = color, 1f, 1f
                            );
            ContinueCheck.DOScale(new Vector3(1f, 1f, 1f), 1f).SetEase(Ease.OutQuint);
        }));

        StartTween.Insert(9f, DOVirtual.DelayedCall(6f, () => {
            Button.SetActive(true);
        }));
        StartTween.Insert(9f, DOVirtual.DelayedCall(8f, () => {
            CountdownFlag = true;
        }));

        //ボタン
        StartTween.Insert(9f,
                          DOVirtual.DelayedCall(6f, () =>
        {
            Button.transform.DOLocalMoveY(0, 0.5f).SetEase(Ease.OutQuint);
        }
                                                )
                          );

        //BGM 設定
        string path = "Audio/endscreen.wav";

        StartCoroutine(GetAudioClip(path));

        if (!DebugMode)
        {
            //SceneChange
            SceneChange = GameObject.Find("SceneChangeEnd");

            float           timeDelay = 0.5f;
            GameObject[]    changer   = new GameObject[4];
            RectTransform[] rectTran  = new RectTransform[4];

            for (int i = 0; i < 4; i++)
            {
                changer[i]  = GameObject.Find("SceneChangeEnd").transform.Find(i.ToString()).gameObject;
                rectTran[i] = changer[i].GetComponent <RectTransform>();
            }

            sceneChangeTween = DOTween.Sequence();
            for (int i = 0; i < 4; i++)
            {
                sceneChangeTween.Insert(1 + 0.25f * (3 - i),
                                        rectTran[i].DOLocalMoveX(-1280, timeDelay).SetEase(Ease.OutQuint)
                                        );
            }

            sceneChangeTween.Join(
                DOVirtual.DelayedCall(6f, () =>
            {
                Destroy(SceneChange);
            })
                );
        }
    }
Exemplo n.º 9
0
 public void ChangeDepthOfField(float distance)
 {
     DOTween.To(() => _depthOfField.focalLength.value, value => _depthOfField.focalLength.value = value,
                distance, changeDepthOfFieldTimer);
 }
Exemplo n.º 10
0
 // Called by RESTART button OnClick event. Restarts all tweens
 public void RestartTweens()
 {
     DOTween.RestartAll();
 }
Exemplo n.º 11
0
    void Construct()
    {
        this.textResultTime        = this.gameObject.transform.Find("TextResultTime").GetComponent <TextMeshProUGUI>();
        this.textNewRecord         = this.gameObject.transform.Find("TextNewRecord").GetComponent <TextMeshProUGUI>();
        this.textNewRecord.enabled = false;

        this.OnEnableAsObservable()
        .Select(_ => (this.gameMain.time.Value < this.gameMain.shortestTime.Value ||
                      this.gameMain.shortestTime.Value < Mathf.Epsilon))
        .Subscribe(isShortest => {
            Debug.Log("UIFinishController.OnEnableAsObservable(): time=" + this.gameMain.time.Value +
                      ", shortestTime=" + this.gameMain.shortestTime.Value + ", isShortest=" + isShortest.ToString());

            this.rawImageResult.texture = this.screenShotController.textureScreenShot;

            this.textNewRecord.enabled = isShortest;
            if (isShortest)
            {
                this.gameMain.uiFadeIn(this.inputName);
                this.gameMain.uiFadeIn(this.buttonRegister);
                this.sequenceBlink.Play();
            }
            else
            {
                this.gameMain.uiFadeOut(this.inputName, 0.0f);
                this.gameMain.uiFadeOut(this.buttonRegister, 0.0f);
            }
        });

        this.buttonTwitter.OnClickAsObservable()
        .Subscribe(_ => {
            var t        = this.gameMain.time.Value;
            var hashTags = new string[] { "unity1week", };
            UnityRoomTweet.Tweet("landingspace", string.Format("こちら着陸スペース、{0:F2}秒で着陸しましたオーバー。", t), hashTags);
        });
        this.buttonRegister.OnClickAsObservable()
        .Subscribe(_ => {
            var typeInput       = PlayerPrefs.GetInt("PlayerInput", (int)(GameMain.InputType.RotateByLeftRight));
            var bytesScreenShot = this.screenShotController.textureScreenShot.EncodeToPNG();
            StartCoroutine(this.leaderBoardManager.SendScore(this.inputName.text, this.gameMain.time.Value, typeInput, bytesScreenShot, false));
            this.gameMain.uiFadeOut(this);
            this.gameMain.title();
        });

        this.buttonBack.OnClickAsObservable()
        .Subscribe(_ => {
            sequenceBlink.Pause();
            sequenceBlink.Rewind();
            this.textNewRecord.enabled = false;
            this.gameMain.uiFadeOut(this);
            this.gameMain.title();
        });

        this.gameMain.time.Subscribe(_ => {
            this.textResultTime.text = string.Format("{0:F2}", this.gameMain.time.Value);
        });

        this.sequenceBlink = DOTween.Sequence();
        sequenceBlink.Append(this.textNewRecord.DOFade(0.0f, 0.1f));
        sequenceBlink.Append(this.textNewRecord.DOFade(1.0f, 0.1f));
        sequenceBlink.SetLoops(-1);
    }
Exemplo n.º 12
0
 // Called by PLAY button OnClick event. Starts all tweens
 public void StartTweens()
 {
     DOTween.PlayAll();
 }
Exemplo n.º 13
0
 public void OnGameStart(string data)
 {
     DOTween.To(() => introCanvasGroup.alpha, x => introCanvasGroup.alpha = x, 0, 1).OnComplete(OnIntroCanvasComplete);
 }
Exemplo n.º 14
0
    void TakePicture()
    {
        //clear the list
        currentPlayerScores.Clear();

        RaycastHit hit;

        //populate the list with the players and their distance to the camera
        for (int i = 0; i < allPlayers.Length; i++)
        {
            allPlayers[i].canMove = false;

            Vector3     camPos    = cameraPivot.GetChild(2).position;
            Vector3     playerPos = allPlayers[i].transform.position;
            PlayerScore score     = new PlayerScore()
            {
                id = i
            };
            score.distance = Vector3.Distance(playerPos, camPos);
            score.position = playerPos;

            //raycast logic
            if (Physics.Raycast(camPos, (allPlayers[i].transform.position - camPos) + Vector3.up, out hit, 5, playerLayer))
            {
                if (hit.transform == allPlayers[i].transform)
                {
                    score.cameraVisible = true;
                }
            }

            if (!allPlayers[i].insideCameraTrigger)
            {
                score.cameraVisible = false;
            }

            if (score.cameraVisible)
            {
                currentPlayerScores.Add(score);
            }
        }

        //order the list based on the players distance to the camera
        currentPlayerScores = currentPlayerScores.OrderBy(s => s.distance).ToList();

        //add to the final score list based on the order of the current list
        for (int i = 0; i < currentPlayerScores.Count; i++)
        {
            PlayerScore player      = finalPlayerScores.Find(x => x.id == currentPlayerScores[i].id);
            int         playerIndex = finalPlayerScores.IndexOf(player);
            player.score += possibleScores[i];
            finalPlayerScores[playerIndex] = player;
        }

        //stop agents from moving
        SetAgentsDestination(Vector3.zero, true);

        cameraLight.DOIntensity(350, .02f).OnComplete(() => cameraLight.DOIntensity(0, .05f));
        cameraLight.transform.parent.DOPunchScale(Vector3.one / 3, .5f, 10, 1);

        WaitForSeconds    intervalWait = new WaitForSeconds(.1f);
        WaitForEndOfFrame frameWait    = new WaitForEndOfFrame();

        StartCoroutine(TakePhoto());

        IEnumerator TakePhoto()
        {
            yield return(intervalWait);

            renderTextureCamera.gameObject.SetActive(true);

            SetPhotoScorePosition(true);

            yield return(frameWait);

            renderTextureCamera.gameObject.SetActive(false);

            Sequence s = DOTween.Sequence();

            s.Append(pictureInterface.DOScale(1, .4f).SetEase(Ease.OutBounce));
            s.AppendInterval(1);
            for (int i = 0; i < currentPlayerScores.Count; i++)
            {
                if (i > 2)
                {
                    break;
                }
                s.Join(pictureScoreTextHolder.GetChild(i).DOScale(1, .2f).SetEase(Ease.OutBack));
            }
            s.AppendInterval(1);
            for (int i = 0; i < currentPlayerScores.Count; i++)
            {
                if (i > 2)
                {
                    break;
                }
                s.Join(pictureScoreTextHolder.GetChild(i).DOMove(playerScoreTextHolder.GetChild(currentPlayerScores[i].id).position, .4f)
                       .OnComplete(() => UpdateScore()));
            }
            s.Append(pictureInterface.DOScale(0, .4f).SetEase(Ease.InBack));
            s.AppendCallback(() => SetPhotoScorePosition(false));
        }
    }
Exemplo n.º 15
0
 /// <summary>
 /// 开始执行效果 物品效果 头顶向上移动消失
 /// </summary>
 private void StartEffect()
 {
     DOTween.To(() => _traIcon.localPosition, r => _traIcon.localPosition = r, new Vector3(_traIcon.localPosition.x, _traIcon.localPosition.y + 240f, 0f), _itemEffectTime).SetEase(Ease.InQuint);
     DOTween.To(() => _icon.color, al => _icon.color = al, new Color(_icon.color.r, _icon.color.g, _icon.color.b, 0.0f), _itemEffectTime).SetEase(Ease.InQuint).onComplete = EffectComplete;
 }
Exemplo n.º 16
0
 public void Show()
 {
     DOTween.ToAlpha(() => titleText.color, x => titleText.color = x, 1f, 0.5f).SetTarget(titleText);
 }
Exemplo n.º 17
0
    /// <summary>
    /// 曲线运动
    /// </summary>
    private async void StartCurveMove(Vector3 endPos, Transform traIcon, Image icon)
    {
        #region 方法 1
        ////圆的参数方程            x = a + r cosθ y = b + r sinθ(θ∈ [0,2π) ) (a, b) 为圆心坐标,r 为圆半径,θ 为参数,(x, y) 为经过点的坐标
        ////椭圆的参数方程          x= a cosθ  y=b sinθ(θ∈[0,2π)) a为长半轴长 b为短半轴长 θ为参数
        ////双曲线的参数方程        x= a secθ (正割) y=b tanθ a为实半轴长 b为虚半轴长 θ为参数    secθ (正割)即1/cosθ

        //var endPos = GetTargetPos();

        //Vector3[] path1 = new Vector3[3];
        //path1[0] = _traIcon.localPosition;//起始点
        //path1[1] = GetMiddlePos(_traIcon.localPosition, endPos);//中间点
        //path1[2] = endPos;//终点

        //Debug.Log("曲线运动 startPos = "+ path1[0]);
        //Debug.Log("曲线运动 GetMiddlePos = " + path1[1]);
        //Debug.Log("曲线运动 endPos = " + path1[2]);

        //var tweenPath = _traIcon.transform.DOLocalPath(path1, 1.8f, PathType.CatmullRom);//.SetEase(Ease.InQuint);
        //tweenPath.onComplete = () =>
        //{
        //    Debug.Log("曲线运动 完成 StartCurveMove ");
        //};
        #endregion

        #region 方法2

        //将屏幕坐标转换到transform的局部坐标中
        Vector2 V2InAt;
        RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)transform, endPos, Camera.main, out V2InAt);

        endPos = V2InAt;
        var r        = (endPos - traIcon.localPosition).magnitude;
        var moveTime = r / _moveSpeed;

        //方向值
        int directionValue = 1;
        if (traIcon.localPosition.x < _traIcon.localPosition.x)
        {
            directionValue = -1;
        }
        float timeAdd = 0f;
        DOTween.To(() => traIcon.localPosition,
                   (pos) =>
        {
            timeAdd += Time.deltaTime;
            var x    = curve.Evaluate(timeAdd / moveTime);

            traIcon.localPosition = pos + r * new Vector2(x, 0.0f) * directionValue;
        }, endPos, moveTime).SetEase(Ease.Linear);
        var delayTime = (int)(moveTime * 1000 - 200);
        if (delayTime > 0)
        {
            await UniTask.Delay(delayTime);
        }
        DOTween.To(() => icon.color, color => icon.color = color, new Color(icon.color.r, icon.color.g, icon.color.b, 0.0f), 0.2f);
        await UniTask.Delay(200);

        if (traIcon != _traIcon)
        {
            ObjectPoolManager.Instance.RecycleObject(_effectKey, traIcon.gameObject);
        }
        else
        {
            EffectComplete();
        }
        #endregion
    }
 public static Tween             DOTweenLocalResizeBottom(this RectTransform rt, float to, float duration) => DOTween.To(() => rt.LocalBottomY(), rt.SetLocalBottom, to, duration);
Exemplo n.º 19
0
 public void StopMoving()
 {
     DOTween.Kill(self.rectTransform);
     transform.localPosition = new Vector3(transform.localPosition.x, 0, 0);
     gameObject.SetActive(false);
 }
 public static Tween             DOTweenLocalResizeLeft(this RectTransform rt, float to, float duration) => DOTween.To(() => rt.LocalLeftX(), rt.SetLocalLeft, to, duration);
Exemplo n.º 21
0
 public void Show()
 {
     gameObject.SetActive(true);
     DOTween.To(() => maxLift, (x) => lift = x, 0, liftTime).SetEase(Ease.OutQuad);
 }
 public static Tween             DOTweenLocalResizeTop(this RectTransform rt, float to, float duration) => DOTween.To(() => rt.LocalTopY(), rt.SetLocalTop, to, duration);
Exemplo n.º 23
0
 void CloseUI()
 {
     DOTween.To(() => Vector3.one, (scale) => aniRoot.transform.localScale = scale, Vector3.zero, 0.3f)
     .OnComplete(() => { Game.UI.CloseForm(this); });
     DOTween.To(() => 0.3f, (scale) => spMask.alpha = scale, 0.01f, 0.3f);
 }
Exemplo n.º 24
0
 public void initPanelChangeSequence()
 {
     panelChangeSequence = DOTween.Sequence();
     panelChangeSequence.Append(gameObject.GetComponent <RectTransform>().DOLocalMove(enterPosition, 0.3f));
     panelChangeSequence.Append(gameObject.GetComponent <RectTransform>().DOLocalMove(mainPosition, 0.3f));
 }
Exemplo n.º 25
0
 public void SetHealthToMin()
 {
     DOTween.To(() => health, (x) => health = x, minHealth, 0.5f);
 }
Exemplo n.º 26
0
        override public void Apply()
        {
            GearSizeValue gv;

            if (!_storage.TryGetValue(_controller.selectedPageId, out gv))
            {
                gv = _default;
            }

            if (tween && UIPackage._constructing == 0 && !disableAllTweenEffect)
            {
                if (tweener != null)
                {
                    if (_tweenTarget.width != gv.width || _tweenTarget.height != gv.height ||
                        _tweenTarget.scaleX != gv.scaleX || _tweenTarget.scaleY != gv.scaleY)
                    {
                        tweener.Kill(true);
                        tweener = null;
                    }
                    else
                    {
                        return;
                    }
                }

                bool a = gv.width != _owner.width || gv.height != _owner.height;
                bool b = gv.scaleX != _owner.scaleX || gv.scaleY != _owner.scaleY;
                if (a || b)
                {
                    if (_owner.CheckGearController(0, _controller))
                    {
                        _displayLockToken = _owner.AddDisplayLock();
                    }
                    _tweenTarget = gv;

                    tweener = DOTween.To(() => new Vector4(_owner.width, _owner.height, _owner.scaleX, _owner.scaleY), v =>
                    {
                        _owner._gearLocked = true;
                        if (a)
                        {
                            _owner.SetSize(v.x, v.y, _owner.CheckGearController(1, _controller));
                        }
                        if (b)
                        {
                            _owner.SetScale(v.z, v.w);
                        }
                        _owner._gearLocked = false;
                    }, new Vector4(gv.width, gv.height, gv.scaleX, gv.scaleY), tweenTime)
                              .SetEase(easeType)
                              .SetUpdate(true)
                              .SetRecyclable()
                              .OnUpdate(() =>
                    {
                        _owner.InvalidateBatchingState();
                    })
                              .OnComplete(() =>
                    {
                        tweener = null;
                        if (_displayLockToken != 0)
                        {
                            _owner.ReleaseDisplayLock(_displayLockToken);
                            _displayLockToken = 0;
                        }
                        _owner.InvalidateBatchingState();
                        _owner.OnGearStop.Call(this);
                    });

                    if (delay > 0)
                    {
                        tweener.SetDelay(delay);
                    }
                }
            }
            else
            {
                _owner._gearLocked = true;
                _owner.SetSize(gv.width, gv.height, _owner.CheckGearController(1, _controller));
                _owner.SetScale(gv.scaleX, gv.scaleY);
                _owner._gearLocked = false;
            }
        }