private void OnItemSelectionChangedCallback(SimpleListView arg1, IList <int> arg2) { foreach (var idx in arg2) { Debug.Log("选中了 " + arg1.items[idx].displayName); } }
private void OnItemDrawCallback(SimpleListView arg1, SimpleListViewItem item, int column, Rect rect, bool arg4, bool arg5) { if (column == 0) { item.displayName = EditorGUI.TextField(rect, item.displayName); } else { EditorGUI.TextField(rect, String.Empty); } }
public override void Init(params object[] param) { base.Init(param); mUIGen = gameObject.AddComponent <SelectRoleUIGen>(); mUIGen.roleItemGameObject.SetActive(false); mRoleListView = new SimpleListView <PRoleInfo, SelectRoleRoleItemViewUI>(); mRoleListView.Init(this); mRoleListView.Create(); mUIGen.addButton.onClick.AddListener(OnAddRole); mUIGen.confirmButton.onClick.AddListener(OnLogin); AddSmartListener(PlayerEvt.close_select_role_ui, Close); UpdateDetailUi(); }
private void OnEnable() { if (simpleListView == null) { simpleListView = new SimpleListView(); } if (simpleListView.IsNotInitialized()) { simpleListView.Init(); SimpleListViewItem item1 = new SimpleListViewItem("item1"); SimpleListViewItem item2 = new SimpleListViewItem("item2"); SimpleListViewItem item3 = new SimpleListViewItem("item3"); simpleListView.items.Add(item1); simpleListView.items.Add(item2); simpleListView.items.Add(item3); simpleListView.EndUpdate(); } if (simpleListView2 == null) { simpleListView2 = new SimpleListView(); } if (simpleListView2.IsNotInitialized()) { simpleListView2.Init(new[] { new SimpleColumnHeader("Item Column"), new SimpleColumnHeader("Column 2"), new SimpleColumnHeader("Column 3"), new SimpleColumnHeader("Column 4"), }); simpleListView2.showSearchField = true; simpleListView2.showAddButton = true; simpleListView2.showRemoveButton = true; simpleListView2.canMultiSelect = true; simpleListView2.onItemSelectionChangedCallback = OnItemSelectionChangedCallback; simpleListView2.onItemDoubleClickedCallback = OnItemDoubleClickedCallback; simpleListView2.onItemContextClickedCallback = OnItemContextClickedCallback; simpleListView2.onItemDrawCallback = OnItemDrawCallback; SimpleListViewItem item1 = new SimpleListViewItem("item4"); item1.subItems.Add("1"); item1.subItems.Add("2"); item1.subItems.Add("3"); SimpleListViewItem item2 = new SimpleListViewItem("item5"); item2.subItems.Add("4"); item2.subItems.Add("5"); item2.subItems.Add("6"); SimpleListViewItem item3 = new SimpleListViewItem("item6"); item3.subItems.Add("7"); item3.subItems.Add("8"); item3.subItems.Add("9"); simpleListView2.items.Add(item1); simpleListView2.items.Add(item2); simpleListView2.items.Add(item3); for (int i = 0; i < 1000; i++) { simpleListView2.items.Add(new SimpleListViewItem(i.ToString())); } simpleListView2.EndUpdate(); } }
private void OnItemDoubleClickedCallback(SimpleListView arg1, int arg2) { Debug.Log("双击 " + arg1.items[arg2].displayName); }
private void OnItemContextClickedCallback(SimpleListView arg1, int arg2) { Debug.Log("右键 " + arg1.items[arg2].displayName); }