Esempio n. 1
0
        // ----------------------
        // Constructor
        // ---------------------
        public NavigateEffectEditor()
        {
            effect = new NavigateEffect();

            mapElementsReorderableList = new ReorderableList(effect.Steps, typeof(NavigationStep));

            mapElementsReorderableList.drawHeaderCallback = (rect) =>
            {
                EditorGUI.LabelField(new Rect(rect.position, rect.size - new Vector2(50, 0)), "Reference Id");
                EditorGUI.LabelField(new Rect(rect.position + new Vector2(rect.size.x - 50, 0), new Vector2(50, rect.size.y)), "Locks");
            };

            mapElementsReorderableList.drawElementCallback = (rect, index, isActive, isFocused) =>
            {
                EditorGUI.LabelField(new Rect(rect.position, rect.size - new Vector2(50, 0)), effect.Steps[index].Reference);
                effect.Steps[index].LockNavigation = GUI.Toggle(
                    new Rect(rect.position + new Vector2(rect.size.x - 50, 0), new Vector2(50, rect.size.y)), effect.Steps[index].LockNavigation, "");
            };

            mapElementsReorderableList.onAddDropdownCallback = (rect, r) =>
            {
                var elems = getObjectIDReferences();

                var menu = new GenericMenu();
                foreach (var elem in elems)
                {
                    menu.AddItem(new GUIContent(elem.Key), false, (v) => effect.Steps.Add(new NavigationStep(v as string)), elem.Value);
                }
                menu.ShowAsContext();
            };
        }
Esempio n. 2
0
        public object DOMParse(XmlElement element, params object[] parameters)
        {
            var navEff = new NavigateEffect();

            navEff.NavigationType = element.GetAttribute("navigation-type").ToEnum <NavigationType>();
            foreach (var stepNode in element.SelectNodes("step"))
            {
                var stepElem = stepNode as XmlElement;
                navEff.Steps.Add(new NavigationStep(stepElem.InnerText, bool.Parse(stepElem.GetAttribute("locks"))));
            }

            return(navEff);
        }