Example #1
0
    private IEnumerator CreateEmoji(List <cfg_chatExpressionEntity> lstExpressionEntity, Action <int> onExpressionClick)
    {
        if (m_EmojiCache.Count > 0)
        {
            yield break;
        }

        for (int i = 0; i < lstExpressionEntity.Count; ++i)
        {
            AssetBundleManager.Instance.LoadOrDownload(string.Format("download/{0}/prefab/uiprefab/emoji/{1}.drb", ConstDefine.GAME_NAME, lstExpressionEntity[i].image), lstExpressionEntity[i].image, (GameObject go) =>
            {
                if (go != null)
                {
                    go = Instantiate(go);
                    go.SetParent(m_ExpressionGrid);
                    UIItemChatExpression uiExpression       = go.GetOrCreatComponent <UIItemChatExpression>();
                    go.GetComponent <UIAnimation>().enabled = false;
                    uiExpression.SetUI(lstExpressionEntity[i].id, lstExpressionEntity[i].image, onExpressionClick);
                    m_EmojiCache.Add(uiExpression);
                }
            });

            yield return(null);
        }
    }
Example #2
0
 public void SetEmoji(List <cfg_interactiveExpressionEntity> lst, Action <int, int> onEmojiClick)
 {
     if (m_InteractiveContainer == null)
     {
         return;
     }
     OnEmojiClick = onEmojiClick;
     for (int i = 0; i < lst.Count; ++i)
     {
         cfg_interactiveExpressionEntity entity = lst[i];
         GameObject go = new GameObject();
         go.SetParent(m_InteractiveContainer);
         Image img = go.AddComponent <Image>();
         UIItemChatExpression item = go.AddComponent <UIItemChatExpression>();
         string path = string.Format("download/{0}/source/uisource/gameuisource/interactive/{1}.drb", ConstDefine.GAME_NAME, entity.animation);
         img.overrideSprite = AssetBundleManager.Instance.LoadSprite(path, entity.image);
         item.SetUI(entity.id, entity.image, OnExpressionClick);
     }
 }