private static bool AddVariable(IVariableSource variableSource, string variableName, int variableTypeIndex, bool fromGlobalVariablesWindow)
        {
            SharedVariable        item = VariableInspector.CreateVariable(variableTypeIndex, variableName, fromGlobalVariablesWindow);
            List <SharedVariable> list = (variableSource == null) ? null : variableSource.GetAllVariables();

            if (list == null)
            {
                list = new List <SharedVariable>();
            }
            list.Add(item);
            GUI.FocusControl("Add");
            if (fromGlobalVariablesWindow && variableSource == null)
            {
                GlobalVariables globalVariables = ScriptableObject.CreateInstance(typeof(GlobalVariables)) as GlobalVariables;
                string          text            = BehaviorDesignerUtility.GetEditorBaseDirectory(null).Substring(6, BehaviorDesignerUtility.GetEditorBaseDirectory(null).Length - 13);
                string          str             = text + "/Resources/BehaviorDesignerGlobalVariables.asset";
                if (!Directory.Exists(Application.dataPath + text + "/Resources"))
                {
                    Directory.CreateDirectory(Application.dataPath + text + "/Resources");
                }
                if (!File.Exists(Application.dataPath + str))
                {
                    AssetDatabase.CreateAsset(globalVariables, "Assets" + str);
                    EditorUtility.DisplayDialog("Created Global Variables", "Behavior Designer Global Variables asset created:\n\nAssets" + text + "/Resources/BehaviorDesignerGlobalVariables.asset\n\nNote: Copy this file to transfer global variables between projects.", "OK");
                }
                variableSource = globalVariables;
            }
            variableSource.SetAllVariables(list);
            return(true);
        }
        // Token: 0x060002BC RID: 700 RVA: 0x0001B100 File Offset: 0x00019300
        private static bool AddVariable(IVariableSource variableSource, string variableName, int variableTypeIndex, bool fromGlobalVariablesWindow)
        {
            SharedVariable        item = VariableInspector.CreateVariable(variableTypeIndex, variableName, fromGlobalVariablesWindow);
            List <SharedVariable> list = (variableSource == null) ? null : variableSource.GetAllVariables();

            if (list == null)
            {
                list = new List <SharedVariable>();
            }
            list.Add(item);
            variableSource.SetAllVariables(list);
            return(true);
        }
        private static void DeserializeVariables(IVariableSource variableSource, Dictionary <string, object> dict, List <UnityEngine.Object> unityObjects)
        {
            object obj;

            if (dict.TryGetValue("Variables", out obj))
            {
                List <SharedVariable> list = new List <SharedVariable>();
                IList list2 = obj as IList;
                for (int i = 0; i < list2.Count; i++)
                {
                    SharedVariable item = JSONDeserializationDeprecated.DeserializeSharedVariable(list2[i] as Dictionary <string, object>, variableSource, true, unityObjects);
                    list.Add(item);
                }
                variableSource.SetAllVariables(list);
            }
        }
        // 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);
        }