【Debug】添加try...catch和日志测试
parent
4cf5adbb3f
commit
b60a4953ed
|
@ -15,7 +15,7 @@ MonoBehaviour:
|
|||
m_DefaultGroup: d58d9f3a3b49b264e94d9dd1182e2910
|
||||
m_currentHash:
|
||||
serializedVersion: 2
|
||||
Hash: 055613adb1a6e9184deaa9c262f9202f
|
||||
Hash: 3980b428a3d1445ac52889f7249df15d
|
||||
m_OptimizeCatalogSize: 0
|
||||
m_BuildRemoteCatalog: 0
|
||||
m_BundleLocalCatalog: 0
|
||||
|
|
|
@ -27,6 +27,11 @@ MonoBehaviour:
|
|||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: b5b08b0ba867e46bd90a825d41b818c9
|
||||
m_Address: Assets/Config/Build
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: ed93b85c5b1133d4c93abe6c976cf739, type: 2}
|
||||
m_SchemaSet:
|
||||
|
|
|
@ -183,6 +183,8 @@ namespace Framework.Manager
|
|||
/// 初始化该Build场景的节点信息
|
||||
/// </summary>
|
||||
private void InitNodesInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var node in _curBuildData.NodeInfos)
|
||||
{
|
||||
|
@ -206,11 +208,18 @@ namespace Framework.Manager
|
|||
NodeInfos.Add(nodeInfo.Name, nodeInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("BuildManager.InitNodesInfo 初始化节点错误 :{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化存盘信息
|
||||
/// </summary>
|
||||
private void InitUserBuildInfo(UserBuildInfo userBuildInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
//游戏中传入数据
|
||||
if (userBuildInfo != null)
|
||||
|
@ -220,7 +229,8 @@ namespace Framework.Manager
|
|||
else
|
||||
{
|
||||
StorageManager.Instance.Init();
|
||||
_userBuildInfo = StorageManager.Instance.GetStorage<UserBuildInfo>(GlobalConstants.UserBuildSaveKey);
|
||||
_userBuildInfo =
|
||||
StorageManager.Instance.GetStorage<UserBuildInfo>(GlobalConstants.UserBuildSaveKey);
|
||||
if (_userBuildInfo == null)
|
||||
{
|
||||
var buildId = _curBuildData.buildID;
|
||||
|
@ -247,34 +257,18 @@ namespace Framework.Manager
|
|||
DebugUtil.LogError("节点 {0} 选择的的是 {1}", infos.Key, infos.Value);
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载该建造物品图标
|
||||
/// </summary>
|
||||
private async UniTask InitIcon()
|
||||
catch (Exception e)
|
||||
{
|
||||
foreach (var nodeInfo in NodeInfos.Values)
|
||||
{
|
||||
foreach (var optionInfo in nodeInfo.Options.Values)
|
||||
{
|
||||
var index = GameBuildUtils.ExtractNumber(optionInfo.Name);
|
||||
|
||||
optionInfo.IconName = await InitOptionIcon(nodeInfo.IconPath, index);
|
||||
DebugUtil.LogError("BuildManager.InitUserBuildInfo 初始玩家信息错误 :{0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void InitBlueprint()
|
||||
{
|
||||
var path = string.Format(Constants.Constants.BuildBlueprint, _curBuildData.buildID);
|
||||
DebugUtil.LogError("加载蓝图的路径:{0}", path);
|
||||
CurBlueprint = await AssetManager.Instance.LoadAssetAsync<Sprite>(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化条件
|
||||
/// </summary>
|
||||
private void InitCondition()
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (_curBuildData.unlockType)
|
||||
{
|
||||
|
@ -312,11 +306,41 @@ namespace Framework.Manager
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("BuildManager.InitCondition 初始化条件错误 :{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载该建造物品图标
|
||||
/// </summary>
|
||||
private async UniTask InitIcon()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var nodeInfo in NodeInfos.Values)
|
||||
{
|
||||
foreach (var optionInfo in nodeInfo.Options.Values)
|
||||
{
|
||||
var index = GameBuildUtils.ExtractNumber(optionInfo.Name);
|
||||
|
||||
optionInfo.IconName = await InitOptionIcon(nodeInfo.IconPath, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("BuildManager.InitIcon 初始化图标数据错误 :{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化加载选项图标
|
||||
/// </summary>
|
||||
private async UniTask<string> InitOptionIcon(string iconsPath, int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileEntries = Directory.GetFiles(iconsPath, "*.png");
|
||||
foreach (var filePath in fileEntries)
|
||||
|
@ -334,6 +358,28 @@ namespace Framework.Manager
|
|||
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("BuildManager.InitOptionIcon 加载选项图标错误, 路径: {0}, Error: {1}", iconsPath, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载当前场景蓝图
|
||||
/// </summary>
|
||||
private async void InitBlueprint()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = string.Format(Constants.Constants.BuildBlueprint, _curBuildData.buildID);
|
||||
CurBlueprint = await AssetManager.Instance.LoadAssetAsync<Sprite>(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("BuildManager.InitBlueprint 加载蓝图错误 :{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得选项Icon图标
|
||||
|
|
|
@ -63,6 +63,13 @@ namespace Gameplay.LoadingExecutor
|
|||
var buildPath = string.Format(Framework.Constants.Constants.SceneBuildPath, buildId);
|
||||
var buildConfig = string.Format(Framework.Constants.Constants.BuildConfigPath, buildId);
|
||||
var buildData = await JsonHelper.LoadFromAddressable<BuildData>(buildConfig);
|
||||
//Debug TODO 删除
|
||||
DebugUtil.LogError("当前buildID: {0}", buildData.buildID);
|
||||
foreach (var nodeInfo in buildData.NodeInfos)
|
||||
{
|
||||
DebugUtil.LogError("加载{0}图标路径:{1}", nodeInfo.Name, nodeInfo.IconPath);
|
||||
}
|
||||
|
||||
await BuildManager.Instance.Init(buildData, true, buildInfo);
|
||||
await Addressables.LoadSceneAsync(buildPath).ToUniTask();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue