protected static void AddWordsToken(List<Token> tokenList, string words) { Token token = new Token(); token.type = TokenType.Words; token.param = words; tokenList.Add(token); }
protected virtual void AddTagToken(List<Token> tokenList, string tagText) { if (tagText.Length < 3 || tagText.Substring(0,1) != "{" || tagText.Substring(tagText.Length - 1,1) != "}") { return; } string tag = tagText.Substring(1, tagText.Length - 2); TokenType type = TokenType.Words; string paramText = ""; if (tag == "b") { type = TokenType.BoldStart; } else if (tag == "/b") { type = TokenType.BoldEnd; } else if (tag == "i") { type = TokenType.ItalicStart; } else if (tag == "/i") { type = TokenType.ItalicEnd; } else if (tag.StartsWith("color=")) { type = TokenType.ColorStart; paramText = tag.Substring(6, tag.Length - 6); } else if (tag == "/color") { type = TokenType.ColorEnd; } else if (tag == "wi") { type = TokenType.WaitForInputNoClear; } if (tag == "wc") { type = TokenType.WaitForInputAndClear; } else if (tag.StartsWith("wp=")) { type = TokenType.WaitOnPunctuationStart; paramText = tag.Substring(3, tag.Length - 3); } else if (tag == "wp") { type = TokenType.WaitOnPunctuationStart; } else if (tag == "/wp") { type = TokenType.WaitOnPunctuationEnd; } else if (tag.StartsWith("w=")) { type = TokenType.Wait; paramText = tag.Substring(2, tag.Length - 2); } else if (tag == "w") { type = TokenType.Wait; } else if (tag == "c") { type = TokenType.Clear; } else if (tag.StartsWith("s=")) { type = TokenType.SpeedStart; paramText = tag.Substring(2, tag.Length - 2); } else if (tag == "s") { type = TokenType.SpeedStart; } else if (tag == "/s") { type = TokenType.SpeedEnd; } else if (tag == "x") { type = TokenType.Exit; } else if (tag.StartsWith("m=")) { type = TokenType.Message; paramText = tag.Substring(2, tag.Length - 2); } else if (tag.StartsWith("vpunch=")) { type = TokenType.VerticalPunch; paramText = tag.Substring(7, tag.Length - 7); } else if (tag.StartsWith("hpunch=")) { type = TokenType.HorizontalPunch; paramText = tag.Substring(7, tag.Length - 7); } else if (tag.StartsWith("shake=")) { type = TokenType.Shake; paramText = tag.Substring(6, tag.Length - 6); } else if (tag.StartsWith("shiver=")) { type = TokenType.Shiver; paramText = tag.Substring(7, tag.Length - 7); } else if (tag.StartsWith("flash=")) { type = TokenType.Flash; paramText = tag.Substring(6, tag.Length - 6); } else if (tag.StartsWith("audio=")) { type = TokenType.Audio; paramText = tag.Substring(6, tag.Length - 6); } else if (tag.StartsWith("audioloop=")) { type = TokenType.AudioLoop; paramText = tag.Substring(10, tag.Length - 10); } Token token = new Token(); token.type = type; token.param = paramText.Trim(); tokenList.Add(token); }
protected virtual void AddTagToken(List<Token> tokenList, string tagText) { if (tagText.Length < 3 || tagText.Substring(0,1) != "{" || tagText.Substring(tagText.Length - 1,1) != "}") { return; } string tag = tagText.Substring(1, tagText.Length - 2); TokenType type = TokenType.Words; string paramText = ""; if (tag == "b") { type = TokenType.BoldStart; } else if (tag == "/b") { type = TokenType.BoldEnd; } else if (tag == "i") { type = TokenType.ItalicStart; } else if (tag == "/i") { type = TokenType.ItalicEnd; } else if (tag.StartsWith("color=")) { type = TokenType.ColorStart; paramText = tag.Substring(6, tag.Length - 6); } else if (tag == "/color") { type = TokenType.ColorEnd; } else if (tag == "wi") { type = TokenType.WaitForInputNoClear; } if (tag == "wc") { type = TokenType.WaitForInputAndClear; } else if (tag.StartsWith("wp=")) { type = TokenType.WaitOnPunctuation; paramText = tag.Substring(3, tag.Length - 3); } else if (tag == "wp") { type = TokenType.WaitOnPunctuation; } else if (tag.StartsWith("w=")) { type = TokenType.Wait; paramText = tag.Substring(2, tag.Length - 2); } else if (tag == "w") { type = TokenType.Wait; } else if (tag == "c") { type = TokenType.Clear; } else if (tag.StartsWith("s=")) { type = TokenType.Speed; paramText = tag.Substring(2, tag.Length - 2); } else if (tag == "s") { type = TokenType.Speed; } else if (tag == "x") { type = TokenType.Exit; } else if (tag.StartsWith("m=")) { type = TokenType.Message; paramText = tag.Substring(2, tag.Length - 2); } Token token = new Token(); token.type = type; token.param = paramText.Trim(); tokenList.Add(token); }
protected virtual void AddTagToken(List<Token> tokenList, string tagText) { if (tagText.Length < 3 || tagText.Substring(0,1) != "{" || tagText.Substring(tagText.Length - 1,1) != "}") { return; } string tag = tagText.Substring(1, tagText.Length - 2); TokenType type = TokenType.Invalid; List<string> parameters = ExtractParameters(tag); if (tag == "b") { type = TokenType.BoldStart; } else if (tag == "/b") { type = TokenType.BoldEnd; } else if (tag == "i") { type = TokenType.ItalicStart; } else if (tag == "/i") { type = TokenType.ItalicEnd; } else if (tag.StartsWith("color=")) { type = TokenType.ColorStart; } else if (tag == "/color") { type = TokenType.ColorEnd; } else if (tag.StartsWith("size=")) { type = TokenType.SizeStart; } else if (tag == "/size") { type = TokenType.SizeEnd; } else if (tag == "wi") { type = TokenType.WaitForInputNoClear; } if (tag == "wc") { type = TokenType.WaitForInputAndClear; } else if (tag.StartsWith("wp=")) { type = TokenType.WaitOnPunctuationStart; } else if (tag == "wp") { type = TokenType.WaitOnPunctuationStart; } else if (tag == "/wp") { type = TokenType.WaitOnPunctuationEnd; } else if (tag.StartsWith("w=")) { type = TokenType.Wait; } else if (tag == "w") { type = TokenType.Wait; } else if (tag == "c") { type = TokenType.Clear; } else if (tag.StartsWith("s=")) { type = TokenType.SpeedStart; } else if (tag == "s") { type = TokenType.SpeedStart; } else if (tag == "/s") { type = TokenType.SpeedEnd; } else if (tag == "x") { type = TokenType.Exit; } else if (tag.StartsWith("m=")) { type = TokenType.Message; } else if (tag.StartsWith("vpunch") || tag.StartsWith("vpunch=")) { type = TokenType.VerticalPunch; } else if (tag.StartsWith("hpunch") || tag.StartsWith("hpunch=")) { type = TokenType.HorizontalPunch; } else if (tag.StartsWith("punch") || tag.StartsWith("punch=")) { type = TokenType.Punch; } else if (tag.StartsWith("flash") || tag.StartsWith("flash=")) { type = TokenType.Flash; } else if (tag.StartsWith("audio=")) { type = TokenType.Audio; } else if (tag.StartsWith("audioloop=")) { type = TokenType.AudioLoop; } else if (tag.StartsWith("audiopause=")) { type = TokenType.AudioPause; } else if (tag.StartsWith("audiostop=")) { type = TokenType.AudioStop; } if (type != TokenType.Invalid) { Token token = new Token(); token.type = type; token.paramList = parameters; tokenList.Add(token); } else { Debug.LogWarning("Invalid text tag " + tag); } }
protected virtual void AddWordsToken(List<Token> tokenList, string words) { Token token = new Token(); token.type = TokenType.Words; token.paramList = new List<string>(); token.paramList.Add(words); tokenList.Add(token); }