textColor() 공개 정적인 메소드

public static textColor ( RectTransform rectTransform, Color to, float time ) : LTDescr,
rectTransform UnityEngine.RectTransform
to Color
time float
리턴 LTDescr,
예제 #1
0
    public IEnumerator PerfectAni()
    {
        PerfectText.SetActive(true);
        LeanTween.cancel(PerfectText);
        PerfectText.transform.position = Vector3.zero;
        LeanTween.scale(PerfectText, new Vector2(3f, 3f), 0.7f).setEase(LeanTweenType.easeOutElastic);
        yield return(new WaitForSeconds(0.6f));

        LeanTween.move(PerfectText, GameScene.instance.TimeText.transform.position, 0.3f).setEase(LeanTweenType.easeInOutSine);
        LeanTween.scale(PerfectText, Vector2.zero, 0.3f).setEase(LeanTweenType.easeInSine).setOnComplete(() =>
        {
            PerfectText.SetActive(false);
        });
        yield return(new WaitForSeconds(0.3f));

        LeanTween.textColor(GameScene.instance.TimeText.GetComponent <RectTransform>(), new Color(0.21f, 0.97f, 0.11f), 0.5f).setEase(LeanTweenType.easeOutSine).setOnComplete(() =>
        {
            LeanTween.textColor(GameScene.instance.TimeText.GetComponent <RectTransform>(), new Color(0.196f, 0.196f, 0.196f), 0.5f).setEase(LeanTweenType.easeInSine);
        });

        for (int i = 0; i < GameScene.BonusTime; i++)
        {
            GameScene.LeftTime++;
            GameScene.instance.TimeText.text = GameScene.LeftTime.ToString();
            yield return(new WaitForSeconds(0.1f));
        }
    }
예제 #2
0
 private void OnGameOver()
 {
     m_text.color   = new Color(1f, 0f, 0f, 0f);
     m_text.enabled = true;
     LeanTween.textColor(m_text.transform as RectTransform, Color.red, 5f);
     Invoke("LoadMainMenu", 10f);
 }
예제 #3
0
    public override void Draw()
    {
        LeanTween.move(topHeaderBg, headerPanelTo, 0.6f)
        .setEase(LeanTweenType.easeOutCubic);

        LeanTween.move(timeTopPanel, timePanelTo, 0.5f)
        .setEase(LeanTweenType.easeOutCubic)
        .setDelay(0.15f)
        .setOnComplete(() =>
        {
            LeanTween.textColor(gameTimeText, new Color(0f, 0f, 0f, 1f), 0.5f)
            .setEase(LeanTweenType.easeOutCubic)
            .setDelay(0.05f);

            LeanTween.move(pauseButton, pauseButtonTo, 0.5f)
            .setEase(LeanTweenType.easeOutCubic)
            .setDelay(0.15f);

            LeanTween.move(muteButton, muteButtonTo, 0.5f)
            .setEase(LeanTweenType.easeOutCubic)
            .setDelay(0.2f);

            LeanTween.alpha(superTireSmallLogo, 1f, 0.65f)
            .setEase(LeanTweenType.easeOutCubic)
            .setDelay(0.25f).setOnComplete(TransitionInCompleted);
        });

        if (acceleratorUI != null)
        {
            acceleratorUI.GetComponent <AxisTouchButton>().Show();
            GameObject.Find("Brake_b").GetComponent <AxisTouchButton>().Show();
        }
    }
예제 #4
0
    void Update()
    {
        if (stage != State.Move)
        {
            return;
        }
        //if (Input.GetKeyUp(KeyCode.Alpha1))
        //{
        //    Encount();
        //}
        //if (Input.GetKeyUp(KeyCode.Alpha1))
        //{
        //    Goal();
        //}

        var remain = Entity.Instance.StageList.period - Util.Time.ServerTime.CurrentUnixTime;

        if (remain <= 0)
        {
            stage = State.Event;
            DialogWindow.OpenOk("確認", "ステージが消失しました", () =>
            {
                SceneManager.LoadScene(SceneName.Home);
            });
        }
        else if (!periodMessage.gameObject.activeSelf && remain < 60 * 10)
        {
            periodMessage.gameObject.SetActive(true);
            LeanTween.textColor(periodMessage.rectTransform, Color.white, 1f).setLoopPingPong(-1);
        }
    }
