【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

This commit is contained in:
2026-04-18 01:00:51 +08:00
parent ef5113afc6
commit 60f1264d51
20 changed files with 227 additions and 200 deletions

View File

@@ -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();
}

View File

@@ -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:

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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,
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7d18419d2d9c488687f9aff50cbd8357
timeCreated: 1751423025

View File

@@ -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
}
}

View File

@@ -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文件夹

View File

@@ -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);

View File

@@ -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)]

View File

@@ -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));