Exemple #1
0
	void Start()
	{
		for (int i = 0; i < 100; i++)
		{
			deleteAndAddDatas.Add(new SimpleData { index = Example.global_index++ });
		}

		BindEvent();

		scrollSystem.SetItemRefresh((prefabName, root, data) =>
		{
			if (useOpenCloseRefreshEvent)
			{
				Debug.Log(string.Format(" {0} Refresh id:{1}", prefabName, (data as SimpleData).index.ToString()));
			}
			switch (prefabName)
			{
				case "A":
					{
						root.GetComponent<ItemA>().OnRefresh(data as SimpleData);
					}
					break;
				case "B":
					{
						root.GetComponent<ItemB>().OnRefresh(data as SimpleData);
					}
					break;
				case "C":
					{
						root.GetComponent<ItemC>().OnRefresh(data as SimpleData);
					}
					break;
				case "D":
					{
						root.GetComponent<ItemD>().OnRefresh(data as SimpleData);
					}
					break;
				case "Chat":
					{
						root.GetComponent<ItemChat>().OnRefresh(data as ChatData);
					}
					break;
			}
		});

		scrollSystem.SetItemClose((prefabName, root, data) =>
		{
			if (useOpenCloseRefreshEvent)
			{
				Debug.Log(string.Format(" {0} Close", prefabName));
			}
		});

		scrollSystem.SetItemOpen((prefabName, root, data) =>
		{
			if (useOpenCloseRefreshEvent)
			{
				Debug.Log(string.Format(" {0} Open", prefabName));
			}
		});

		if (useBeginDragEvent)
		{
			scrollSystem.SetBeginDrag(data =>
			{
				Debug.Log("OnBeginDrag");
			});
		}

		if (useEndDragEvent)
		{
			scrollSystem.SetEndDrag(data =>
			{
				Debug.Log("OnEndDrag");
			});
		}

		if (useDragEvent)
		{
			scrollSystem.SetDrag(data =>
			{
				Debug.Log("OnDrag");
			});
		}

	}