예제 #1
0
        public ListItemIntInput AddIntField(int value = 0, bool alternate = false, bool secondAlternate = false, bool thirdAlternate = false)
        {
            ListItemIntInput el = new ListItemIntInput();

            el.value = value;
            this.Add(el);
            return(el);
        }
예제 #2
0
        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;
                }
            }
        }