LoopListViewItem2 OnGetItemByIndexForHour(LoopListView2 listView, int index) { LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem7 itemScript = item.GetComponent <ListItem7>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } int firstItemVal = 1; int itemCount = 24; int val = 0; if (index >= 0) { val = index % itemCount; } else { val = itemCount + ((index + 1) % itemCount) - 1; } val = val + firstItemVal; itemScript.Refresh(index, val); return(item); }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= DataSourceMgr.Get.TotalItemCount) { return(null); } ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(index); if (itemData == null) { return(null); } //get a new item. Every item can use a different prefab, the parameter of the NewListViewItem is the prefab’name. //And all the prefabs should be listed in ItemPrefabList in LoopListView2 Inspector Setting LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem5 itemScript = item.GetComponent <ListItem5>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.SetItemData(itemData, index); return(item); }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { Debug.Log(index); if (index < 0 || index >= DataSourceMgr.Get.TotalItemCount) { return(null); } ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(index); if (itemData == null) { return(null); } LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem3 itemScript = item.GetComponent <ListItem3>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.SetItemData(itemData, index); return(item); }
public static void InitListView(this LoopListView2 view, LuaTable self, int num, LuaFunction onUpdate) { if (view != null) { view.InitListView(num, (LoopListView2 arg1, int arg2) => onGetItemByIndex(arg1, arg2, self, onUpdate)); } }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= mDataList.Count) { return(null); } CustomData itemData = mDataList[index]; if (itemData == null) { return(null); } //get a new item. Every item can use a different prefab, the parameter of the NewListViewItem is the prefab’name. //And all the prefabs should be listed in ItemPrefabList in LoopListView2 Inspector Setting LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem16 itemScript = item.GetComponent <ListItem16>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.mNameText.text = itemData.mContent; return(item); }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0) { return(null); } LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem6 itemScript = item.GetComponent <ListItem6>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } for (int i = 0; i < mItemCountPerRow; ++i) { int itemIndex = index * mItemCountPerRow + i; if (itemIndex >= mListItemTotalCount) { itemScript.mItemList[i].gameObject.SetActive(false); continue; } ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex); if (itemData != null) { itemScript.mItemList[i].gameObject.SetActive(true); itemScript.mItemList[i].SetItemData(itemData, itemIndex); } else { itemScript.mItemList[i].gameObject.SetActive(false); } } return(item); }
LoopListViewItem2 OnGetItemByIndexForMonth(LoopListView2 listView, int index) { LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem7 itemScript = item.GetComponent <ListItem7>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } int firstItemVal = 1; int itemCount = 12; int val = 0; if (index >= 0) { val = index % itemCount; } else { val = itemCount + ((index + 1) % itemCount) - 1; } val = val + firstItemVal; itemScript.Value = val; itemScript.mText.text = mMonthNameArray[val - 1]; return(item); }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= ChatMsgDataSourceMgr.Get.TotalItemCount) { return(null); } ChatMsg itemData = ChatMsgDataSourceMgr.Get.GetChatMsgByIndex(index); if (itemData == null) { return(null); } LoopListViewItem2 item = null; if (itemData.mPersonId == 0) { item = listView.NewListViewItem("ItemPrefab1"); } else { item = listView.NewListViewItem("ItemPrefab2"); } ListItem4 itemScript = item.GetComponent <ListItem4>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.SetItemData(itemData, index); return(item); }
private LoopListViewItem2 OnGetItem1(LoopListView2 loopList, int index) { if (index < 0 || index >= dataNum) { return(null); } var data = new Item1Data() { HeadColor = Mathf.CorrelatedColorTemperatureToRGB(40000 * index / 20f), Desc = $"#R这是第{index}个Item的描述,表情啊#{index},哈哈哈哈哈#{index}#{index}#{index}#{index}" }; var item = loopList.NewListViewItem("Item1"); if (!item.IsInitHandlerCalled) { var script = item.GetComponent <Item1Script>(); item.UserObjectData = script; script.Init(); } var item1Script = (Item1Script)item.UserObjectData; item1Script.SetData(data); return(item); }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index > DataSourceMgr.Get.TotalItemCount) { return(null); } LoopListViewItem2 item = null; if (index == 0) { item = listView.NewListViewItem("ItemPrefab0"); UpdateLoadingTip(item); return(item); } int itemDataIndex = index - 1; ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemDataIndex); if (itemData == null) { return(null); } item = listView.NewListViewItem("ItemPrefab1"); ListItem2 itemScript = item.GetComponent <ListItem2>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.SetItemData(itemData, itemDataIndex); return(item); }
private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index > DataSourceMgr.Get.TotalItemCount) { return((LoopListViewItem2)null); } if (index == 0) { LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab0"); this.UpdateLoadingTip(loopListViewItem2); return(loopListViewItem2); } int num = index - 1; ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(num); if (itemDataByIndex == null) { return((LoopListViewItem2)null); } LoopListViewItem2 loopListViewItem2_1 = listView.NewListViewItem("ItemPrefab1"); ListItem2 component = (ListItem2)((Component)loopListViewItem2_1).GetComponent <ListItem2>(); if (!loopListViewItem2_1.IsInitHandlerCalled) { loopListViewItem2_1.IsInitHandlerCalled = true; component.Init(); } component.SetItemData(itemDataByIndex, num); return(loopListViewItem2_1); }
protected override LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= DataManger.TotalItemCount) { return(null); } GridItemData itemData = DataManger.GetItemDataByIndex(index); if (itemData == null) { return(null); } LoopListViewItem2 item = listView.NewListViewItem(ItemName); for (int i = 0; i < row; i++) { int itemIndex = index * row + i; UIGameLevelItem itemScript = item.transform.GetChild(i).GetComponent <UIGameLevelItem>(); if (itemIndex >= DataManger.TotalDataCount) { itemScript.gameObject.SetActive(false); continue; } else { itemScript.gameObject.SetActive(true); } itemScript.Init(); m_TransferDataList[itemIndex].ActionOneIntCallBack = CallBack; m_TransferDataList[itemIndex].ObjArray = new object[] { itemScript }; itemScript.SetData(m_TransferDataList[itemIndex]); } return(item); }
protected override LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= DataManger.TotalItemCount) { return(null); } GridItemData itemData = DataManger.GetItemDataByIndex(index); if (itemData == null) { return(null); } LoopListViewItem2 item = listView.NewListViewItem(ItemName); EquipItem itemScript = item.GetComponent <EquipItem>(); itemScript.Init(); itemScript.SetData(index, UnityEngine.Random.Range(1, 6), SpriteArray[UnityEngine.Random.Range(0, SpriteArray.Length)].name, UnityEngine.Random.Range(0, 2) == 1, UnityEngine.Random.Range(1, 1000), UnityEngine.Random.Range(1, 6)); itemScript.GetComponent <Button>().onClick.RemoveAllListeners(); itemScript.GetComponent <Button>().onClick.AddListener(delegate { Debug.Log(itemScript.Index); }); return(item); }
LoopListViewItem2 InitScrollView(LoopListView2 listView, int index) { if (index < 0 || index >= TotalItemCount) { return(null); } UserData itemData = GetItemDataByIndex(index); if (itemData == null) { return(null); } //get a new item. Every item can use a different prefab, the parameter of the NewListViewItem is the prefab’name. //And all the prefabs should be listed in ItemPrefabList in LoopListView2 Inspector Setting LoopListViewItem2 item = listView.NewListViewItem("UserItem"); UserItem itemScript = item.GetComponent <UserItem>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } if (itemScript != null) { itemScript.SetItemData(itemData, index); } return(item); }
private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0) { return((LoopListViewItem2)null); } if (index == DataSourceMgr.Get.TotalItemCount) { LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab0"); if (!loopListViewItem2.IsInitHandlerCalled) { loopListViewItem2.IsInitHandlerCalled = true; // ISSUE: method pointer ((UnityEvent)((ListItem11)((Component)loopListViewItem2).GetComponent <ListItem11>()).mRootButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnLoadMoreBtnClicked))); } this.UpdateLoadingTip(loopListViewItem2); return(loopListViewItem2); } ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(index); if (itemDataByIndex == null) { return((LoopListViewItem2)null); } LoopListViewItem2 loopListViewItem2_1 = listView.NewListViewItem("ItemPrefab1"); ListItem2 component = (ListItem2)((Component)loopListViewItem2_1).GetComponent <ListItem2>(); if (!loopListViewItem2_1.IsInitHandlerCalled) { loopListViewItem2_1.IsInitHandlerCalled = true; component.Init(); } component.SetItemData(itemDataByIndex, index); return(loopListViewItem2_1); }
void ShowItemPrefabDataList(LoopListView2 listView) { EditorGUILayout.PropertyField(mItemPrefabDataList, mItemPrefabListContent); if (mItemPrefabDataList.isExpanded == false) { return; } EditorGUI.indentLevel += 1; if (GUILayout.Button("Add New")) { mItemPrefabDataList.InsertArrayElementAtIndex(mItemPrefabDataList.arraySize); if (mItemPrefabDataList.arraySize > 0) { SerializedProperty itemData = mItemPrefabDataList.GetArrayElementAtIndex(mItemPrefabDataList.arraySize - 1); SerializedProperty mItemPrefab = itemData.FindPropertyRelative("mItemPrefab"); mItemPrefab.objectReferenceValue = null; } } int removeIndex = -1; EditorGUILayout.PropertyField(mItemPrefabDataList.FindPropertyRelative("Array.size")); for (int i = 0; i < mItemPrefabDataList.arraySize; i++) { SerializedProperty itemData = mItemPrefabDataList.GetArrayElementAtIndex(i); SerializedProperty mInitCreateCount = itemData.FindPropertyRelative("mInitCreateCount"); SerializedProperty mItemPrefab = itemData.FindPropertyRelative("mItemPrefab"); SerializedProperty mItemPrefabPadding = itemData.FindPropertyRelative("mPadding"); SerializedProperty mItemStartPosOffset = itemData.FindPropertyRelative("mStartPosOffset"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(itemData); if (GUILayout.Button("Remove")) { removeIndex = i; } EditorGUILayout.EndHorizontal(); if (itemData.isExpanded == false) { continue; } mItemPrefab.objectReferenceValue = EditorGUILayout.ObjectField("ItemPrefab", mItemPrefab.objectReferenceValue, typeof(GameObject), true); mItemPrefabPadding.floatValue = EditorGUILayout.FloatField("ItemPadding", mItemPrefabPadding.floatValue); if (listView.ArrangeType == ListItemArrangeType.TopToBottom || listView.ArrangeType == ListItemArrangeType.BottomToTop) { mItemStartPosOffset.floatValue = EditorGUILayout.FloatField("XPosOffset", mItemStartPosOffset.floatValue); } else { mItemStartPosOffset.floatValue = EditorGUILayout.FloatField("YPosOffset", mItemStartPosOffset.floatValue); } mInitCreateCount.intValue = EditorGUILayout.IntField("InitCreateCount", mInitCreateCount.intValue); EditorGUILayout.Space(); EditorGUILayout.Space(); } if (removeIndex >= 0) { mItemPrefabDataList.DeleteArrayElementAtIndex(removeIndex); } EditorGUI.indentLevel -= 1; }
void OnMonthSnapTargetFinished(LoopListView2 listView, LoopListViewItem2 item) { LoopListViewItem2 item0 = mLoopListViewDay.GetShownItemByIndex(0); ListItem7 itemScript = item0.GetComponent <ListItem7>(); int index = itemScript.Value - 1; mLoopListViewDay.RefreshAllShownItemWithFirstIndex(index); }
private static void SetSnapIndex(int offset, LoopListView2 view) { //m_timer = 0; int currentIndex = view.CurSnapNearestItemIndex; int nextIndex = currentIndex + offset; view.SetSnapTargetItemIndex(nextIndex); }
void OnListViewSnapTargetChanged(LoopListView2 listView, int targetIndex) { for (int i = 0; i < listView.ShownItemCount; ++i) { LoopListViewItem2 item2 = listView.GetShownItemByIndex(i); ListItem7 itemScript = item2.GetComponent <ListItem7>(); itemScript.OnListViewSnapTargetChanged(i == targetIndex); } }
private void Awake() { mLoopListView = UnityHelper.FindTheChildNode(gameObject, "Viewport").GetComponent <LoopListView2>(); mLoopListView.InitListView(0, OnGetItemByIndex); scrollbar = UnityHelper.FindTheChildNode(gameObject, "Scrollbar").GetComponent <Scrollbar>(); MessageMgr.AddMsgListener("AllMsgUIFormMsg", OnUIFormMessagesEvent); MessageMgr.AddMsgListener(Define.GLOBAL_MESSAGE_TYPE, OnGlobalMessagesEvent); }
/// <summary> /// バナードットを更新する /// </summary> /// <param name="view"></param> /// <param name="item"></param> private void OnUpdateBannerDot(LoopListView2 view, LoopListViewItem2 item) { int itemIndex = view.CurSnapNearestItemIndex; int count = ScrollItemDataList.Count; int currentIndex = itemIndex % count; //ドットをオンオフする処理 //currentIndexとリストのIndexの比較の処理が入る DotAction(currentIndex); }
private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); Item itemScript = item.GetComponent <Item>(); itemScript.SetItemData(index); return(item); }
private void OnHourSnapTargetChanged(LoopListView2 listView, LoopListViewItem2 item) { int indexInShownItemList = listView.GetIndexInShownItemList(item); if (indexInShownItemList < 0) { return; } this.mCurSelectedHour = ((ListItem7)((Component)item).GetComponent <ListItem7>()).Value; this.OnListViewSnapTargetChanged(listView, indexInShownItemList); }
public static void DestroyListView(this LoopListView2 view, LuaTable self, LuaFunction onUpdate) { if (self != null) { self.Dispose(); } if (onUpdate != null) { onUpdate.Dispose(); } }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0) { return(null); } TreeViewItemCountData countData = mTreeItemCountMgr.QueryTreeItemByTotalIndex(index); if (countData == null) { return(null); } int treeItemIndex = countData.mTreeItemIndex; TreeViewItemData treeViewItemData = TreeViewDataSourceMgr.Get.GetItemDataByIndex(treeItemIndex); if (index == countData.mBeginIndex) { LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1"); ListItem12 itemScript = item.GetComponent <ListItem12>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); itemScript.SetClickCallBack(this.OnExpandClicked); } item.UserIntData1 = treeItemIndex; item.UserIntData2 = 0; itemScript.mText.text = treeViewItemData.mName; itemScript.SetItemData(treeItemIndex, countData.mIsExpand); return(item); } else { int childIndex = index - countData.mBeginIndex - 1; ItemData itemData = treeViewItemData.GetChild(childIndex); if (itemData == null) { return(null); } LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab2"); ListItem13 itemScript = item.GetComponent <ListItem13>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } item.UserIntData1 = treeItemIndex; item.UserIntData2 = childIndex; itemScript.SetItemData(itemData, treeItemIndex, childIndex); return(item); } }
public LoopScrollerPageCom(LoopListView2 loopListView2, UnityAction <int> reqDataCall, string poolName, int pageItemNum = 20, int overlapReqCount = 5, AnimationCurve jumpToTargetCurve = null, float jumpToTargetTime = 0, HasLastPage hasLastPage = null) { loopScrollRect2LoopListView2 = new LoopScrollRect2LoopListView2(loopListView2, poolName, 0, ScrollerRectUpdateIndex); this.reqDataCall = reqDataCall; this.pageItemNum = pageItemNum; this.pageItemNum = pageItemNum; this.OverlapReqNum = overlapReqCount; this.hasLastPage = hasLastPage; this.targetJumpIndex = null; this.JumpToTargetCurve = jumpToTargetCurve; this.JumpToTargetTime = jumpToTargetTime; }
private void OnSnapNearestChanged(LoopListView2 view, LoopListViewItem2 item) { int itemIndex = m_view.CurSnapNearestItemIndex; int count = m_list.Length; int currentIndex = itemIndex % count; for (int i = 0; i < count; i++) { var dotUI = m_dotUIList[i]; dotUI.SetDisp(currentIndex == i); } }
private void OnMaxLevelChanged(LoopListView2 listView, LoopListViewItem2 item) { int index = listView.GetIndexInShownItemList(item); if (index < 0) { return; } LevelLimitItem itemScript = item.GetComponent <LevelLimitItem>(); m_LevelMax = itemScript.Level; }
LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int row) { if (row < 0) { return(null); } LoopListViewItem2 item = null; if (row == 0) { item = listView.NewListViewItem("ItemPrefab0"); UpdateLoadingTip1(item); return(item); } if (row == GetMaxRowCount() + 1) { item = listView.NewListViewItem("ItemPrefab1"); UpdateLoadingTip2(item); return(item); } int itemRow = row - 1; item = listView.NewListViewItem("ItemPrefab2"); ListItem6 itemScript = item.GetComponent <ListItem6>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } for (int i = 0; i < mItemCountPerRow; ++i) { int itemIndex = itemRow * mItemCountPerRow + i; if (itemIndex >= DataSourceMgr.Get.TotalItemCount) { itemScript.mItemList[i].gameObject.SetActive(false); continue; } ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex); if (itemData != null) { itemScript.mItemList[i].gameObject.SetActive(true); itemScript.mItemList[i].SetItemData(itemData, itemIndex); } else { itemScript.mItemList[i].gameObject.SetActive(false); } } return(item); }
void OnHourSnapTargetChanged(LoopListView2 listView, LoopListViewItem2 item) { int index = listView.GetIndexInShownItemList(item); if (index < 0) { return; } ListItem7 itemScript = item.GetComponent <ListItem7>(); mCurSelectedHour = itemScript.Value; OnListViewSnapTargetChanged(listView, index); }