【m】打包脚本修改
This commit is contained in:
@@ -56,6 +56,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
StartBuild(PLayerMode.LOCAL_PLAYMODE);
|
StartBuild(PLayerMode.LOCAL_PLAYMODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Button("服务器热更包", ButtonSizes.Large, ButtonStyle.FoldoutButton)]
|
[Button("服务器热更包", ButtonSizes.Large, ButtonStyle.FoldoutButton)]
|
||||||
private void BuildServerPackage()
|
private void BuildServerPackage()
|
||||||
{
|
{
|
||||||
@@ -135,12 +136,6 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
buildStatus = "加载配置文件...";
|
buildStatus = "加载配置文件...";
|
||||||
Repaint();
|
Repaint();
|
||||||
|
|
||||||
|
|
||||||
buildStatus = "设置打包模式...";
|
|
||||||
Repaint();
|
|
||||||
ChangePlayerSchema.SetPlayerMode(PLayerMode.HOST_PLAYMODE);
|
|
||||||
|
|
||||||
buildStatus = "配置包名...";
|
buildStatus = "配置包名...";
|
||||||
Repaint();
|
Repaint();
|
||||||
ConfigurePackageInfo();
|
ConfigurePackageInfo();
|
||||||
@@ -155,23 +150,25 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
ConfigureWatermark();
|
ConfigureWatermark();
|
||||||
}
|
}
|
||||||
|
|
||||||
buildStatus = "执行打包...";
|
|
||||||
Repaint();
|
|
||||||
|
|
||||||
// 打包前检查
|
// 打包前检查
|
||||||
if (!PreBuildCheck())
|
if (!PreBuildCheck())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildStatus = "设置打包模式...";
|
||||||
|
Repaint();
|
||||||
|
ChangePlayerSchema.SetPlayerMode(pLayerMode);
|
||||||
|
|
||||||
|
buildStatus = "执行打包...";
|
||||||
|
Repaint();
|
||||||
// 配置构建选项
|
// 配置构建选项
|
||||||
BuildPlayerOptions buildOptions = ConfigureBuildOptions(sceneList, isWatermark);
|
BuildPlayerOptions buildOptions = ConfigureBuildOptions(sceneList, isWatermark);
|
||||||
|
|
||||||
// 执行打包
|
// 执行打包
|
||||||
var report = BuildPipeline.BuildPlayer(buildOptions);
|
var report = BuildPipeline.BuildPlayer(buildOptions);
|
||||||
_lastBuildReport = report;
|
_lastBuildReport = report;
|
||||||
|
|
||||||
// 处理打包结果
|
// 处理打包结果
|
||||||
HandleBuildResult(report, buildOptions.locationPathName);
|
HandleBuildResult(report, buildOptions.locationPathName);
|
||||||
}
|
}
|
||||||
@@ -248,13 +245,15 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
foreach (var scenePath in _scenePaths)
|
foreach (var scenePath in _scenePaths)
|
||||||
{
|
{
|
||||||
if (mainScenePath == scenePath)
|
string path = scenePath.Replace("\\", "/");
|
||||||
|
if (mainScenePath == path)
|
||||||
{
|
{
|
||||||
LoadSceneForEditing(mainScenePath);
|
LoadSceneForEditing(mainScenePath);
|
||||||
|
scenes.Add(mainScenePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scenes.Add(mainScenePath);
|
|
||||||
return scenes.ToArray();
|
return scenes.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,8 +323,7 @@ namespace Stary.Evo.Editor
|
|||||||
private string GetBuildPath(bool isWatermark)
|
private string GetBuildPath(bool isWatermark)
|
||||||
{
|
{
|
||||||
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||||
string packageType = isWatermark ? "watermark" : "normal";
|
string buildFileName = $"{PlayerSettings.productName}_{timestamp}.apk";
|
||||||
string buildFileName = $"{PlayerSettings.productName}_{packageType}_{timestamp}.apk";
|
|
||||||
return Path.Combine("Builds", "Android", buildFileName);
|
return Path.Combine("Builds", "Android", buildFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,26 +616,12 @@ namespace Stary.Evo.Editor
|
|||||||
// 加载场景
|
// 加载场景
|
||||||
EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
|
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组件
|
||||||
HybridClREntrance entrance = null;
|
HybridClREntrance entrance = loadDllObj.GetComponent<HybridClREntrance>();
|
||||||
foreach (GameObject obj in loadDllObjects)
|
entrance.loadDomain = selectedPackageName;
|
||||||
{
|
|
||||||
entrance = obj.GetComponent<HybridClREntrance>();
|
|
||||||
entrance.loadDomain = selectedPackageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"成功加载场景: {scenePath}");
|
Debug.Log($"成功加载场景: {scenePath}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.tools",
|
"name": "com.staryevo.tools",
|
||||||
"version": "1.3.17",
|
"version": "1.3.18",
|
||||||
"displayName": "00.StaryEvo.Tools",
|
"displayName": "00.StaryEvo.Tools",
|
||||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user