Exemplo n.º 1
0
        private static void AddWordsToken(List <TextTagTokenExtend> tokenList, string words)
        {
            TextTagTokenExtend token = new TextTagTokenExtend();

            token.type      = TokenTypeExtend.Words;
            token.paramList = new List <string>();
            token.paramList.Add(words);
            tokenList.Add(token);
        }
Exemplo n.º 2
0
        private static void AddTagToken(List <TextTagTokenExtend> 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       = TokenTypeExtend.Invalid;
            List <string> parameters = ExtractParameters(tag);

            if (tag == "b")
            {
                type = TokenTypeExtend.BoldStart;
            }
            else if (tag == "/b")
            {
                type = TokenTypeExtend.BoldEnd;
            }
            else if (tag == "i")
            {
                type = TokenTypeExtend.ItalicStart;
            }
            else if (tag == "/i")
            {
                type = TokenTypeExtend.ItalicEnd;
            }
            else if (tag.StartsWith("color="))
            {
                type = TokenTypeExtend.ColorStart;
            }
            else if (tag == "/color")
            {
                type = TokenTypeExtend.ColorEnd;
            }
            else if (tag.StartsWith("size="))
            {
                type = TokenTypeExtend.SizeStart;
            }
            else if (tag == "/size")
            {
                type = TokenTypeExtend.SizeEnd;
            }
            else if (tag == "wi")
            {
                type = TokenTypeExtend.WaitForInputNoClear;
            }
            else if (tag == "wc")
            {
                type = TokenTypeExtend.WaitForInputAndClear;
            }
            else if (tag == "wvo")
            {
                type = TokenTypeExtend.WaitForVoiceOver;
            }
            else if (tag.StartsWith("wp="))
            {
                type = TokenTypeExtend.WaitOnPunctuationStart;
            }
            else if (tag == "wp")
            {
                type = TokenTypeExtend.WaitOnPunctuationStart;
            }
            else if (tag == "/wp")
            {
                type = TokenTypeExtend.WaitOnPunctuationEnd;
            }
            else if (tag.StartsWith("w="))
            {
                type = TokenTypeExtend.Wait;
            }
            else if (tag == "w")
            {
                type = TokenTypeExtend.Wait;
            }
            else if (tag == "c")
            {
                type = TokenTypeExtend.Clear;
            }
            else if (tag.StartsWith("s="))
            {
                type = TokenTypeExtend.SpeedStart;
            }
            else if (tag == "s")
            {
                type = TokenTypeExtend.SpeedStart;
            }
            else if (tag == "/s")
            {
                type = TokenTypeExtend.SpeedEnd;
            }
            else if (tag == "x")
            {
                type = TokenTypeExtend.Exit;
            }
            else if (tag.StartsWith("m="))
            {
                type = TokenTypeExtend.Message;
            }
            //Sora.add
            else if (tag.StartsWith("emoji="))
            {
                type = TokenTypeExtend.Emoji;
            }
            else if (tag.StartsWith("vpunch") ||
                     tag.StartsWith("vpunch="))
            {
                type = TokenTypeExtend.VerticalPunch;
            }
            else if (tag.StartsWith("hpunch") ||
                     tag.StartsWith("hpunch="))
            {
                type = TokenTypeExtend.HorizontalPunch;
            }
            else if (tag.StartsWith("punch") ||
                     tag.StartsWith("punch="))
            {
                type = TokenTypeExtend.Punch;
            }
            else if (tag.StartsWith("flash") ||
                     tag.StartsWith("flash="))
            {
                type = TokenTypeExtend.Flash;
            }
            else if (tag.StartsWith("audio="))
            {
                type = TokenTypeExtend.Audio;
            }
            else if (tag.StartsWith("audioloop="))
            {
                type = TokenTypeExtend.AudioLoop;
            }
            else if (tag.StartsWith("audiopause="))
            {
                type = TokenTypeExtend.AudioPause;
            }
            else if (tag.StartsWith("audiostop="))
            {
                type = TokenTypeExtend.AudioStop;
            }

            if (type != TokenTypeExtend.Invalid)
            {
                TextTagTokenExtend token = new TextTagTokenExtend();
                token.type      = type;
                token.paramList = parameters;
                tokenList.Add(token);
            }
            else
            {
                Debug.LogWarning("Invalid text tag " + tag);
            }
        }