Firstborn/Assets/ModTool/ModTool.Editor/ModToolSettingsEditor.cs
Schaken-Mods 7502018d20 Adding Mod Support
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
2023-05-13 22:01:48 -05:00

70 lines
2.4 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using ModTool.Shared;
namespace ModTool.Editor
{
[CustomEditor(typeof(ModToolSettings))]
public class ModToolSettingsEditor : UnityEditor.Editor
{
private SerializedProperty _supportedPlatforms;
private SerializedProperty _supportedContent;
private SerializedProperty _logLevel;
void OnEnable()
{
_supportedPlatforms = serializedObject.FindProperty("_supportedPlatforms");
_supportedContent = serializedObject.FindProperty("_supportedContent");
_logLevel = serializedObject.FindProperty("_logLevel");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
ModPlatform supportedPlatforms = (ModPlatform)EditorGUILayout.EnumMaskField("Supported Platforms", (ModPlatform)_supportedPlatforms.intValue);
ModContent supportedContent = (ModContent)EditorGUILayout.EnumMaskField("Supported Content", (ModContent)_supportedContent.intValue);
LogLevel logLevel = (LogLevel)EditorGUILayout.EnumPopup("Log Level", (LogLevel)_logLevel.intValue);
_supportedPlatforms.intValue = supportedPlatforms.FixEnum();
_supportedContent.intValue = supportedContent.FixEnum();
_logLevel.intValue = (int)logLevel;
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
using (new GUILayout.HorizontalScope())
{
GUILayout.Label(ModToolSettings.sharedAssets.Count + " Shared Assets");
GUILayout.FlexibleSpace();
if (GUILayout.Button("edit"))
AssetSelector.Open();
}
GUILayout.Space(2);
EditorGUILayout.EndVertical();
GUILayout.BeginVertical(EditorStyles.helpBox);
using (new GUILayout.HorizontalScope())
{
GUILayout.Label(ModToolSettings.sharedPackages.Count + " Shared Packages");
GUILayout.FlexibleSpace();
if (GUILayout.Button("edit"))
PackageSelector.Open();
}
GUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
}
}
}