コード例 #1
0
//	public void ReceiveChat(List<COM_ChatInfo> ChatInfos)
//	{
//		Refresh ();
//		GameObject go = null;
//		for(int i = 0;i<ChatInfos.Count;i++)
//		{
//			if (ChatInfos[i].ck_ != ChatSystem.instance.chatType)
//				continue;
//
//			GameObject clone = GameObject.Instantiate (Item)as GameObject;
//			clone.transform.parent = grid.transform;
//			clone.transform.position = Vector3.zero;
//			clone.transform.localScale = Vector3.one;
//			ShowLineCell cell = clone.GetComponent<ShowLineCell> ();
//			cell.ChatInfo = ChatInfos[i];
//			if (ChatInfos[i].audio_.Length > 0)
//			{
//				cell.isVec = true;
//			}
//			else
//			{
//				cell.isVec = false;
//			}
//
//			if (mlist.Count +1 >MaxCount)
//			{
//				go = mlist[0];
//				mlist.Remove(go);
//				Destroy(go);
//			}
//
//			mlist.Add(clone);
//			grid.repositionNow = true;
//			clone.SetActive(true);
//
//			//grid.Reposition();
//		}
//
//	}

    public void UpdataChatItem(List <COM_ChatInfo> ChatInfos)
    {
        Refresh();
        GameObject go = null;

        for (int i = 0; i < ChatInfos.Count; i++)
        {
            GameObject clone = GameObject.Instantiate(Item) as GameObject;
            clone.transform.parent     = grid.transform;
            clone.transform.position   = Vector3.zero;
            clone.transform.localScale = Vector3.one;
            ShowLineCell cell = clone.GetComponent <ShowLineCell> ();
            cell.ChatInfo = ChatInfos[i];
            if (ChatInfos[i].audio_.Length > 0)
            {
                cell.isVec = true;
            }
            else
            {
                cell.isVec = false;
            }

            if (mlist.Count + 1 > MaxCount)
            {
                go = mlist[0];
                mlist.Remove(go);
                Destroy(go);
            }

            mlist.Add(clone);
            grid.repositionNow = true;
            clone.SetActive(true);
        }



//		for (int k =0; k<items.Length; k++)
//		{
//			items[k].gameObject.SetActive(false);
//		}
//
//		for(int i=ChatInfos.Count-1,j=0;i>=0&&j<items.Length;i--,j++)
//		{
//			if(!ChatSystem.instance.GetTypeIsOPen(ChatInfos[i].ck_))
//				continue;
//			ShowLineCell cell = items[j].GetComponent<ShowLineCell>();
//			if (ChatInfos[i].audio_.Length > 0)
//			{
//				cell.isVec = true;
//			}
//			else
//			{
//				cell.isVec = false;
//			}
//			items[j].gameObject.SetActive(true);
//			cell.ChatInfo = ChatInfos[i];
//		}
    }
コード例 #2
0
    public void UpdataChatItem(List <COM_ChatInfo> ChatInfos)
    {
        for (int k = 0; k < items.Length; k++)
        {
            items[k].gameObject.SetActive(false);
        }

        for (int i = ChatInfos.Count - 1, j = 0; i >= 0 && j < items.Length; i--, j++)
        {
            //if(!ChatSystem.instance.GetTypeIsOPen(ChatInfos[i].ck_))
            //	continue;
            ShowLineCell cell = items[j].GetComponent <ShowLineCell>();
            if (ChatInfos[i].audio_.Length > 0)
            {
                cell.isVec = true;
            }
            else
            {
                cell.isVec = false;
            }
            items[j].gameObject.SetActive(true);
            cell.ChatInfo = ChatInfos[i];
        }
    }