【m】本地打apk集成

This commit is contained in:
2025-07-02 18:36:48 +08:00
parent 103d1c76d4
commit b6c35a6331
4 changed files with 40 additions and 14 deletions

View File

@@ -23,9 +23,9 @@ public class BuildApkWindow : OdinEditorWindow
protected override void Initialize() protected override void Initialize()
{ {
base.Initialize(); base.Initialize();
buildApkLocalEntity = new BuildApkEntity(BuildAndroid, BuildAndroid); buildApkLocalEntity = new BuildApkEntity(() => { BuildAndroid(false); }, null);
buildApkServerEntity = new BuildApkEntity(BuildAndroid, BuildAndroid); buildApkServerEntity = new BuildApkEntity(null, null);
buildApkWatermarkEntity = new BuildApkEntity(BuildAndroid, BuildAndroid); buildApkWatermarkEntity = new BuildApkEntity(() => { BuildAndroid(true); }, null);
} }
[EnumToggleButtons, HideLabel] public DeviceType deviceType; [EnumToggleButtons, HideLabel] public DeviceType deviceType;
@@ -77,7 +77,7 @@ public class BuildApkWindow : OdinEditorWindow
[BoxGroup("Build(水印包)", centerLabel: true, order: 4), HideLabel] [BoxGroup("Build(水印包)", centerLabel: true, order: 4), HideLabel]
public BuildApkEntity buildApkWatermarkEntity; public BuildApkEntity buildApkWatermarkEntity;
public void BuildAndroid() public void BuildAndroid(bool isWatermark)
{ {
HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain"); HotfixMainResDomain hotfixMainResDomain = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
if (hotfixMainResDomain == null) if (hotfixMainResDomain == null)
@@ -90,15 +90,27 @@ public class BuildApkWindow : OdinEditorWindow
PlayerSettings.productName = hotfixMainResDomain.projectInfo.projectName; PlayerSettings.productName = hotfixMainResDomain.projectInfo.projectName;
PlayerSettings.applicationIdentifier = hotfixMainResDomain.projectInfo.projectPackageName; PlayerSettings.applicationIdentifier = hotfixMainResDomain.projectInfo.projectPackageName;
string[] scenelist = default;
if (isWatermark)
{
scenelist = new[]
{
hotfixMainResDomain.projectInfo.loadingScenePath,
$"Assets/Main/main_{deviceType.ToString()}.unity"
};
}
else
{
scenelist = new[]
{
$"Assets/Main/main_{deviceType.ToString()}.unity"
};
}
// 配置构建选项 // 配置构建选项
BuildPlayerOptions buildOptions = new BuildPlayerOptions BuildPlayerOptions buildOptions = new BuildPlayerOptions
{ {
scenes = new[] scenes = scenelist,
{
hotfixMainResDomain.projectInfo.loadingScenePath,
$"Assets/Main/main_{deviceType.ToString()}.unity"
},
locationPathName = $"Builds/Android/{PlayerSettings.applicationIdentifier}.apk", locationPathName = $"Builds/Android/{PlayerSettings.applicationIdentifier}.apk",
target = BuildTarget.Android, target = BuildTarget.Android,
options = BuildOptions.None options = BuildOptions.None

View File

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

View File

@@ -1,13 +1,26 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
#if HotUpdate
using YooAsset; using YooAsset;
#endif
namespace Stary.Evo.TableTextConversion namespace Stary.Evo.TableTextConversion
{ {
public static class ReadDumpInformation public static class ReadDumpInformation
{ {
public static async Task<T> Read<T>() where T : ScriptableObject, ITableData public static async Task<T> Read<T>() where T : ScriptableObject, ITableData
{ {
#if NotUpdate
var conf = Resources.Load<T>(typeof(T).Name);
if (conf != null)
{
return conf;
}
else
{
Debug.LogError("UnityEvo:" + "配置文件:" + typeof(T).Name + "加载失败!!!");
return null;
}
#elif HotUpdate
var conf = YooAssets.LoadAssetAsync($"Config_{typeof(T).Name}"); var conf = YooAssets.LoadAssetAsync($"Config_{typeof(T).Name}");
await conf.Task; await conf.Task;
if (conf.Status == EOperationStatus.Succeed) if (conf.Status == EOperationStatus.Succeed)
@@ -19,6 +32,7 @@ namespace Stary.Evo.TableTextConversion
Debug.LogError("UnityEvo:" + "配置文件:" + typeof(T).Name + "加载失败!!!"); Debug.LogError("UnityEvo:" + "配置文件:" + typeof(T).Name + "加载失败!!!");
return null; return null;
} }
#endif
} }
#if UNITY_EDITOR #if UNITY_EDITOR
@@ -26,12 +40,12 @@ namespace Stary.Evo.TableTextConversion
{ {
// 同步加载并直接返回结果 // 同步加载并直接返回结果
var conf = Resources.Load<T>(typeof(T).Name); var conf = Resources.Load<T>(typeof(T).Name);
if (conf != null) if (conf != null)
{ {
return conf; return conf;
} }
Debug.LogError($"UnityEvo:配置文件同步加载失败:{typeof(T).Name}"); Debug.LogError($"UnityEvo:配置文件同步加载失败:{typeof(T).Name}");
return null; return null;
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "com.staryevo.tabletextconversion", "name": "com.staryevo.tabletextconversion",
"version": "1.1.1", "version": "1.1.2",
"displayName": "05.TableTextConversion", "displayName": "05.TableTextConversion",
"description": "表格转化工具", "description": "表格转化工具",
"unity": "2021.3", "unity": "2021.3",