예제 #1
0
 static bool GetIndex_(EmojiConfig config, string ch, out int ind)
 {
     if (getIndexDelegate == null)
     {
         return(GetIndex(config, ch, out ind));
     }
     return(getIndexDelegate(config, ch, out ind));
 }
예제 #2
0
 static Rect GetRect_(EmojiConfig config, int ind)
 {
     if (getRectDelegate == null)
     {
         return(GetRect(config, ind));
     }
     return(getRectDelegate(config, ind));
 }
예제 #3
0
 static Texture GetTexture_(EmojiConfig config)
 {
     if (getTextureDelegate == null)
     {
         return(GetTexture(config));
     }
     return(getTextureDelegate(config));
 }
예제 #4
0
        public static void UpdateEmojiReplacements(string inputString, EmojiConfig config, System.Action <string, int> onEmojiChar)
        {
            if (!string.IsNullOrEmpty(inputString))
            {
                int i = 0;
                while (i < inputString.Length)
                {
                    string singleChar = inputString.Substring(i, 1);
                    string doubleChar = "";
                    string fourChar   = "";

                    if (i < (inputString.Length - 1))
                    {
                        doubleChar = inputString.Substring(i, 2);
                    }

                    if (i < (inputString.Length - 3))
                    {
                        fourChar = inputString.Substring(i, 4);
                    }

                    int emojiIndex;
                    if (GetIndex_(config, fourChar, out emojiIndex))
                    {
                        // Check 64 bit emojis first
                        onEmojiChar(fourChar, emojiIndex);
                        i += 4;
                    }
                    else if (GetIndex_(config, doubleChar, out emojiIndex))
                    {
                        // Then check 32 bit emojis
                        onEmojiChar(doubleChar, emojiIndex);
                        i += 2;
                    }
                    else if (GetIndex_(config, singleChar, out emojiIndex))
                    {
                        onEmojiChar(singleChar, emojiIndex);
                        i++;
                    }
                    else
                    {
                        onEmojiChar(singleChar, -1);
                        i++;
                    }
                }
            }
        }
예제 #5
0
 protected static bool GetIndex(EmojiConfig config, string ch, out int ind)
 {
     return(config.map.TryGetValue(ch, out ind));
 }
예제 #6
0
 protected static Rect GetRect(EmojiConfig config, int ind)
 {
     return(config.rects[ind]);
 }
예제 #7
0
 protected static Texture GetTexture(EmojiConfig config)
 {
     return(config.texture);
 }