コード例 #1
0
    public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target)
    {
        bool edited = false;

        target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query"));

        if (target.xPathQuery == null)
        {
            target.xPathQuery = new FsmString();
        }

        if (target._foldout)
        {
                        #if PLAYMAKER_1_8_OR_NEWER
            PlayMakerInspectorUtils.SetActionEditorVariableSelectionContext(target, target.GetType().GetField("xPathQuery"));
                        #endif


            target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null);
        }

        if (string.IsNullOrEmpty(target.xPathQuery.Value))
        {
        }
        else
        {
            if (target.xPathVariables == null || target.xPathVariables.Length == 0)
            {
                if (!target._foldout)
                {
                    EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value);
                }
            }
            else
            {
                EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm));
            }
        }
        if (target._foldout)
        {
            edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target);
        }


        return(edited);
    }
コード例 #2
0
    public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target)
    {
        bool edited = false;

        target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query"));

        if (target.xPathQuery == null)
        {
            target.xPathQuery = new FsmString();
        }

        if (target._foldout)
        {
            target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null);
        }

        if (string.IsNullOrEmpty(target.xPathQuery.Value))
        {
        }
        else
        {
            if (target.xPathVariables == null || target.xPathVariables.Length == 0)
            {
                if (!target._foldout)
                {
                    EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value);
                }
            }
            else
            {
                EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm));
            }
        }
        if (target._foldout)
        {
            edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target);
        }


        return(edited);
    }
コード例 #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);
    }
コード例 #4
0
    public static bool EditFsmXmlSourceField(Fsm fsm, FsmXmlSource source)
    {
        source.sourceSelection = EditorGUILayout.Popup("Source selection", source.sourceSelection, source.sourceTypes);

        if (source.sourceString == null)
        {
            source.sourceString = new FsmString();
        }

        source.sourceString.UseVariable = source.sourceSelection == 2;

        bool   showPreview = false;
        string preview     = "";

        if (source.sourceSelection == 0)
        {
            source._sourceEdit = EditorGUILayout.Foldout(source._sourceEdit, new GUIContent("Edit"));
            if (source._sourceEdit)
            {
                source.sourceString.Value = EditorGUILayout.TextArea(source.sourceString.Value, GUILayout.Height(200));
            }
        }
        else if (source.sourceSelection == 1)
        {
            source.sourcetextAsset = (TextAsset)EditorGUILayout.ObjectField("TextAsset Object", source.sourcetextAsset, typeof(TextAsset), false);
            if (source.sourcetextAsset != null)
            {
                source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview"));
                showPreview           = source._sourcePreview;
                preview = source.sourcetextAsset.text;
            }
        }
        else if (source.sourceSelection == 2)
        {
            source.sourceString = VariableEditor.FsmStringField(new GUIContent("Fsm String"), fsm, source.sourceString, null);

            if (!source.sourceString.UseVariable)
            {
                source.sourceSelection = 0;
                return(true);
            }

            if (!source.sourceString.IsNone)
            {
                source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview"));
                showPreview           = source._sourcePreview;
                preview = source.sourceString.Value;
            }
        }
        else if (source.sourceSelection == 3)
        {
            if (source.sourceProxyGameObject == null)
            {
                source.sourceProxyGameObject = new FsmGameObject();
                source.sourceProxyReference  = new FsmString();
            }
            source.sourceProxyGameObject = VariableEditor.FsmGameObjectField(new GUIContent("GameObject"), fsm, source.sourceProxyGameObject);
            source.sourceProxyReference  = VariableEditor.FsmStringField(new GUIContent("Reference"), fsm, source.sourceProxyReference, null);

            if (source.sourceProxyGameObject != null)
            {
                DataMakerXmlProxy proxy = DataMakerCore.GetDataMakerProxyPointer(typeof(DataMakerXmlProxy), source.sourceProxyGameObject.Value, source.sourceProxyReference.Value, true) as DataMakerXmlProxy;
                if (proxy != null)
                {
                    if (proxy.XmlTextAsset != null)
                    {
                        source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview"));
                        showPreview           = source._sourcePreview;
                        preview = proxy.XmlTextAsset.text;
                    }
                    else
                    {
                        //oupss...
                    }
                }
                else
                {
                    //oupss..
                }
            }
        }
        else if (source.sourceSelection == 4)
        {
            if (source.inMemoryReference == null)
            {
                source.inMemoryReference = new FsmString();
            }
            source.inMemoryReference = VariableEditor.FsmStringField(new GUIContent("Memory Reference"), fsm, source.inMemoryReference, null);

            if (!string.IsNullOrEmpty(source.inMemoryReference.Value))
            {
                source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview"));
                showPreview           = source._sourcePreview;
                preview = DataMakerXmlUtils.XmlNodeToString(DataMakerXmlUtils.XmlRetrieveNode(source.inMemoryReference.Value));
            }
        }

        if (showPreview)
        {
            if (string.IsNullOrEmpty(preview))
            {
                GUILayout.Label("-- empty --");
            }
            else
            {
                source._scroll         = GUILayout.BeginScrollView(source._scroll, "box", GUILayout.Height(200));
                GUI.skin.box.alignment = TextAnchor.UpperLeft;
                GUILayout.Box(preview, "", null);
                GUILayout.EndScrollView();
            }
        }


        return(false);
    }
コード例 #5
0
 public static void EditHashSetField(Fsm fsm, FsmString key, FsmString content)
 {
     key     = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, key, null);
     content = VariableEditor.FsmStringField(new GUIContent("Value"), fsm, content, null);
 }
