// Token: 0x060001A6 RID: 422 RVA: 0x0000F010 File Offset: 0x0000D210 private void SerializeVariables() { if (this.mVariableSource == null) { this.mVariableSource = GlobalVariables.Instance; } if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(this.mVariableSource); } else { JSONSerialization.Save(this.mVariableSource); } }
// Token: 0x060002B9 RID: 697 RVA: 0x0001AB2C File Offset: 0x00018D2C public static bool DrawVariables(IVariableSource variableSource, BehaviorSource behaviorSource, ref string variableName, ref bool focusNameField, ref int variableTypeIndex, ref Vector2 scrollPosition, ref List <float> variablePosition, ref float variableStartPosition, ref int selectedVariableIndex, ref string selectedVariableName, ref int selectedVariableTypeIndex) { scrollPosition = GUILayout.BeginScrollView(scrollPosition, new GUILayoutOption[0]); bool flag = false; bool flag2 = false; List <SharedVariable> list = (variableSource == null) ? null : variableSource.GetAllVariables(); if (VariableInspector.DrawHeader(variableSource, behaviorSource == null, ref variableStartPosition, ref variableName, ref focusNameField, ref variableTypeIndex, ref selectedVariableIndex, ref selectedVariableName, ref selectedVariableTypeIndex)) { flag = true; } list = ((variableSource == null) ? null : variableSource.GetAllVariables()); if (list != null && list.Count > 0) { GUI.enabled = !flag2; if (VariableInspector.DrawAllVariables(true, variableSource, ref list, true, ref variablePosition, ref selectedVariableIndex, ref selectedVariableName, ref selectedVariableTypeIndex, true, true)) { flag = true; } } if (flag && variableSource != null) { variableSource.SetAllVariables(list); } GUI.enabled = true; GUILayout.EndScrollView(); if (flag && !EditorApplication.isPlayingOrWillChangePlaymode && behaviorSource != null && behaviorSource.Owner is Behavior) { Behavior behavior = behaviorSource.Owner as Behavior; if (behavior.ExternalBehavior != null) { if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(behaviorSource); } else { JSONSerialization.Save(behaviorSource); } BehaviorSource behaviorSource2 = behavior.ExternalBehavior.GetBehaviorSource(); behaviorSource2.CheckForSerialization(true, null); VariableInspector.SyncVariables(behaviorSource2, list); } } return(flag); }
// Token: 0x06000187 RID: 391 RVA: 0x0000D71C File Offset: 0x0000B91C public static bool DrawInspectorGUI(BehaviorSource behaviorSource, bool fromInspector, ref bool showVariables) { EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.LabelField("Behavior Name", new GUILayoutOption[] { GUILayout.Width(120f) }); behaviorSource.behaviorName = EditorGUILayout.TextField(behaviorSource.behaviorName, new GUILayoutOption[0]); if (fromInspector && GUILayout.Button("Open", new GUILayoutOption[0])) { BehaviorDesignerWindow.ShowWindow(); BehaviorDesignerWindow.instance.LoadBehavior(behaviorSource, false, true); } GUILayout.EndHorizontal(); EditorGUILayout.LabelField("Behavior Description", new GUILayoutOption[0]); behaviorSource.behaviorDescription = EditorGUILayout.TextArea(behaviorSource.behaviorDescription, new GUILayoutOption[] { GUILayout.Height(48f) }); if (fromInspector) { string text = "BehaviorDesigner.VariablesFoldout." + behaviorSource.GetHashCode(); if (showVariables = EditorGUILayout.Foldout(EditorPrefs.GetBool(text, true), "Variables")) { EditorGUI.indentLevel++; List <SharedVariable> allVariables = behaviorSource.GetAllVariables(); if (allVariables != null && VariableInspector.DrawAllVariables(false, behaviorSource, ref allVariables, false, ref ExternalBehaviorInspector.variablePosition, ref ExternalBehaviorInspector.selectedVariableIndex, ref ExternalBehaviorInspector.selectedVariableName, ref ExternalBehaviorInspector.selectedVariableTypeIndex, true, false)) { if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(behaviorSource); } else { JSONSerialization.Save(behaviorSource); } } EditorGUI.indentLevel--; } EditorPrefs.SetBool(text, showVariables); } return(EditorGUI.EndChangeCheck()); }
// Token: 0x060002C6 RID: 710 RVA: 0x0001BDC4 File Offset: 0x00019FC4 private static void PropertySelected(object selected) { VariableInspector.SelectedPropertyMapping selectedPropertyMapping = selected as VariableInspector.SelectedPropertyMapping; if (selectedPropertyMapping.Property.Equals("None")) { VariableInspector.mPropertyMappingVariable.PropertyMapping = string.Empty; VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = null; } else { VariableInspector.mPropertyMappingVariable.PropertyMapping = selectedPropertyMapping.Property; VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = selectedPropertyMapping.GameObject; } if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(VariableInspector.mPropertyMappingBehaviorSource); } else { JSONSerialization.Save(VariableInspector.mPropertyMappingBehaviorSource); } }
// Token: 0x06000148 RID: 328 RVA: 0x0000B544 File Offset: 0x00009744 public static bool DrawInspectorGUI(Behavior behavior, SerializedObject serializedObject, bool fromInspector, ref bool externalModification, ref bool showOptions, ref bool showVariables) { EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.LabelField("Behavior Name", new GUILayoutOption[] { GUILayout.Width(120f) }); behavior.GetBehaviorSource().behaviorName = EditorGUILayout.TextField(behavior.GetBehaviorSource().behaviorName, new GUILayoutOption[0]); if (fromInspector && GUILayout.Button("Open", new GUILayoutOption[0])) { BehaviorDesignerWindow.ShowWindow(); BehaviorDesignerWindow.instance.LoadBehavior(behavior.GetBehaviorSource(), false, true); } GUILayout.EndHorizontal(); EditorGUILayout.LabelField("Behavior Description", new GUILayoutOption[0]); behavior.GetBehaviorSource().behaviorDescription = EditorGUILayout.TextArea(behavior.GetBehaviorSource().behaviorDescription, BehaviorDesignerUtility.TaskInspectorCommentGUIStyle, new GUILayoutOption[] { GUILayout.Height(48f) }); serializedObject.Update(); GUI.enabled = ((int)PrefabUtility.GetPrefabType(behavior) != 3 || BehaviorDesignerPreferences.GetBool(BDPreferences.EditablePrefabInstances)); SerializedProperty serializedProperty = serializedObject.FindProperty("externalBehavior"); ExternalBehavior externalBehavior = serializedProperty.objectReferenceValue as ExternalBehavior; EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); serializedObject.ApplyModifiedProperties(); if ((!object.ReferenceEquals(behavior.ExternalBehavior, null) && !behavior.ExternalBehavior.Equals(externalBehavior)) || (!object.ReferenceEquals(externalBehavior, null) && !externalBehavior.Equals(behavior.ExternalBehavior))) { if (!object.ReferenceEquals(behavior.ExternalBehavior, null)) { behavior.ExternalBehavior.BehaviorSource.Owner = behavior.ExternalBehavior; behavior.ExternalBehavior.BehaviorSource.CheckForSerialization(true, behavior.GetBehaviorSource()); } else { behavior.GetBehaviorSource().EntryTask = null; behavior.GetBehaviorSource().RootTask = null; behavior.GetBehaviorSource().DetachedTasks = null; behavior.GetBehaviorSource().Variables = null; behavior.GetBehaviorSource().CheckForSerialization(true, null); behavior.GetBehaviorSource().Variables = null; if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(behavior.GetBehaviorSource()); } else { JSONSerialization.Save(behavior.GetBehaviorSource()); } } externalModification = true; } GUI.enabled = true; serializedProperty = serializedObject.FindProperty("group"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); string text; if (fromInspector) { text = "BehaviorDesigner.VariablesFoldout." + behavior.GetHashCode(); if (showVariables = EditorGUILayout.Foldout(EditorPrefs.GetBool(text, true), "Variables")) { EditorGUI.indentLevel++; bool flag = false; BehaviorSource behaviorSource = behavior.GetBehaviorSource(); List <SharedVariable> allVariables = behaviorSource.GetAllVariables(); if (allVariables != null && allVariables.Count > 0) { if (VariableInspector.DrawAllVariables(false, behaviorSource, ref allVariables, false, ref BehaviorInspector.variablePosition, ref BehaviorInspector.selectedVariableIndex, ref BehaviorInspector.selectedVariableName, ref BehaviorInspector.selectedVariableTypeIndex, false, true)) { if (!EditorApplication.isPlayingOrWillChangePlaymode && behavior.ExternalBehavior != null) { BehaviorSource behaviorSource2 = behavior.ExternalBehavior.GetBehaviorSource(); behaviorSource2.CheckForSerialization(true, null); if (VariableInspector.SyncVariables(behaviorSource2, allVariables)) { if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(behaviorSource2); } else { JSONSerialization.Save(behaviorSource2); } } } flag = true; } } else { EditorGUILayout.LabelField("There are no variables to display", new GUILayoutOption[0]); } if (flag) { if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization)) { BinarySerialization.Save(behaviorSource); } else { JSONSerialization.Save(behaviorSource); } } EditorGUI.indentLevel--; } EditorPrefs.SetBool(text, showVariables); } text = "BehaviorDesigner.OptionsFoldout." + behavior.GetHashCode(); if (!fromInspector || (showOptions = EditorGUILayout.Foldout(EditorPrefs.GetBool(text, true), "Options"))) { if (fromInspector) { EditorGUI.indentLevel++; } serializedProperty = serializedObject.FindProperty("startWhenEnabled"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); serializedProperty = serializedObject.FindProperty("pauseWhenDisabled"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); serializedProperty = serializedObject.FindProperty("restartWhenComplete"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); serializedProperty = serializedObject.FindProperty("resetValuesOnRestart"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); serializedProperty = serializedObject.FindProperty("logTaskChanges"); EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]); if (fromInspector) { EditorGUI.indentLevel--; } } if (fromInspector) { EditorPrefs.SetBool(text, showOptions); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); return(true); } return(false); }