【建造】条件添加、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 System;
using PhxhSDK;
using UnityEngine;
using UnityEngine.UI;
using Gameplay.Level;
using Framework.Event;
using Gameplay.Manager;
using Framework.Manager;
using Sirenix.OdinInspector;
using System.Collections.Generic;
using Framework.Event;
using PhxhSDK;
using UnityEngine.Rendering.Universal;
public class BuildBoot : MonoBehaviour
{
@ -307,7 +306,23 @@ public class BuildBoot : MonoBehaviour
return;
}
CurCondition = BuildManager.Instance.ReachCondition < 0
? CurCondition
: BuildManager.Instance.ReachCondition;
var nextLockNode = BuildManager.Instance.GetNextLockNode(CurCondition);
if (string.IsNullOrEmpty(nextLockNode))
{
foreach (var chooseNode in chooseNodeInfo)
{
if (_nodes.TryGetValue(chooseNode.Key, out var node))
{
var option = node.GetOption(chooseNode.Value);
node.OptionDisplay(option);
}
}
}
else
{
foreach (var chooseNode in chooseNodeInfo)
{
if (_nodes.TryGetValue(chooseNode.Key, out var node))
@ -333,6 +348,7 @@ public class BuildBoot : MonoBehaviour
}
}
}
}
#endregion
@ -503,12 +519,14 @@ public class BuildBoot : MonoBehaviour
private void ShowUI()
{
_uiMainBuild.SetActive(true);
_curBubble.SetActive(true);
if (_curBubble != null)
_curBubble.SetActive(false);
}
private void HideUI()
{
_uiMainBuild.SetActive(false);
if (_curBubble != null)
_curBubble.SetActive(false);
}

View File

@ -1,10 +1,8 @@
using System;
using PhxhSDK;
using System.IO;
using UnityEngine;
using System.Linq;
using LC.Newtonsoft.Json;
using Framework.GameBuild;
using Sirenix.OdinInspector;
using Cysharp.Threading.Tasks;
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;
@ -442,6 +446,9 @@ namespace Framework.Manager
{
var nodeList = NodeInfos.Values.Where(node => node.Condition > condition).ToList();
if (nodeList.Count <= 0)
return null;
nodeName = nodeList[0].Name;
int minCondition = nodeList[0].Condition;
@ -471,7 +478,8 @@ namespace Framework.Manager
/// </summary>
public void UpdateReachCondition(int condition)
{
ReachCondition = condition;
//TODO 分场景 、解锁类型、解锁条件
_reachCondition = condition;
}
public void Release()

View File

@ -6,17 +6,9 @@ using Framework.Event;
using Gameplay.Level;
using Framework.UI;
using PhxhSDK;
using UnityEngine;
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")]
public void IncreaseTime()

View File

@ -63,6 +63,8 @@ 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);
var reachCondition = LevelSelectManager.Instance.CurPassLevelIndex;
BuildManager.Instance.UpdateReachCondition(reachCondition);
await BuildManager.Instance.Init(buildData, true, buildInfo);
await Addressables.LoadSceneAsync(buildPath).ToUniTask();
}

View File

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