public static void Load(string serialization, GlobalVariables globalVariables)
        {
            if (globalVariables == null)
            {
                return;
            }
            Dictionary <string, object> dictionary = MiniJSON.Deserialize(serialization) as Dictionary <string, object>;

            if (dictionary == null)
            {
                Debug.Log("Failed to deserialize");
                return;
            }
            if (globalVariables.VariableData == null)
            {
                globalVariables.VariableData = new VariableSerializationData();
            }
            JSONDeserializationDeprecated.DeserializeVariables(globalVariables, dictionary, globalVariables.VariableData.fieldSerializationData.unityObjects);
        }
        public static void Load(TaskSerializationData taskData, BehaviorSource behaviorSource)
        {
            behaviorSource.entryTask     = null;
            behaviorSource.rootTask      = null;
            behaviorSource.detachedTasks = null;
            behaviorSource.variables     = null;
            Dictionary <string, object> dictionary;

            if (!JSONDeserializationDeprecated.serializationCache.TryGetValue(taskData.JSONSerialization.GetHashCode(), out dictionary))
            {
                dictionary = (MiniJSON.Deserialize(taskData.JSONSerialization) as Dictionary <string, object>);
                JSONDeserializationDeprecated.serializationCache.Add(taskData.JSONSerialization.GetHashCode(), dictionary);
            }
            if (dictionary == null)
            {
                Debug.Log("Failed to deserialize");
                return;
            }
            JSONDeserializationDeprecated.taskIDs = new Dictionary <JSONDeserializationDeprecated.TaskField, List <int> >();
            Dictionary <int, Task> dictionary2 = new Dictionary <int, Task>();

            JSONDeserializationDeprecated.DeserializeVariables(behaviorSource, dictionary, taskData.fieldSerializationData.unityObjects);
            if (dictionary.ContainsKey("EntryTask"))
            {
                behaviorSource.entryTask = JSONDeserializationDeprecated.DeserializeTask(behaviorSource, dictionary["EntryTask"] as Dictionary <string, object>, ref dictionary2, taskData.fieldSerializationData.unityObjects);
            }
            if (dictionary.ContainsKey("RootTask"))
            {
                behaviorSource.rootTask = JSONDeserializationDeprecated.DeserializeTask(behaviorSource, dictionary["RootTask"] as Dictionary <string, object>, ref dictionary2, taskData.fieldSerializationData.unityObjects);
            }
            if (dictionary.ContainsKey("DetachedTasks"))
            {
                List <Task> tasks = new List <Task>();
                foreach (Dictionary <string, object> dict in (dictionary["DetachedTasks"] as IEnumerable))
                {
                    tasks.Add(JSONDeserializationDeprecated.DeserializeTask(behaviorSource, dict, ref dictionary2, taskData.fieldSerializationData.unityObjects));
                }
                behaviorSource.detachedTasks = tasks;
            }
            if (JSONDeserializationDeprecated.taskIDs != null && JSONDeserializationDeprecated.taskIDs.Count > 0)
            {
                foreach (JSONDeserializationDeprecated.TaskField current in JSONDeserializationDeprecated.taskIDs.Keys)
                {
                    List <int> list2     = JSONDeserializationDeprecated.taskIDs[current];
                    Type       fieldType = current.fieldInfo.FieldType;
                    if (current.fieldInfo.FieldType.IsArray)
                    {
                        int num = 0;
                        for (int i = 0; i < list2.Count; i++)
                        {
                            Task task = dictionary2[list2[i]];
                            if (task.GetType().Equals(fieldType.GetElementType()) || task.GetType().IsSubclassOf(fieldType.GetElementType()))
                            {
                                num++;
                            }
                        }
                        Array array = Array.CreateInstance(fieldType.GetElementType(), num);
                        int   num2  = 0;
                        for (int j = 0; j < list2.Count; j++)
                        {
                            Task task2 = dictionary2[list2[j]];
                            if (task2.GetType().Equals(fieldType.GetElementType()) || task2.GetType().IsSubclassOf(fieldType.GetElementType()))
                            {
                                array.SetValue(task2, num2);
                                num2++;
                            }
                        }
                        current.fieldInfo.SetValue(current.task, array);
                    }
                    else
                    {
                        Task task3 = dictionary2[list2[0]];
                        if (task3.GetType().Equals(current.fieldInfo.FieldType) || task3.GetType().IsSubclassOf(current.fieldInfo.FieldType))
                        {
                            current.fieldInfo.SetValue(current.task, task3);
                        }
                    }
                }
                JSONDeserializationDeprecated.taskIDs = null;
            }
        }