From 84199621602b11fdacb82e97c9d16ab5ff550b32 Mon Sep 17 00:00:00 2001 From: Nilton Constantino Date: Thu, 2 Jul 2026 09:01:02 +0100 Subject: [PATCH] adjustments on action belt window when saving game --- .../Interactable_SaveStation_Prototype.prefab | 2 +- .../Tags/Windows/action-belt.window.data.asset | 2 ++ .../Tags/Windows/action-belt.window.hide.asset | 18 ++++++++++++++++++ .../Windows/action-belt.window.hide.asset.meta | 8 ++++++++ .../Tags/Windows/action-belt.window.show.asset | 18 ++++++++++++++++++ .../Windows/action-belt.window.show.asset.meta | 8 ++++++++ .../Player/ActionBelt/ActionBeltManager.cs | 12 +++++++----- .../ActionBelt/Events/ActionBeltHideEvent.cs | 8 ++++++++ .../Events/ActionBeltHideEvent.cs.meta | 3 +++ .../ActionBelt/Events/ActionBeltShowEvent.cs | 8 ++++++++ .../Events/ActionBeltShowEvent.cs.meta | 3 +++ .../Player/ActionBelt/UI/ActionBeltUI.cs | 16 ++++++++++++++++ .../States/SentinelStateSavingStation.cs | 7 +++++-- .../SaveStations/SaveStageActionCallable.cs | 2 ++ Packages/packages-lock.json | 2 +- 15 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 Assets/Resources/Tags/Windows/action-belt.window.hide.asset create mode 100644 Assets/Resources/Tags/Windows/action-belt.window.hide.asset.meta create mode 100644 Assets/Resources/Tags/Windows/action-belt.window.show.asset create mode 100644 Assets/Resources/Tags/Windows/action-belt.window.show.asset.meta create mode 100644 Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs create mode 100644 Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs.meta create mode 100644 Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs create mode 100644 Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs.meta diff --git a/Assets/Prefabs/Prototypes/Interactable_SaveStation_Prototype.prefab b/Assets/Prefabs/Prototypes/Interactable_SaveStation_Prototype.prefab index 09848b8..3a6f29c 100644 --- a/Assets/Prefabs/Prototypes/Interactable_SaveStation_Prototype.prefab +++ b/Assets/Prefabs/Prototypes/Interactable_SaveStation_Prototype.prefab @@ -251,7 +251,7 @@ MonoBehaviour: id: a2bcfde700d74b6397798ea30791316a actionCategory: 0 canBeDropped: 0 - shouldDropFromBeltWhenActivated: 1 + shouldDropFromBeltWhenActivated: 0 saveStationModelPrototype: {fileID: 3729166946730868368} actionLocalization: {fileID: 11400000, guid: 218e1b6f0cf274c8195e312760cf82b0, type: 2} descriptionLocalization: {fileID: 11400000, guid: 677dd73e7449b408590ce7f89865a8d0, type: 2} diff --git a/Assets/Resources/Tags/Windows/action-belt.window.data.asset b/Assets/Resources/Tags/Windows/action-belt.window.data.asset index ac0d7fd..2f78445 100644 --- a/Assets/Resources/Tags/Windows/action-belt.window.data.asset +++ b/Assets/Resources/Tags/Windows/action-belt.window.data.asset @@ -16,3 +16,5 @@ MonoBehaviour: shouldBeKeptAlwaysEnabled: 0 onEntry: {fileID: 11400000, guid: b12d41919e089475da15bef8808f80b8, type: 2} onExit: {fileID: 11400000, guid: 86176d631377e4d5fba70988ef37e9d9, type: 2} + onShow: {fileID: 11400000, guid: 5fa9aef3ab3364c00927f003e33f4321, type: 2} + onHide: {fileID: 11400000, guid: 99848f21b8e934dc1a0f1f50b435799d, type: 2} diff --git a/Assets/Resources/Tags/Windows/action-belt.window.hide.asset b/Assets/Resources/Tags/Windows/action-belt.window.hide.asset new file mode 100644 index 0000000..8ea91af --- /dev/null +++ b/Assets/Resources/Tags/Windows/action-belt.window.hide.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3} + m_Name: action-belt.window.hide + m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData + mode: 3 + direction: 1 + soundEffect: {fileID: 0} + animationSpeed: 3 diff --git a/Assets/Resources/Tags/Windows/action-belt.window.hide.asset.meta b/Assets/Resources/Tags/Windows/action-belt.window.hide.asset.meta new file mode 100644 index 0000000..474f7f2 --- /dev/null +++ b/Assets/Resources/Tags/Windows/action-belt.window.hide.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99848f21b8e934dc1a0f1f50b435799d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Tags/Windows/action-belt.window.show.asset b/Assets/Resources/Tags/Windows/action-belt.window.show.asset new file mode 100644 index 0000000..890f10d --- /dev/null +++ b/Assets/Resources/Tags/Windows/action-belt.window.show.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3} + m_Name: action-belt.window.show + m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData + mode: 3 + direction: 0 + soundEffect: {fileID: 0} + animationSpeed: 3 diff --git a/Assets/Resources/Tags/Windows/action-belt.window.show.asset.meta b/Assets/Resources/Tags/Windows/action-belt.window.show.asset.meta new file mode 100644 index 0000000..c9eab45 --- /dev/null +++ b/Assets/Resources/Tags/Windows/action-belt.window.show.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fa9aef3ab3364c00927f003e33f4321 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/ActionBeltManager.cs b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/ActionBeltManager.cs index 6ecbfea..0065fc3 100644 --- a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/ActionBeltManager.cs +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/ActionBeltManager.cs @@ -59,7 +59,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt private void WhenActionBeltEnable(ActionBeltEnableEvent e) { IsOperational = true; - if (IsEmpty) return; OpenUI(); } @@ -109,6 +108,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt private void WhenActionBeltTakeAction(ActionBeltTakeActionEvent e) { TakeAction(); + if (!IsOperational) return; Proxy.Instance.EventBus.Raise(new ActionBeltUITakeActionEvent()); } @@ -134,18 +134,20 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt private void OpenUI() { + if (!IsOperational) return; + if (IsEmpty) return; + Proxy.Instance.EventBus.Raise(new ActionBeltUIOpenEvent { ActionBelt = ActionBelt, - // GetFocusActionEnvelope = () => ActionBelt.Focus, - // SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight, - // SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft, - // GetSize = () => ActionBelt.Count, }); } private void CirculateUI() { + if (!IsOperational) return; + if (IsEmpty) return; + if (nextRight) { Proxy.Instance.EventBus.Raise(new ActionBeltUIToRightEvent()); diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs new file mode 100644 index 0000000..65ecf4f --- /dev/null +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs @@ -0,0 +1,8 @@ +using Intrepid.SimpleEvents; + +namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events +{ + public class ActionBeltHideEvent : IEventBase + { + } +} \ No newline at end of file diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs.meta b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs.meta new file mode 100644 index 0000000..bec7c39 --- /dev/null +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltHideEvent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d82e173549834f8ebb63570df81ef64f +timeCreated: 1782975954 \ No newline at end of file diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs new file mode 100644 index 0000000..3520bef --- /dev/null +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs @@ -0,0 +1,8 @@ +using Intrepid.SimpleEvents; + +namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events +{ + public class ActionBeltShowEvent : IEventBase + { + } +} \ No newline at end of file diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs.meta b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs.meta new file mode 100644 index 0000000..14ac2c6 --- /dev/null +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/Events/ActionBeltShowEvent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d84bdcd9e99048e08e3d3ad428b60fd0 +timeCreated: 1782975971 \ No newline at end of file diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/UI/ActionBeltUI.cs b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/UI/ActionBeltUI.cs index f62a10e..680ada4 100644 --- a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/UI/ActionBeltUI.cs +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/ActionBelt/UI/ActionBeltUI.cs @@ -62,6 +62,9 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI protected override void Subscriptions() { + Subscribe(_ => ManagedWindow.Show()); + Subscribe(_ => ManagedWindow.Hide()); + Subscribe(WhenActionBeltNextRight); Subscribe(WhenActionBeltNextLeft); @@ -71,6 +74,8 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI private void WhenActionBeltUIDrop(ActionBeltUIDropEvent e) { + if (!actionBeltManager.IsOperational) return; + center.BlinkBorderDropped(); if (local.gameObject.activeSelf) local.BlinkBorderDropped(); } @@ -89,6 +94,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI private void WhenActionBeltNextRight(ActionBeltUIToRightEvent e) { + if (!actionBeltManager.IsOperational) return; if (!IsOptionActive) return; SwitchRight(); contentIconAnimation.SpriteAnimation.Reset(); @@ -97,6 +103,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI private void WhenActionBeltNextLeft(ActionBeltUIToLeftEvent e) { + if (!actionBeltManager.IsOperational) return; if (!IsOptionActive) return; SwitchLeft(); contentIconAnimation.SpriteAnimation.Reset(); @@ -105,6 +112,8 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI private void WhenActionBeltUITakeAction(ActionBeltUITakeActionEvent e) { + if (!actionBeltManager.IsOperational) return; + center.BlinkBorderActionTaken(); if (local.gameObject.activeSelf) local.BlinkBorderActionTaken(); } @@ -129,6 +138,13 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI private void Update() { UpdateTheme(); + + if (!actionBeltManager.IsOperational) + { + Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent()); + return; + } + switch (GetNumberOfActionsInBelt()) { case 0: diff --git a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/Sentinel/StateMachine/States/SentinelStateSavingStation.cs b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/Sentinel/StateMachine/States/SentinelStateSavingStation.cs index 20e976b..b1a8f72 100644 --- a/Assets/Scripts/Intrepid/Gameplay/Entities/Player/Sentinel/StateMachine/States/SentinelStateSavingStation.cs +++ b/Assets/Scripts/Intrepid/Gameplay/Entities/Player/Sentinel/StateMachine/States/SentinelStateSavingStation.cs @@ -1,5 +1,7 @@ using Intrepid.Core; using Intrepid.Diagnostics; +using Intrepid.GameManagers; +using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Integration.Input; using Intrepid.Integration.Persistence.Events; using Intrepid.Structures; @@ -22,11 +24,11 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States protected override void Subscriptions() { - Subscribe(e => + Subscribe(_ => { DLogger.LogDebug("Saving started"); }); - Subscribe(e => + Subscribe(_ => { DLogger.LogDebug("Saving ended"); Timer.Start(); @@ -53,6 +55,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States protected override void RunOnExit() { Timer.Stop(); + Proxy.Instance.EventBus.Raise(new ActionBeltShowEvent()); } public override void RunOnUpdate() diff --git a/Assets/Scripts/Intrepid/Gameplay/Prototyping/SaveStations/SaveStageActionCallable.cs b/Assets/Scripts/Intrepid/Gameplay/Prototyping/SaveStations/SaveStageActionCallable.cs index 51ffe6e..3ebfe91 100644 --- a/Assets/Scripts/Intrepid/Gameplay/Prototyping/SaveStations/SaveStageActionCallable.cs +++ b/Assets/Scripts/Intrepid/Gameplay/Prototyping/SaveStations/SaveStageActionCallable.cs @@ -1,5 +1,6 @@ using Intrepid.GameManagers; using Intrepid.Gameplay.Entities.Player.ActionBelt; +using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Gameplay.Entities.Player.Sentinel.Events; using Intrepid.Localization; using Intrepid.Utilities; @@ -23,6 +24,7 @@ namespace Intrepid.Gameplay.Prototyping.SaveStations StageTag = saveStationModelPrototype.StageTag, DeploymentPoint = saveStationModelPrototype.DeploymentPoint }); + Proxy.Instance.EventBus.Raise(new ActionBeltHideEvent()); } } } \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 0d62d91..d3c3677 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -5,7 +5,7 @@ "depth": 0, "source": "git", "dependencies": {}, - "hash": "8b705cd47233eb0aaa29b302894b4cf1e256b919" + "hash": "6f1ee5036dced65524bd7cc8af9f244d52f15491" }, "com.unity.2d.animation": { "version": "13.0.5",