【建造】条件添加、bug 修改

iOS_release
zhangaotian 2024-07-19 17:59:28 +08:00
parent 13d8c42778
commit 1f3122de91
5 changed files with 54 additions and 29 deletions

View File

@ -1,15 +1,14 @@
using TMPro; using TMPro;
using System; using System;
using PhxhSDK;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using Gameplay.Level; using Gameplay.Level;
using Framework.Event;
using Gameplay.Manager; using Gameplay.Manager;
using Framework.Manager; using Framework.Manager;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using System.Collections.Generic; using System.Collections.Generic;
using Framework.Event;
using PhxhSDK;
using UnityEngine.Rendering.Universal;
public class BuildBoot : MonoBehaviour public class BuildBoot : MonoBehaviour
{ {
@ -307,27 +306,44 @@ public class BuildBoot : MonoBehaviour
return; return;
} }
CurCondition = BuildManager.Instance.ReachCondition < 0
? CurCondition
: BuildManager.Instance.ReachCondition;
var nextLockNode = BuildManager.Instance.GetNextLockNode(CurCondition); var nextLockNode = BuildManager.Instance.GetNextLockNode(CurCondition);
foreach (var chooseNode in chooseNodeInfo) if (string.IsNullOrEmpty(nextLockNode))
{ {
if (_nodes.TryGetValue(chooseNode.Key, out var node)) foreach (var chooseNode in chooseNodeInfo)
{ {
var option = node.GetOption(chooseNode.Value); if (_nodes.TryGetValue(chooseNode.Key, out var node))
var condition = BuildManager.Instance.GetCondition(chooseNode.Key);
if (CurCondition >= condition)
{ {
var option = node.GetOption(chooseNode.Value);
node.OptionDisplay(option); node.OptionDisplay(option);
} }
else }
}
else
{
foreach (var chooseNode in chooseNodeInfo)
{
if (_nodes.TryGetValue(chooseNode.Key, out var node))
{ {
if (node.Name.Equals(nextLockNode)) var option = node.GetOption(chooseNode.Value);
var condition = BuildManager.Instance.GetCondition(chooseNode.Key);
if (CurCondition >= condition)
{ {
_curBubble = node.BubbleObj; node.OptionDisplay(option);
node.CloseAllOptionButBubble(true);
} }
else else
{ {
node.CloseAllOptionButBubble(false); if (node.Name.Equals(nextLockNode))
{
_curBubble = node.BubbleObj;
node.CloseAllOptionButBubble(true);
}
else
{
node.CloseAllOptionButBubble(false);
}
} }
} }
} }
@ -503,13 +519,15 @@ public class BuildBoot : MonoBehaviour
private void ShowUI() private void ShowUI()
{ {
_uiMainBuild.SetActive(true); _uiMainBuild.SetActive(true);
_curBubble.SetActive(true); if (_curBubble != null)
_curBubble.SetActive(false);
} }
private void HideUI() private void HideUI()
{ {
_uiMainBuild.SetActive(false); _uiMainBuild.SetActive(false);
_curBubble.SetActive(false); if (_curBubble != null)
_curBubble.SetActive(false);
} }
#endregion #endregion

View File

@ -1,10 +1,8 @@
using System; using System;
using PhxhSDK; using PhxhSDK;
using System.IO;
using UnityEngine; using UnityEngine;
using System.Linq; using System.Linq;
using LC.Newtonsoft.Json; using LC.Newtonsoft.Json;
using Framework.GameBuild;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
@ -161,7 +159,13 @@ namespace Framework.Manager
} }
//已达到的条件 //已达到的条件
public int ReachCondition; public int ReachCondition
{
get => _reachCondition;
private set => _reachCondition = value;
}
private int _reachCondition = -1;
//动态加载的图标 //动态加载的图标
private Dictionary<string, Sprite> _iconSprites; private Dictionary<string, Sprite> _iconSprites;
@ -442,6 +446,9 @@ namespace Framework.Manager
{ {
var nodeList = NodeInfos.Values.Where(node => node.Condition > condition).ToList(); var nodeList = NodeInfos.Values.Where(node => node.Condition > condition).ToList();
if (nodeList.Count <= 0)
return null;
nodeName = nodeList[0].Name; nodeName = nodeList[0].Name;
int minCondition = nodeList[0].Condition; int minCondition = nodeList[0].Condition;
@ -471,7 +478,8 @@ namespace Framework.Manager
/// </summary> /// </summary>
public void UpdateReachCondition(int condition) public void UpdateReachCondition(int condition)
{ {
ReachCondition = condition; //TODO 分场景 、解锁类型、解锁条件
_reachCondition = condition;
} }
public void Release() public void Release()

View File

@ -6,17 +6,9 @@ using Framework.Event;
using Gameplay.Level; using Gameplay.Level;
using Framework.UI; using Framework.UI;
using PhxhSDK; using PhxhSDK;
using UnityEngine;
public partial class SROptions public partial class SROptions
{ {
[Category("临时测试"), DisplayName("读取文件")]
public async void ReadFile()
{
var iconPath = "Assets/Art/GameBuild/Texture/Series_Spring/Node1/Icon/Grass_1.png";
var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(iconPath);
DebugUtil.LogError("加载失败:{0}", sprite == null);
}
[Category("关卡相关"), DisplayName("增加10s")] [Category("关卡相关"), DisplayName("增加10s")]
public void IncreaseTime() public void IncreaseTime()

View File

@ -63,6 +63,8 @@ namespace Gameplay.LoadingExecutor
var buildPath = string.Format(Framework.Constants.Constants.SceneBuildPath, buildId); var buildPath = string.Format(Framework.Constants.Constants.SceneBuildPath, buildId);
var buildConfig = string.Format(Framework.Constants.Constants.BuildConfigPath, buildId); var buildConfig = string.Format(Framework.Constants.Constants.BuildConfigPath, buildId);
var buildData = await JsonHelper.LoadFromAddressable<BuildData>(buildConfig); var buildData = await JsonHelper.LoadFromAddressable<BuildData>(buildConfig);
var reachCondition = LevelSelectManager.Instance.CurPassLevelIndex;
BuildManager.Instance.UpdateReachCondition(reachCondition);
await BuildManager.Instance.Init(buildData, true, buildInfo); await BuildManager.Instance.Init(buildData, true, buildInfo);
await Addressables.LoadSceneAsync(buildPath).ToUniTask(); await Addressables.LoadSceneAsync(buildPath).ToUniTask();
} }

View File

@ -21,7 +21,7 @@ public class UIStartMainController : UIWindow
InitBlueprint(); InitBlueprint();
_mask = FindObj("MaskPanel").gameObject; _mask = FindObj("MaskPanel").gameObject;
BindButton("MaskPanel", ShowUI); BindButton("MaskPanel", ShowAllUI);
BindButton("UI_LiuHaiBottom/Btn_Game", OnEnterLevel); BindButton("UI_LiuHaiBottom/Btn_Game", OnEnterLevel);
BindButton("UI_LiuHaiBottom/Btn_Level", OnSelectLevel); BindButton("UI_LiuHaiBottom/Btn_Level", OnSelectLevel);
BindButton("UI_LiuHaiTop/Btn_Setting", OpenSettingPanel); BindButton("UI_LiuHaiTop/Btn_Setting", OpenSettingPanel);
@ -49,12 +49,17 @@ public class UIStartMainController : UIWindow
EventManager.Instance.Send(EventManager.EventName.HideBuildUI); EventManager.Instance.Send(EventManager.EventName.HideBuildUI);
} }
private void ShowAllUI()
{
ShowUI();
EventManager.Instance.Send(EventManager.EventName.ShowBuildUI);
}
private void ShowUI() private void ShowUI()
{ {
FindObj("UI_LiuHaiBottom").SetActive(true); FindObj("UI_LiuHaiBottom").SetActive(true);
FindObj("UI_LiuHaiTop").SetActive(true); FindObj("UI_LiuHaiTop").SetActive(true);
_mask.SetActive(false); _mask.SetActive(false);
EventManager.Instance.Send(EventManager.EventName.ShowBuildUI);
} }
private void HideUI() private void HideUI()