【打包】安卓打包报错

iOS_release
zhangaotian 2024-07-16 15:58:21 +08:00
parent 573cee7a6f
commit c44e84122e
2 changed files with 30 additions and 31 deletions

View File

@ -1,10 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using Framework.GameBuild;
using PhxhSDK;
using UnityEngine; using UnityEngine;
using cfg.Build;
using Cysharp.Threading.Tasks;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEditor; using UnityEditor;
@ -64,6 +63,9 @@ namespace Framework.Manager
} }
} }
/// <summary>
/// 节点信息类
/// </summary>
public class NodeInfo public class NodeInfo
{ {
public string Name; public string Name;
@ -76,6 +78,9 @@ namespace Framework.Manager
public string IconPath; public string IconPath;
} }
/// <summary>
/// 节点选项类
/// </summary>
public class OptionInfo public class OptionInfo
{ {
public int ID; public int ID;
@ -107,9 +112,10 @@ namespace Framework.Manager
} }
} }
public BuildData CurBuildData { get; private set; }
public int CurCondition;
public Dictionary<string, NodeInfo> NodeInfos; public Dictionary<string, NodeInfo> NodeInfos;
private BuildData _curBuildData;
private bool _isInit; private bool _isInit;
private bool _isInGame; private bool _isInGame;
@ -117,7 +123,7 @@ namespace Framework.Manager
{ {
if (_isInit) return; if (_isInit) return;
NodeInfos = new Dictionary<string, NodeInfo>(); NodeInfos = new Dictionary<string, NodeInfo>();
CurBuildData = buildData; _curBuildData = buildData;
foreach (var node in buildData.nodeInfos) foreach (var node in buildData.nodeInfos)
{ {
var nodeInfo = new NodeInfo var nodeInfo = new NodeInfo
@ -129,7 +135,7 @@ namespace Framework.Manager
foreach (var option in node.options) foreach (var option in node.options)
{ {
var index = ExtractNumber(option); var index = GameBuildUtils.ExtractNumber(option);
var optionInfo = new OptionInfo() var optionInfo = new OptionInfo()
{ {
ID = index, ID = index,
@ -146,13 +152,16 @@ namespace Framework.Manager
_isInit = true; _isInit = true;
} }
/// <summary>
/// 初始化条件
/// </summary>
private void InitCondition() private void InitCondition()
{ {
switch (CurBuildData.unlockType) switch (_curBuildData.unlockType)
{ {
case UnlockType.ForGroup: case UnlockType.ForGroup:
{ {
foreach (var unlockInfo in CurBuildData.unlockInfos) foreach (var unlockInfo in _curBuildData.unlockInfos)
{ {
var nodeName = string.Format(NodeName, unlockInfo.conditionGroup); var nodeName = string.Format(NodeName, unlockInfo.conditionGroup);
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo)) if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
@ -166,7 +175,7 @@ namespace Framework.Manager
} }
case UnlockType.ForThematic: case UnlockType.ForThematic:
{ {
foreach (var unlockInfo in CurBuildData.unlockInfos) foreach (var unlockInfo in _curBuildData.unlockInfos)
{ {
var optionName = string.Format(OptionName, unlockInfo.conditionGroup); var optionName = string.Format(OptionName, unlockInfo.conditionGroup);
foreach (var nodeInfo in NodeInfos.Values) foreach (var nodeInfo in NodeInfos.Values)
@ -197,7 +206,7 @@ namespace Framework.Manager
{ {
var fileName = Path.GetFileName(filePath); var fileName = Path.GetFileName(filePath);
var name = fileName.Replace(".png", ""); var name = fileName.Replace(".png", "");
if (ExtractNumber(name) == index) if (GameBuildUtils.ExtractNumber(name) == index)
{ {
var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/'); var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/');
return assetPath; return assetPath;
@ -207,32 +216,16 @@ namespace Framework.Manager
return null; return null;
} }
private int ExtractNumber(string input) /// <summary>
{ /// 获得选项Icon图标
var str = input; /// </summary>
int lastIndex = input.LastIndexOf('_');
if (lastIndex != -1 && lastIndex < input.Length - 1)
{
str = input.Substring(lastIndex + 1);
}
Match match = Regex.Match(str, @"\d+");
if (match.Success)
{
return int.Parse(match.Value);
}
return 0;
}
public Sprite GetOptionIcon(string nodeName, string optionName) public Sprite GetOptionIcon(string nodeName, string optionName)
{ {
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo)) if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
{ {
if (nodeInfo.Options.TryGetValue(optionName, out var optionInfo)) if (nodeInfo.Options.TryGetValue(optionName, out var optionInfo))
{ {
var sprite = AssetDatabase.LoadAssetAtPath<Sprite>(optionInfo.IconPath); var sprite = AssetManager.Instance.LoadAsset<Sprite>(optionInfo.IconPath);
if (sprite != null) if (sprite != null)
return sprite; return sprite;
} }
@ -241,6 +234,10 @@ namespace Framework.Manager
return null; return null;
} }
/// <summary>
/// 根据节点获得解锁条件
/// </summary>
/// <returns></returns>
public int GetCondition(string nodeName) public int GetCondition(string nodeName)
{ {
var condition = 0; var condition = 0;

View File

@ -5,6 +5,7 @@ using UnityEngine;
namespace Framework.Manager namespace Framework.Manager
{ {
#if UNITY_EDITOR
public class EditorTableManager public class EditorTableManager
{ {
private static EditorTableManager _instance; private static EditorTableManager _instance;
@ -52,4 +53,5 @@ namespace Framework.Manager
return getValue.ValueEn; return getValue.ValueEn;
} }
} }
#endif
} }