【存盘】默认打开没有解锁完成主题
parent
9a0fb7c3f8
commit
2923def249
|
@ -1,4 +1,5 @@
|
|||
using Gameplay.Manager;
|
||||
using Framework.Manager;
|
||||
using Framework.BI;
|
||||
using UnityEngine;
|
||||
using PhxhSDK;
|
||||
|
@ -60,6 +61,10 @@ namespace Gameplay.Game
|
|||
{
|
||||
ADManager.Instance.Release();
|
||||
_game.Release();
|
||||
|
||||
//建造释放
|
||||
BuildSelectManager.Instance.Release();
|
||||
BuildManager.Instance.Release();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ namespace Gameplay
|
|||
_Register<AppInfoManager>();
|
||||
_Register<GameStateManager>();
|
||||
_Register<LevelSelectManager>();
|
||||
_Register<BuildSelectManager>();
|
||||
_Register<LoadingExecutorManager>();
|
||||
|
||||
SDKManager.Instance.Init();
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Gameplay.Game
|
|||
|
||||
public void OnExit()
|
||||
{
|
||||
BuildManager.Instance.Release();
|
||||
BuildManager.Instance.CurBuildRelease();
|
||||
UIManager.Instance.CloseAllUI(true);
|
||||
GfxManager.Instance.ReturnGfxObj("Effect_SelectSequin", true);
|
||||
GfxManager.Instance.ReturnGfxObj("Effect_Sequin", true);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class UISelectBuildController : UIWindow
|
|||
|
||||
private void GoBuild()
|
||||
{
|
||||
if (!_curBuildID.Equals(BuildManager.Instance.UserBuildInfo.CurBuildId))
|
||||
if (!_curBuildID.Equals(BuildManager.Instance.CurBuildInfo.BuildSceneID))
|
||||
{
|
||||
BuildManager.Instance.ChangeBuildSceneID = true;
|
||||
GameStateManager.Instance.ChangeState(new GameStateStart(buildID: _curBuildID));
|
||||
|
|
|
@ -39,7 +39,7 @@ public class UIStartMainController : UIWindow
|
|||
{
|
||||
OnStart();
|
||||
}
|
||||
|
||||
|
||||
private void InitBlueprint()
|
||||
{
|
||||
_blueprint = FindObj("ResultPanel");
|
||||
|
@ -87,7 +87,7 @@ public class UIStartMainController : UIWindow
|
|||
|
||||
private async void ChangeBuildScene()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UIConstants.UISelectBuild, BuildManager.Instance.UserBuildInfo.CurBuildId);
|
||||
await UIManager.Instance.OpenWindow(UIConstants.UISelectBuild, BuildManager.Instance.CurBuildInfo.BuildSceneID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.ComponentModel;
|
||||
using Gameplay.ForestLevel;
|
||||
using Framework.Constants;
|
||||
using LC.Newtonsoft.Json;
|
||||
using Framework.Manager;
|
||||
using Gameplay.Manager;
|
||||
using Framework.Event;
|
||||
using Framework.Manager;
|
||||
using Gameplay.Level;
|
||||
using Gameplay.Game;
|
||||
using Framework.UI;
|
||||
using Gameplay.ForestLevel;
|
||||
using PhxhSDK;
|
||||
|
||||
public partial class SROptions
|
||||
|
@ -39,6 +39,9 @@ public partial class SROptions
|
|||
public void PassAllLevel()
|
||||
{
|
||||
LevelSelectManager.Instance.PassAllLevel();
|
||||
BuildManager.Instance.ChangeBuildSceneID = true;
|
||||
GameStateManager.Instance.ChangeState(
|
||||
new GameStateStart(buildID: BuildManager.Instance.CurBuildInfo.BuildSceneID));
|
||||
}
|
||||
|
||||
[Category("关卡相关"), DisplayName("开启新手引导")]
|
||||
|
@ -78,7 +81,7 @@ public partial class SROptions
|
|||
{
|
||||
LevelSelectManager.Instance.ClearFile();
|
||||
}
|
||||
|
||||
|
||||
[Category("存档相关"), DisplayName("清除当前场景所有选择节点")]
|
||||
public void ClearBuildOption()
|
||||
{
|
||||
|
|
|
@ -2,13 +2,12 @@ using System;
|
|||
using PhxhSDK;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using PhxhSDK.Phxh;
|
||||
using LC.Newtonsoft.Json;
|
||||
using Framework.Constants;
|
||||
using Sirenix.OdinInspector;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using cfg.Build;
|
||||
using PhxhSDK.Phxh;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Framework.Manager
|
||||
|
@ -124,8 +123,12 @@ namespace Framework.Manager
|
|||
public class BuildInfo
|
||||
{
|
||||
public string BuildSceneID;
|
||||
|
||||
public Dictionary<string, string> ChooseNodeInfo;
|
||||
|
||||
//当前节点
|
||||
public bool Complete;
|
||||
|
||||
public BuildInfo()
|
||||
{
|
||||
ChooseNodeInfo = new Dictionary<string, string>();
|
||||
|
@ -192,9 +195,9 @@ namespace Framework.Manager
|
|||
private UserBuildInfo _userBuildInfo;
|
||||
|
||||
/// <summary>
|
||||
/// 当前主题玩家选择情况
|
||||
/// 当前玩家选择主题
|
||||
/// </summary>
|
||||
public BuildInfo BuildInfo
|
||||
public BuildInfo CurBuildInfo
|
||||
{
|
||||
get => _curBuildInfo;
|
||||
private set => _curBuildInfo = value;
|
||||
|
@ -245,6 +248,7 @@ namespace Framework.Manager
|
|||
{
|
||||
InitForStorage();
|
||||
|
||||
var lastBuildID = _curBuildInfo;
|
||||
var buildConfigId = !string.IsNullOrEmpty(buildID) ? buildID : _userBuildInfo.CurBuildId;
|
||||
|
||||
if (!TableManager.Instance.Tables.BuildConfig.DataMap.TryGetValue(buildConfigId, out var buildConfig))
|
||||
|
@ -267,8 +271,12 @@ namespace Framework.Manager
|
|||
|
||||
await Init(buildData, true);
|
||||
await Addressables.LoadSceneAsync(buildConfig.Path).ToUniTask();
|
||||
_userBuildInfo.CurBuildId = buildConfigId;
|
||||
StorageManager.Instance.SaveWithoutUpdate();
|
||||
|
||||
if (lastBuildID is { Complete: true } && !_curBuildInfo.Complete)
|
||||
{
|
||||
_userBuildInfo.CurBuildId = buildConfigId;
|
||||
StorageManager.Instance.SaveWithoutUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -546,7 +554,7 @@ namespace Framework.Manager
|
|||
if (_curBuildInfo.ChooseNodeInfo.TryGetValue(node, out var oldOption))
|
||||
{
|
||||
_curBuildInfo.ChooseNodeInfo[node] = option;
|
||||
DebugUtil.LogY($"场景{_userBuildInfo.CurBuildId}中的节点{node}保存了{option}选择");
|
||||
DebugUtil.LogY($"场景{_curBuildInfo.BuildSceneID}中的节点{node}保存了{option}选择");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -554,6 +562,19 @@ namespace Framework.Manager
|
|||
_curBuildInfo.ChooseNodeInfo.Add(node, option);
|
||||
}
|
||||
|
||||
var complete = true;
|
||||
foreach (var chooseNode in _curBuildInfo.ChooseNodeInfo)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chooseNode.Value))
|
||||
{
|
||||
complete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (complete)
|
||||
_curBuildInfo.Complete = true;
|
||||
|
||||
StorageManager.Instance.SaveWithoutUpdate();
|
||||
}
|
||||
|
||||
|
@ -643,13 +664,13 @@ namespace Framework.Manager
|
|||
|
||||
private void DebugUserChooseNode()
|
||||
{
|
||||
foreach (var infos in BuildInfo.ChooseNodeInfo)
|
||||
foreach (var infos in CurBuildInfo.ChooseNodeInfo)
|
||||
{
|
||||
DebugUtil.LogError("节点 {0} 选择的的是 {1}", infos.Key, infos.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Release()
|
||||
public void CurBuildRelease()
|
||||
{
|
||||
foreach (var icon in _iconSprites)
|
||||
{
|
||||
|
@ -659,5 +680,10 @@ namespace Framework.Manager
|
|||
CurBlueprint = null;
|
||||
CurTopBuildUI = null;
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
CurBuildRelease();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ using Framework.Constants;
|
|||
using Cysharp.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class BuildSelectManager : Singlenton<BuildSelectManager>, IInitable
|
||||
public class BuildSelectManager
|
||||
{
|
||||
public class BuildSelectItem
|
||||
{
|
||||
|
@ -17,6 +17,21 @@ public class BuildSelectManager : Singlenton<BuildSelectManager>, IInitable
|
|||
public int Index;
|
||||
}
|
||||
|
||||
private static BuildSelectManager _instance;
|
||||
|
||||
public static BuildSelectManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new BuildSelectManager();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, BuildSelectItem> BuildSelectItems;
|
||||
|
||||
private bool _isInit;
|
||||
|
@ -81,10 +96,6 @@ public class BuildSelectManager : Singlenton<BuildSelectManager>, IInitable
|
|||
return BuildSelectItems.Values.FirstOrDefault(item => item.Index == index - 1);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
foreach (var buildSelectItem in BuildSelectItems)
|
||||
|
|
|
@ -321,7 +321,7 @@ public class BuildBoot : MonoBehaviour
|
|||
/// </summary>
|
||||
private void UpdateBuildDisplay()
|
||||
{
|
||||
var chooseNodeInfo = BuildManager.Instance.BuildInfo.ChooseNodeInfo;
|
||||
var chooseNodeInfo = BuildManager.Instance.CurBuildInfo.ChooseNodeInfo;
|
||||
if (chooseNodeInfo == null || chooseNodeInfo.Count <= 0)
|
||||
{
|
||||
DebugUtil.LogError("Build Boot: 玩家在该场景的建造信息获取错误");
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Framework.GameBuild
|
|||
{
|
||||
if (!BuildManager.Instance.BuildInGame)
|
||||
{
|
||||
BuildManager.Instance.Release();
|
||||
BuildManager.Instance.CurBuildRelease();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue