架构大更

This commit is contained in:
SoulliesOfficial
2026-03-20 11:56:50 -04:00
parent e60ef64d01
commit d09b58fd80
3663 changed files with 15232012 additions and 105579 deletions

View File

@@ -1,33 +1,40 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using UnityEngine;
namespace Michsky.MUIP
{
[CustomEditor(typeof(ContextMenuManager))]
public class ContextMenuManagerEditor : Editor
{
private GUISkin customSkin;
private ContextMenuManager cmTarget;
private UIManagerContextMenu tempUIM;
private int currentTab;
private GUISkin customSkin;
private UIManagerContextMenu tempUIM;
private void OnEnable()
{
cmTarget = (ContextMenuManager)target;
try { tempUIM = cmTarget.GetComponent<UIManagerContextMenu>(); }
catch { }
try
{
tempUIM = cmTarget.GetComponent<UIManagerContextMenu>();
}
catch
{
}
if (EditorGUIUtility.isProSkin == true) { customSkin = MUIPEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = MUIPEditorHandler.GetLightEditor(customSkin); }
if (EditorGUIUtility.isProSkin)
customSkin = MUIPEditorHandler.GetDarkEditor(customSkin);
else
customSkin = MUIPEditorHandler.GetLightEditor(customSkin);
}
public override void OnInspectorGUI()
{
MUIPEditorHandler.DrawComponentHeader(customSkin, "CM Top Header");
GUIContent[] toolbarTabs = new GUIContent[3];
var toolbarTabs = new GUIContent[3];
toolbarTabs[0] = new GUIContent("Content");
toolbarTabs[1] = new GUIContent("Resources");
toolbarTabs[2] = new GUIContent("Settings");
@@ -80,10 +87,13 @@ namespace Michsky.MUIP
case 2:
MUIPEditorHandler.DrawHeader(customSkin, "Options Header", 6);
debugMode.boolValue = MUIPEditorHandler.DrawToggle(debugMode.boolValue, customSkin, "Debug Mode");
autoSubMenuPosition.boolValue = MUIPEditorHandler.DrawToggle(autoSubMenuPosition.boolValue, customSkin, "Auto Sub Menu Position");
autoSubMenuPosition.boolValue = MUIPEditorHandler.DrawToggle(autoSubMenuPosition.boolValue,
customSkin, "Auto Sub Menu Position");
MUIPEditorHandler.DrawProperty(subMenuBehaviour, customSkin, "Sub Menu Behaviour");
#if UNITY_2022_1_OR_NEWER
EditorGUILayout.HelpBox("Due to an issue with the event system, the 'Hover' option will be temporarily disabled in Unity 2022.1.", MessageType.Info);
EditorGUILayout.HelpBox(
"Due to an issue with the event system, the 'Hover' option will be temporarily disabled in Unity 2022.1.",
MessageType.Info);
#endif
MUIPEditorHandler.DrawProperty(cameraSource, customSkin, "Camera Source");
@@ -100,22 +110,29 @@ namespace Michsky.MUIP
EditorApplication.ExecuteMenuItem("Tools/Modern UI Pack/Show UI Manager");
if (GUILayout.Button("Disable UI Manager Connection", customSkin.button))
{
if (EditorUtility.DisplayDialog("Modern UI Pack", "Are you sure you want to disable UI Manager connection with the object? " +
"This operation cannot be undone.", "Yes", "Cancel"))
{
try { DestroyImmediate(tempUIM); }
catch { Debug.LogError("<b>[Context Menu]</b> Failed to delete UI Manager connection.", this); }
}
}
if (EditorUtility.DisplayDialog("Modern UI Pack",
"Are you sure you want to disable UI Manager connection with the object? " +
"This operation cannot be undone.", "Yes", "Cancel"))
try
{
DestroyImmediate(tempUIM);
}
catch
{
Debug.LogError("<b>[Context Menu]</b> Failed to delete UI Manager connection.",
this);
}
}
else if (tempUIM == null) { MUIPEditorHandler.DrawUIManagerDisconnectedHeader(); }
else if (tempUIM == null)
{
MUIPEditorHandler.DrawUIManagerDisconnectedHeader();
}
break;
}
if (Application.isPlaying == false) { this.Repaint(); }
if (!Application.isPlaying) Repaint();
serializedObject.ApplyModifiedProperties();
}
}