コード例 #6
0
    public static bool EditFsmXmlPropertiesTypes(Fsm fsm, FsmXmlPropertiesTypes target)
    {
        FsmEditorGUILayout.LightDivider();


        bool edited = false;

        int count = 0;

        if (target.properties != null && target.propertiesTypes != null)
        {
            count = target.properties.Length;


                        #if PLAYMAKER_1_8_OR_NEWER
            FieldInfo _fsmStringArray_FieldInfo = target.GetType().GetField("properties");
                        #endif


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

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


                if (FsmEditorGUILayout.DeleteButton())
                {
                    ArrayUtility.RemoveAt(ref target.properties, i);
                    ArrayUtility.RemoveAt(ref target.propertiesTypes, 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.EndHorizontal();

                                #if PLAYMAKER_1_8_OR_NEWER
                //PlayMakerInspectorUtils.SetActionEditorArrayVariableSelectionContext(target,i,_fsmStringArray_FieldInfo);
                                #endif

                target.properties[i]      = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null);
                target.propertiesTypes[i] = (VariableType)EditorGUILayout.EnumPopup(new GUIContent("Type"), target.propertiesTypes[i]);
            }
        }

        string _addButtonLabel = "Define a Property";

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

        GUILayout.BeginHorizontal();
        GUILayout.Space(154);

        if (GUILayout.Button(_addButtonLabel))
        {
            if (target.properties == null)
            {
                target.properties      = new FsmString[0];
                target.propertiesTypes = new VariableType[0];
            }


            ArrayUtility.Add <FsmString>(ref target.properties, new FsmString());
            ArrayUtility.Add <VariableType>(ref target.propertiesTypes, VariableType.Float);
            edited = true;
        }
        GUILayout.Space(21);
        GUILayout.EndHorizontal();

        return(edited || GUI.changed);
    }
コード例 #7
0
    public static bool EditFsmPropertiesStorage(Fsm fsm, FsmXmlPropertiesStorage target)
    {
        FsmEditorGUILayout.LightDivider();


        bool edited = false;

        int count = 0;

        if (target != null && target.properties != null && target.propertiesVariables != null)
        {
            count = target.properties.Length;


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

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


                if (FsmEditorGUILayout.DeleteButton())
                {
                    ArrayUtility.RemoveAt(ref target.properties, i);
                    ArrayUtility.RemoveAt(ref target.propertiesVariables, 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.EndHorizontal();

                                #if PLAYMAKER_1_8_OR_NEWER
//				PlayMakerInspectorUtils.SetActionEditorArrayVariableSelectionContext(target,i,target.GetType().GetField("properties").GetType());
                                #endif



                target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null);
                if (target.properties[i].UseVariable)
                {
                    DataMakerEditorGUILayoutUtils.feedbackLabel("Using variables not supported, Check changeLog for infos", DataMakerEditorGUILayoutUtils.labelFeedbacks.ERROR);
                }
                //	target.propertiesVariables[i] = VariableEditor.FsmVarPopup(new GUIContent("Value"),fsm,target.propertiesVariables[i]);
                bool fsmVariableChangedFlag = false;
                target.propertiesVariables[i] = PlayMakerInspectorUtils.EditorGUILayout_FsmVarPopup("Value", fsm.Variables.GetAllNamedVariables(), target.propertiesVariables[i], out fsmVariableChangedFlag);
            }
        }

        string _addButtonLabel = "Get a Property";

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

        GUILayout.BeginHorizontal();
        GUILayout.Space(154);

        if (GUILayout.Button(_addButtonLabel))
        {
            if (target.properties == null)
            {
                target.properties          = new FsmString[0];
                target.propertiesVariables = new FsmVar[0];
            }


            ArrayUtility.Add <FsmString>(ref target.properties, new FsmString());
            ArrayUtility.Add <FsmVar>(ref target.propertiesVariables, new FsmVar());
            edited = true;
        }
        GUILayout.Space(21);
        GUILayout.EndHorizontal();

        return(edited || GUI.changed);
    }
コード例 #8
0
    public static bool EditFsmPropertiesStorage(Fsm fsm, FsmXmlPropertiesStorage target)
    {
        FsmEditorGUILayout.LightDivider();


        bool edited = false;

        int count = 0;

        if (target != null && target.properties != null && target.propertiesVariables != null)
        {
            count = target.properties.Length;


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

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


                if (FsmEditorGUILayout.DeleteButton())
                {
                    ArrayUtility.RemoveAt(ref target.properties, i);
                    ArrayUtility.RemoveAt(ref target.propertiesVariables, 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.EndHorizontal();

                target.properties[i]          = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null);
                target.propertiesVariables[i] = VariableEditor.FsmVarPopup(new GUIContent("Value"), fsm, target.propertiesVariables[i]);
            }
        }

        string _addButtonLabel = "Get a Property";

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

        GUILayout.BeginHorizontal();
        GUILayout.Space(154);

        if (GUILayout.Button(_addButtonLabel))
        {
            if (target.properties == null)
            {
                target.properties          = new FsmString[0];
                target.propertiesVariables = new FsmVar[0];
            }


            ArrayUtility.Add <FsmString>(ref target.properties, new FsmString());
            ArrayUtility.Add <FsmVar>(ref target.propertiesVariables, new FsmVar());
            edited = true;
        }
        GUILayout.Space(21);
        GUILayout.EndHorizontal();

        return(edited || GUI.changed);
    }