Example #1
0
        internal int        startValueStrippedLength, changeValueStrippedLength; // No-tag lengths of start and change value

        public void Reset()
        {
            richTextEnabled          = false;
            scrambleMode             = ScrambleMode.None;
            scrambledChars           = null;
            startValueStrippedLength = changeValueStrippedLength = 0;
        }
Example #2
0
 protected override void JsonTo(IJsonNode json)
 {
     if (json.Contains("beginStr"))
     {
         BeginStr = json.GetString("beginStr");
     }
     // end if
     if (json.Contains("str"))
     {
         m_toStr = json.GetString("str");
     }
     // end if
     if (json.Contains("rich"))
     {
         m_richTextEnabled = json.GetBool("rich");
     }
     // end if
     if (json.Contains("mode"))
     {
         m_scrambleMode = (ScrambleMode)json.GetInt("mode");
     }
     // end if
     if (json.Contains("char"))
     {
         m_scrambleChars = json.GetString("char");
     }
     // end if
     Restore();
 }
Example #3
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginStr"))
     {
         BeginStr = json["beginStr"].ToString();
     }
     // end if
     if (json.Contains("str"))
     {
         m_toStr = json["str"].ToString();
     }
     // end if
     if (json.Contains("rich"))
     {
         m_richTextEnabled = json["rich"].ToBool();
     }
     // end if
     if (json.Contains("mode"))
     {
         m_scrambleMode = (ScrambleMode)json["mode"].ToInt32();
     }
     // end if
     if (json.Contains("char"))
     {
         m_scrambleChars = json["char"].ToString();
     }
     // end if
     Restore();
 }
Example #4
0
    private static int IntToEnum(IntPtr L)
    {
        int          num          = (int)LuaDLL.lua_tonumber(L, 1);
        ScrambleMode scrambleMode = (ScrambleMode)num;

        ToLua.Push(L, scrambleMode);
        return(1);
    }
Example #5
0
    public static XTween DOText(object obj, string to, float duration, bool richTextEnabled, int scrambleMode, string scrambleChars)
    {
        ScrambleMode md = (ScrambleMode)scrambleMode;

        if (obj is Text)
        {
            return(new XTween((obj as Text).DOText(to, duration, richTextEnabled, md, scrambleChars)));
        }
        return(null);
    }
Example #6
0
 /// <summary>
 /// text拓展
 /// </summary>
 /// <param name="txtObj"></param>
 /// <param name="text"></param>
 public static void SetText(this Text txtObj, string text, bool isAnima = false, ScrambleMode scrambleMode = ScrambleMode.None)
 {
     if (txtObj != null)
     {
         if (isAnima)
         {
             txtObj.text = "";
             txtObj.DOText(text, 0.3f, scrambleMode: scrambleMode);
         }
         else
         {
             txtObj.text = text;
         }
     }
 }
Example #7
0
        /// <summary>
        ///     Tweens a Text's text to the given value.
        ///     Also stores the Text as the tween's target so it can be used for filtered operations
        /// </summary>
        /// <param name="endValue">The end string to tween to</param>
        /// <param name="duration">The duration of the tween</param>
        /// <param name="richTextEnabled">
        ///     If TRUE (default), rich text will be interpreted correctly while animated,
        ///     otherwise all tags will be considered as normal text
        /// </param>
        /// <param name="scrambleMode">The type of scramble mode to use, if any</param>
        /// <param name="scrambleChars">
        ///     A string containing the characters to use for scrambling.
        ///     Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
        ///     Leave it to NULL (default) to use default ones
        /// </param>
        public static TweenerCore <string, string, StringOptions> DOText(this Text target, string endValue, float duration, bool richTextEnabled = true,
                                                                         ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
        {
            if (endValue == null)
            {
                if (Debugger.logPriority > 0)
                {
                    Debugger.LogWarning("You can't pass a NULL string to DOText: an empty string will be used instead to avoid errors");
                }

                endValue = "";
            }

            var t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);

            t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
            .SetTarget(target);
            return(t);
        }
        /// <summary>Tweens a tk2dTextMesh's text to the given value.
        /// Also stores the tk2dTextMesh as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end string to tween to</param><param name="duration">The duration of the tween</param>
        /// <param name="richTextEnabled">If TRUE (default), rich text will be interpreted correctly while animated,
        /// otherwise all tags will be considered as normal text</param>
        /// <param name="scrambleMode">The type of scramble mode to use, if any</param>
        /// <param name="scrambleChars">A string containing the characters to use for scrambling.
        /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
        /// Leave it to NULL (default) to use default ones</param>
        public static TweenerCore <string, string, StringOptions> DOText(this tk2dTextMesh target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
        {
            TweenerCore <string, string, StringOptions> t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);

            t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
            .SetTarget(target);
            return(t);
        }
