Example #1
0
    public override bool OnGUI()
    {
        bool edited = false;
        XmlSelectSingleNode _target = (XmlSelectSingleNode)target;

        if (_target.xmlSource == null)
        {
            _target.xmlSource = new FsmXmlSource();
        }

        edited = DataMakerActionEditorUtils.EditFsmXmlSourceField(_target.Fsm, _target.xmlSource);

        EditField("xPathQuery");
        EditField("xPathVariables");

        EditField("xmlResult");
        EditField("storeReference");

        edited = edited || EditResultProperties(_target);

        EditField("foundEvent");
        EditField("notFoundEvent");
        EditField("errorEvent");

        return(GUI.changed || edited);
    }
Example #2
0
    int _propCount = -1;     // bug where action doesn't set dirty flag when length of array is edited without further edition on other properties

    public override bool OnGUI()
    {
        bool edited = false;
        XmlSelectSingleNode _target = (XmlSelectSingleNode)target;

        if (_target.xmlSource == null)
        {
            _target.xmlSource = new FsmXmlSource();
        }

        if (_target.xPath == null)
        {
            _target.xPath = new FsmXpathQuery();
        }

        edited = edited || DataMakerActionEditorUtils.EditFsmXmlSourceField(_target.Fsm, _target.xmlSource);

        edited = edited || DataMakerActionEditorUtils.EditFsmXpathQueryField(_target.Fsm, _target.xPath);

        EditField("xmlResult");
        EditField("storeReference");

        if (_target.storeProperties == null || (_target.storeProperties != null && _target.storeProperties.properties != null && _target.storeProperties.properties.Length == 0))
        {
            if (_target.storeNodeProperties != null)
            {
                _propCount = _target.storeNodeProperties.Length;
            }

            EditField("storeNodeProperties");

            if (_target.storeNodeProperties != null && _propCount != _target.storeNodeProperties.Length)
            {
                edited = true;
            }
        }
        else
        {
            edited = edited || DataMakerActionEditorUtils.EditFsmPropertiesStorage(_target.Fsm, _target.storeProperties);
        }

        EditField("found");
        EditField("foundEvent");
        EditField("notFoundEvent");
        EditField("errorEvent");

        return(GUI.changed || edited);
    }
Example #3
0
    private bool EditResultProperties(XmlSelectSingleNode _target)
    {
        bool edited = false;

        int count = 0;

        if (_target.properties != null && _target.propertyValues != null)
        {
            count = _target.properties.Length;


            for (int i = 0; i < count; i++)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label("Property item " + i);
                GUILayout.FlexibleSpace();


                if (FsmEditorGUILayout.MiniButton(new GUIContent("x"), GUILayout.Width(16)))
                {
                    ArrayUtility.RemoveAt(ref _target.properties, i);
                    ArrayUtility.RemoveAt(ref _target.propertyValues, i);
                    return(true);                            // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well.
                }
                GUILayout.Space(5);

                GUILayout.EndHorizontal();

                _target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), _target.Fsm, _target.properties[i], null);

                _target.propertyValues[i] = VariableEditor.FsmStringField(new GUIContent("Value"), _target.Fsm, _target.propertyValues[i], null);



                FsmEditorGUILayout.LightDivider();
            }
        }

        string _addButtonLabel = "Get a Property";

        if (count > 0)
        {
            _addButtonLabel = "Get another Property";
        }

        if (GUILayout.Button(_addButtonLabel))
        {
            if (_target.properties == null)
            {
                _target.properties     = new FsmString[0];
                _target.propertyValues = new FsmString[0];
            }


            ArrayUtility.Add <FsmString>(ref _target.properties, new FsmString());
            ArrayUtility.Add <FsmString>(ref _target.propertyValues, new FsmString());
            edited = true;
        }

        return(edited || GUI.changed);
    }