From d165b75f0212835a6621319cd6fced4e303eecb6 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Fri, 22 Aug 2025 11:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=99=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E5=88=87=E6=8D=A2=E4=B8=8A=E4=BC=A0=E5=99=A8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=90=8E,=E4=B9=9F=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VersionFlow/Editor/BuilderConfigEditor.cs | 13 ++++++++++--- .../PatchUploader/PatchUploaderUtility.cs | 2 +- Assets/VersionFlow/Runtime/BuilderConfig.cs | 19 ++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Assets/VersionFlow/Editor/BuilderConfigEditor.cs b/Assets/VersionFlow/Editor/BuilderConfigEditor.cs index 43d33b7..72af93e 100644 --- a/Assets/VersionFlow/Editor/BuilderConfigEditor.cs +++ b/Assets/VersionFlow/Editor/BuilderConfigEditor.cs @@ -86,6 +86,7 @@ namespace VersionFlow.Editors } } + Dictionary m_uploaderEditorMapper = new Dictionary(); private void DrawUploader() { var builder = target as BuilderConfig; @@ -107,15 +108,21 @@ namespace VersionFlow.Editors var patchLoader = builder.GetPatchLoader(); if (patchLoader != null) { - Editor.CreateEditor(patchLoader).OnInspectorGUI(); + if (!m_uploaderEditorMapper.TryGetValue(patchLoader, out Editor editor)) + { + editor = Editor.CreateEditor(patchLoader); + m_uploaderEditorMapper[patchLoader] = editor; + } + editor.OnInspectorGUI(); + string json = patchLoader.GetCfgJson(); - builder.uploaderCfgJson = json; + builder.UploaderCfgDict.SetCfgJson(patchLoader.GetType(), json); } if (GUI.changed) { EditorUtility.SetDirty(target); - patchLoader.CfgChanged(builder, builder.uploaderCfgJson); + patchLoader.CfgChanged(builder, builder.UploaderCfgDict.GetUploaderCfg(patchLoader.GetType())); } } diff --git a/Assets/VersionFlow/Editor/PatchUploader/PatchUploaderUtility.cs b/Assets/VersionFlow/Editor/PatchUploader/PatchUploaderUtility.cs index 95ee6ea..bd9d428 100644 --- a/Assets/VersionFlow/Editor/PatchUploader/PatchUploaderUtility.cs +++ b/Assets/VersionFlow/Editor/PatchUploader/PatchUploaderUtility.cs @@ -80,7 +80,7 @@ namespace VersionFlow.Editors else //创建patchloader实例 { var patchloaderInstance = ScriptableObject.CreateInstance(patchType) as PatchUploader; - patchloaderInstance.CfgChanged(builder, builder.uploaderCfgJson); + patchloaderInstance.CfgChanged(builder, builder.UploaderCfgDict.GetUploaderCfg(patchType)); s_patchInstance[builder] = patchloaderInstance; return patchloaderInstance; } diff --git a/Assets/VersionFlow/Runtime/BuilderConfig.cs b/Assets/VersionFlow/Runtime/BuilderConfig.cs index 71dd48f..403adda 100644 --- a/Assets/VersionFlow/Runtime/BuilderConfig.cs +++ b/Assets/VersionFlow/Runtime/BuilderConfig.cs @@ -1,9 +1,11 @@ #if UNITY_EDITOR +using System; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; +using VersionFlow.Runtime.Builder; namespace VersionFlow.Runtime { @@ -26,7 +28,7 @@ namespace VersionFlow.Runtime internal string uploaderClassName; [SerializeField] [HideInInspector] - internal string uploaderCfgJson; + internal UploaderCfgDict UploaderCfgDict; public BuildAssetBundleOptions Options; [HideInInspector] @@ -224,6 +226,21 @@ namespace VersionFlow.Runtime } } + [Serializable] + public class UploaderCfgDict : SerializableDictionary + { + public string GetUploaderCfg(Type uploaderCfg) + { + TryGetValue(uploaderCfg.FullName, out var json); + return json; + } + + public void SetCfgJson(Type type, string json) + { + this[type.FullName] = json; + } + } + public class BundleExtraInfo { public string BundleName { get; internal set; }