上传器配置现在切换上传器类型后,也不会丢失配置
This commit is contained in:
parent
e8c9abd219
commit
d165b75f02
@ -86,6 +86,7 @@ namespace VersionFlow.Editors
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<PatchUploader, Editor> m_uploaderEditorMapper = new Dictionary<PatchUploader, Editor>();
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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<string, string>
|
||||
{
|
||||
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; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user