private void OnItemClick(object sender, ItemArgs e) { ToolCmd cmd = (ToolCmd)e.Items[0]; if (cmd.Validate()) { cmd.Run(); } }
private void OnItemDataBinding(object sender, VirtualizingTreeViewItemDataBindingArgs e) { TextMeshProUGUI text = e.ItemPresenter.GetComponentInChildren <TextMeshProUGUI>(); ToolCmd cmd = (ToolCmd)e.Item; text.text = cmd.Text; bool isValid = cmd.Validate(); Color color = text.color; color.a = isValid ? 1 : 0.5f; text.color = color; e.CanDrag = cmd.CanDrag; e.HasChildren = cmd.HasChildren; }