示例#1
0
        private static void TypeColorsGUI(string key, GameFlowEditorSettings settings)
        {
            //Label
            EditorGUILayout.LabelField("Types", EditorStyles.boldLabel);

            //Display type colors. Save them if they are edited by the user
            var typeColorKeys = new List <string>(typeColors.Keys);

            foreach (var typeColorKey in typeColorKeys)
            {
                var col = typeColors[typeColorKey];
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                col = EditorGUILayout.ColorField(typeColorKey, col);
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    typeColors[typeColorKey] = col;
                    if (settings.typeColors.ContainsKey(typeColorKey))
                    {
                        settings.typeColors[typeColorKey] = col;
                    }
                    else
                    {
                        settings.typeColors.Add(typeColorKey, col);
                    }
                    SavePrefs(typeColorKey, settings);
                    NodeEditorWindow.RepaintAll();
                }
            }
        }
示例#2
0
 private static void SystemSettingsGUI(string key, GameFlowEditorSettings settings)
 {
     //Label
     EditorGUILayout.LabelField("System", EditorStyles.boldLabel);
     settings.autoSave =
         EditorGUILayout.Toggle(new GUIContent("Autosave", "Disable for better editor performance"),
                                settings.autoSave);
     if (GUI.changed)
     {
         SavePrefs(key, settings);
     }
     EditorGUILayout.Space();
 }
示例#3
0
        private static void NodeSettingsGUI(string key, GameFlowEditorSettings settings)
        {
            //Label
            EditorGUILayout.LabelField("Node", EditorStyles.boldLabel);
            settings.highlightColor = EditorGUILayout.ColorField("Selection", settings.highlightColor);
            settings.noodleType     = (NodeEditorNoodleType)EditorGUILayout.EnumPopup("Noodle type", settings.noodleType);
            if (GUI.changed)
            {
                SavePrefs(key, settings);
                NodeEditorWindow.RepaintAll();
            }

            EditorGUILayout.Space();
        }
示例#4
0
        private static void GridSettingsGUI(string key, GameFlowEditorSettings settings)
        {
            //Label
            EditorGUILayout.LabelField("Grid", EditorStyles.boldLabel);
            settings.gridSnap = EditorGUILayout.Toggle(new GUIContent("Snap", "Hold CTRL in editor to invert"),
                                                       settings.gridSnap);

            settings.gridLineColor = EditorGUILayout.ColorField("Color", settings.gridLineColor);
            settings.gridBgColor   = EditorGUILayout.ColorField(" ", settings.gridBgColor);
            if (GUI.changed)
            {
                SavePrefs(key, settings);

                NodeEditorWindow.RepaintAll();
            }

            EditorGUILayout.Space();
        }
示例#5
0
 /// <summary> Save preferences in EditorPrefs </summary>
 private static void SavePrefs(string key, GameFlowEditorSettings settings)
 {
     EditorPrefs.SetString(key, JsonUtility.ToJson(settings));
 }