123
This commit is contained in:
parent
88135a2dc6
commit
8ec8cc71cb
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,4 +7,4 @@ Temp/
|
||||
Library/
|
||||
UserSettings/
|
||||
obj/
|
||||
|
||||
output/
|
||||
|
||||
@ -13,10 +13,16 @@ MonoBehaviour:
|
||||
m_Name: Builder
|
||||
m_EditorClassIdentifier:
|
||||
vfSetting: {fileID: 11400000, guid: b304f98f44ccac546969282b7054a052, type: 2}
|
||||
uploaderClassName: VersionFlow.Editors.Patchloader_AliOSS
|
||||
uploaderCfgJson: '{"BucketName":"2020yoyo","UploadPath":"VERSION_TEST","accessKeyId":"LTAI5tCMR4e8A4W8sKvt1pLe","accessKeySecret":"yOGzDbtS1cGS9y5C7akfjgITf376CJ","endPoint":"oss-cn-hangzhou.aliyuncs.com"}'
|
||||
uploaderClassName: VersionFlow.Editors.PatchUploader_LocalFileSystem
|
||||
uploaderCfgJson: '{"UploadRoot":"../TestDown"}'
|
||||
Options: 256
|
||||
Groups: []
|
||||
Groups:
|
||||
- GroupName: Effect
|
||||
BuildMode: 2
|
||||
OptionBundle: 0
|
||||
InstallReady: 0
|
||||
FolderList:
|
||||
- {fileID: 102900000, guid: 575569e40b6a7d847aeed7e74c5fead8, type: 3}
|
||||
SVC: {fileID: 0}
|
||||
DuplicateBundleBeInstallBundle: 0
|
||||
ShaderBundleBeInstallBundle: 0
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Aliyun.OSS;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -7,7 +6,6 @@ using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VersionFlow.Runtime;
|
||||
using static UnityEditor.ObjectChangeEventStream;
|
||||
|
||||
namespace VersionFlow.Editors
|
||||
{
|
||||
@ -95,11 +93,11 @@ namespace VersionFlow.Editors
|
||||
var uploaderTypes = builder.GetAllPatcherType();
|
||||
|
||||
var options = uploaderTypes.Select(t => $"{t.Namespace}.{t.Name}").ToList();
|
||||
|
||||
|
||||
var selectIndex = options.IndexOf(builder.uploaderClassName);
|
||||
|
||||
|
||||
selectIndex = EditorGUILayout.Popup("选择上传器", selectIndex, options.Select(op=>PatchUploaderUtility.GetPatcherPrettyName(op)).ToArray());
|
||||
selectIndex = EditorGUILayout.Popup("选择上传器", selectIndex, options.Select(op => PatchUploaderUtility.GetPatcherPrettyName(op)).ToArray());
|
||||
if (selectIndex != -1)
|
||||
{
|
||||
var selectClassName = options[selectIndex];
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
using AlibabaCloud.SDK.Cdn20180510.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VersionFlow.Runtime;
|
||||
using static VersionFlow.Editors.ICDNPerformer;
|
||||
|
||||
namespace VersionFlow.Editors.Assets.Scripts.VersionFlow.Editor
|
||||
{
|
||||
public class CDNTaskWindow : EditorWindow
|
||||
{
|
||||
[MenuItem("项目工具/Builder/CDN进度查询")]
|
||||
[MenuItem("VersionFlow/CDN进度查询")]
|
||||
public static void OpenWindow()
|
||||
{
|
||||
var window = GetWindow<CDNTaskWindow>();
|
||||
|
||||
@ -5,7 +5,7 @@ namespace VersionFlow.Editors
|
||||
{
|
||||
public class LoadingChainDebugWindow : EditorWindow
|
||||
{
|
||||
[MenuItem("Tools/VersionFlow/Debug")]
|
||||
[MenuItem("VersionFlow/RuntimeDebug")]
|
||||
public static void Open()
|
||||
{
|
||||
var wnd = GetWindow<LoadingChainDebugWindow>();
|
||||
|
||||
@ -11,7 +11,7 @@ namespace VersionFlow.Editors
|
||||
public abstract void CfgChanged(BuilderConfig builder, string cfgJson);
|
||||
public abstract void UploadFile(string remoteFilePath, MemoryStream localfileStream);
|
||||
public abstract byte[] DownloadFile(string remoteFilePath);
|
||||
public abstract void DeleteFile(string bundlePath);
|
||||
public abstract void DeleteFile(string remoteFilePath);
|
||||
public abstract string GetCfgJson();
|
||||
}
|
||||
|
||||
|
||||
@ -41,9 +41,9 @@ namespace VersionFlow.Editors
|
||||
m_ossClient.PutObject(m_cfg.BucketName, filePathInBucket, localfileStream, metadata);
|
||||
}
|
||||
|
||||
public override void DeleteFile(string bundlePath)
|
||||
public override void DeleteFile(string remoteFilePath)
|
||||
{
|
||||
m_ossClient.DeleteObject(m_cfg.BucketName, bundlePath);
|
||||
m_ossClient.DeleteObject(m_cfg.BucketName, remoteFilePath);
|
||||
}
|
||||
|
||||
void ICDNPerformer.CDNRefresh(IEnumerable<string> refreshPaths)
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
|
||||
namespace VersionFlow.Editors
|
||||
{
|
||||
[Description("本地文件系统")]
|
||||
public class PatchUploader_LocalFileSystem : PatchUploader<PatchUploader_LocalFileSystem.Config>
|
||||
{
|
||||
protected override void OnCfgChanged() { }
|
||||
|
||||
public override void UploadFile(string remoteFilePath, MemoryStream localfileStream)
|
||||
{
|
||||
var writePath = $"{m_cfg.UploadRoot}/{remoteFilePath}";
|
||||
var direct = Path.GetDirectoryName(writePath);
|
||||
Directory.CreateDirectory(direct);
|
||||
|
||||
File.WriteAllBytes(writePath, localfileStream.ToArray());
|
||||
}
|
||||
|
||||
public override byte[] DownloadFile(string remoteFilePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
return File.ReadAllBytes($"{m_cfg.UploadRoot}/{remoteFilePath}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeleteFile(string remoteFilePath)
|
||||
{
|
||||
var path = $"{m_cfg.UploadRoot}/{remoteFilePath}";
|
||||
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct Config
|
||||
{
|
||||
public string UploadRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 056e6292c75f09242a261ec6d965487c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VersionFlow.Runtime;
|
||||
|
||||
namespace VersionFlow.Editors
|
||||
@ -28,14 +29,12 @@ namespace VersionFlow.Editors
|
||||
if (!typeof(PatchUploader).IsAssignableFrom(type)) continue;
|
||||
|
||||
s_patchloaderTypesMapper[type.FullName] = type;
|
||||
var desAttName = $"{type.Namespace}.{type.Name}";
|
||||
if (type.GetCustomAttribute<DescriptionAttribute>() is DescriptionAttribute desAtt)
|
||||
{
|
||||
s_patcherPrettyNameMapper[type] = desAtt.Description;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_patcherPrettyNameMapper[type] = $"{type.Namespace}.{type.Name}";
|
||||
desAttName = desAtt.Description;
|
||||
}
|
||||
s_patcherPrettyNameMapper[type] = desAttName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,7 +79,7 @@ namespace VersionFlow.Editors
|
||||
}
|
||||
else //创建patchloader实例
|
||||
{
|
||||
var patchloaderInstance = Activator.CreateInstance(patchType) as PatchUploader;
|
||||
var patchloaderInstance = ScriptableObject.CreateInstance(patchType) as PatchUploader;
|
||||
patchloaderInstance.CfgChanged(builder, builder.uploaderCfgJson);
|
||||
s_patchInstance[builder] = patchloaderInstance;
|
||||
return patchloaderInstance;
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VersionFlow.Runtime;
|
||||
@ -10,34 +8,6 @@ namespace VersionFlow.Editors
|
||||
[CustomEditor(typeof(VersionFlowSetting))]
|
||||
public class VersionFlowSettingEditor : Editor
|
||||
{
|
||||
[MenuItem("项目工具/打开VersionFlow设置 &4")]
|
||||
public static void OpenSettingInspector()
|
||||
{
|
||||
var setting = AssetDatabase.LoadAssetAtPath<VersionFlowSetting>("Assets/Scripts/VersionFlow/Resources/VersionFlowSettings.asset");
|
||||
var builder = AssetDatabase.LoadAssetAtPath<BuilderConfig>("Assets/Scripts/VersionFlow/Builder/Builder.asset");
|
||||
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
OpenPropertyEditor(setting);
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
OpenPropertyEditor(builder);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static dynamic OpenPropertyEditor(UnityEngine.Object obj, bool showWindow = true)
|
||||
{
|
||||
var ass = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(ass => ass.FullName.Contains("UnityEditor.CoreModule"));
|
||||
if (ass == null) return null;
|
||||
|
||||
var t = ass.GetType("UnityEditor.PropertyEditor");
|
||||
Type[] parameterTypes = { typeof(UnityEngine.Object), typeof(bool) };
|
||||
var method = t.GetMethod("OpenPropertyEditor", BindingFlags.Static | BindingFlags.NonPublic, null, parameterTypes, null);
|
||||
return method.Invoke(null, new object[] { obj, showWindow });
|
||||
}
|
||||
|
||||
private bool foldBundleLoadingInfo;
|
||||
private bool foldOptionDownloader;
|
||||
public override void OnInspectorGUI()
|
||||
|
||||
54
Assets/VersionFlow/Editor/VersionFlowSettingWnd.cs
Normal file
54
Assets/VersionFlow/Editor/VersionFlowSettingWnd.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VersionFlow.Runtime;
|
||||
|
||||
namespace VersionFlow.Editors
|
||||
{
|
||||
public class VersionFlowSettingWnd : EditorWindow
|
||||
{
|
||||
private BuilderConfig m_builder;
|
||||
private Editor m_builderEditor;
|
||||
private Editor m_settingEditor;
|
||||
private Vector2 m_builderEditorScroll;
|
||||
|
||||
[MenuItem("VersionFlow/Setting")]
|
||||
static void Open()
|
||||
{
|
||||
var wnd = EditorWindow.GetWindow<VersionFlowSettingWnd>();
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_builder = PatchUploaderUtility.FindBuilderInProject();
|
||||
|
||||
m_builderEditor = Editor.CreateEditor(m_builder);
|
||||
m_settingEditor = Editor.CreateEditor(m_builder.vfSetting);
|
||||
|
||||
m_currentEditor = m_builderEditor;
|
||||
}
|
||||
|
||||
Editor m_currentEditor;
|
||||
private void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Toggle(m_currentEditor == m_builderEditor, "上传设置", GUI.skin.button))
|
||||
{
|
||||
m_currentEditor = m_builderEditor;
|
||||
}
|
||||
if (GUILayout.Toggle(m_currentEditor == m_settingEditor, "运行时设置", GUI.skin.button))
|
||||
{
|
||||
m_currentEditor = m_settingEditor;
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
{
|
||||
m_builderEditorScroll = EditorGUILayout.BeginScrollView(m_builderEditorScroll);
|
||||
m_currentEditor.OnInspectorGUI();
|
||||
EditorGUILayout.EndScrollView();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VersionFlow/Editor/VersionFlowSettingWnd.cs.meta
Normal file
11
Assets/VersionFlow/Editor/VersionFlowSettingWnd.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29eb4093954b5384086d1b51782f4ba3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -12,7 +12,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7dc52158fc454554abe766cf83fc6e1b, type: 3}
|
||||
m_Name: VersionFlowSettings
|
||||
m_EditorClassIdentifier:
|
||||
PendingPatch: PendingPatch_ORG
|
||||
RootPath: https://update.2020yoyo.com
|
||||
SubPath: HXORG
|
||||
RootPath: https://update.test.com
|
||||
SubPath: ProjectName
|
||||
AutoReleaseBundle: 1
|
||||
|
||||
@ -12,12 +12,10 @@ namespace VersionFlow.Runtime
|
||||
get => EditorPrefs.GetBool("VERSIONFLOW_ENABLE_IN_EDITOR", false);
|
||||
set => EditorPrefs.SetBool("VERSIONFLOW_ENABLE_IN_EDITOR", value);
|
||||
}
|
||||
|
||||
public string PendingPatch = "PendingPatch_ORG";
|
||||
#endif
|
||||
|
||||
public string RootPath = "https://download-test.hx160.com";
|
||||
public string SubPath = "hx3_new_test";
|
||||
public string RootPath = "https://127.0.0.1:80";
|
||||
public string SubPath = "ProjectName";
|
||||
/// <summary> 自动释放Bundle资源 </summary>
|
||||
public bool AutoReleaseBundle;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user