Example #9
0
 internal WndScramble(ScrambleMode mode, PNote note)
     : this()
 {
     _Mode = mode;
     _Note = note;
 }
Example #10
0
 public static void DOText(this Text uiText, string startValue, string endValue, float timeAnimation = 0.25f, float delayTime = 0.1f, string fomat = "{0}", TweenCallback onDone = null, ScrambleMode scrambleMode = ScrambleMode.Uppercase)
 {
     uiText.text = startValue;
     uiText.DOText(endValue, timeAnimation, false, scrambleMode)
     .SetDelay(delayTime)
     .OnComplete(() => onDone?.Invoke());
 }
Example #11
0
 /// <summary>Tweens a Text's text to the given value.
 /// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
 /// <param name="endValue">The end string to tween to</param><param name="duration">The duration of the tween</param>
 /// <param name="richTextEnabled">If TRUE (default), rich text will be interpreted correctly while animated,
 /// otherwise all tags will be considered as normal text</param>
 /// <param name="scrambleMode">The type of scramble mode to use, if any</param>
 /// <param name="scrambleChars">A string containing the characters to use for scrambling.
 /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
 /// Leave it to NULL (default) to use default ones</param>
 public static Tweener DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
 {
     return(DOTween.To(() => target.text, x => target.text = x, endValue, duration)
            .SetOptions(richTextEnabled, scrambleMode, scrambleChars)
            .SetTarget(target));
 }
Example #12
0
    //UI扩展=================================

    /// <summary>
    /// 设置Text值(带动画)
    /// </summary>
    /// <param name="txtObj"></param>
    /// <param name="text"></param>
    public static void SetText(this Text txtObj, string text, bool isAnimation = false, float duration = 0.2f, ScrambleMode scrambleMode = ScrambleMode.None)
    {
        if (txtObj != null)
        {
            if (isAnimation)
            {
                txtObj.text = "";
                txtObj.DOText(text, duration, scrambleMode: scrambleMode);
            }
            else
            {
                txtObj.text = text;
            }
        }
    }
