【m】打包脚本修改

This commit is contained in:
zhangzheng
2026-03-18 16:18:16 +08:00
parent 1c4f810aab
commit 0616cf85d8
2 changed files with 20 additions and 36 deletions

View File

@@ -56,6 +56,7 @@ namespace Stary.Evo.Editor
{
StartBuild(PLayerMode.LOCAL_PLAYMODE);
}
[Button("服务器热更包", ButtonSizes.Large, ButtonStyle.FoldoutButton)]
private void BuildServerPackage()
{
@@ -135,12 +136,6 @@ namespace Stary.Evo.Editor
{
buildStatus = "加载配置文件...";
Repaint();
buildStatus = "设置打包模式...";
Repaint();
ChangePlayerSchema.SetPlayerMode(PLayerMode.HOST_PLAYMODE);
buildStatus = "配置包名...";
Repaint();
ConfigurePackageInfo();
@@ -155,23 +150,25 @@ namespace Stary.Evo.Editor
{
ConfigureWatermark();
}
buildStatus = "执行打包...";
Repaint();
// 打包前检查
if (!PreBuildCheck())
{
return;
}
buildStatus = "设置打包模式...";
Repaint();
ChangePlayerSchema.SetPlayerMode(pLayerMode);
buildStatus = "执行打包...";
Repaint();
// 配置构建选项
BuildPlayerOptions buildOptions = ConfigureBuildOptions(sceneList, isWatermark);
// 执行打包
var report = BuildPipeline.BuildPlayer(buildOptions);
_lastBuildReport = report;
// 处理打包结果
HandleBuildResult(report, buildOptions.locationPathName);
}
@@ -248,13 +245,15 @@ namespace Stary.Evo.Editor
foreach (var scenePath in _scenePaths)
{
if (mainScenePath == scenePath)
string path = scenePath.Replace("\\", "/");
if (mainScenePath == path)
{
LoadSceneForEditing(mainScenePath);
scenes.Add(mainScenePath);
}
}
scenes.Add(mainScenePath);
return scenes.ToArray();
}
@@ -324,8 +323,7 @@ namespace Stary.Evo.Editor
private string GetBuildPath(bool isWatermark)
{
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
string packageType = isWatermark ? "watermark" : "normal";
string buildFileName = $"{PlayerSettings.productName}_{packageType}_{timestamp}.apk";
string buildFileName = $"{PlayerSettings.productName}_{timestamp}.apk";
return Path.Combine("Builds", "Android", buildFileName);
}
@@ -618,26 +616,12 @@ namespace Stary.Evo.Editor
// 加载场景
EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
// 查找所有LoadDll物体
GameObject[] loadDllObjects = GameObject.FindGameObjectsWithTag("LoadDll");
// 如果没有找到,尝试按名称查找
if (loadDllObjects.Length == 0)
{
GameObject loadDllObj = GameObject.Find("LoadDll");
if (loadDllObj != null)
{
loadDllObjects = new GameObject[] { loadDllObj };
}
}
GameObject loadDllObj = GameObject.Find("LoadDll");
// 收集HybridClREntrance组件
HybridClREntrance entrance = null;
foreach (GameObject obj in loadDllObjects)
{
entrance = obj.GetComponent<HybridClREntrance>();
entrance.loadDomain = selectedPackageName;
}
HybridClREntrance entrance = loadDllObj.GetComponent<HybridClREntrance>();
entrance.loadDomain = selectedPackageName;
Debug.Log($"成功加载场景: {scenePath}");
}

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.tools",
"version": "1.3.17",
"version": "1.3.18",
"displayName": "00.StaryEvo.Tools",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",