예제 #5
0
    IEnumerable <Instruction> FadeIn(float duration)
    {
        GameMachine.Instance.OpenTween("CreditsScroller", 115);
        LeanTween.textColor(_StartingText.rectTransform, Color.black, duration).onComplete = () => GameMachine.Instance.CloseTween("CreditsScroller", 115);

        yield return(ControlFlow.Call(Wait(duration)));
    }
예제 #6
0
        protected override LTDescr TweenRun(bool reversed, float time)
        {
            Color color = reversed ? colorRange.To : colorRange.From;

            Image image = GetComponent <Image> ();

            if (image != null)
            {
                return(LeanTween.color((RectTransform)transform, color, time));
            }

            Text text = GetComponent <Text> ();

            if (text != null)
            {
                return(LeanTween.textColor((RectTransform)transform, color, time));
            }

            Renderer renderer = GetComponent <Renderer> ();

            if (renderer != null)
            {
                return(LeanTween.color(gameObject, color, time));
            }

            return(null);
        }
예제 #7
0
    public IEnumerator Pulsate_Coroutine()
    {
        var towns = townsPanel.GetComponentsInChildren <Image> ().Where(img => img.gameObject != townsPanel.gameObject);

        foreach (var town in towns)
        {
            if (town.name != "lost")
            {
                LeanTween.scale(town.gameObject, Vector3.one * 1.1f, 0.5f).setEasePunch();
                yield return(new WaitForSeconds(0.18f));
            }
        }

        var cities = citiesPanel.GetComponentsInChildren <Image> ().Where(img => img.gameObject != citiesPanel.gameObject);

        foreach (var city in cities)
        {
            if (city.name != "lost")
            {
                LeanTween.scale(city.gameObject, Vector3.one * 1.15f, 0.5f).setEasePunch();
                yield return(new WaitForSeconds(0.2f));
            }
        }

        if (results.Infections > 0)
        {
            LeanTween.textColor(infectionsPenaltyLabel.GetComponent <RectTransform> (), Color.red, 0.75f).setEaseInOutElastic();

            yield return(new WaitForSeconds(0.75f));
        }
    }
예제 #8
0
 void AfterTextFade(Text text)
 {
     if (fadeOutTime > 0)
     {
         LeanTween.textColor(text.rectTransform, new Color(text.color.r, text.color.g, text.color.b, 0), fadeOutTime).setDelay(time - fadeOutTime - fadeInTime);
     }
 }
