Exemple #1
0
        protected static void CreateControl <V>(StructureControl <ProvenceCollectionInstance <V> > control) where V : ProvenceCollectionEntry
        {
            //Change to picker
            ListItem           item        = new ListItem();
            KeySelectorElement keySelector = item.AddKeySelector("Entry Name:", control.structure.key, ProvenceManager.Collections <V>().Keys.ToSet());

            keySelector.eventManager.AddListener <MainframeKeySelection <string> >(e => {
                control.structure.key = e.value;
                control.eventManager.Raise <MainframeKeySelection <string> >(new MainframeKeySelection <string>(e.value));
                control.eventManager.Raise(new StructureControlUpdated <ProvenceCollectionInstance <V> >(control));
            });
            item.AddButton("Set to Entry").eventManager.AddListener <MouseClickEvent>(e => {
                if (e.button != 0)
                {
                    return;
                }
                if (control.world != null && control.entity != null)
                {
                    control.world.eventManager.Raise(new SetEntityToManualEntry <V>(control.entity, keySelector.value));
                    control.eventManager.Raise(new StructureControlUpdated <ProvenceCollectionInstance <V> >(control));
                    control.eventManager.Raise(new StructureControlRefreshRequest(100));
                }
            });
            control.Add(item);
        }
Exemple #2
0
        protected static void CreateControl(StructureControl <Model> control)
        {
            ListItem           keySelectorItem = new ListItem();
            KeySelectorElement keySelector     = keySelectorItem.AddKeySelector("Model Bank Key", control.structure.manualKey, new HashSet <string>(ProvenceManager.ModelBank.Keys));

            keySelector.eventManager.AddListener <MainframeKeySelection <string> >(e => {
                control.structure.manualKey = e.value;
                control.eventManager.Raise <MainframeKeySelection <string> >(new MainframeKeySelection <string>(e.value));
                control.eventManager.Raise <StructureControlUpdated <Model> >(new StructureControlUpdated <Model>(control));
            });
            keySelector.eventManager.AddListener <ListItemInputCancel>(e => {
                control.structure.manualKey = "";
                control.eventManager.Raise <ListItemInputCancel>(new ListItemInputCancel(control));
                control.eventManager.Raise <StructureControlUpdated <Model> >(new StructureControlUpdated <Model>(control));
            });
            control.Add(keySelectorItem);
        }
Exemple #3
0
        protected static void CreateControl <V>(StructureControl <List <V> > control)
        {
            Div      container = new Div();
            ListItem addBar    = new ListItem().AddToClassList("spacer", "alternate");

            addBar.AddDiv().AddToClassList("filler");
            addBar.AddImage(AssetDatabase.LoadAssetAtPath <Texture>("Assets/Icons/plus.png"));
            addBar.eventManager.AddListener <MouseClickEvent>(e => {
                if (e.button != 0)
                {
                    return;
                }
                control.structure.Add(default(V));
                control.eventManager.Raise(new StructureControlUpdated <List <V> >(control));
                DrawListControls(control, container);
            });
            control.Add(container, addBar);
            DrawListControls(control, container);
        }