【m】增加web第一版暂存
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 4s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 4s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 10s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 5s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 32s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 4s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 16s
Plugin Library CI / publish (07.RKTools) (push) Successful in 3s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 4s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 4s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 10s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 5s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 32s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 4s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 16s
Plugin Library CI / publish (07.RKTools) (push) Successful in 3s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s
This commit is contained in:
@@ -144,7 +144,7 @@ namespace Stary.Evo
|
||||
/// <param name="url">获取Token值的服务URL地址(很重要)</param>
|
||||
/// <param name="postData">传入请求的参数,此处参数为JOSN格式</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<ResultMessageEntity> PostFile(string url, string[] path,Action<float> uploadProgress = null)
|
||||
public static async Task<ResultMessageEntity> PostFile(string url, string[] path,Dictionary<string,string> headers = null,Action<float> uploadProgress = null)
|
||||
{
|
||||
if (!GetTokenState())
|
||||
{
|
||||
@@ -170,6 +170,14 @@ namespace Stary.Evo
|
||||
using UnityWebRequest webRequest = UnityWebRequest.Post(url, form);
|
||||
|
||||
webRequest.SetRequestHeader("Authorization", authorization);
|
||||
if (headers != null)
|
||||
{
|
||||
foreach (var header in headers)
|
||||
{
|
||||
webRequest.SetRequestHeader(header.Key, header.Value);
|
||||
}
|
||||
|
||||
}
|
||||
webRequest.disposeUploadHandlerOnDispose = true;
|
||||
webRequest.disposeDownloadHandlerOnDispose = true;
|
||||
webRequest.disposeCertificateHandlerOnDispose = true;
|
||||
|
||||
@@ -17,4 +17,13 @@ namespace Stary.Evo
|
||||
public string PackageVersion { get; set; }
|
||||
public string DocumentFileId { get; set; }
|
||||
}
|
||||
|
||||
public struct DocumentFileResponse
|
||||
{
|
||||
public string type { get; set; }
|
||||
public string fileName { get; set; }
|
||||
public string fileType { get; set; }
|
||||
public string filePath { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -38,14 +38,12 @@ namespace Stary.Evo.Editor
|
||||
/// <param name="oneKeyBuildEntities"></param>
|
||||
public static void OneClickMark(List<OneKeyBuildEntity> oneKeyBuildEntities)
|
||||
{
|
||||
#if HotUpdate
|
||||
//打dll
|
||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||
//拷贝dll
|
||||
MarkAdressable.AddHotfixAddressableDllAll(oneKeyBuildEntities);
|
||||
//标记全部资源
|
||||
MarkAdressable.AddMarkAll(oneKeyBuildEntities);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void OneShaderMark(Action<string> complete)
|
||||
@@ -59,7 +57,6 @@ namespace Stary.Evo.Editor
|
||||
/// <param name="oneKeyBuildEntities"></param>
|
||||
public static void OneShaderMark(List<OneKeyBuildEntity> oneKeyBuildEntities,Action<string> complete)
|
||||
{
|
||||
#if HotUpdate
|
||||
//标记全部资源
|
||||
foreach (var oneKeyBUildEntity in oneKeyBuildEntities)
|
||||
{
|
||||
@@ -72,9 +69,6 @@ namespace Stary.Evo.Editor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void OneUpdatePackageVersionBuild()
|
||||
@@ -208,7 +202,7 @@ namespace Stary.Evo.Editor
|
||||
if (buildAssetDataSetting != null)
|
||||
{
|
||||
string zipFilePath = BuildAssetWindow.BuildZip(buildAssetDataSetting);
|
||||
await BuildAssetWindow.UpdateFileDataResDomain(buildAssetDataSetting, zipFilePath);
|
||||
await BuildAssetWindow.UpdateFileDataResDomain(buildAssetDataSetting, new []{zipFilePath});
|
||||
await Task.Delay(1000);
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Stary.Evo.Editor
|
||||
Debug.Log("切换为[HOST_PLAYMODE]模式");
|
||||
break;
|
||||
case 1:
|
||||
ChangePlayerSchema.SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
||||
ChangePlayerSchema.SetPlayerMode(PLayerMode.LOCAL_PLAYMODE);
|
||||
Debug.Log("切换为[HOST_PLAYMODE]模式");
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@@ -13,8 +13,14 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public void OnEnable()
|
||||
{
|
||||
#if UNITY_WEBGL
|
||||
viewer = new ScriptableBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(),
|
||||
packageVersion);
|
||||
#else
|
||||
viewer = new MixedBuildPipelineViewer(packageName, selectedBuildPipelines.ToString(),
|
||||
packageVersion);
|
||||
#endif
|
||||
|
||||
oldVersionX = packageVersionX;
|
||||
oldVersionY = packageVersionY;
|
||||
oldVersionZ = packageVersionZ;
|
||||
|
||||
@@ -11,10 +11,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Threading.Tasks;
|
||||
#if HotUpdate
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Commands;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Sirenix.OdinInspector;
|
||||
@@ -34,13 +32,6 @@ namespace Stary.Evo.Editor
|
||||
[MenuItem("Evo/Dev/资源打包工具", false, 2)]
|
||||
static void ShowWindows()
|
||||
{
|
||||
#if NotUpdate
|
||||
if (EditorUtility.DisplayDialog("提示", "当前为非热更模式,不支持热更打包功能,是否切换热更模式", "是", "否"))
|
||||
{
|
||||
ChangeHotUpdateSchema.SetHotUpdateMode(HotUpdateMode.HotUpdate);
|
||||
}
|
||||
|
||||
#elif HotUpdate
|
||||
if (CreatAssetWindow.GetCreatDomainAll().Count <= 0)
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", "不存在Domain元素,无法打开此面板,请先创建Domain元素", "确定");
|
||||
@@ -49,7 +40,6 @@ namespace Stary.Evo.Editor
|
||||
|
||||
window = (BuildAssetWindow)EditorWindow.GetWindow(typeof(BuildAssetWindow));
|
||||
window.Show();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
@@ -95,17 +85,17 @@ namespace Stary.Evo.Editor
|
||||
|
||||
#region HyBridCLRBuild
|
||||
|
||||
#if !UNITY_WEBGL
|
||||
[BoxGroup("Build", showLabel: false)]
|
||||
[Title("打包dll(子包仅打一次)", titleAlignment: TitleAlignments.Centered)]
|
||||
[HorizontalGroup("Build/HyBridClrBuildEntity"), HideLabel]
|
||||
public BuildAssetEntity hyBridClrBuildEntity =
|
||||
new BuildAssetEntity("HyBridCLRBuild", "DllBuildTarget", () =>
|
||||
{
|
||||
#if HotUpdate
|
||||
//PrebuildCommand.GenerateAll();
|
||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||
#endif
|
||||
});
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -230,8 +220,19 @@ namespace Stary.Evo.Editor
|
||||
$"开始上传至服务器[{selectedPackageNames}],,版本号为[{BuildAssetDataSetting.packageVersion}", "Yes", "No"))
|
||||
{
|
||||
// 新增:打包为zip的逻辑
|
||||
List<string> fileList = new List<string>();
|
||||
#if UNITY_WEBGL
|
||||
var outputPackageDirectory =
|
||||
$"{AssetBundleBuilderHelper.GetDefaultBuildOutputRoot()}/{EditorUserBuildSettings.activeBuildTarget}/{selectedPackageNames}";
|
||||
//拷贝目录
|
||||
string outFilePath = $"{outputPackageDirectory}/{BuildAssetDataSetting.packageVersion}";
|
||||
|
||||
FilesUtils.GetFiles(outFilePath, ref fileList);
|
||||
#else
|
||||
string zipFilePath = BuildZip(BuildAssetDataSetting);
|
||||
await UpdateFileDataResDomain(BuildAssetDataSetting, zipFilePath);
|
||||
fileList.Add(zipFilePath);
|
||||
#endif
|
||||
await UpdateFileDataResDomain(BuildAssetDataSetting, fileList.ToArray());
|
||||
await Task.Delay(1000);
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
@@ -355,10 +356,23 @@ namespace Stary.Evo.Editor
|
||||
File.Copy(sourcePath, destinationPath);
|
||||
}
|
||||
|
||||
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string zipFilePath)
|
||||
public static async Task UpdateFileDataResDomain(BuildAssetDataSetting setting, string[] zipFiles)
|
||||
{
|
||||
string ip = CustomEditorPrefs.GetString("ip");
|
||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", new[] { zipFilePath });
|
||||
|
||||
Dictionary<string, string> headers = null;
|
||||
#if UNITY_WEBGL
|
||||
headers = new Dictionary<string, string>()
|
||||
{
|
||||
{ "folderName", setting.packageName },
|
||||
{ "folderVersion", setting.packageVersion },
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
var messageEntity = await WebRequestSystem.PostFile(ip + "/FileLoad/UpLoadFile", zipFiles, headers);
|
||||
|
||||
|
||||
EditorUtility.DisplayProgressBar("提示", $"开始上传{setting.packageName}(上传zip文件)", 0.5f);
|
||||
if (messageEntity.code == 200)
|
||||
{
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.Editor
|
||||
{
|
||||
public class ChangeHotUpdateSchema
|
||||
{
|
||||
public static HotUpdateMode HotUpdateMode
|
||||
{
|
||||
get => _hotUpdate;
|
||||
set => SetHotUpdateMode(value);
|
||||
}
|
||||
|
||||
private static HotUpdateMode _hotUpdate;
|
||||
|
||||
private const string EditorNotUpdateMode = "Evo/Schema/ChangeHotUpdate/NOTUPDARE(非热更模式)";
|
||||
private const string EditorHotUpdateMode = "Evo/Schema/ChangeHotUpdate/HOTUPDATE(热更模式)";
|
||||
|
||||
[MenuItem(EditorNotUpdateMode)]
|
||||
private static void SetNotUpdateMode() => SetHotUpdateMode(HotUpdateMode.NotUpdate);
|
||||
|
||||
[MenuItem(EditorHotUpdateMode)]
|
||||
private static void SetHotUpdateMode() => SetHotUpdateMode(HotUpdateMode.HotUpdate);
|
||||
|
||||
// [MenuItem(WebPlayMode)]
|
||||
// private static void SetWebMode() => SetPlayerMode(HotUpdateMode.WEB_PLAYMODE);
|
||||
|
||||
[MenuItem(EditorNotUpdateMode, true)]
|
||||
private static bool ValidateModeMenu()
|
||||
{
|
||||
string platform = CustomEditorPrefs.GetString("ChangeHotUpdateSchema");
|
||||
Menu.SetChecked(EditorNotUpdateMode, platform == HotUpdateMode.NotUpdate.ToString());
|
||||
Menu.SetChecked(EditorHotUpdateMode, platform == HotUpdateMode.HotUpdate.ToString());
|
||||
//Menu.SetChecked(WebPlayMode, platform == HotUpdateMode.WEB_PLAYMODE.ToString());
|
||||
Debug.Log("ChangeHotUpdateSchema:"+platform);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SetHotUpdateMode(HotUpdateMode mode)
|
||||
{
|
||||
// 清除所有旧模式定义
|
||||
var currentTarget = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
if (currentTarget == BuildTargetGroup.Unknown) return;
|
||||
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget)
|
||||
.Split(';')
|
||||
.Where(d => !Enum.GetNames(typeof(HotUpdateMode)).Contains(d))
|
||||
.ToList();
|
||||
|
||||
// 添加新模式
|
||||
defines.Add(mode.ToString());
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, string.Join(";", defines));
|
||||
_hotUpdate = mode;
|
||||
CustomEditorPrefs.SetString("ChangeHotUpdateSchema", _hotUpdate.ToString());
|
||||
|
||||
ValidateModeMenu();
|
||||
AssetDatabase.Refresh();
|
||||
// 添加解决方案文件重新生成逻辑
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
|
||||
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum HotUpdateMode
|
||||
{
|
||||
//非热更模式,
|
||||
NotUpdate,
|
||||
//热更模式
|
||||
HotUpdate,
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d18419d2d9c488687f9aff50cbd8357
|
||||
timeCreated: 1751423025
|
||||
@@ -26,8 +26,8 @@ namespace Stary.Evo.Editor
|
||||
private static void SetHostMode() => SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
||||
[MenuItem(LocalPlayMode, false,3)]
|
||||
private static void SetLocalMode() => SetPlayerMode(PLayerMode.LOCAL_PLAYMODE);
|
||||
// [MenuItem(WebPlayMode)]
|
||||
// private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
||||
[MenuItem(WebPlayMode)]
|
||||
private static void SetWebMode() => SetPlayerMode(PLayerMode.WEB_PLAYMODE);
|
||||
|
||||
[MenuItem(EditorSimulateMode, true,3)]
|
||||
private static bool ValidateModeMenu()
|
||||
@@ -36,7 +36,7 @@ namespace Stary.Evo.Editor
|
||||
Menu.SetChecked(EditorSimulateMode, platform == PLayerMode.EDITOR_SIMULATEMODE.ToString());
|
||||
Menu.SetChecked(HostPlayMode, platform == PLayerMode.HOST_PLAYMODE.ToString());
|
||||
Menu.SetChecked(LocalPlayMode, platform == PLayerMode.LOCAL_PLAYMODE.ToString());
|
||||
//Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
||||
Menu.SetChecked(WebPlayMode, platform == PLayerMode.WEB_PLAYMODE.ToString());
|
||||
Debug.Log($"ChangePlayerSchema:{platform}");
|
||||
return true;
|
||||
}
|
||||
@@ -79,6 +79,6 @@ namespace Stary.Evo.Editor
|
||||
//本地运行模式
|
||||
LOCAL_PLAYMODE,
|
||||
// //web运行模式
|
||||
// WEB_PLAYMODE
|
||||
WEB_PLAYMODE
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if HotUpdate
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Settings;
|
||||
#endif
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using UnityEditor;
|
||||
@@ -119,8 +117,10 @@ namespace Stary.Evo.Editor
|
||||
CreatDirectory(resPath + "/Audios");
|
||||
//创建Config文件夹
|
||||
CreatDirectory(resPath + "/Config");
|
||||
#if !UNITY_WEBGL
|
||||
//创建Dll文件夹
|
||||
CreatDirectory(resPath + "/Dll");
|
||||
#endif
|
||||
//创建Prefabs文件夹
|
||||
CreatDirectory(resPath + "/Prefabs");
|
||||
//创建Scenes文件夹
|
||||
@@ -174,7 +174,6 @@ namespace Stary.Evo.Editor
|
||||
domainClassName = domainClassName.Replace('.', '_');
|
||||
string architectureClassName = $"{domain}Architecture";
|
||||
architectureClassName = architectureClassName.Replace('.', '_');
|
||||
#if HotUpdate
|
||||
//模块配置资源
|
||||
DomainConfig moduleConfig = CreateInstance<DomainConfig>();
|
||||
moduleConfig.domain = domain;
|
||||
@@ -221,7 +220,6 @@ namespace Stary.Evo.Editor
|
||||
HybridCLRSettings.Instance.hotUpdateAssemblyDefinitions = assemblies.ToArray();
|
||||
HybridCLRSettings.Save();
|
||||
}
|
||||
#endif
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
|
||||
@@ -362,8 +360,12 @@ namespace Stary.Evo.Editor
|
||||
CreatDirectory(resPath + "/Audios");
|
||||
//创建Config文件夹
|
||||
CreatDirectory(resPath + "/Config");
|
||||
//创建Dll文件夹
|
||||
#if !UNITY_WEBGL
|
||||
{
|
||||
//创建Dll文件夹
|
||||
CreatDirectory(resPath + "/Dll");
|
||||
}
|
||||
#endif
|
||||
//创建Prefabs文件夹
|
||||
CreatDirectory(resPath + "/Prefabs");
|
||||
//创建Scenes文件夹
|
||||
|
||||
@@ -36,16 +36,6 @@ namespace Stary.Evo
|
||||
}
|
||||
}
|
||||
|
||||
if (CustomEditorPrefs.GetString("ChangeHotUpdateSchema") == "")
|
||||
{
|
||||
ChangeHotUpdateSchema.SetHotUpdateMode(HotUpdateMode.NotUpdate);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeHotUpdateSchema.SetHotUpdateMode(
|
||||
Enum.Parse<HotUpdateMode>(CustomEditorPrefs.GetString("ChangeHotUpdateSchema")));
|
||||
}
|
||||
|
||||
if (CustomEditorPrefs.GetString("ChangePlayerSchema") == "")
|
||||
{
|
||||
ChangePlayerSchema.SetPlayerMode(PLayerMode.EDITOR_SIMULATEMODE);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
#if HotUpdate
|
||||
using HybridCLR.Editor.Commands;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
@@ -18,15 +16,10 @@ namespace Stary.Evo.Editor
|
||||
[MenuItem("Evo/Dev/(一键)打包工具",false, 3)]
|
||||
static void Init()
|
||||
{
|
||||
#if NotUpdate
|
||||
if (EditorUtility.DisplayDialog("提示", "当前为非热更模式,不支持热更打包功能,是否切换热更模式", "是", "否"))
|
||||
{
|
||||
ChangeHotUpdateSchema.SetHotUpdateMode(HotUpdateMode.HotUpdate);
|
||||
}
|
||||
#elif HotUpdate
|
||||
|
||||
var window = (OneKeyBuildWindow)EditorWindow.GetWindow(typeof(OneKeyBuildWindow));
|
||||
window.Show();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
[Title("全选"), OnValueChanged("OneKeyBuildEvent"), HideLabel]
|
||||
@@ -53,20 +46,16 @@ namespace Stary.Evo.Editor
|
||||
[Button("(一键)标记选择资源", ButtonSizes.Large)]
|
||||
public void OneClickMark()
|
||||
{
|
||||
#if HotUpdate
|
||||
AutoBuildPackage.OneClickMark(OneKeyBuildEntities);
|
||||
EditorUtility.DisplayDialog("提示", $"标记所有资源完成!", "确定");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Button("(一键)收集shader【材质异常或资源修改】", ButtonSizes.Large)]
|
||||
public void OneShaderMark()
|
||||
{
|
||||
#if HotUpdate
|
||||
EditorTools.ClearUnityConsole();
|
||||
AutoBuildPackage.OneShaderMark(OneKeyBuildEntities,(domainName)=>
|
||||
ShowNotification(new GUIContent($"收集【{domainName}】的shader【材质异常或资源修改】!"), 2f));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Button("(一键)获取服务器版本", ButtonSizes.Large)]
|
||||
|
||||
@@ -2,11 +2,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
#if HotUpdate
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Commands;
|
||||
#endif
|
||||
using UnityEditor;
|
||||
using UnityEditor.U2D;
|
||||
using UnityEngine;
|
||||
@@ -18,7 +15,9 @@ namespace Stary.Evo.Editor
|
||||
public class MarkAdressable
|
||||
{
|
||||
private static AssetBundleCollectorPackage package;
|
||||
#if !UNITY_WEBGL
|
||||
private static AssetBundleCollectorPackage packageRawFile;
|
||||
#endif
|
||||
|
||||
|
||||
private static Dictionary<string, string> addressDic = new Dictionary<string, string>();
|
||||
@@ -27,7 +26,9 @@ namespace Stary.Evo.Editor
|
||||
new Dictionary<string, AssetBundleCollectorGroup>();
|
||||
|
||||
private static string _packageName;
|
||||
#if !UNITY_WEBGL
|
||||
private static string[] rawFiles = new[] { "Video" };
|
||||
#endif
|
||||
|
||||
public static string DomainRoot
|
||||
{
|
||||
@@ -56,7 +57,6 @@ namespace Stary.Evo.Editor
|
||||
|
||||
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
||||
{
|
||||
#if HotUpdate
|
||||
//读取打包dll位置
|
||||
string hotUpdateDir =
|
||||
$"{SettingsUtil.HybridCLRSettings.hotUpdateDllCompileOutputRootDir}/{EditorUserBuildSettings.activeBuildTarget}";
|
||||
@@ -89,12 +89,10 @@ namespace Stary.Evo.Editor
|
||||
FileUtility.Copy(hotfixDllPathPdb, hotfixDllPathPdbTarget, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void CopyDllStrippedAOTDllOutputRootDir(string target)
|
||||
{
|
||||
#if HotUpdate
|
||||
//读取打包dll位置
|
||||
string hotUpdateDir =
|
||||
$"{SettingsUtil.HybridCLRSettings.strippedAOTDllOutputRootDir}/{EditorUserBuildSettings.activeBuildTarget}";
|
||||
@@ -105,7 +103,6 @@ namespace Stary.Evo.Editor
|
||||
$"{target}/Dll/{EditorUserBuildSettings.activeBuildTarget}/{dll}.bytes";
|
||||
FileUtility.Copy(hotfixDllPath, hotfixDllPathTarget, true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void AddMarkAll(List<OneKeyBuildEntity> oneKeyBUildEntities)
|
||||
@@ -145,7 +142,9 @@ namespace Stary.Evo.Editor
|
||||
|
||||
public static void AddDomainMark()
|
||||
{
|
||||
#if !UNITY_WEBGL
|
||||
AddHotfixAddressableDll();
|
||||
#endif
|
||||
//清空用户旧数据
|
||||
|
||||
string configPath =
|
||||
@@ -185,7 +184,9 @@ namespace Stary.Evo.Editor
|
||||
|
||||
|
||||
package = CreatePackage(_packageName);
|
||||
#if !UNITY_WEBGL
|
||||
packageRawFile = CreatePackage($"{_packageName}_RawFile");
|
||||
#endif
|
||||
//检测Packages是否存在Group
|
||||
foreach (var info in dirs)
|
||||
{
|
||||
@@ -195,7 +196,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#if !UNITY_WEBGL
|
||||
if (rawFiles.Contains(groupName))
|
||||
{
|
||||
AddGroup(packageRawFile, groupName);
|
||||
@@ -204,7 +205,9 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
AddGroup(package, groupName);
|
||||
}
|
||||
|
||||
#else
|
||||
AddGroup(package, groupName);
|
||||
#endif
|
||||
AutoMarkRootAddress(info);
|
||||
// if (info.Name != "SpriteAtlas" && info.Name != "Atlas")
|
||||
// AutoMark(info.Name);
|
||||
@@ -457,13 +460,14 @@ namespace Stary.Evo.Editor
|
||||
AssetTags = groupName,
|
||||
};
|
||||
|
||||
#if !UNITY_WEBGL
|
||||
////TODO 暂时不设置
|
||||
//如果是video目录,设置
|
||||
if (rawFiles.Contains(groupName))
|
||||
{
|
||||
collector.PackRuleName = nameof(PackVideoFile);
|
||||
}
|
||||
|
||||
#endif
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(group, collector);
|
||||
Debug.Log("GetAssetAddress:" + GetAssetAddress(file));
|
||||
AddAddressInfo(file, GetAssetAddress(file));
|
||||
|
||||
@@ -183,8 +183,8 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8578243747545439734}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.5}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -9.5}
|
||||
m_LocalScale: {x: 0.0042, y: 0.0042, z: 0.0042}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
@@ -193,7 +193,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: -0.000091552734, y: -0.1000061}
|
||||
m_AnchoredPosition: {x: -0.00048828125, y: 0.94000244}
|
||||
m_SizeDelta: {x: 20, y: 3}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &7581257579931840423
|
||||
@@ -241,7 +241,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &9212297630861054377
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace Stary.Evo
|
||||
//登录
|
||||
if ((AppConfig.IsLogin))
|
||||
{
|
||||
await GetServerVersion();
|
||||
await HOST_PLAYMODE(package);
|
||||
isInitSuccess = await HOST_PLAYMODE(packageRawFile);
|
||||
}
|
||||
@@ -78,24 +77,10 @@ namespace Stary.Evo
|
||||
await UpdateLocalPackage(packageRawFile);
|
||||
await LoadHotfixSettings();
|
||||
#elif WEB_PLAYMODE
|
||||
// IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
||||
// var webServerFileSystemParams = FileSystemParameters.CreateDefaultWebServerFileSystemParameters();
|
||||
// var webRemoteFileSystemParams =
|
||||
// FileSystemParameters.CreateDefaultWebRemoteFileSystemParameters(remoteServices); //支持跨域下载
|
||||
//
|
||||
// var initParameters = new WebPlayModeParameters();
|
||||
// initParameters.WebServerFileSystemParameters = webServerFileSystemParams;
|
||||
// initParameters.WebRemoteFileSystemParameters = webRemoteFileSystemParams;
|
||||
//
|
||||
// var initOperation = package.InitializeAsync(initParameters);
|
||||
// await initOperation;
|
||||
//
|
||||
// if (initOperation.Status == EOperationStatus.Succeed)
|
||||
// Debug.Log("UnityEvo:资源包初始化成功!");
|
||||
// else
|
||||
// Debug.LogError($"UnityEvo:资源包初始化失败:{initOperation.Error}");
|
||||
|
||||
Debug.LogError($"UnityEvo:暂不支持");
|
||||
await WEB_PLAYMODE(package);
|
||||
await UpdateLocalPackage(package);
|
||||
await LoadHotfixSettings();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -119,6 +104,19 @@ namespace Stary.Evo
|
||||
|
||||
private async UniTask<bool> HOST_PLAYMODE(ResourcePackage package)
|
||||
{
|
||||
var resDmainResponse = await GetServerDomainVersion();
|
||||
//获取当前版本
|
||||
var oldVersion = CustomPlayerPrefs.GetString($"{AppConfig.PackageDomainName}_GAME_VERSION");
|
||||
//版本不一致,开始下载
|
||||
if (resDmainResponse.PackageVersion != oldVersion)
|
||||
{
|
||||
await Download(resDmainResponse.DocumentFileId);
|
||||
CustomPlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION",resDmainResponse.PackageVersion);
|
||||
}
|
||||
else //版本一致,加载缓存资源
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:当前版本{oldVersion}资源版本一致,自动跳过更新...");
|
||||
}
|
||||
var initParams = YooAssetFileSystem.HostInitializeParameter(package.PackageName);
|
||||
// initParameters.CacheFileSystemParameters = cacheFileSystemParams;
|
||||
try
|
||||
@@ -145,6 +143,36 @@ namespace Stary.Evo
|
||||
return false;
|
||||
}
|
||||
|
||||
private async UniTask<bool> WEB_PLAYMODE(ResourcePackage package)
|
||||
{
|
||||
var path = await GetServerVersionPath();
|
||||
string defaultHostServer = $"{AppConfig.IpConfig}/StaticFiles{path}";
|
||||
var initParams = YooAssetFileSystem.WebInitializeParameter(package.PackageName, defaultHostServer,"");
|
||||
// initParameters.CacheFileSystemParameters = cacheFileSystemParams;
|
||||
try
|
||||
{
|
||||
var initOperation = package.InitializeAsync(initParams);
|
||||
|
||||
await initOperation;
|
||||
|
||||
if (initOperation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
Debug.Log("UnityEvo:从Web加载资源包,初始化成功!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:从Web加载资源包,初始化失败:{initOperation.Error}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:从Web加载资源包,初始化失败:{e}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async UniTask<bool> OFFLINE_PLAYMODE(ResourcePackage package)
|
||||
{
|
||||
var initParams = YooAssetFileSystem.OfflineInitializeParameter();
|
||||
@@ -265,7 +293,7 @@ namespace Stary.Evo
|
||||
#endif
|
||||
}
|
||||
|
||||
private async UniTask GetServerVersion()
|
||||
private async UniTask<ResDmainResponse> GetServerDomainVersion()
|
||||
{
|
||||
// 新增平台判断代码
|
||||
#if UNITY_EDITOR
|
||||
@@ -290,31 +318,53 @@ namespace Stary.Evo
|
||||
{
|
||||
ResDmainResponse resDmainResponse =
|
||||
JsonConvert.DeserializeObject<ResDmainResponse>(resDmainMessageEntity.data.ToString());
|
||||
//获取当前版本
|
||||
var oldVersion = CustomPlayerPrefs.GetString($"{AppConfig.PackageDomainName}_GAME_VERSION");
|
||||
//版本不一致,开始下载
|
||||
if (resDmainResponse.PackageVersion != oldVersion)
|
||||
{
|
||||
await Download(resDmainResponse.DocumentFileId);
|
||||
CustomPlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION",
|
||||
resDmainResponse.PackageVersion);
|
||||
}
|
||||
else //版本一致,加载缓存资源
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:当前版本{oldVersion}资源版本一致,自动跳过更新...");
|
||||
}
|
||||
|
||||
return resDmainResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
private async UniTask<string> GetServerVersionPath()
|
||||
{
|
||||
var resDmainResponse = await GetServerDomainVersion();
|
||||
if (!string.IsNullOrEmpty(resDmainResponse.DocumentFileId))
|
||||
{
|
||||
try
|
||||
{
|
||||
CustomPlayerPrefs.SetString($"{AppConfig.PackageDomainName}_GAME_VERSION",resDmainResponse.PackageVersion);
|
||||
string url = $"{AppConfig.IpConfig}/FileLoad/QueryFileById";
|
||||
var resDmainMessageEntity = await WebRequestSystem.Get(url, resDmainResponse.DocumentFileId);
|
||||
if (resDmainMessageEntity.code == 200)
|
||||
{
|
||||
DocumentFileResponse documentFileResponse =
|
||||
JsonConvert.DeserializeObject<DocumentFileResponse>(resDmainMessageEntity.data.ToString());
|
||||
return documentFileResponse.filePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:获取资源版本失败: 【{resDmainMessageEntity.message}】");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"UnityEvo:获取资源版本失败: 【{resDmainResponse.DocumentFileId}】: {e.Message}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"UnityEvo:获取资源版本失败: 【{resDmainResponse.DocumentFileId}】");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private async UniTask UpdateLocalPackage(ResourcePackage package)
|
||||
{
|
||||
//更新失败
|
||||
|
||||
Debug.Log($"UnityEvo:开始加载本地缓存资源...");
|
||||
|
||||
// 获取上次成功记录的版本
|
||||
string packageVersion =
|
||||
@@ -351,7 +401,7 @@ namespace Stary.Evo
|
||||
{
|
||||
//初始化读取资源配置表
|
||||
var package = YooAssets.GetPackage(AppConfig.PackageDomainName);
|
||||
if (AppConfig.PackageDomainName.Equals("Main") || HybridClREntrance.Global.stage == StageType.Developer)
|
||||
if (HybridClREntrance.Global.stage == StageType.Developer)
|
||||
{
|
||||
//加载热更配置文件
|
||||
var loadHotfixSettingsOp = package.LoadAssetAsync<DomainConfig>("Config_DomainConfig");
|
||||
@@ -373,8 +423,12 @@ namespace Stary.Evo
|
||||
{
|
||||
Debug.LogError($"UnityEvo:【{package.PackageName}】加载DomainConfig为空,无法继续执行后续流程,请检查!!!");
|
||||
}
|
||||
|
||||
#if UNITY_WEBGL
|
||||
await FsmSystem.SetCurState(nameof(ResStartState), domainConfig,domainConfig.className);
|
||||
#else
|
||||
FsmSystem.SetCurState(nameof(HotFixDllState), domainConfig);
|
||||
#endif
|
||||
|
||||
}
|
||||
else if (HybridClREntrance.Global.stage == StageType.Originality)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if HotUpdate
|
||||
using YooAsset;
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo.UIFarme
|
||||
{
|
||||
@@ -201,7 +199,6 @@ namespace Stary.Evo.UIFarme
|
||||
{
|
||||
return activePanel.gameObject;
|
||||
}
|
||||
#if HotUpdate
|
||||
AssetHandle handle = null;
|
||||
if (packageName == null)
|
||||
{
|
||||
@@ -223,10 +220,6 @@ namespace Stary.Evo.UIFarme
|
||||
await handle.Task;
|
||||
|
||||
activePanel = GameObject.Instantiate(handle.AssetObject as GameObject, panelParent);
|
||||
#else
|
||||
GameObject handle = Resources.Load<GameObject>(panelName);
|
||||
activePanel = GameObject.Instantiate(handle, panelParent);
|
||||
#endif
|
||||
|
||||
|
||||
activePanel.name = this.GetType().Name;
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if HotUpdate
|
||||
using YooAsset;
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo.UIFarme
|
||||
{
|
||||
@@ -163,7 +161,6 @@ namespace Stary.Evo.UIFarme
|
||||
{
|
||||
return activePanel.gameObject;
|
||||
}
|
||||
#if HotUpdate
|
||||
AssetHandle handle = null;
|
||||
if (packageName == null)
|
||||
{
|
||||
@@ -185,10 +182,6 @@ namespace Stary.Evo.UIFarme
|
||||
await handle.Task;
|
||||
|
||||
activePanel = GameObject.Instantiate(handle.AssetObject as GameObject, panelParent);
|
||||
#else
|
||||
GameObject handle = Resources.Load<GameObject>(panelName);
|
||||
activePanel = GameObject.Instantiate(handle, panelParent);
|
||||
#endif
|
||||
|
||||
activePanel.name = panelName;
|
||||
|
||||
|
||||
36
Assets/00.StaryEvoTools/Runtime/Tools/RemoteServices.cs
Normal file
36
Assets/00.StaryEvoTools/Runtime/Tools/RemoteServices.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using YooAsset;
|
||||
namespace Stary.Evo
|
||||
{
|
||||
|
||||
|
||||
public class RemoteServices : IRemoteServices
|
||||
{
|
||||
private readonly string _mainHost;
|
||||
private readonly string _fallbackHost;
|
||||
|
||||
public RemoteServices(string mainHost, string fallbackHost = null)
|
||||
{
|
||||
_mainHost = mainHost.TrimEnd('/');
|
||||
_fallbackHost = string.IsNullOrEmpty(fallbackHost)
|
||||
? _mainHost
|
||||
: fallbackHost.TrimEnd('/');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主下载地址(YooAsset 会优先使用)
|
||||
/// fileName 示例:DefaultPackage/StaticAssets/DefaultPackage.version
|
||||
/// </summary>
|
||||
public string GetRemoteMainURL(string fileName)
|
||||
{
|
||||
return $"{_mainHost}/{fileName}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 备用下载地址(主地址失败时自动重试)
|
||||
/// </summary>
|
||||
public string GetRemoteFallbackURL(string fileName)
|
||||
{
|
||||
return $"{_fallbackHost}/{fileName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bfb1ccd41e3422e9b42f65c275eb0ea
|
||||
timeCreated: 1776440659
|
||||
@@ -26,6 +26,17 @@ namespace Stary.Evo
|
||||
initParameters.BuildinFileSystemParameters = buildinFileSystemParams;
|
||||
return initParameters;
|
||||
}
|
||||
public static InitializeParameters WebInitializeParameter(string packageName, string defaultHostServer, string fallbackHostServer)
|
||||
{
|
||||
IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
||||
var webServerFileSystemParams = FileSystemParameters.CreateDefaultWebServerFileSystemParameters();
|
||||
var webRemoteFileSystemParams = FileSystemParameters.CreateDefaultWebRemoteFileSystemParameters(remoteServices); //支持跨域下载
|
||||
|
||||
var initParameters = new WebPlayModeParameters();
|
||||
initParameters.WebServerFileSystemParameters = webServerFileSystemParams;
|
||||
initParameters.WebRemoteFileSystemParameters = webRemoteFileSystemParams;
|
||||
return initParameters;
|
||||
}
|
||||
public static InitializeParameters EditorSimulateInitializeParameter(string packageName)
|
||||
{
|
||||
var buildResult = EditorSimulateModeHelper.SimulateBuild(packageName);
|
||||
|
||||
Reference in New Issue
Block a user