예제 #9
0
    private void OnGameCompleted(float time)
    {
        GameManager.Instance.OnCompleted -= OnGameCompleted;

        // here we are stopping the clock flag, adding to the total time and resetting the challenge time.

        // stop clock and reset
        pModel.ClockIsStopped = true;

        // save current time to total time
        // The Challenge Time should get added up to the TotalChallengeTime
        // We should save the TotalChallengeTime and the current ChallengeIndex to the server.
        // If the user leaves early, we can load up the TotalChallengeTime and ChallengeIndex from the server to resume play
        pModel.SaveCurrentTotalTime();

        // before we reset ChallengeTime, lets save it to CurrentCompletedChallengeTime
        // we will be using it to display the time in the Congratulations Screen
        pModel.CurrentCompletedChallengeTime = pModel.ChallengeTime;

        // now reset ChallengeTime to 0
        pModel.ChallengeTime = 0;

        // transition out
        LeanTween.move(topHeaderBg, headerPanelFrom, .5f).setEase(LeanTweenType.easeOutCubic);
        LeanTween.textColor(gameTimeText, new Color(0f, 0f, 0f, 0f), 0.5f).setEase(LeanTweenType.easeOutCubic);
        LeanTween.move(timeTopPanel, timePanelFrom, 0.5f).setEase(LeanTweenType.easeOutCubic);
        LeanTween.move(pauseButton, pauseButtonFrom, 0.5f).setEase(LeanTweenType.easeOutCubic);
        LeanTween.move(muteButton, muteButtonFrom, 0.5f).setEase(LeanTweenType.easeOutCubic);
        LeanTween.alpha(superTireSmallLogo, 0f, 0.5f).setEase(LeanTweenType.easeOutCubic).setOnComplete(GotoNextScreen);
    }
    void Start()
    {
        // Time.timeScale = 1f/4f;

        // *********** Main Window **********
        // Scale the whole window in
        mainWindow.localScale = Vector3.zero;
        LeanTween.scale(mainWindow, new Vector3(1f, 1f, 1f), 0.6f).setEase(LeanTweenType.easeOutBack);
        LeanTween.alphaCanvas(mainWindow.GetComponent <CanvasGroup>(), 0f, 1f).setDelay(2f).setLoopPingPong().setRepeat(2);

        // Fade the main paragraph in while moving upwards
        mainParagraphText.anchoredPosition3D += new Vector3(0f, -10f, 0f);
        LeanTween.textAlpha(mainParagraphText, 0f, 0.6f).setFrom(0f).setDelay(0f);
        LeanTween.textAlpha(mainParagraphText, 1f, 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f);
        LeanTween.move(mainParagraphText, mainParagraphText.anchoredPosition3D + new Vector3(0f, 10f, 0f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f);

        // Flash text to purple and back
        LeanTween.textColor(mainTitleText, new Color(133f / 255f, 145f / 255f, 223f / 255f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f).setLoopPingPong().setRepeat(-1);

        // Fade button in
        LeanTween.textAlpha(mainButton2, 1f, 2f).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad);
        LeanTween.alpha(mainButton2, 1f, 2f).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad);


        // *********** Pause Button **********
        // Drop pause button in
        pauseWindow.anchoredPosition3D += new Vector3(0f, 200f, 0f);
        LeanTween.moveY(pauseWindow, pauseWindow.anchoredPosition3D.y + -200f, 0.6f).setEase(LeanTweenType.easeOutSine).setDelay(0.6f);

        // Punch Pause Symbol
        RectTransform pauseText = pauseWindow.Find("PauseText").GetComponent <RectTransform>();

        LeanTween.moveZ(pauseText, pauseText.anchoredPosition3D.z - 80f, 1.5f).setEase(LeanTweenType.punch).setDelay(2.0f);

        // Rotate rings around in opposite directions
        LeanTween.rotateAroundLocal(pauseRing1, Vector3.forward, 360f, 12f).setRepeat(-1);
        LeanTween.rotateAroundLocal(pauseRing2, Vector3.forward, -360f, 22f).setRepeat(-1);


        // *********** Chat Window **********
        // Flip the chat window in
        chatWindow.RotateAround(chatWindow.position, Vector3.up, -180f);
        LeanTween.rotateAround(chatWindow, Vector3.up, 180f, 2f).setEase(LeanTweenType.easeOutElastic).setDelay(1.2f);

        // Play a series of sprites on the window on repeat endlessly
        LeanTween.play(chatRect, chatSprites).setLoopPingPong();

        // Animate the bar up and down while changing the color to red-ish
        LeanTween.color(chatBar2, new Color(248f / 255f, 67f / 255f, 108f / 255f, 0.5f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong().setDelay(1.2f);
        LeanTween.scale(chatBar2, new Vector2(1f, 0.7f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong();

        // Write in paragraph text
        string origText = chatText.text;

        chatText.text = "";
        LeanTween.value(gameObject, 0, (float)origText.Length, 6f).setEase(LeanTweenType.easeOutQuad).setOnUpdate((float val) => {
            chatText.text = origText.Substring(0, Mathf.RoundToInt(val));
        }).setLoopClamp().setDelay(2.0f);
    }
예제 #11
0
    public void OnPointerExit(PointerEventData eventData)
    {
        //LeanTween.textColor(buttonText.rectTransform, Color.white, 0.15f).setIgnoreTimeScale(true);
        //LeanTween.color(myImage.rectTransform, Color.clear, 0.15f).setIgnoreTimeScale(true);

        LeanTween.textColor(buttonText.rectTransform, normalText, 0.15f).setIgnoreTimeScale(true);
        LeanTween.color(myImage.rectTransform, normalButton, 0.15f).setIgnoreTimeScale(true);
    }
예제 #12
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        //LeanTween.textColor(buttonText.rectTransform, Color.black, 0.15f).setIgnoreTimeScale(true);
        //LeanTween.color(myImage.rectTransform, Color.white, 0.15f).setIgnoreTimeScale(true);

        LeanTween.textColor(buttonText.rectTransform, highlightedText, 0.15f).setIgnoreTimeScale(true);
        LeanTween.color(myImage.rectTransform, highlightedButton, 0.15f).setIgnoreTimeScale(true);
    }
 void OnCompleteTween()
 {
     score_manager.setScore(Vector3.zero, killCount * Constants.REWARD_PER_KILL);
     animated_score.text  = (killCount * Constants.REWARD_PER_KILL).ToString();
     animated_score.color = Color.white;
     LeanTween.move(animated_score.GetComponent <RectTransform> (), new Vector2(2, Screen.height), 3);
     LeanTween.textColor(animated_score.GetComponent <RectTransform> (), Color.clear, 3);
     killCount = 0;
 }
예제 #14
0
    public void UpdateTurnDisplay(float transitionDuration)
    {
        var nextPlayer      = turnManager.NextPlayer;
        var targetTextColor = GetTextColorForPlayer(nextPlayer);
        var nextRound       = turnManager.NextRound.ToString();

        LeanTween.textColor(currentPlayerTextbox.rectTransform, Color.black, transitionDuration * 0.5f).setOnComplete(() =>
        {
            currentTurnTextbox.text   = string.Format("Round {0} of {1}", nextRound, turnManager.TotalRounds);
            currentPlayerTextbox.text = string.Format("{0}'s Turn", nextPlayer.ToString());
            LeanTween.textColor(currentPlayerTextbox.rectTransform, targetTextColor, transitionDuration * 0.5f);
        });
    }
 private void ShowInfo(string msg)
 {
     info.GetComponent <Text>().text = msg;
     info.SetActive(true);
     LeanTween.delayedCall(info, 3.0f, () =>
     {
         LeanTween.textColor(info.GetComponent <RectTransform>(), new Color(1, 0, 0, 0), 1).setOnComplete(() =>
         {
             info.SetActive(false);
             info.GetComponent <Text>().color = Color.red;
         });
     });
 }
예제 #16
0
    private void OnEnable()
    {
        timeToEnd = time;
        if (fade)
        {
            if (fadeInTime + fadeOutTime > time)
            {
                Debug.LogError(name + ": 'fadeInTime + fadeOutTime' can't be greater than time");
            }
            else
            {
                Image image;
                Text  text;
                if (TryGetComponent <Image>(out image))
                {
                    image.color = new Color(image.color.r, image.color.g, image.color.b, 0);
                    LeanTween.imageColor(image.rectTransform, new Color(image.color.r, image.color.g, image.color.b, 1), fadeInTime).setOnComplete(() => AfterImageFade(image));
                }
                else if (TryGetComponent <Text>(out text))
                {
                    text.color = new Color(text.color.r, text.color.g, text.color.b, 0);
                    LeanTween.textColor(text.rectTransform, new Color(text.color.r, text.color.g, text.color.b, 1), fadeInTime).setOnComplete(() => AfterTextFade(text));
                }
                else
                {
                    Debug.LogError("You can't use fade on this object: '" + name + "'");
                }
            }
        }

        if (scale)
        {
            if (scaleInTime + scaleOutTime > time)
            {
                Debug.LogError(name + ": 'scaleInTime + scaleOutTime' can't be greater than time");
            }
            else
            {
                transform.localScale = startScale;
                LeanTween.scale(gameObject, endScale, scaleInTime).setOnComplete(AfterScale);
            }
        }
    }
예제 #17
0
    public override List <LTDescr> Animate(GameEvent gameEvent)
    {
        List <LTDescr> animations = new List <LTDescr>();
        LTDescr        scaleUp    = LeanTween.scale(
            rectTrans: rect,
            to: new Vector3(1.1f, 1.1f, 1.1f),
            time: 0.1f);
        LTDescr scaleDown = LeanTween.scale(
            rectTrans: rect,
            to: new Vector3(1f, 1f, 1f),
            time: 0.2f)
                            .setEaseOutBack()
                            .PlayAfter(scaleUp)
                            .SetCallEventOnComplete(new GameEvent()
        {
            eventType = GameEvent.EventEnum.ShowDeltaScores
        });

        animations.Add(scaleUp);
        animations.Add(scaleDown);
        if (Background != null)
        {
            LTDescr backgroundChange = LeanTween.color(
                rectTrans: Background.rectTransform,
                to: backgroundRevealColor,
                time: 0.1f);
            animations.Add(backgroundChange);
        }
        if (Title != null)
        {
            LTDescr titleChange = LeanTween.textColor(
                rectTransform: Title.rectTransform,
                to: textRevealColor,
                time: 0.1f);
            animations.Add(titleChange);
        }

        return(animations);
    }
예제 #18
0
        protected override void ApplyTween(GameObject go)
        {
            foreach (Image image in go.GetComponentsInChildren <Image>())
            {
                if (duration == 0f)
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = image.color;
                        tempColor.a = targetAlpha;
                        image.color = tempColor;
                        break;

                    case FadeMode.Color:
                        image.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(image.rectTransform, targetAlpha, duration).setEase(tweenType).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(image.rectTransform, targetColor, duration).setEase(tweenType).setEase(tweenType);
                        break;
                    }
                }
            }

            foreach (Text text in go.GetComponentsInChildren <Text>())
            {
                if (duration == 0f)
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = text.color;
                        tempColor.a = targetAlpha;
                        text.color  = tempColor;
                        break;

                    case FadeMode.Color:
                        text.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.textAlpha(text.rectTransform, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.textColor(text.rectTransform, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }

            foreach (TextMesh textMesh in go.GetComponentsInChildren <TextMesh>())
            {
                if (duration == 0f)
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = textMesh.color;
                        tempColor.a    = targetAlpha;
                        textMesh.color = tempColor;
                        break;

                    case FadeMode.Color:
                        textMesh.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(go, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(go, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }
        }
예제 #19
0
        protected override void ApplyTween(GameObject go)
        {
            var images = go.GetComponentsInChildren <Image>();

            for (int i = 0; i < images.Length; i++)
            {
                var image = images[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = image.color;
                        tempColor.a = targetAlpha;
                        image.color = tempColor;
                        break;

                    case FadeMode.Color:
                        image.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(image.rectTransform, targetAlpha, duration).setEase(tweenType).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(image.rectTransform, targetColor, duration).setEase(tweenType).setEase(tweenType);
                        break;
                    }
                }
            }

            var texts = go.GetComponentsInChildren <Text>();

            for (int i = 0; i < texts.Length; i++)
            {
                var text = texts[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = text.color;
                        tempColor.a = targetAlpha;
                        text.color  = tempColor;
                        break;

                    case FadeMode.Color:
                        text.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.textAlpha(text.rectTransform, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.textColor(text.rectTransform, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }

            var textMeshes = go.GetComponentsInChildren <TextMesh>();

            for (int i = 0; i < textMeshes.Length; i++)
            {
                var textMesh = textMeshes[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = textMesh.color;
                        tempColor.a    = targetAlpha;
                        textMesh.color = tempColor;
                        break;

                    case FadeMode.Color:
                        textMesh.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(go, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(go, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }
        }
예제 #20
0
 public static LTDescr LTTextColor(this RectTransform rectTransform, Color to, float time)
 {
     return(LeanTween.textColor(rectTransform, to, time));
 }
예제 #21
0
        private void buildTween(LeanTweenItem item, float delayAdd, bool generateCode)
        {
            float delay = item.delay + delayAdd;
            bool  code  = generateCode;
            float d     = item.duration;

            // Debug.Log("item:"+item.action);
            if (item.action == TweenAction.ALPHA)
            {
                tween = code ? append("alpha", item.to.x, d) : LeanTween.alpha(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ALPHA_VERTEX)
            {
                tween = code ? append("alphaVertex", item.to.x, d) : LeanTween.alphaVertex(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE)
            {
                tween = code ? append("move", item.to, d) : LeanTween.move(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL)
            {
                tween = code ? append("moveLocal", item.to, d) : LeanTween.moveLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_X)
            {
                tween = code ? append("moveLocalX", item.to.x, d) : LeanTween.moveLocalX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Y)
            {
                tween = code ? append("moveLocalY", item.to.x, d) : LeanTween.moveLocalY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Z)
            {
                tween = code ? append("moveLocalZ", item.to.x, d) : LeanTween.moveLocalZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_X)
            {
                tween = code ? append("moveX", item.to.x, d) : LeanTween.moveX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Y)
            {
                tween = code ? append("moveY", item.to.x, d) : LeanTween.moveY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Z)
            {
                tween = code ? append("moveZ", item.to.x, d) : LeanTween.moveZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_CURVED)
            {
                tween = code ? append("move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.move(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_CURVED_LOCAL)
            {
                tween = code ? append("moveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.moveLocal(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_SPLINE)
            {
                tween = code ? append("moveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.moveSpline(gameObject, item.splinePath.splineVector(), d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.ROTATE)
            {
                tween = code ? append("rotate", item.to, d) : LeanTween.rotate(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_AROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_AROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_LOCAL)
            {
                tween = code ? append("rotateLocal", item.to, d) : LeanTween.rotateLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_X)
            {
                tween = code ? append("rotateX", item.to.x, d) : LeanTween.rotateX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Y)
            {
                tween = code ? append("rotateY", item.to.x, d) : LeanTween.rotateY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Z)
            {
                tween = code ? append("rotateZ", item.to.x, d) : LeanTween.rotateZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE)
            {
                tween = code ? append("scale", item.to, d) : LeanTween.scale(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.SCALE_X)
            {
                tween = code ? append("scaleX", item.to.x, d) : LeanTween.scaleX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Y)
            {
                tween = code ? append("scaleY", item.to.x, d) : LeanTween.scaleY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Z)
            {
                tween = code ? append("scaleZ", item.to.x, d) : LeanTween.scaleZ(gameObject, item.to.x, d);
            }
                        #if !UNITY_4_3 && !UNITY_4_5
            else if (item.action == TweenAction.CANVAS_MOVE)
            {
                tween = code ? appendRect("move", item.to, d) : LeanTween.move(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_SCALE)
            {
                tween = code ? appendRect("scale", item.to, d) : LeanTween.scale(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ALPHA)
            {
                tween = code ? appendRect("alpha", item.to.x, d) : LeanTween.alpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.CANVAS_COLOR)
            {
                tween = code ? appendRect("color", item.colorTo, d) : LeanTween.color(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.TEXT_ALPHA)
            {
                tween = code ? appendRect("textAlpha", item.to.x, d) : LeanTween.textAlpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.TEXT_COLOR)
            {
                tween = code ? appendRect("textColor", item.colorTo, d) : LeanTween.textColor(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.CANVAS_PLAYSPRITE)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.play(rectTransform, sprites).setFrameRate(" + item.frameRate + "f)");
                }
                else
                {
                    tween = LeanTween.play(GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate);
                }
            }
                        #endif
            else if (item.action == TweenAction.COLOR)
            {
                tween = code ? append("color", item.colorTo, d) : LeanTween.color(gameObject, item.colorTo, d);
            }
            else if (item.action == TweenAction.DELAYED_SOUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.delayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)");
                }
                else
                {
                    tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration);
                }
            }
            else
            {
                tween = null;
                Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item);
                return;
            }


            // Append Extras
            if (generateCode)
            {
                if (delay > 0f)
                {
                    codeBuild.Append(".setDelay(" + delay + "f)");
                }
            }
            else
            {
                tween = tween.setDelay(delay);
            }
            if (item.ease == LeanTweenType.animationCurve)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setEase(");
                    append(item.animationCurve);
                    codeBuild.Append(")");
                }
                else
                {
                    tween.setEase(item.animationCurve);
                }
            }
            else
            {
                if (generateCode)
                {
                    if (item.ease != LeanTweenType.linear)
                    {
                        codeBuild.Append(".setEase(LeanTweenType." + item.ease + ")");
                    }
                }
                else
                {
                    tween.setEase(item.ease);
                }
            }
            // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease);
            if (item.between == LeanTweenBetween.FromTo)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setFrom(" + item.from + ")");
                }
                else
                {
                    tween.setFrom(item.from);
                }
            }
            if (item.doesLoop)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setRepeat(" + item.loopCount + ")");
                }
                else
                {
                    tween.setRepeat(item.loopCount);
                }

                if (item.loopType == LeanTweenType.pingPong)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".setLoopPingPong()");
                    }
                    else
                    {
                        tween.setLoopPingPong();
                    }
                }
            }
            if (generateCode)
            {
                codeBuild.Append(";\n");
            }
        }
예제 #22
0
    private IEnumerator HideText(Text text)
    {
        yield return(WaitSecondsPause(.2f));

        LeanTween.textColor(text.rectTransform, Color.clear, .15f);
    }
예제 #23
0
        protected override void ApplyTween(GameObject go)
        {
            var images = go.GetComponentsInChildren <Image>();

            for (int i = 0; i < images.Length; i++)
            {
                var image = images[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = image.color;
                        tempColor.a = targetAlpha;
                        image.color = tempColor;
                        break;

                    case FadeMode.Color:
                        image.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(image.rectTransform, targetAlpha, duration).setEase(tweenType).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(image.rectTransform, targetColor, duration).setEase(tweenType).setEase(tweenType);
                        break;
                    }
                }
            }

            var texts = go.GetComponentsInChildren <Text>();

            for (int i = 0; i < texts.Length; i++)
            {
                var text = texts[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = text.color;
                        tempColor.a = targetAlpha;
                        text.color  = tempColor;
                        break;

                    case FadeMode.Color:
                        text.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.textAlpha(text.rectTransform, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.textColor(text.rectTransform, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }

            var textMeshes = go.GetComponentsInChildren <TextMesh>();

            for (int i = 0; i < textMeshes.Length; i++)
            {
                var textMesh = textMeshes[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = textMesh.color;
                        tempColor.a    = targetAlpha;
                        textMesh.color = tempColor;
                        break;

                    case FadeMode.Color:
                        textMesh.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alpha(go, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.color(go, targetColor, duration).setEase(tweenType);
                        break;
                    }
                }
            }

#if UNITY_2018_1_OR_NEWER
            var tmpros = go.GetComponentsInChildren <Text>();
            for (int i = 0; i < tmpros.Length; i++)
            {
                var tmpro = tmpros[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        Color tempColor = tmpro.color;
                        tempColor.a = targetAlpha;
                        tmpro.color = tempColor;
                        break;

                    case FadeMode.Color:
                        tmpro.color = targetColor;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.value(tmpro.gameObject, tmpro.color.a, targetAlpha.Value, duration)
                        .setEase(tweenType)
                        .setOnUpdate((float alphaValue) =>
                        {
                            Color tempColor = tmpro.color;
                            tempColor.a     = alphaValue;
                            tmpro.color     = tempColor;
                        });
                        break;

                    case FadeMode.Color:
                        LeanTween.value(tmpro.gameObject, tmpro.color, targetColor.Value, duration)
                        .setEase(tweenType)
                        .setOnUpdate((Color colorValue) =>
                        {
                            tmpro.color = colorValue;
                        });
                        break;
                    }
                }
            }
#endif
            //canvas groups don't support color but we can anim the alpha IN the color
            var canvasGroups = go.GetComponentsInChildren <CanvasGroup>();
            for (int i = 0; i < canvasGroups.Length; i++)
            {
                var canvasGroup = canvasGroups[i];
                if (Mathf.Approximately(duration, 0f))
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        canvasGroup.alpha = targetAlpha.Value;
                        break;

                    case FadeMode.Color:
                        canvasGroup.alpha = targetColor.Value.a;
                        break;
                    }
                }
                else
                {
                    switch (fadeMode)
                    {
                    case FadeMode.Alpha:
                        LeanTween.alphaCanvas(canvasGroup, targetAlpha, duration).setEase(tweenType);
                        break;

                    case FadeMode.Color:
                        LeanTween.alphaCanvas(canvasGroup, targetColor.Value.a, duration).setEase(tweenType);
                        break;
                    }
                }
            }
        }
예제 #24
0
 void Start()
 {
     LeanTween.textColor(text.rectTransform, new Color(0.25f, 0.25f, 0.25f), 1).setLoopPingPong();
 }