Example #13
0
 /// <summary>Tweens a tk2dTextMesh's text to the given value.
 /// Also stores the tk2dTextMesh as the tween's target so it can be used for filtered operations</summary>
 /// <param name="endValue">The end string to tween to</param><param name="duration">The duration of the tween</param>
 /// <param name="richTextEnabled">If TRUE (default), rich text will be interpreted correctly while animated,
 /// otherwise all tags will be considered as normal text</param>
 /// <param name="scrambleMode">The type of scramble mode to use, if any</param>
 /// <param name="scrambleChars">A string containing the characters to use for scrambling.
 /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
 /// Leave it to NULL (default) to use default ones</param>
 public static Tweener DOText(this tk2dTextMesh target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
 {
     return DOTween.To(() => target.text, x => target.text = x, endValue, duration)
         .SetOptions(richTextEnabled, scrambleMode, scrambleChars)
         .SetTarget(target);
 }
Example #14
0
 public static Tweener DoText_TMP(this TMPro.TextMeshProUGUI textPro, string target, float duration, bool richTextEnable = true, ScrambleMode scramble = ScrambleMode.None, string scrambleChars = null)
 {
     return(DOTween.To(() => textPro.text, x => textPro.text = x, target, duration).SetOptions(richTextEnable, scramble, scrambleChars));
 }
 public static void SetText(this Text text, string textValue, bool isAnimation = false, float duration = 0.2f, ScrambleMode scrambleMode = ScrambleMode.None)
 {
     if (text != null)
     {
         text.text = "";
         text.DOText(textValue, duration, scrambleMode: scrambleMode);
     }
     else
     {
         text.text = textValue;
     }
 }
Example #16
0
        public override void OnEnter()
        {
            if (loopDontFinish.Value == true)
            {
                settingLoops = -1;
            }
            else
            {
                settingLoops = loopsQuantity.Value;
            }

            setFinal = new TweenParams().SetDelay(setDelay.Value).SetAutoKill(setAutoKill.Value).SetRecyclable(setRecycle.Value).SetSpeedBased(isSpeedBased.Value).SetRelative(setRelative.Value).OnComplete(MyCallback);

            if (scrambleTypeSelect != scrambleType.None && scrambleChars.Value.Length > 0 && scrambleChars.Value.Length < 10)
            {
                Debug.LogWarning("<b>[DotweenEaseString]</b><color=#FF9900ff!!!  Use as many characters as possible (minimum 10) in 'Scramble Chars' because DOTween uses a fast scramble mode which gives better results with more characters. !!! </color>", this.Owner);
            }


            switch (loopTypeSelect)
            {
            case loopType.None:
                if (settingLoops > 0 || settingLoops < 0)
                {
                    Debug.LogWarning("<b>[DotweenEaseString]</b><color=#FF9900ff>!!! Loop Time is set but no 'Loop Type' is selected !!! </color>", this.Owner);
                }
                break;

            case loopType.Yoyo:
                setFinal.SetLoops(settingLoops, LoopType.Yoyo);
                break;

            case loopType.Restart:
                setFinal.SetLoops(settingLoops, LoopType.Restart);
                break;

            case loopType.Incremental:
                setFinal.SetLoops(settingLoops, LoopType.Incremental);
                break;
            }



            if (!tag.IsNone)
            {
                setFinal.SetId(tag.Value);
            }
            bool _isNullOrEmpty = orInputID.IsNone || orInputID == null || string.IsNullOrEmpty(orInputID.Value);

            if (_isNullOrEmpty == false)
            {
                setFinal.SetId(orInputID.Value);
            }
            bool obj_isNullOrEmpty = gameObjectId.IsNone || gameObjectId.Value == false;

            if (obj_isNullOrEmpty == false)
            {
                setFinal.SetId(this.Owner);
            }



            switch (easeTypeSelect)
            {
            case setEaseType.none:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Linear);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Linear));
                }
                break;

            case setEaseType.InSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InSine));
                }
                break;

            case setEaseType.OutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InOutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuad));
                }
                break;

            case setEaseType.OutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuad));
                }
                break;

            case setEaseType.InOutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuad));
                }
                break;

            case setEaseType.InCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCubic));
                }
                break;

            case setEaseType.OutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCubic));
                }
                break;

            case setEaseType.InOutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCubic));
                }
                break;

            case setEaseType.InQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuart));
                }
                break;

            case setEaseType.OutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuart));
                }
                break;

            case setEaseType.InOutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuart));
                }
                break;

            case setEaseType.InQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuint));
                }
                break;

            case setEaseType.OutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuint));
                }
                break;

            case setEaseType.InOutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuint));
                }
                break;

            case setEaseType.InExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InExpo));
                }
                break;

            case setEaseType.OutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutExpo));
                }
                break;

            case setEaseType.InOutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutExpo));
                }
                break;

            case setEaseType.InCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCirc));
                }
                break;

            case setEaseType.OutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCirc));
                }
                break;

            case setEaseType.InOutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCirc));
                }
                break;

            case setEaseType.InElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InElastic));
                }
                break;

            case setEaseType.OutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutElastic));
                }
                break;

            case setEaseType.InOutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutElastic));
                }
                break;

            case setEaseType.InBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBack));
                }
                break;

            case setEaseType.OutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBack));
                }
                break;

            case setEaseType.InOutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBack));
                }
                break;

            case setEaseType.InBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBounce));
                }
                break;

            case setEaseType.OutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBounce));
                }
                break;

            case setEaseType.InOutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBounce));
                }
                break;

            case setEaseType.Flash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Flash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Flash));
                }
                break;

            case setEaseType.InFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InFlash));
                }
                break;

            case setEaseType.OutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutFlash));
                }
                break;

            case setEaseType.InOutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutFlash));
                }
                break;


            case setEaseType.AnimationCurve:
                setFinal.SetEase(animationCurve.curve);
                break;
            }

            // Update + TimeScale

            switch (updateTypeSelect)
            {
            case updateType.Normal:
                setFinal.SetUpdate(UpdateType.Normal, isTimeIndependent.Value);
                break;

            case updateType.Fixed:
                setFinal.SetUpdate(UpdateType.Fixed, isTimeIndependent.Value);
                break;

            case updateType.Late:
                setFinal.SetUpdate(UpdateType.Late, isTimeIndependent.Value);
                break;
            }

            switch (scrambleTypeSelect)
            {
            case scrambleType.None:
                scrambleTypeSelected = ScrambleMode.None;
                break;

            case scrambleType.All:
                scrambleTypeSelected = ScrambleMode.All;
                break;

            case scrambleType.Custom:
                scrambleTypeSelected = ScrambleMode.Custom;
                break;

            case scrambleType.Lowercase:
                scrambleTypeSelected = ScrambleMode.Lowercase;
                break;

            case scrambleType.Numerals:
                scrambleTypeSelected = ScrambleMode.Numerals;
                break;

            case scrambleType.Uppercase:
                scrambleTypeSelected = ScrambleMode.Uppercase;
                break;
            }



            // Easy part fromValue edit for other DotTween actions --->

            DOTween.To(() => fromValue.Value, x => resultValue.Value = x, toValue.Value, duration.Value).SetOptions(richTextOn.Value, scrambleTypeSelected, scrambleChars.Value).SetAs(setFinal);

            // <---


            if (startEvent != null)
            {
                Fsm.Event(startEvent);
                Finish();
            }
        }
