Пример #1
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.Space();
        GUILayout.Label("Quest Game Manager", CustomProps.GetProp("QuestGameManagerTitle"));
        EditorGUILayout.Space();

        if (questPlayed.arraySize > 0)
        {
            for (int element = 0; element < questPlayed.arraySize; element++)
            {
                EditorGUILayout.BeginVertical("BOX");
                SerializedProperty questPlayedReference = questPlayed.GetArrayElementAtIndex(element);
                questPlayedReference.intValue = EditorGUILayout.IntField($"Quest { element }", questPlayedReference.intValue);

                if (GUILayout.Button("-"))
                {
                    questPlayed.DeleteArrayElementAtIndex(element);
                }
                EditorGUILayout.EndVertical();
            }
        }
        else
        {
            EditorGUILayout.LabelField("No quests played. :(", CustomProps.GetProp("QuestGameManagerError"));
        }

        serializedObject.ApplyModifiedProperties();
    }
Пример #2
0
    private void CreateNewFile()
    {
        customProps = new CustomProps();
        if (customProps != null)
        {
            CustomProps asset = ScriptableObject.CreateInstance <CustomProps>();
            AssetDatabase.CreateAsset(asset, "Assets/Scripting/CustomPropsForEditors/CustomProperty.asset");
            AssetDatabase.SaveAssets();

            string customPropsFile = AssetDatabase.GetAssetPath(asset);
            EditorPrefs.SetString("customPropsPath", customPropsFile);
        }
    }
Пример #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.Space(10);
        EditorGUILayout.LabelField("Quest Data Editor", CustomProps.GetProp("QuestEditorMainTitle"));
        EditorGUILayout.Space(10);
        EditorGUILayout.LabelField("Add Question: ");

        if (GUILayout.Button("ADD"))
        {
            AddElement();
        }

        DisplayListElements();

        serializedObject.ApplyModifiedProperties();
    }
Пример #4
0
    public static GUIStyle GetProp(string guiStyleName)
    {
        CustomProps customProps = new CustomProps();


        if (EditorPrefs.HasKey("customPropsPath"))
        {
            string objectPath = EditorPrefs.GetString("customPropsPath");
            customProps = AssetDatabase.LoadAssetAtPath(objectPath, typeof(CustomProps)) as CustomProps;
            Debug.Log($"Loaded at {objectPath}");
            return(customProps.GUIStyles.Find(x => x.name.Equals(guiStyleName)));
        }
        else
        {
            Debug.LogWarning("No EditoPrefs Defined");
            return(new GUIStyle());
        }
    }
Пример #5
0
    public void OnEnable()
    {
        StyleSettings();


        if (EditorPrefs.HasKey("customPropsPath"))
        {
            string objectPath = EditorPrefs.GetString("customPropsPath");
            customProps = AssetDatabase.LoadAssetAtPath(objectPath, typeof(CustomProps)) as CustomProps;
        }

        if (customProps.customColors == null)
        {
            customProps.customColors = new List <CustomProperties>();
        }


        serializedObject = new SerializedObject(customProps);
        customGUIStyle   = serializedObject.FindProperty("GUIStyles");
    }