diff --git a/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs b/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs index 9a94689..fd6bd7d 100644 --- a/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs +++ b/Forest/Assets/Scripts/Framework/GameBuild/BuildBoot.cs @@ -347,7 +347,6 @@ public class BuildBoot : MonoBehaviour //已选择节点 if (!string.IsNullOrEmpty(unlockNode)) { - var option = node.Value.GetOption(unlockNode); node.Value.OptionDisplay(option); } @@ -533,6 +532,7 @@ public class BuildBoot : MonoBehaviour _curNode = null; _curOption = null; _newOption = null; + _curBubble = null; UpdateBuildDisplay(); } @@ -562,7 +562,6 @@ public class BuildBoot : MonoBehaviour if (_isChanging) return; _isChanging = true; _mask.SetActive(true); - _pickItem.SetActive(true); EventManager.Instance.Send(EventManager.EventName.HideMainUI); var optionObj = obj.transform.parent.gameObject; var nodeName = optionObj.transform.parent.name; @@ -575,7 +574,8 @@ public class BuildBoot : MonoBehaviour var condition = BuildManager.Instance.GetCondition(nodeName); _buildBar.Open(node, BuildIconClick, BuildLockIconClick, CurCondition, condition); _buildBar.PickItemDisplay(optionName); - OutlinePickItem(_curOption); + if (_curOption != null) + OutlinePickItem(_curOption); EventManager.Instance.Send(EventManager.EventName.OpenUI); } @@ -590,7 +590,7 @@ public class BuildBoot : MonoBehaviour /// private void OutlinePickItem(Option option) { - if (option == null) return; + _pickItem.SetActive(true); _pickItem.transform.position = option.OptionObj.transform.position; _pickSpriteRenderer.sprite = option.NormalObj.GetComponent().sprite; @@ -670,8 +670,12 @@ public class BuildBoot : MonoBehaviour private void UnregisterClickEvent() { - InputManager.Instance.OnBuildItemClick -= OnBuildItemClick; - InputManager.Instance.OnBuildBubbleClick -= OnBuildBubbleClick; + if (InputManager.Instance) + { + InputManager.Instance.OnBuildItemClick -= OnBuildItemClick; + InputManager.Instance.OnBuildBubbleClick -= OnBuildBubbleClick; + } + EventManager.Instance.Unregister(EventManager.EventName.HideBuildUI, HideUI); EventManager.Instance.Unregister(EventManager.EventName.ShowBuildUI, ShowUI); }