protected void DrawAnimationDrawer(Div container, GameObject model) { container.Clear(); bool alternate = false; Animator animComponent = model.GetComponent <Animator>(); if (animComponent != null) { foreach (KeyValuePair <string, ModelAnimationData> kvp in collection[chosenKey].animationData) { ListItem item = new ListItem(alternate); KeySelectorElement keyButton = item.AddKeySelector("Animation Key", kvp.Key, Helpers.GetAllTypesFromBaseType(typeof(AnimationKey)).Select(key => key.Name).ToSet()); keyButton.eventManager.AddListener <MainframeKeySelection <string> >(e => { if (!collection[chosenKey].animationData.ContainsKey(e.value)) { string newKey = e.value; collection[chosenKey].animationData[newKey] = collection[chosenKey].animationData[kvp.Key]; collection[chosenKey].animationData.Remove(kvp.Key); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnimationDrawer(container, model); } }); item.AddLabel("State Name"); ListItemTextInput stateInput = item.AddTextField(kvp.Value.stateName); stateInput.AddToClassList("animation-data-state-input"); stateInput.eventManager.AddListener <ListItemInputChange>(e => { collection[chosenKey].animationData[kvp.Key].stateName = stateInput.text; eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); }); ListItemIntInput layerInput = item.AddIntField(collection[chosenKey].animationData[kvp.Key].layer); layerInput.AddToClassList("animation-data-layer-input"); layerInput.eventManager.AddListener <ListItemInputChange>(e => { collection[chosenKey].animationData[kvp.Key].layer = layerInput.value; eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); }); ListItemImage delButton = item.AddImage(delIcon); delButton.AddToClassList("selectable", "hoverable", "icon"); delButton.eventManager.AddListener <MouseClickEvent>(e => { collection[chosenKey].animationData.Remove(kvp.Key); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnimationDrawer(container, model); }); container.Add(item); alternate = !alternate; } } }
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); }
protected virtual Div DrawComponentControl <V>(V component) where V : ProvenceComponent { Div container = new Div(); container.name = typeof(V).Name.ToLower() + "-control-container"; StructureControl <V> control = new StructureControl <V>(ref component, null, false, null, null, 0, typeof(DontDisplayInManual)); control.eventManager.AddListener <StructureControlUpdated <V> >(e => { eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); }); container.Add(control); return(container); }
protected void DrawAnchorList(Div container, GameObject model) { container.Clear(); bool alternate = false; foreach (KeyValuePair <string, ModelAnchorData> kvp in collection[chosenKey].anchors) { ListItem anchorItem = new ListItem(alternate); anchorItem.AddToClassList("search-list-item"); anchorItem.userData = kvp.Key; anchorItem.AddToClassList("anchor-list-item"); KeySelectorElement keyInput = anchorItem.AddKeySelector("Anchor Name", kvp.Key, ModelAnchorKeys.keys); keyInput.eventManager.AddListener <MainframeKeySelection <string> >(e => { string newKey = e.value; if (collection[chosenKey].anchors.ContainsKey(newKey)) { return; } collection[chosenKey].anchors[newKey] = collection[chosenKey].anchors[kvp.Key]; collection[chosenKey].anchors.Remove(kvp.Key); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnchorList(container, model); }); HierarchySelectorElement hierarchyInput = anchorItem.AddHierarchySelector("Object", model, ModelBank.GetChildByHierarhcy(model, kvp.Value.hierarchy.ToArray())); hierarchyInput.eventManager.AddListener <MainframeKeySelection <int[]> >(e => { collection[chosenKey].anchors[kvp.Key] = new ModelAnchorData(hierarchyInput.objectDisplay.value.name, hierarchyInput.value); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnchorList(container, model); }); ListItemImage delButton = anchorItem.AddImage(delIcon); delButton.AddToClassList("selectable", "hoverable", "icon"); delButton.eventManager.AddListener <MouseClickEvent>(e => { collection[chosenKey].anchors.Remove(kvp.Key); eventManager.Raise <SetSceneDirtyEvent>(new SetSceneDirtyEvent(SceneManager.GetActiveScene())); DrawAnchorList(container, model); }); container.Add(anchorItem); alternate = !alternate; } }