mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Update UpdateSettingEditor.cs
This commit is contained in:
@@ -1,11 +1,28 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using HybridCLR.Editor.Settings;
|
using HybridCLR.Editor.Settings;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace TEngine.Editor
|
namespace TEngine.Editor
|
||||||
{
|
{
|
||||||
[CustomEditor(typeof(UpdateSetting), true)]
|
[CustomEditor(typeof(UpdateSetting), true)]
|
||||||
public class UpdateSettingEditor : UnityEditor.Editor
|
public class UpdateSettingEditor : UnityEditor.Editor
|
||||||
{
|
{
|
||||||
|
public List<string> HotUpdateAssemblies = new() {};
|
||||||
|
public List<string> AOTMetaAssemblies = new() {};
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
// 获取当前编辑的 ScriptableObject 实例
|
||||||
|
UpdateSetting updateSetting = (UpdateSetting)target;
|
||||||
|
if (updateSetting != null)
|
||||||
|
{
|
||||||
|
HotUpdateAssemblies.AddRange(updateSetting.HotUpdateAssemblies);
|
||||||
|
AOTMetaAssemblies.AddRange(updateSetting.AOTMetaAssemblies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
// 记录对象修改前的状态
|
// 记录对象修改前的状态
|
||||||
@@ -18,13 +35,23 @@ namespace TEngine.Editor
|
|||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
// 获取当前编辑的 ScriptableObject 实例
|
// 获取当前编辑的 ScriptableObject 实例
|
||||||
UpdateSetting so = (UpdateSetting)target;
|
UpdateSetting updateSetting = (UpdateSetting)target;
|
||||||
|
|
||||||
// 标记对象为“已修改”,确保修改能被保存
|
// 标记对象为“已修改”,确保修改能被保存
|
||||||
EditorUtility.SetDirty(so);
|
EditorUtility.SetDirty(updateSetting);
|
||||||
|
|
||||||
HybridCLRSettings.Instance.hotUpdateAssemblies = so.HotUpdateAssemblies.ToArray();
|
bool isHotChanged = HotUpdateAssemblies.SequenceEqual(updateSetting.HotUpdateAssemblies);
|
||||||
HybridCLRSettings.Instance.patchAOTAssemblies = so.AOTMetaAssemblies.ToArray();
|
bool isAOTChanged = AOTMetaAssemblies.SequenceEqual(updateSetting.AOTMetaAssemblies);
|
||||||
|
if (isHotChanged)
|
||||||
|
{
|
||||||
|
HybridCLRSettings.Instance.hotUpdateAssemblies = updateSetting.HotUpdateAssemblies.ToArray();
|
||||||
|
Debug.Log("HotUpdateAssemblies changed");
|
||||||
|
}
|
||||||
|
if (isAOTChanged)
|
||||||
|
{
|
||||||
|
HybridCLRSettings.Instance.patchAOTAssemblies = updateSetting.AOTMetaAssemblies.ToArray();
|
||||||
|
Debug.Log("AOTMetaAssemblies changed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user