private static int SetEmojiSprite(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(int))) { var gameObject = LuaScriptMgr.GetUnityObject <GameObject>(L, 1); if (gameObject != null) { var image = gameObject.GetComponent <Image>(); if (image != null) { var index = (int)LuaDLL.lua_tonumber(L, 2); var emoji = CEmojiManager.Instance.GetEmotionAssetById(CEmojiManager.EmojiIndex2EmojiID(index)); if (emoji != null) { image.sprite = emoji.IconSprite; } } } } else { LogParamError("SetEmojiSprite", count); } return(0); }
private static int InputEmoji(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(InputField), typeof(int))) { var inputField = LuaScriptMgr.GetUnityObject <InputField>(L, 1); if (inputField != null) { var index = (int)LuaDLL.lua_tonumber(L, 2); //var emoji = CEmojiManager.Instance.GetEmotionAssetById(index); //if (emoji != null) { var oldContent = inputField.text; inputField.text = HobaText.Format("{0}[e]{1}[-]", oldContent, CEmojiManager.EmojiIndex2EmojiID(index)); } } } else { LogParamError("InputEmoji", count); } return(0); }