Example #17
0
 internal WndScramble(ScrambleMode mode, PNote note)
     : this()
 {
     _Mode = mode;
     _Note = note;
 }
Example #18
0
        /// <summary>Options for Vector4 tweens</summary>
        /// <param name="richTextEnabled">If TRUE, rich text will be interpreted correctly while animated,
        /// otherwise all tags will be considered as normal text</param>
        /// <param name="scrambleMode">The type of scramble to use, if any</param>
        /// <param name="scrambleChars">A string containing the characters to use for scrambling.
        /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
        /// Leave it to NULL to use default ones</param>
        public static Tweener SetOptions(this TweenerCore <string, string, StringOptions> t, bool richTextEnabled, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
        {
            if (t == null || !t.active)
            {
                return(t);
            }

            t.plugOptions.richTextEnabled = richTextEnabled;
            t.plugOptions.scrambleMode    = scrambleMode;
            if (!string.IsNullOrEmpty(scrambleChars))
            {
                if (scrambleChars.Length <= 1)
                {
                    scrambleChars += scrambleChars;
                }
                t.plugOptions.scrambledChars = scrambleChars.ToCharArray();
                t.plugOptions.scrambledChars.ScrambleChars();
            }
            return(t);
        }
Example #19
0
        public static TweenerCore <string, string, StringOptions> DOTextAlign(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
        {
            if (endValue == null)
            {
                if (Debugger.logPriority > 0)
                {
                    Debugger.LogWarning("You can't pass a NULL string to DOText: an empty string will be used instead to avoid errors");
                }
                endValue = "";
            }
            bool isRich = false;

            for (ushort index = 0; index < endValue.Length; index++)
            {
                if (endValue[index] == '<')
                {
                    isRich = true;
                    SetDoTextRichIndex(index, endValue);
                    break;
                }
            }
            TweenerCore <string, string, StringOptions> t = DOTween.To(
                () => target.text,
                (x) => {
                m_doTextCache.Clear();
                m_doTextCache.Append(x);
                m_doTextCache.Append("<color=#00000000>");
                bool isEqual         = true;
                ushort richEndLength = 0;
                if (isRich)
                {
                    for (ushort index = 0; index < x.Length; index++)
                    {
                        if (x[index] != endValue[index])
                        {
                            isEqual = false;
                        }
                        if (!isEqual)
                        {
                            richEndLength++;
                        }
                    }
                }

                if (isEqual)
                {
                    for (int index = x.Length; index < endValue.Length; index++)
                    {
                        m_doTextCache.Append(endValue[index]);
                    }
                }
                else
                {
                    ushort startIndex    = Convert.ToUInt16(x.Length - richEndLength);
                    string[] richEndList = m_doTextIndexRichStart[startIndex];
                    if (m_doTextIndexRichStart.ContainsKey(startIndex))
                    {
                        for (short arrayIndex = Convert.ToInt16(richEndList.Length - 1); arrayIndex >= 0; arrayIndex--)
                        {
                            m_doTextCache.Append(richEndList[arrayIndex]);
                        }
                    }
                    for (int index = startIndex; index < endValue.Length; index++)
                    {
                        m_doTextCache.Append(endValue[index]);
                    }
                }
                m_doTextCache.Append("</color>");
                target.text = m_doTextCache.ToString();
            },
                endValue,
                duration
                );

            t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
            .SetTarget(target);
            return(t);
        }
Example #20
0
        public override void Reset()
        {
            base.Reset();

            gameObject = null;

            to = new FsmString {
                UseVariable = false
            };
            duration = new FsmFloat {
                UseVariable = false
            };
            setSpeedBased = new FsmBool {
                UseVariable = false, Value = false
            };
            richTextEnabled = new FsmBool {
                UseVariable = false, Value = true
            };
            scrambleMode  = ScrambleMode.None;
            scrambleChars = new FsmString {
                UseVariable = false, Value = null
            };

            setRelative = new FsmBool {
                UseVariable = false, Value = false
            };

            playInReverse = new FsmBool {
                UseVariable = false, Value = false
            };
            setReverseRelative = new FsmBool {
                UseVariable = false, Value = false
            };

            startEvent        = null;
            finishEvent       = null;
            finishImmediately = new FsmBool {
                UseVariable = false, Value = false
            };

            stringAsId = new FsmString {
                UseVariable = false
            };
            tagAsId = new FsmString {
                UseVariable = false
            };

            startDelay = new FsmFloat {
                Value = 0
            };

            selectedEase = DOTweenActionsEnums.SelectedEase.EaseType;
            easeType     = Ease.Linear;

            loops = new FsmInt {
                Value = 0
            };
            loopType = LoopType.Restart;

            autoKillOnCompletion = new FsmBool {
                Value = true
            };
            recyclable = new FsmBool {
                Value = false
            };

            updateType          = UpdateType.Normal;
            isIndependentUpdate = new FsmBool {
                Value = false
            };

            debugThis = new FsmBool {
                Value = false
            };
        }
Example #21
0
    /// <summary>
    /// 打字机
    /// </summary>
    private void TypeWriter(Text text, string content, float duration, TweenCallback callback, ScrambleMode mode)
    {
        Tweener tweener = text.DOText(content, duration, true, mode);

        tweener.OnComplete(callback);
    }