From 68f004d85fe112d31c038b68e920711e5d0e4bf0 Mon Sep 17 00:00:00 2001 From: zhangaotian <8474238@qq.com> Date: Tue, 30 Jul 2024 12:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90bug=E3=80=91=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=9F=B3=E6=95=88=E3=80=81=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E6=96=B0=E6=89=8B=E5=BC=95=E5=AF=BCbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Framework/GameBuild/BuildBoot.cs | 46 ++++++++++++------- .../Scripts/Framework/Manager/BuildManager.cs | 25 ++++++++-- .../GameStartLoadingExecutor.cs | 5 +- .../UI/Other/UILoginPanelController.cs | 9 ++-- .../Gameplay/UI/Other/UISyncTipController.cs | 7 ++- 5 files changed, 65 insertions(+), 27 deletions(-) diff --git a/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs b/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs index fd6bd7d..54103d2 100644 --- a/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs +++ b/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs @@ -327,7 +327,7 @@ public class BuildBoot : MonoBehaviour ? CurCondition : BuildManager.Instance.ReachCondition; - var nextLockNode = BuildManager.Instance.GetNextLockNode(CurCondition); + var nextLockNode = BuildManager.Instance.GetNextLockNode(); if (string.IsNullOrEmpty(nextLockNode)) { foreach (var chooseNode in chooseNodeInfo) @@ -429,7 +429,6 @@ public class BuildBoot : MonoBehaviour /// private void InitUI() { - //选择时UI var otherRoot = GameObject.Find("OtherRoot").gameObject; _mask = otherRoot.transform.Find("Mask").gameObject; _pickItem = GameObject.Find("OtherRoot/PickItem").gameObject; @@ -472,6 +471,7 @@ public class BuildBoot : MonoBehaviour private void CloseTipPanel() { _tipObj.SetActive(false); + BuildManager.Instance.PlaySound(); } /// @@ -485,6 +485,7 @@ public class BuildBoot : MonoBehaviour GameStateManager.Instance.ChangeState(new LevelState(levelID)); EventManager.Instance.Send(EventManager.EventName.EnterGame); } + BuildManager.Instance.PlaySound(); } /// @@ -492,6 +493,7 @@ public class BuildBoot : MonoBehaviour /// private void CloseBar() { + BuildManager.Instance.PlaySound(); _isChanging = false; _buildBar.Close(); _mask.SetActive(false); @@ -513,6 +515,7 @@ public class BuildBoot : MonoBehaviour /// private void YesBar() { + BuildManager.Instance.PlaySound(); _isChanging = false; _mask.SetActive(false); _pickItem.SetActive(false); @@ -566,7 +569,7 @@ public class BuildBoot : MonoBehaviour var optionObj = obj.transform.parent.gameObject; var nodeName = optionObj.transform.parent.name; var optionName = optionObj.name; - + BuildManager.Instance.PlaySound(); if (_nodes.TryGetValue(nodeName, out var node)) { _curNode = node; @@ -585,17 +588,6 @@ public class BuildBoot : MonoBehaviour } } - /// - /// 描边展示 - /// - private void OutlinePickItem(Option option) - { - _pickItem.SetActive(true); - _pickItem.transform.position = option.OptionObj.transform.position; - _pickSpriteRenderer.sprite = - option.NormalObj.GetComponent().sprite; - } - /// /// 泡泡点击 /// @@ -608,7 +600,7 @@ public class BuildBoot : MonoBehaviour obj.SetActive(false); var nodeName = obj.transform.parent.name; EventManager.Instance.Send(EventManager.EventName.HideMainUI); - + BuildManager.Instance.PlaySound(); if (_nodes.TryGetValue(nodeName, out var node)) { var condition = BuildManager.Instance.GetCondition(nodeName); @@ -642,7 +634,7 @@ public class BuildBoot : MonoBehaviour } _newOption = option; - + BuildManager.Instance.PlaySound(); OutlinePickItem(option); //DebugUtil.LogError("点击了{0}节点的{1}选项", nodeName, option.OptionObj.name); @@ -655,9 +647,29 @@ public class BuildBoot : MonoBehaviour { _mask.SetActive(true); _tipObj.SetActive(true); + BuildManager.Instance.PlaySound(); EventManager.Instance.Send(EventManager.EventName.OpenUI); } + /// + /// 描边展示 + /// + private void OutlinePickItem(Option option) + { + _pickItem.SetActive(true); + _pickItem.transform.position = option.OptionObj.transform.position; + _pickSpriteRenderer.sprite = + option.NormalObj.GetComponent().sprite; + } + + private void UpdateReachCondition() + { + //TODO 不同类型的条件 + CurCondition = LevelSelectManager.Instance.CurPassLevelIndex; + + BuildManager.Instance.UpdateReachCondition(CurCondition); + } + #endregion private void RegisterEvent() @@ -666,6 +678,7 @@ public class BuildBoot : MonoBehaviour InputManager.Instance.OnBuildBubbleClick += OnBuildBubbleClick; EventManager.Instance.Register(EventManager.EventName.HideBuildUI, HideUI); EventManager.Instance.Register(EventManager.EventName.ShowBuildUI, ShowUI); + EventManager.Instance.Register(EventManager.EventName.RefreshGameData, UpdateReachCondition); } private void UnregisterClickEvent() @@ -678,5 +691,6 @@ public class BuildBoot : MonoBehaviour EventManager.Instance.Unregister(EventManager.EventName.HideBuildUI, HideUI); EventManager.Instance.Unregister(EventManager.EventName.ShowBuildUI, ShowUI); + EventManager.Instance.Unregister(EventManager.EventName.RefreshGameData, UpdateReachCondition); } } \ No newline at end of file diff --git a/Forest/Assets/Scripts/Framework/Manager/BuildManager.cs b/Forest/Assets/Scripts/Framework/Manager/BuildManager.cs index b5cd764..d569cdf 100644 --- a/Forest/Assets/Scripts/Framework/Manager/BuildManager.cs +++ b/Forest/Assets/Scripts/Framework/Manager/BuildManager.cs @@ -189,6 +189,7 @@ namespace Framework.Manager //Build场景相机 public Camera CurBuildCamera; + private BuildData _curBuildData; private bool _isInit; private bool _isInGame; @@ -205,6 +206,7 @@ namespace Framework.Manager InitCondition(); await InitIcon(); InitBlueprint(); + _isInGame = inGame; if (inGame) CurBuildCamera = CameraManager.Instance.UICamera; _isInit = true; @@ -451,8 +453,10 @@ namespace Framework.Manager StorageManager.Instance.SaveWithoutUpdate(); } - - public string GetNextLockNode(int condition) + /// + /// 获取下一个解锁节点 + /// + public string GetNextLockNode() { string nodeName = null; @@ -475,9 +479,9 @@ namespace Framework.Manager } var firstNode = NodeInfos - .OrderBy(kv => kv.Value.Condition) + .OrderBy(kv => kv.Value.Condition) .FirstOrDefault(); - + return firstNode.Key; } //TODO 按主题解锁 @@ -499,12 +503,25 @@ namespace Framework.Manager _reachCondition = condition; } + /// + /// 更新本地节点选择 + /// public void SetBuildUserInfo(int guideGroupID) { _userBuildInfo.GuideGroup = guideGroupID; StorageManager.Instance.SyncForce = true; } + /// + /// 播放音效 + /// + public void PlaySound() + { + if (_isInGame) + AudioManager.Instance.PlaySound(AudioType.SOUND, "S_Btn", + new UnityAudio(false)); + } + /// /// Debug 清楚玩家所有选择 /// diff --git a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs index 05a0db2..fc1afd7 100644 --- a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs +++ b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs @@ -63,11 +63,12 @@ namespace Gameplay.LoadingExecutor } //判断是否开启新手引导 - if (!GuideMananger.Instance.IsGuiding && buildInfo.GuideGroup <= 0) + if (!GuideMananger.Instance.IsGuiding && buildInfo.GuideGroup <= 0 && + LevelSelectManager.Instance.CurPassLevelIndex < 1) { buildInfo.ChooseNodeInfo = new Dictionary(); GuideMananger.Instance.NeedGuide = true; - DebugUtil.LogG("开启新手引导!"); + DebugUtil.LogG("需要开启新手引导!"); } var buildId = buildInfo.BuildData; diff --git a/Forest/Assets/Scripts/Gameplay/UI/Other/UILoginPanelController.cs b/Forest/Assets/Scripts/Gameplay/UI/Other/UILoginPanelController.cs index e32b930..2c13bf1 100644 --- a/Forest/Assets/Scripts/Gameplay/UI/Other/UILoginPanelController.cs +++ b/Forest/Assets/Scripts/Gameplay/UI/Other/UILoginPanelController.cs @@ -5,10 +5,10 @@ using Framework.BI; using UnityEngine.UI; using Gameplay.Login; using Framework.Event; +using Gameplay.Manager; using Framework.Manager; using Framework.Constants; using Event = cfg.BI.Event; -using System; public class UILoginPanelController : UIWindow { @@ -37,7 +37,7 @@ public class UILoginPanelController : UIWindow #endif ChangeLanguage(); } - + protected override void OnOpenWindow(object data) { BIManager.Instance.TrackEvent(Event.show_login); @@ -121,11 +121,12 @@ public class UILoginPanelController : UIWindow } else if (!_needHideGfx) { - GuideMananger.Instance.StartGroupGuide(); + if (LevelSelectManager.Instance.CurPassLevelIndex < 1) + GuideMananger.Instance.StartGroupGuide(); EventManager.Instance.Send(EventManager.EventName.ShowGfx); } } - + private void OnDestroy() { EventManager.Instance.Unregister(EventManager.EventName.LoginFail, LoginFail); diff --git a/Forest/Assets/Scripts/Gameplay/UI/Other/UISyncTipController.cs b/Forest/Assets/Scripts/Gameplay/UI/Other/UISyncTipController.cs index ced7b3b..e2f6022 100644 --- a/Forest/Assets/Scripts/Gameplay/UI/Other/UISyncTipController.cs +++ b/Forest/Assets/Scripts/Gameplay/UI/Other/UISyncTipController.cs @@ -1,3 +1,4 @@ +using Gameplay.Manager; using Framework.Event; using UnityEngine.UI; using Framework.BI; @@ -31,7 +32,11 @@ public class UISyncTipController : UIWindow private void CloseUI() { CloseWindow(true); - GuideMananger.Instance.StartGroupGuide(); + if (LevelSelectManager.Instance.CurPassLevelIndex < 1) + { + DebugUtil.LogG("开启新手引导!"); + GuideMananger.Instance.StartGroupGuide(); + } if (!_needHideGfx) EventManager.Instance.Send(EventManager.EventName.ShowGfx); }