public static TextToken2D CreateTextToken(string tokenType, string textToken, Color fillColor) { TextToken2D textToken2D = null; switch (tokenType) { case "Normal": textToken2D = new TextToken2D(textToken, fillColor); break; case "BannerTitle": textToken2D = new TitleBannerTextToken2D(textToken, fillColor); break; case "MenuTitle": textToken2D = new TitleTextToken2D(textToken, fillColor); break; case "CardLabel": textToken2D = new CardLabelTextToken2D(textToken, fillColor); break; default: textToken2D = new TextToken2D(textToken, fillColor); break; } return(textToken2D); }
private void LaunchAnimationScrollingOnToken() { if (this.tokenCursor < this.textToken2Ds.Count) { TextToken2D textToken2D = this.textToken2Ds[this.tokenCursor]; TextScrollingAnimation textScrollingAnimation = new TextScrollingAnimation(0, textToken2D.FullText.Length, Time.FromSeconds(textToken2D.FullText.Length * 1 / this.scrollingSpeed), Astrategia.Animation.AnimationType.ONETIME, Astrategia.Animation.InterpolationMethod.LINEAR); textToken2D.PlayAnimation(textScrollingAnimation); } }
public static List <TextToken2D> CreateTextTokens(string tokenType, string text, Color fillColor) { List <TextToken2D> tokens = new List <TextToken2D>(); string[] textTokens = text.Split(' '); foreach (string textToken in textTokens) { // Replace by ctr choice. TextToken2D textToken2D = CreateTextToken(tokenType, textToken, fillColor); tokens.Add(textToken2D); } return(tokens); }
public void AppendTextTokens(List <TextToken2D> tokenListToAppend, string text, string tokenType, Color fillColor) { string[] textTokens = text.Split(' '); foreach (string textToken in textTokens) { if (string.IsNullOrEmpty(textToken) == false) { TextToken2D textToken2D = null; if (textToken.StartsWith("{") && textToken.EndsWith("}") && int.TryParse(textToken.Substring(1, textToken.Length - 2), out int parameterIndex)) { textToken2D = new ParameterTextToken2D(tokenType, fillColor); } else { textToken2D = CreateTextToken(tokenType, textToken, fillColor); } tokenListToAppend.Add(textToken2D); } } }