【打包】安卓打包报错
parent
573cee7a6f
commit
c44e84122e
|
@ -1,10 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Framework.GameBuild;
|
||||
using PhxhSDK;
|
||||
using UnityEngine;
|
||||
using cfg.Build;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEditor;
|
||||
|
||||
|
@ -64,6 +63,9 @@ namespace Framework.Manager
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 节点信息类
|
||||
/// </summary>
|
||||
public class NodeInfo
|
||||
{
|
||||
public string Name;
|
||||
|
@ -76,6 +78,9 @@ namespace Framework.Manager
|
|||
public string IconPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 节点选项类
|
||||
/// </summary>
|
||||
public class OptionInfo
|
||||
{
|
||||
public int ID;
|
||||
|
@ -107,9 +112,10 @@ namespace Framework.Manager
|
|||
}
|
||||
}
|
||||
|
||||
public BuildData CurBuildData { get; private set; }
|
||||
public int CurCondition;
|
||||
|
||||
public Dictionary<string, NodeInfo> NodeInfos;
|
||||
|
||||
private BuildData _curBuildData;
|
||||
private bool _isInit;
|
||||
private bool _isInGame;
|
||||
|
||||
|
@ -117,7 +123,7 @@ namespace Framework.Manager
|
|||
{
|
||||
if (_isInit) return;
|
||||
NodeInfos = new Dictionary<string, NodeInfo>();
|
||||
CurBuildData = buildData;
|
||||
_curBuildData = buildData;
|
||||
foreach (var node in buildData.nodeInfos)
|
||||
{
|
||||
var nodeInfo = new NodeInfo
|
||||
|
@ -129,7 +135,7 @@ namespace Framework.Manager
|
|||
|
||||
foreach (var option in node.options)
|
||||
{
|
||||
var index = ExtractNumber(option);
|
||||
var index = GameBuildUtils.ExtractNumber(option);
|
||||
var optionInfo = new OptionInfo()
|
||||
{
|
||||
ID = index,
|
||||
|
@ -146,13 +152,16 @@ namespace Framework.Manager
|
|||
_isInit = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化条件
|
||||
/// </summary>
|
||||
private void InitCondition()
|
||||
{
|
||||
switch (CurBuildData.unlockType)
|
||||
switch (_curBuildData.unlockType)
|
||||
{
|
||||
case UnlockType.ForGroup:
|
||||
{
|
||||
foreach (var unlockInfo in CurBuildData.unlockInfos)
|
||||
foreach (var unlockInfo in _curBuildData.unlockInfos)
|
||||
{
|
||||
var nodeName = string.Format(NodeName, unlockInfo.conditionGroup);
|
||||
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
|
||||
|
@ -166,7 +175,7 @@ namespace Framework.Manager
|
|||
}
|
||||
case UnlockType.ForThematic:
|
||||
{
|
||||
foreach (var unlockInfo in CurBuildData.unlockInfos)
|
||||
foreach (var unlockInfo in _curBuildData.unlockInfos)
|
||||
{
|
||||
var optionName = string.Format(OptionName, unlockInfo.conditionGroup);
|
||||
foreach (var nodeInfo in NodeInfos.Values)
|
||||
|
@ -197,7 +206,7 @@ namespace Framework.Manager
|
|||
{
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
var name = fileName.Replace(".png", "");
|
||||
if (ExtractNumber(name) == index)
|
||||
if (GameBuildUtils.ExtractNumber(name) == index)
|
||||
{
|
||||
var assetPath = filePath.Replace(Application.dataPath, "").Replace('\\', '/');
|
||||
return assetPath;
|
||||
|
@ -207,32 +216,16 @@ namespace Framework.Manager
|
|||
return null;
|
||||
}
|
||||
|
||||
private int ExtractNumber(string input)
|
||||
{
|
||||
var str = input;
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得选项Icon图标
|
||||
/// </summary>
|
||||
public Sprite GetOptionIcon(string nodeName, string optionName)
|
||||
{
|
||||
if (NodeInfos.TryGetValue(nodeName, out var nodeInfo))
|
||||
{
|
||||
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)
|
||||
return sprite;
|
||||
}
|
||||
|
@ -241,6 +234,10 @@ namespace Framework.Manager
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据节点获得解锁条件
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetCondition(string nodeName)
|
||||
{
|
||||
var condition = 0;
|
||||
|
|
|
@ -5,6 +5,7 @@ using UnityEngine;
|
|||
|
||||
namespace Framework.Manager
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
public class EditorTableManager
|
||||
{
|
||||
private static EditorTableManager _instance;
|
||||
|
@ -52,4 +53,5 @@ namespace Framework.Manager
|
|||
return getValue.ValueEn;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue