예제 #1
0
    private string RandomDonationMessage(int emotes = 0)
    {
        string message = messages[Random.Range(0, messages.Count - 1)];

        for (int i = 0; i < emotes; i++)
        {
            message += TwitchEmotes.RandomEmote() + " ";
        }
        return(message);
    }
예제 #2
0
    private string ProcessEmoticons(string text)
    {
        if (textMesh == null)
        {
            return("");
        }

        if (string.IsNullOrEmpty(text))
        {
            return("");
        }

        string result = "";
        int    length = 0;

        foreach (string word in text.Split(' '))
        {
            if (length > charsPerLine)
            {
                result += "\n";
                length  = 0;
            }
            if (!TwitchEmotes.IsEmote(word))
            {
                result += word + " ";
                length += word.Length + 1;
            }
            else
            {
                Vector2     pos    = TwitchEmotes.GetPos(word);
                const float offset = 0.1428f;
                result += string.Format("<quad material=1 x={0} y={1} width={2} height={3} size=80/> ", offset * pos.x, offset * pos.y, offset, offset);
                length += 4;
            }
        }

        if (textMesh.GetComponent <MeshRenderer>().materials.Length > 1)
        {
            result += string.Format("<quad material=1 x={0} y={1} width={2} height={3} size=80/> ", 0, 0, 0.00001f, 0.00001f);
        }

        return(result);
    }