private void OnGUI() { m_setCount = GUILayout.TextField(m_setCount); int setCount = 0; int.TryParse(m_setCount, out setCount); if (GUILayout.Button("項目数設定")) { m_view.SetListItemCount(setCount, false); } m_addCount = GUILayout.TextField(m_addCount); int addCount = 0; int.TryParse(m_addCount, out addCount); if (GUILayout.Button("項目数追加")) { int count = m_view.ItemTotalCount + addCount; m_view.SetListItemCount(count, false); } m_jumpToIndex = GUILayout.TextField(m_jumpToIndex); int jumpToIndex = 0; int.TryParse(m_jumpToIndex, out jumpToIndex); if (GUILayout.Button("特定の項目にジャンプ")) { m_view.MovePanelToItemIndex(jumpToIndex, 0); } if (GUILayout.Button("位置リセット")) { m_view.MovePanelToItemIndex(0, 0); } }
private void OnUIFormMessagesEvent(string key, object values) { switch (key) { case Define.ON_UPDATE_DEBUG_COUNT: OnUpdataDebugCount(JsonUtility.FromJson <DebugCountInfo>((string)values)); break; case "CloseData": OnCloseData(); break; case Define.ON_ALL_MSG_UI_MOVE_TO_INDEX: mLoopListView.MovePanelToItemIndex((int)values, 0); break; } }
/// <summary> 跳转到指定索引 </summary> /// <param name="itemIndex">一级树索引(0开始)</param> /// <param name="childIndex">二级树索引(0开始)</param> public void MoveToIndex(int itemIndex, int childIndex) { int finalIndex = 0; if (childIndex < 0) { childIndex = 0; } TreeViewItemCountData itemCountData = TreeItemCountMgr.GetTreeItem(itemIndex); if (itemCountData == null) { return; } int childCount = itemCountData.mChildCount; if (itemCountData.mIsExpand == false || childCount == 0 || childIndex == 0) { finalIndex = itemCountData.mBeginIndex; } else { if (childIndex > childCount) { childIndex = childCount; } if (childIndex < 1) { childIndex = 1; } finalIndex = itemCountData.mBeginIndex + childIndex; } LoopListView.MovePanelToItemIndex(finalIndex, 0); }
void OnJumpBtnClicked() { int itemIndex = 0; if (int.TryParse(mScrollToInput.text, out itemIndex) == false) { return; } if (itemIndex < 0) { itemIndex = 0; } itemIndex++; int count1 = itemIndex / mItemCountPerRow; if (itemIndex % mItemCountPerRow > 0) { count1++; } if (count1 > 0) { count1--; } mLoopListView.MovePanelToItemIndex(count1, 0); }
void OnJumpBtnClicked() { int itemIndex = 0; if (int.TryParse(mScrollToInput.text, out itemIndex) == false) { return; } mLoopListView.MovePanelToItemIndex(itemIndex, 0); }
void OnJumpBtnClicked() { int itemIndex = 0; //int.TryParse(string s,out int i) 的参数: s是要转换的字符串,i 是转换的结果。 if (int.TryParse("0", out itemIndex) == false) { return; } if (itemIndex < 0) { return; } mLoopListView.MovePanelToItemIndex(itemIndex, 0); }
void OnJumpBtnClicked() { int itemIndex = 0; if (int.TryParse(mScrollToInput.text, out itemIndex) == false) { return; } itemIndex -= 2; if (itemIndex < 0) { itemIndex = 0; } mLoopListView.MovePanelToItemIndex(itemIndex, 0); mLoopListView.FinishSnapImmediately(); }
void OnJumpBtnClicked() { int itemIndex = 0; int childIndex = 0; int finalIndex = 0; if (int.TryParse(mScrollToInputItem.text, out itemIndex) == false) { return; } if (int.TryParse(mScrollToInputChild.text, out childIndex) == false) { childIndex = 0; } if (childIndex < 0) { childIndex = 0; } TreeViewItemCountData itemCountData = mTreeItemCountMgr.GetTreeItem(itemIndex); if (itemCountData == null) { return; } int childCount = itemCountData.mChildCount; if (itemCountData.mIsExpand == false || childCount == 0 || childIndex == 0) { finalIndex = itemCountData.mBeginIndex; } else { if (childIndex > childCount) { childIndex = childCount; } if (childIndex < 1) { childIndex = 1; } finalIndex = itemCountData.mBeginIndex + childIndex; } mLoopListView.MovePanelToItemIndex(finalIndex, 0); }
protected void Awake() { dataNum = 100; LoopList.InitListView(100, OnGetItem1); SetBtn.onClick.AddListener(() => { if (int.TryParse(InputField.text, out var num)) { dataNum = num; LoopList.SetListItemCount(num, false); } }); ScollTo.onClick.AddListener(() => { if (int.TryParse(InputField.text, out var index)) { LoopList.MovePanelToItemIndex(index, 0); } }); }
//LoopListViewItem2 OnGetItemByIndex1(LoopListView2 listView, int index) //{ // if (index < 0 || index >= DataManger.TotalItemCount) // { // return null; // } // ItemData 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; // EquipItem itemScript = item.transform.GetChild(i).GetComponent<EquipItem>(); // if (itemIndex >= DataManger.TotalDataCount) // { // itemScript.gameObject.SetActive(false); // continue; // } // if (item.IsInitHandlerCalled == false) // { // item.IsInitHandlerCalled = true; // } // itemScript.Init(); // itemScript.SetData(itemIndex, 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; //} /// <summary> 移动到指定索引(0开始) </summary> /// <param name="index"></param> public void MoveToIndex(int index) { LoopListView.MovePanelToItemIndex(index / row, 0); }
void OnJumpBtnClicked(int count) { mLoopListView.MovePanelToItemIndex(count, 0); }
void OnAppendMsgBtnClicked() { ChatMsgDataSourceMgr.Get.AppendOneMsg(); mLoopListView.SetListItemCount(ChatMsgDataSourceMgr.Get.TotalItemCount, false); mLoopListView.MovePanelToItemIndex(ChatMsgDataSourceMgr.Get.TotalItemCount - 1, 0); }