Example #1
0
 // Token: 0x06000150 RID: 336 RVA: 0x0000BAE4 File Offset: 0x00009CE4
 public static void Save(BehaviorSource behaviorSource)
 {
     BinarySerialization.fieldIndex             = 0;
     BinarySerialization.taskSerializationData  = new TaskSerializationData();
     BinarySerialization.fieldSerializationData = BinarySerialization.taskSerializationData.fieldSerializationData;
     if (behaviorSource.Variables != null)
     {
         for (int i = 0; i < behaviorSource.Variables.Count; i++)
         {
             BinarySerialization.taskSerializationData.variableStartIndex.Add(BinarySerialization.fieldSerializationData.startIndex.Count);
             BinarySerialization.SaveSharedVariable(behaviorSource.Variables[i], 0);
         }
     }
     if (!object.ReferenceEquals(behaviorSource.EntryTask, null))
     {
         BinarySerialization.SaveTask(behaviorSource.EntryTask, -1);
     }
     if (!object.ReferenceEquals(behaviorSource.RootTask, null))
     {
         BinarySerialization.SaveTask(behaviorSource.RootTask, 0);
     }
     if (behaviorSource.DetachedTasks != null)
     {
         for (int j = 0; j < behaviorSource.DetachedTasks.Count; j++)
         {
             BinarySerialization.SaveTask(behaviorSource.DetachedTasks[j], -1);
         }
     }
     BinarySerialization.taskSerializationData.Version = "1.5.7";
     behaviorSource.TaskData = BinarySerialization.taskSerializationData;
     if (behaviorSource.Owner != null && !behaviorSource.Owner.Equals(null))
     {
         BehaviorDesignerUtility.SetObjectDirty(behaviorSource.Owner.GetObject());
     }
 }
        // Token: 0x06000185 RID: 389 RVA: 0x0000D694 File Offset: 0x0000B894
        public override void OnInspectorGUI()
        {
            ExternalBehavior externalBehavior = this.target as ExternalBehavior;

            if (externalBehavior == null)
            {
                return;
            }
            if (ExternalBehaviorInspector.DrawInspectorGUI(externalBehavior.BehaviorSource, true, ref this.mShowVariables))
            {
                BehaviorDesignerUtility.SetObjectDirty(externalBehavior);
            }
        }
Example #3
0
        // Token: 0x060001F5 RID: 501 RVA: 0x0001253C File Offset: 0x0001073C
        public static void Save(GlobalVariables variables)
        {
            if (variables == null)
            {
                return;
            }
            JSONSerialization.variableSerializationData = new VariableSerializationData();
            JSONSerialization.fieldSerializationData    = JSONSerialization.variableSerializationData.fieldSerializationData;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("Variables", JSONSerialization.SerializeVariables(variables.Variables, ref JSONSerialization.fieldSerializationData.unityObjects));
            JSONSerialization.variableSerializationData.JSONSerialization = MiniJSON.Serialize(dictionary);
            variables.VariableData = JSONSerialization.variableSerializationData;
            variables.Version      = "1.5.7";
            BehaviorDesignerUtility.SetObjectDirty(variables);
        }
Example #4
0
        // Token: 0x06000147 RID: 327 RVA: 0x0000B4B4 File Offset: 0x000096B4
        public override void OnInspectorGUI()
        {
            Behavior behavior = this.target as Behavior;

            if (behavior == null)
            {
                return;
            }
            bool flag = false;

            if (BehaviorInspector.DrawInspectorGUI(behavior, base.serializedObject, true, ref flag, ref this.mShowOptions, ref this.mShowVariables))
            {
                BehaviorDesignerUtility.SetObjectDirty(behavior);
                if (flag && BehaviorDesignerWindow.instance != null && behavior.GetBehaviorSource().BehaviorID == BehaviorDesignerWindow.instance.ActiveBehaviorID)
                {
                    BehaviorDesignerWindow.instance.LoadBehavior(behavior.GetBehaviorSource(), false, false);
                }
            }
        }
Example #5
0
 // Token: 0x06000151 RID: 337 RVA: 0x0000BC20 File Offset: 0x00009E20
 public static void Save(GlobalVariables globalVariables)
 {
     if (globalVariables == null)
     {
         return;
     }
     BinarySerialization.fieldIndex = 0;
     globalVariables.VariableData   = new VariableSerializationData();
     if (globalVariables.Variables == null || globalVariables.Variables.Count == 0)
     {
         return;
     }
     BinarySerialization.fieldSerializationData = globalVariables.VariableData.fieldSerializationData;
     for (int i = 0; i < globalVariables.Variables.Count; i++)
     {
         globalVariables.VariableData.variableStartIndex.Add(BinarySerialization.fieldSerializationData.startIndex.Count);
         BinarySerialization.SaveSharedVariable(globalVariables.Variables[i], 0);
     }
     globalVariables.Version = "1.5.7";
     BehaviorDesignerUtility.SetObjectDirty(globalVariables);
 }
