public override void Reset() { gameObject = null; reference = null; xmlSource = null; propertiesTypes = new FsmXmlPropertiesTypes(); successEvent = null; failureEvent = null; }
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; 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(); 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; }
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); }