protected override void DrawTagList() { tagListScroller.Clear(); if (chosenKey != null) { foreach (System.Type tag in collection[chosenKey].tags) { ListItemText tagElement = new ListItemText(tag.Name); tagElement.userData = tag; tagElement.AddToClassList("entry-editor-tag"); tagElement.eventManager.AddListener <MouseClickEvent>(e => { switch (e.button) { case 0: ListItemSearchBar compSearchBar = root.Q <ListItemSearchBar>("entry-editor-search-bar"); compSearchBar.searchInput.value = compSearchBar.searchInput.value.Replace(" ", ""); if (tagElement.ClassListContains("selected")) { tagElement.RemoveFromClassList("selected"); compSearchBar.searchInput.value = compSearchBar.searchInput.text.ToLower().Replace(tag.Name.ToLower() + "/", ""); } else { tagElement.AddToClassList("selected"); if (compSearchBar.searchInput.value == "") { compSearchBar.searchInput.value = tag.Name.ToLower() + "/"; } else { if (compSearchBar.searchInput.value[compSearchBar.searchInput.value.Length - 1] != '/') { compSearchBar.searchInput.value += "/"; } compSearchBar.searchInput.value += tag.Name.ToLower() + "/"; } } break; case 1: entryEditorTagContextMenu.Show(root, e, true); ListItem removeButton = entryEditorTagContextMenu.Q <ListItem>("entry-editor-tag-remove-button"); removeButton.eventManager.ClearListeners(); removeButton.eventManager.AddListener <MouseClickEvent>(ev => { RemoveTagFromEntry((dynamic)tagElement.userData); entryEditorTagContextMenu.Toggle(); }); break; } }); tagListScroller.Add(tagElement); } } }
protected void DrawAnimationControls(GameObject model) { Div animationDrawer = new Div(); ListItem titleItem = new ListItem(); titleItem.AddToClassList("spacer", "selectable", "container-title"); titleItem.AddImage(null); ListItemText title = titleItem.AddTitle("Animation Keys"); ListItemImage addButton = titleItem.AddImage(addIcon); addButton.AddToClassList("hoverable", "selectable"); addButton.eventManager.AddListener <MouseClickEvent>(e => { if (e.button != 0) { return; } collection[chosenKey].animationData[""] = new ModelAnimationData(); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnimationDrawer(animationDrawer, model); }); Div container = new Div(); container.AddToClassList("category-container"); title.eventManager.AddListener <MouseClickEvent>(e => { if (e.button != 0) { return; } if (title.ClassListContains("second-alternate")) { title.RemoveFromClassList("second-alternate"); } else { title.AddToClassList("second-alternate"); } container.Toggle(); }); ListItem searchBar = new ListItemSearchBar(animationDrawer); DrawAnimationDrawer(animationDrawer, model); container.Add(searchBar, animationDrawer); entryEditorScroller.Add(titleItem, container); }