Example #6
0
        // Token: 0x060001F4 RID: 500 RVA: 0x000123A8 File Offset: 0x000105A8
        public static void Save(BehaviorSource behaviorSource)
        {
            behaviorSource.CheckForSerialization(false, null);
            JSONSerialization.taskSerializationData  = new TaskSerializationData();
            JSONSerialization.fieldSerializationData = JSONSerialization.taskSerializationData.fieldSerializationData;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            if (behaviorSource.EntryTask != null)
            {
                dictionary.Add("EntryTask", JSONSerialization.SerializeTask(behaviorSource.EntryTask, true, ref JSONSerialization.fieldSerializationData.unityObjects));
            }
            if (behaviorSource.RootTask != null)
            {
                dictionary.Add("RootTask", JSONSerialization.SerializeTask(behaviorSource.RootTask, true, ref JSONSerialization.fieldSerializationData.unityObjects));
            }
            if (behaviorSource.DetachedTasks != null && behaviorSource.DetachedTasks.Count > 0)
            {
                Dictionary <string, object>[] array = new Dictionary <string, object> [behaviorSource.DetachedTasks.Count];
                for (int i = 0; i < behaviorSource.DetachedTasks.Count; i++)
                {
                    array[i] = JSONSerialization.SerializeTask(behaviorSource.DetachedTasks[i], true, ref JSONSerialization.fieldSerializationData.unityObjects);
                }
                dictionary.Add("DetachedTasks", array);
            }
            if (behaviorSource.Variables != null && behaviorSource.Variables.Count > 0)
            {
                dictionary.Add("Variables", JSONSerialization.SerializeVariables(behaviorSource.Variables, ref JSONSerialization.fieldSerializationData.unityObjects));
            }
            JSONSerialization.taskSerializationData.Version           = "1.5.7";
            JSONSerialization.taskSerializationData.JSONSerialization = MiniJSON.Serialize(dictionary);
            behaviorSource.TaskData = JSONSerialization.taskSerializationData;
            if (behaviorSource.Owner != null && !behaviorSource.Owner.Equals(null))
            {
                BehaviorDesignerUtility.SetObjectDirty(behaviorSource.Owner.GetObject());
            }
        }
        // Token: 0x060002CB RID: 715 RVA: 0x0001BE90 File Offset: 0x0001A090
        public override void OnInspectorGUI()
        {
            VariableSynchronizer variableSynchronizer = this.target as VariableSynchronizer;

            if (variableSynchronizer == null)
            {
                return;
            }
            GUILayout.Space(5f);
            variableSynchronizer.UpdateInterval = (UpdateIntervalType)EditorGUILayout.EnumPopup("Update Interval", variableSynchronizer.UpdateInterval, new GUILayoutOption[0]);
            if (variableSynchronizer.UpdateInterval == UpdateIntervalType.SpecifySeconds)
            {
                variableSynchronizer.UpdateIntervalSeconds = EditorGUILayout.FloatField("Seconds", variableSynchronizer.UpdateIntervalSeconds, new GUILayoutOption[0]);
            }
            GUILayout.Space(5f);
            GUI.enabled = !Application.isPlaying;
            this.DrawSharedVariableSynchronizer(this.sharedVariableSynchronizer, null);
            if (string.IsNullOrEmpty(this.sharedVariableSynchronizer.targetName))
            {
                this.DrawSynchronizedVariables(variableSynchronizer);
                return;
            }
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.LabelField("Direction", new GUILayoutOption[]
            {
                GUILayout.MaxWidth(146f)
            });
            if (GUILayout.Button(BehaviorDesignerUtility.LoadTexture((!this.setVariable) ? "RightArrowButton.png" : "LeftArrowButton.png", true, this), BehaviorDesignerUtility.ButtonGUIStyle, new GUILayoutOption[]
            {
                GUILayout.Width(22f)
            }))
            {
                this.setVariable = !this.setVariable;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginChangeCheck();
            this.synchronizationType = (VariableSynchronizer.SynchronizationType)EditorGUILayout.EnumPopup("Type", this.synchronizationType, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                this.targetSynchronizer = new VariableSynchronizerInspector.Synchronizer();
            }
            if (this.targetSynchronizer == null)
            {
                this.targetSynchronizer = new VariableSynchronizerInspector.Synchronizer();
            }
            if (this.sharedVariableValueType == null && !string.IsNullOrEmpty(this.sharedVariableValueTypeName))
            {
                this.sharedVariableValueType = TaskUtility.GetTypeWithinAssembly(this.sharedVariableValueTypeName);
            }
            switch (this.synchronizationType)
            {
            case VariableSynchronizer.SynchronizationType.BehaviorDesigner:
                this.DrawSharedVariableSynchronizer(this.targetSynchronizer, this.sharedVariableValueType);
                break;

            case VariableSynchronizer.SynchronizationType.Property:
                this.DrawPropertySynchronizer(this.targetSynchronizer, this.sharedVariableValueType);
                break;

            case VariableSynchronizer.SynchronizationType.Animator:
                this.DrawAnimatorSynchronizer(this.targetSynchronizer);
                break;

            case VariableSynchronizer.SynchronizationType.PlayMaker:
                this.DrawPlayMakerSynchronizer(this.targetSynchronizer, this.sharedVariableValueType);
                break;

            case VariableSynchronizer.SynchronizationType.uFrame:
                this.DrawuFrameSynchronizer(this.targetSynchronizer, this.sharedVariableValueType);
                break;
            }
            if (string.IsNullOrEmpty(this.targetSynchronizer.targetName))
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Add", new GUILayoutOption[0]))
            {
                VariableSynchronizer.SynchronizedVariable item = new VariableSynchronizer.SynchronizedVariable(this.synchronizationType, this.setVariable, this.sharedVariableSynchronizer.component as Behavior, this.sharedVariableSynchronizer.targetName, this.sharedVariableSynchronizer.global, this.targetSynchronizer.component, this.targetSynchronizer.targetName, this.targetSynchronizer.global);
                variableSynchronizer.SynchronizedVariables.Add(item);
                BehaviorDesignerUtility.SetObjectDirty(variableSynchronizer);
                this.sharedVariableSynchronizer = new VariableSynchronizerInspector.Synchronizer();
                this.targetSynchronizer         = new VariableSynchronizerInspector.Synchronizer();
            }
            GUI.enabled = true;
            this.DrawSynchronizedVariables(variableSynchronizer);
        }