Example #1
0
    void OnInitItem(LoopItemObject item, LoopItemData data)
    {
        chatItemData myData   = data as chatItemData;
        chatItem     itemComp = item.widget.GetComponent <chatItem>();

        itemComp.showItemByType(myData.ItemType);

        switch (myData.ItemType)
        {
        case 1:
            itemComp.selfContent.text       = myData.content;
            itemComp.selfUserNameLabel.text = myData.username;
            break;

        case 2:
            itemComp.otherContent.text       = myData.content;
            itemComp.ohterUserNameLabel.text = myData.username;
            GameObject go = itemComp.transform.FindChild("otherChatItem/headImgBg/headImg").gameObject;
            //go.name = "headImg" + myData.uid;
            UIEventListener.Get(go).onClick
                = (g) => { print(myData.uid); };
            break;

        case 3:
            itemComp.timeLable.text = myData.content;

            break;
        }
    }
Example #2
0
    void OnItemInit(LoopItemObject item, LoopItemData data)
    {
        chatItemData myData   = data as chatItemData;
        chatItem     itemComp = item.widget.GetComponent <chatItem>();

        itemComp.showItemByType(myData.ItemType);
        itemComp.otherContent.text = myData.content;
        itemComp.selfContent.text  = myData.content;
        itemComp.timeLable.text    = myData.content;
        item.gameObject.name       = "Item" + item.dataIndex;
        //item.widget.gameObject.SetActive(false);
        //print(myData.content +"  " +item.widget.isVisible);
    }
Example #3
0
 static int showItemByType(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         chatItem obj  = (chatItem)ToLua.CheckObject(L, 1, typeof(chatItem));
         int      arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.showItemByType(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }