This commit is contained in:
陈思海 2025-09-23 15:58:55 +08:00
parent 093926898e
commit 97c7b8cd36

View File

@ -11,6 +11,13 @@ namespace AlicizaX.Resource.Editor
[CustomEditor(typeof(ResourceComponent))]
internal sealed class ResourceComponentInspector : GameFrameworkInspector
{
private static readonly string[] _playModeNames = new string[]
{
"EditorSimulateMode (编辑器下的模拟模式)",
"OfflinePlayMode (单机模式)",
"HostPlayMode (联机运行模式)",
"WebPlayMode (WebGL运行模式)"
};
private SerializedProperty _milliseconds = null;
private SerializedProperty _minUnloadUnusedAssetsInterval = null;
private SerializedProperty _maxUnloadUnusedAssetsInterval = null;
@ -23,13 +30,13 @@ namespace AlicizaX.Resource.Editor
private SerializedProperty _failedTryAgain = null;
private SerializedProperty _packageName = null;
private SerializedProperty _decryptionServices = null;
private int _packageNameIndex = 0;
private string[] _packageNames;
private List<string> m_DecryptionServicesTypeName = new();
private int m_DecryptionSelectIndex;
private int _playModeIndex = 0;
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
@ -38,6 +45,23 @@ namespace AlicizaX.Resource.Editor
ResourceComponent t = (ResourceComponent)target;
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
{
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
{
int index = UnityEditor.EditorPrefs.GetInt(ResourceComponent.PrefsKey, 0);
int selectedIndex = EditorGUILayout.Popup("Play Mode", index, _playModeNames);
}
else
{
int selectedIndex = EditorGUILayout.Popup("Play Mode", _playModeIndex, _playModeNames);
if (selectedIndex != _playModeIndex)
{
_playModeIndex = selectedIndex;
EditorPrefs.SetInt(ResourceComponent.PrefsKey, selectedIndex);
}
}
}
m_DecryptionSelectIndex = EditorGUILayout.Popup("解密服务", m_DecryptionSelectIndex, m_DecryptionServicesTypeName.ToArray());
string selectService = m_DecryptionServicesTypeName[m_DecryptionSelectIndex];
if (_decryptionServices.stringValue != selectService)