コード例 #1
0
    public IFlexibleItemView GetItemView(int position, RectTransform itemParent, DynamicFlexibleLayout parent)
    {
        //int index = position;
        int index = m_DataInfoList.Count - position - 1;

        switch (m_DataInfoList[index].messageType)
        {
        case MessageType.SystemInfo:
            var go       = Instantiate(systemInfoGo, itemParent);
            var itemView = new SystemInfoItemView();
            itemView.rectTransform = go.transform as RectTransform;;
            itemView.msgText       = go.transform.GetChild(0).GetComponent <Text>();
            return(itemView);

        case MessageType.OtherTextInfo:
            var go1       = Instantiate(otherTextInfoGo, itemParent);
            var itemView1 = new OtherTextItemView();
            itemView1.rectTransform = go1.transform as RectTransform;;
            itemView1.msgText       = go1.transform.Find("Info/Msg/Text").GetComponent <Text>();
            return(itemView1);

        case MessageType.OtherVocieInfo:
            var go2       = Instantiate(otherVoiceInfoGo, itemParent);
            var itemView2 = new OtherVoiceItemView();
            itemView2.rectTransform = go2.transform as RectTransform;;
            itemView2.msgText       = go2.transform.Find("Info/Msg/Text").GetComponent <Text>();
            return(itemView2);

        case MessageType.MyselfTextInfo:
            var go3       = Instantiate(myTextInfoGo, itemParent);
            var itemView3 = new MyselfTextItemView();
            itemView3.rectTransform = go3.transform as RectTransform;;
            itemView3.msgText       = go3.transform.Find("Info/Msg/Text").GetComponent <Text>();
            return(itemView3);

        case MessageType.MyselfVoiceInfo:
            var go4       = Instantiate(myVoiceInfoGo, itemParent);
            var itemView4 = new MyselfVoiceItemView();
            itemView4.rectTransform = go4.transform as RectTransform;;
            itemView4.msgText       = go4.transform.Find("Info/Msg/Text").GetComponent <Text>();
            return(itemView4);
        }

        return(null);
    }
コード例 #2
0
    public void ProcessItemView(int position, IFlexibleItemView itemView, DynamicFlexibleLayout parent)
    {
        //第一条数据显示在最上面
        //var index = position;
        //最后一条数据显示在最上面
        var index = m_DataInfoList.Count - position - 1;

        switch (m_DataInfoList[index].messageType)
        {
        case MessageType.SystemInfo:
            var systemItemView = itemView as SystemInfoItemView;
            systemItemView.msgText.text = m_DataInfoList[index].msgText;
            break;

        case MessageType.OtherTextInfo:
            var otherTextItemView = itemView as OtherTextItemView;
            otherTextItemView.msgText.text = m_DataInfoList[index].msgText;
            break;

        case MessageType.OtherVocieInfo:
            var otherVoiceItemView = itemView as OtherVoiceItemView;
            otherVoiceItemView.msgText.text = m_DataInfoList[index].msgText;
            break;

        case MessageType.MyselfTextInfo:
            var myTextItemView = itemView as MyselfTextItemView;
            myTextItemView.msgText.text = m_DataInfoList[index].msgText;
            break;

        case MessageType.MyselfVoiceInfo:
            var myVoiceItemView = itemView as MyselfVoiceItemView;
            myVoiceItemView.msgText.text = m_DataInfoList[index].msgText;
            break;

        default:
            break;
        }
    }
コード例 #3
0
 public RecycleBin(DynamicFlexibleLayout layout)
 {
     m_Owner = layout;
 }
コード例 #4
0
 public void RecycleItemViewDone(DynamicFlexibleLayout parent)
 {
 }
コード例 #5
0
 public bool RecycleItemView(IFlexibleItemView itemView, DynamicFlexibleLayout parent)
 {
     return(false);
 }