public static void DoTextTagToken(Writer writer, TextTagToken token, int index, int maxIndex) { if (OnTextTagToken != null) { OnTextTagToken(writer, token, index, maxIndex); } }
private static void AddWordsToken(List<TextTagToken> tokenList, string words) { TextTagToken token = new TextTagToken(); token.type = TokenType.Words; token.paramList = new List<string>(); token.paramList.Add(words); tokenList.Add(token); }
void OnTextTagToken(Writer writer, TextTagToken token, int index, int maxIndex) { if (index == 0 && token.type == TokenType.BoldStart) { correctTagCount++; } else if (index == 1 && token.type == TokenType.Wait) { correctTagCount++; } else if (index == 2 && token.type == TokenType.Words) { correctTagCount++; } else if (index == 3 && token.type == TokenType.BoldEnd) { correctTagCount++; } }
private static void AddTagToken(List<TextTagToken> 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); var 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) { TextTagToken token = new TextTagToken(); token.type = type; token.paramList = parameters; tokenList.Add(token); } else { Debug.LogWarning("Invalid text tag " + tag); } }
public static void DoTextTagToken(Writer writer, TextTagToken token, int index, int maxIndex) { if(OnTextTagToken != null) OnTextTagToken(writer, token, index, maxIndex); }