finished the grounds for UI and transitions

This commit is contained in:
Nilton Constantino 2026-07-02 07:20:09 +01:00
parent cdc8f624fd
commit 5721986a74
No known key found for this signature in database
32 changed files with 14671 additions and 33907 deletions

View File

@ -178,7 +178,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7de97ae883244ed6b181345e75dfa871, type: 3} m_Script: {fileID: 11500000, guid: 7de97ae883244ed6b181345e75dfa871, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
subscriptionId: ad34ca6cfdde4b00b5ddd46bb5bc02cd subscriptionId: event-listener.pda-device-ui
managedWindow: {fileID: 5189104512823423114}
device: {fileID: 11400000, guid: 5851ff4beee4547de8bb37a91c321af0, type: 2} device: {fileID: 11400000, guid: 5851ff4beee4547de8bb37a91c321af0, type: 2}
operationalSystem: {fileID: 6195836449349636204} operationalSystem: {fileID: 6195836449349636204}
loadingProcess: {fileID: 6090578839837176443} loadingProcess: {fileID: 6090578839837176443}
@ -291,7 +292,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.0000009536743, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -16.000004, y: -60} m_SizeDelta: {x: -16.000004, y: -60}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7630895582552750376 --- !u!1 &7630895582552750376

View File

@ -181,7 +181,20 @@ MonoBehaviour:
windowData: {fileID: 11400000, guid: 1537ea5428e7543199d76b4e6bac3d96, type: 2} windowData: {fileID: 11400000, guid: 1537ea5428e7543199d76b4e6bac3d96, type: 2}
beforePushAction: beforePushAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls:
- m_Target: {fileID: 5033331184899599699}
m_TargetAssemblyTypeName: Intrepid.Gameplay.Entities.Player.ActionBelt.UI.ActionBeltUI,
Gameplay
m_MethodName: BeforeOpen
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
afterPushAction: afterPushAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
@ -203,8 +216,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8b925ea9b2014d7dbf49b1feccc31cb5, type: 3} m_Script: {fileID: 11500000, guid: 8b925ea9b2014d7dbf49b1feccc31cb5, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Entities.Sentinel.ActionBelt.UI.ActionBeltUI m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Entities.Sentinel.ActionBelt.UI.ActionBeltUI
subscriptionId: a1df0a46cbe24e97947feeab90e3e4ed subscriptionId: event-listener.action-belt-ui
actionBeltWindow: {fileID: 8491231505598950554} managedWindow: {fileID: 8491231505598950554}
left: {fileID: 767535166410223100} left: {fileID: 767535166410223100}
right: {fileID: 3069517553568958000} right: {fileID: 3069517553568958000}
center: {fileID: 402030598129591330} center: {fileID: 402030598129591330}

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 8803547296707761723} - component: {fileID: 8803547296707761723}
- component: {fileID: 6824141671802266881} - component: {fileID: 6824141671802266881}
- component: {fileID: 5611358189969385221} - component: {fileID: 5611358189969385221}
- component: {fileID: 8110345811091377059}
m_Layer: 5 m_Layer: 5
m_Name: CadenceUI m_Name: CadenceUI
m_TagString: Untagged m_TagString: Untagged
@ -75,6 +76,20 @@ MonoBehaviour:
afterPopAction: afterPopAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &8110345811091377059
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4918975841418452536}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c7a1e29cc5ba44e68a73e3c9c3074c48, type: 3}
m_Name:
m_EditorClassIdentifier: Gameplay::Intrepid.Gameplay.Entities.Player.Sentinel.Cadence.UI.CadenceUI
subscriptionId: event-listener.cadence-ui
managedWindow: {fileID: 5611358189969385221}
--- !u!1 &7725383792336003602 --- !u!1 &7725383792336003602
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 4900185607944954028} - component: {fileID: 4900185607944954028}
- component: {fileID: 460047827402522156} - component: {fileID: 460047827402522156}
- component: {fileID: 531983622729822985} - component: {fileID: 531983622729822985}
- component: {fileID: 2856903456991075389}
m_Layer: 5 m_Layer: 5
m_Name: GadgetsUI m_Name: GadgetsUI
m_TagString: Untagged m_TagString: Untagged
@ -75,6 +76,20 @@ MonoBehaviour:
afterPopAction: afterPopAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &2856903456991075389
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6663252926434001246}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9cca14f115cd4a088d33a323d24076e3, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Temporary.GadgetsUI
subscriptionId: event-listener.gadgets-ui
managedWindow: {fileID: 531983622729822985}
--- !u!1 &6777305499653059458 --- !u!1 &6777305499653059458
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 56466203216048244} - component: {fileID: 56466203216048244}
- component: {fileID: 7125298882751191058} - component: {fileID: 7125298882751191058}
- component: {fileID: 6633350990235118641} - component: {fileID: 6633350990235118641}
- component: {fileID: 4987402901937390553}
m_Layer: 5 m_Layer: 5
m_Name: LifeShieldMeterUI m_Name: LifeShieldMeterUI
m_TagString: Untagged m_TagString: Untagged
@ -75,6 +76,20 @@ MonoBehaviour:
afterPopAction: afterPopAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &4987402901937390553
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 712538905394568941}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cb0c8e637b1a4d8cb468318e2e55f337, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Temporary.LifeShieldMeterUI
subscriptionId: event-listener.life-shield-meter-ui
managedWindow: {fileID: 6633350990235118641}
--- !u!1 &5822726913951774340 --- !u!1 &5822726913951774340
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -13,6 +13,6 @@ MonoBehaviour:
m_Name: action-belt.window.data m_Name: action-belt.window.data
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData
id: a35f38b0d2af466c9b0557c538c1f733 id: a35f38b0d2af466c9b0557c538c1f733
shouldBeKeptAlwaysEnabled: 1 shouldBeKeptAlwaysEnabled: 0
onEntry: {fileID: 11400000, guid: b12d41919e089475da15bef8808f80b8, type: 2} onEntry: {fileID: 11400000, guid: b12d41919e089475da15bef8808f80b8, type: 2}
onExit: {fileID: 11400000, guid: 86176d631377e4d5fba70988ef37e9d9, type: 2} onExit: {fileID: 11400000, guid: 86176d631377e4d5fba70988ef37e9d9, type: 2}

View File

@ -13,6 +13,6 @@ MonoBehaviour:
m_Name: cadence.window.data m_Name: cadence.window.data
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData
id: 94df6e7abb5445c5b6e2fa0d446dfdb3 id: 94df6e7abb5445c5b6e2fa0d446dfdb3
shouldBeKeptAlwaysEnabled: 1 shouldBeKeptAlwaysEnabled: 0
onEntry: {fileID: 11400000, guid: efe1ca274d51c46a5886b3ac1fb216ac, type: 2} onEntry: {fileID: 11400000, guid: efe1ca274d51c46a5886b3ac1fb216ac, type: 2}
onExit: {fileID: 11400000, guid: 6bdbf19a007654ef49dafdce51db6e97, type: 2} onExit: {fileID: 11400000, guid: 6bdbf19a007654ef49dafdce51db6e97, type: 2}

File diff suppressed because one or more lines are too long

View File

@ -21,6 +21,10 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
public bool IsNotEmpty => !IsEmpty; public bool IsNotEmpty => !IsEmpty;
public ActionBeltManagerTag ActionBeltManagerTag => actionBeltManagerTag; public ActionBeltManagerTag ActionBeltManagerTag => actionBeltManagerTag;
public ActionEnvelope Focus => ActionBelt.Focus; public ActionEnvelope Focus => ActionBelt.Focus;
public ActionEnvelope PeekRight => ActionBelt.PeekRight;
public ActionEnvelope PeekLeft => ActionBelt.PeekLeft;
public int Count => ActionBelt.Count;
protected override void InitializeVariables() protected override void InitializeVariables()
{ {
@ -152,10 +156,11 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{ {
Proxy.Instance.EventBus.Raise(new ActionBeltUIOpenEvent Proxy.Instance.EventBus.Raise(new ActionBeltUIOpenEvent
{ {
GetFocusActionEnvelope = () => ActionBelt.Focus, ActionBelt = ActionBelt,
SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight, // GetFocusActionEnvelope = () => ActionBelt.Focus,
SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft, // SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight,
GetSize = () => ActionBelt.Count, // SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft,
// GetSize = () => ActionBelt.Count,
}); });
} }

View File

@ -7,6 +7,11 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{ {
public new bool Push(ActionEnvelope envelope) public new bool Push(ActionEnvelope envelope)
{ {
if (envelope is { ActionIdentifier: null })
{
return false;
}
var envelopesToRemove = Elements var envelopesToRemove = Elements
.Where(action => action.ActionIdentifier.Id.Equals(envelope.ActionIdentifier.Id)) .Where(action => action.ActionIdentifier.Id.Equals(envelope.ActionIdentifier.Id))
.ToList(); .ToList();

View File

@ -5,9 +5,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events
{ {
public class ActionBeltUIOpenEvent : IEventBase public class ActionBeltUIOpenEvent : IEventBase
{ {
public Func<ActionEnvelope> GetFocusActionEnvelope { get; set; } public ActionStackBelt ActionBelt { get; set; }
public Func<ActionEnvelope> SneakPeekLeftActionEnvelope { get; set; }
public Func<ActionEnvelope> SneakPeekRightActionEnvelope { get; set; }
public Func<int> GetSize { get; set; }
} }
} }

View File

@ -1,10 +1,11 @@
using System; using System;
using System.Collections;
using Intrepid.Core.UI; using Intrepid.Core.UI;
using Intrepid.Core.UI.Dialog; using Intrepid.Core.UI.Dialog;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.UI;
using Intrepid.Gameplay.Themes; using Intrepid.Gameplay.Themes;
using Intrepid.SimpleEvents;
using Intrepid.Utilities; using Intrepid.Utilities;
using Intrepid.Utilities.Sprite; using Intrepid.Utilities.Sprite;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
@ -13,9 +14,9 @@ using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
{ {
public class ActionBeltUI : EventListener public class ActionBeltUI : ManagedWindowUI
{ {
[GroupInjections, SerializeField] private Window.Window actionBeltWindow; [GroupInjections, SerializeField] private ActionBeltManager actionBeltManager;
[GroupInjections, SerializeField, PropertySpace] private DialogMinimalUI left; [GroupInjections, SerializeField, PropertySpace] private DialogMinimalUI left;
[GroupInjections, SerializeField] private DialogMinimalUI right; [GroupInjections, SerializeField] private DialogMinimalUI right;
[GroupInjections, SerializeField] private DialogMinimalUI center; [GroupInjections, SerializeField] private DialogMinimalUI center;
@ -26,14 +27,19 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
[GroupInjections, SerializeField, PropertySpace] private TextMeshProUGUI actionTextMeshPro; [GroupInjections, SerializeField, PropertySpace] private TextMeshProUGUI actionTextMeshPro;
[GroupInjections, SerializeField] private NewsTickerUI localNewsTicker; [GroupInjections, SerializeField] private NewsTickerUI localNewsTicker;
private UIActionBeltTheme CurrentTheme { get; set; }
private Func<ActionEnvelope> GetFocus { get; set; } private Func<ActionEnvelope> GetFocus { get; set; }
public Func<ActionEnvelope> SneakPeekRight { get; set; } private Func<ActionEnvelope> SneakPeekRight { get; set; }
public Func<ActionEnvelope> SneakPeekLeft { get; set; } private Func<ActionEnvelope> SneakPeekLeft { get; set; }
private Func<int> GetNumberOfActionsInBelt { get; set; } = () => 0; private Func<int> GetNumberOfActionsInBelt { get; set; } = () => 0;
private bool IsOptionActive { get; set; } private bool IsOptionActive => GetNumberOfActionsInBelt() > 1;
protected override void InitializeVariables() protected override void InitializeVariables()
{ {
GetFocus = () => actionBeltManager.Focus;
SneakPeekRight = () => actionBeltManager.PeekRight;
SneakPeekLeft = () => actionBeltManager.PeekLeft;
GetNumberOfActionsInBelt = () => actionBeltManager.Count;
} }
protected override void OnBootstrap() protected override void OnBootstrap()
@ -44,6 +50,8 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void UpdateTheme() private void UpdateTheme()
{ {
var theme = ThemeManager.Instance.CurrentTheme.ActionBeltTheme; var theme = ThemeManager.Instance.CurrentTheme.ActionBeltTheme;
if (CurrentTheme == theme) return;
CurrentTheme = theme;
left.Theme = theme.Option; left.Theme = theme.Option;
right.Theme = theme.Option; right.Theme = theme.Option;
center.Theme = theme.Main; center.Theme = theme.Main;
@ -54,9 +62,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
protected override void Subscriptions() protected override void Subscriptions()
{ {
Subscribe<ActionBeltUIOpenEvent>(WhenActionBeltUIOpen);
Subscribe<ActionBeltUICloseEvent>(WhenActionBeltUIClose);
Subscribe<ActionBeltUIToRightEvent>(WhenActionBeltNextRight); Subscribe<ActionBeltUIToRightEvent>(WhenActionBeltNextRight);
Subscribe<ActionBeltUIToLeftEvent>(WhenActionBeltNextLeft); Subscribe<ActionBeltUIToLeftEvent>(WhenActionBeltNextLeft);
@ -69,22 +74,17 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
center.BlinkBorderDropped(); center.BlinkBorderDropped();
if (local.gameObject.activeSelf) local.BlinkBorderDropped(); if (local.gameObject.activeSelf) local.BlinkBorderDropped();
} }
private void WhenActionBeltUIOpen(ActionBeltUIOpenEvent e) private IEnumerator UpdateContentNextFrame()
{ {
if (GetFocus is not null) return; yield return null;
GetFocus = e.GetFocusActionEnvelope; UpdateTheme();
SneakPeekRight = e.SneakPeekRightActionEnvelope;
SneakPeekLeft = e.SneakPeekLeftActionEnvelope;
GetNumberOfActionsInBelt = e.GetSize;
IsOptionActive = GetNumberOfActionsInBelt() > 1;
actionBeltWindow.Open();
UpdateContent(); UpdateContent();
} }
private void WhenActionBeltUIClose(ActionBeltUICloseEvent e) public void BeforeOpen()
{ {
Close(); StartCoroutine(UpdateContentNextFrame());
} }
private void WhenActionBeltNextRight(ActionBeltUIToRightEvent e) private void WhenActionBeltNextRight(ActionBeltUIToRightEvent e)
@ -92,7 +92,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
if (!IsOptionActive) return; if (!IsOptionActive) return;
SwitchRight(); SwitchRight();
contentIconAnimation.SpriteAnimation.Reset(); contentIconAnimation.SpriteAnimation.Reset();
UpdateContent(); StartCoroutine(UpdateContentNextFrame());
} }
private void WhenActionBeltNextLeft(ActionBeltUIToLeftEvent e) private void WhenActionBeltNextLeft(ActionBeltUIToLeftEvent e)
@ -100,7 +100,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
if (!IsOptionActive) return; if (!IsOptionActive) return;
SwitchLeft(); SwitchLeft();
contentIconAnimation.SpriteAnimation.Reset(); contentIconAnimation.SpriteAnimation.Reset();
UpdateContent(); StartCoroutine(UpdateContentNextFrame());
} }
private void WhenActionBeltUITakeAction(ActionBeltUITakeActionEvent e) private void WhenActionBeltUITakeAction(ActionBeltUITakeActionEvent e)
@ -108,17 +108,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
center.BlinkBorderActionTaken(); center.BlinkBorderActionTaken();
if (local.gameObject.activeSelf) local.BlinkBorderActionTaken(); if (local.gameObject.activeSelf) local.BlinkBorderActionTaken();
} }
private void Close()
{
if (GetFocus is null) return;
IsOptionActive = false;
GetFocus = null;
SneakPeekRight = null;
SneakPeekLeft = null;
GetNumberOfActionsInBelt = () => 0;
actionBeltWindow.Close();
}
private void UpdateContent() private void UpdateContent()
{ {
@ -143,18 +132,15 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
switch (GetNumberOfActionsInBelt()) switch (GetNumberOfActionsInBelt())
{ {
case 0: case 0:
Close(); Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent());
IsOptionActive = false;
return; return;
case 1: case 1:
left.gameObject.SetActive(false); left.gameObject.SetActive(false);
right.gameObject.SetActive(false); right.gameObject.SetActive(false);
IsOptionActive = false;
break; break;
case > 1: case > 1:
left.gameObject.SetActive(true); left.gameObject.SetActive(true);
right.gameObject.SetActive(true); right.gameObject.SetActive(true);
IsOptionActive = true;
rightIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekRight().ActionCategory)); rightIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekRight().ActionCategory));
leftIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekLeft().ActionCategory)); leftIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekLeft().ActionCategory));
break; break;

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8ee9661bddd34cb8a25c3d39a29da878
timeCreated: 1782972804

View File

@ -0,0 +1,8 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Entities.Player.Events
{
public class PlayerCommandGrantedEvent : IEventBase
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1c1c223e3ccc4eb3883530a36c95fc00
timeCreated: 1782972809

View File

@ -0,0 +1,8 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Entities.Player.Events
{
public class PlayerCommandRevokedEvent : IEventBase
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b930b51213934eeca5d6935880268a50
timeCreated: 1782972825

View File

@ -1,13 +1,13 @@
using System; using System;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.PDA.Events; using Intrepid.Gameplay.Entities.Player.PDA.Events;
using Intrepid.SimpleEvents; using Intrepid.Gameplay.Entities.Player.UI;
using Intrepid.Utilities; using Intrepid.Utilities;
using UnityEngine; using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.PDA.UI namespace Intrepid.Gameplay.Entities.Player.PDA.UI
{ {
public class PDADeviceUI : EventListener, IPDASystemBootEvents, IPDASystemShutdownEvents public class PDADeviceUI : ManagedWindowUI, IPDASystemBootEvents, IPDASystemShutdownEvents
{ {
[GroupInjections, SerializeField] private PDADevice device; [GroupInjections, SerializeField] private PDADevice device;
[GroupInjections, SerializeField] private PDAOperationalSystemUI operationalSystem; [GroupInjections, SerializeField] private PDAOperationalSystemUI operationalSystem;

View File

@ -0,0 +1,19 @@
using Intrepid.Gameplay.Entities.Player.UI;
namespace Intrepid.Gameplay.Entities.Player.Sentinel.Cadence.UI
{
public class CadenceUI : ManagedWindowUI
{
protected override void InitializeVariables()
{
}
protected override void OnBootstrap()
{
}
protected override void Subscriptions()
{
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c7a1e29cc5ba44e68a73e3c9c3074c48
timeCreated: 1782924857

View File

@ -1,5 +1,4 @@
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.Core.TimeControl;
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 021af47d156c4e948a48b28a1d0c4d79
timeCreated: 1782966859

View File

@ -0,0 +1,17 @@
namespace Intrepid.Gameplay.Entities.Player.UI
{
public class GadgetsUI : ManagedWindowUI
{
protected override void InitializeVariables()
{
}
protected override void OnBootstrap()
{
}
protected override void Subscriptions()
{
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9cca14f115cd4a088d33a323d24076e3
timeCreated: 1782925751

View File

@ -0,0 +1,17 @@
namespace Intrepid.Gameplay.Entities.Player.UI
{
public class LifeShieldMeterUI : ManagedWindowUI
{
protected override void InitializeVariables()
{
}
protected override void OnBootstrap()
{
}
protected override void Subscriptions()
{
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cb0c8e637b1a4d8cb468318e2e55f337
timeCreated: 1782925673

View File

@ -0,0 +1,15 @@
using Intrepid.SimpleEvents;
using Intrepid.Utilities;
using Intrepid.Window.Data;
using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.UI
{
public abstract class ManagedWindowUI : EventListener
{
[GroupInjections, SerializeField] private Window.Window managedWindow;
public Window.Window ManagedWindow => managedWindow;
public WindowData WindowData => managedWindow.WindowData;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 957d832adf514e89acbbd9647cf39f29
timeCreated: 1782968207

View File

@ -0,0 +1,149 @@
using System.Collections.Generic;
using System.Linq;
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.ActionBelt.UI;
using Intrepid.Gameplay.Entities.Player.Events;
using Intrepid.Gameplay.Entities.Player.PDA.UI;
using Intrepid.Gameplay.Entities.Player.Sentinel.Cadence.UI;
using Intrepid.SimpleEvents;
using Intrepid.Utilities;
using Intrepid.Window;
using Intrepid.Window.Data;
using Intrepid.Window.Events;
using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.UI
{
public class PlayerWindowManager : EventListener
{
[GroupConfigurations, SerializeField] private CadenceUI cadenceUI;
[GroupConfigurations, SerializeField] private LifeShieldMeterUI lifeShieldUI;
[GroupConfigurations, SerializeField] private GadgetsUI gadgetsUI;
[GroupConfigurations, SerializeField] private ActionBeltUI actionBeltUI;
[GroupConfigurations, SerializeField] private PDADeviceUI pdaDeviceUI;
private Dictionary<WindowData, Window.Window> WindowsMap { get; } = new();
private Stack<List<Window.Window>> StackWindows { get; } = new();
private void Add(ManagedWindowUI mwUI) => WindowsMap.Add(mwUI.WindowData, mwUI.ManagedWindow);
protected override void InitializeVariables()
{
StackWindows.Clear();
WindowsMap.Clear();
Add(cadenceUI);
Add(lifeShieldUI);
Add(gadgetsUI);
Add(actionBeltUI);
Add(pdaDeviceUI);
DisableAllWindows();
}
protected override void OnBootstrap()
{
}
protected override void Subscriptions()
{
Subscribe<WindowOpenEvent>(WhenWindowOpen);
Subscribe<WindowCloseEvent>(WhenWindowClose);
Subscribe<ActionBeltUIOpenEvent>(WhenActionBeltUIOpen);
Subscribe<ActionBeltUICloseEvent>(WhenActionBeltUIClose);
Subscribe<PlayerCommandGrantedEvent>(_ =>
{
WindowsMap[cadenceUI.WindowData].Open();
WindowsMap[lifeShieldUI.WindowData].Open();
WindowsMap[gadgetsUI.WindowData].Open();
});
Subscribe<PlayerCommandRevokedEvent>(_ =>
{
WindowsMap[cadenceUI.WindowData].Close();
WindowsMap[lifeShieldUI.WindowData].Close();
WindowsMap[gadgetsUI.WindowData].Close();
});
}
private void WhenWindowOpen(WindowOpenEvent e)
{
if (e.ShouldStack)
{
var openedWindows = WindowsMap
.Values
.Where(w => w.ConditionType == WindowConditionType.Opened)
.ToList();
StackWindows.Push(openedWindows);
openedWindows.ForEach(window =>
{
window.Close();
});
}
foreach (var windowData in e.WindowDataList)
{
if (WindowsMap.TryGetValue(windowData, out var window))
{
window.Open();
}
}
}
private void WhenWindowClose(WindowCloseEvent e)
{
foreach (var windowData in e.WindowDataList)
{
if (WindowsMap.TryGetValue(windowData, out var window))
{
window.Close();
}
}
UnStackWindows();
return;
void UnStackWindows()
{
if (StackWindows.Count <= 0) return;
var stackedWindows = StackWindows.Pop();
foreach (var window in stackedWindows)
{
window.Open();
}
}
}
private void WhenActionBeltUIOpen(ActionBeltUIOpenEvent e)
{
Proxy.Instance.EventBus.Raise(new WindowOpenEvent
{
ShouldStack = true,
WindowDataList = new[] { actionBeltUI.WindowData },
});
}
private void WhenActionBeltUIClose(ActionBeltUICloseEvent e)
{
Proxy.Instance.EventBus.Raise(new WindowCloseEvent
{
WindowDataList = new[] { actionBeltUI.WindowData },
});
}
private void DisableAllWindows()
{
foreach (var window in WindowsMap.Values)
{
if (window.WindowData.ShouldBeKeptAlwaysEnabled)
{
window.Close();
}
else
{
window.gameObject.SetActive(false);
}
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e2dbddcd3c2848658bdbf062c764025b
timeCreated: 1782966873

View File

@ -1,6 +1,7 @@
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.Events;
using Intrepid.Gameplay.Entities.Player.Tags; using Intrepid.Gameplay.Entities.Player.Tags;
using Intrepid.Gameplay.Journey.Runtime.Messages; using Intrepid.Gameplay.Journey.Runtime.Messages;
using Intrepid.Integration.Input; using Intrepid.Integration.Input;
@ -28,12 +29,14 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
var previousInputSchema = InputService.Instance.CurrentInputSchema; var previousInputSchema = InputService.Instance.CurrentInputSchema;
InputService.Instance.ChangeInputSchema(InputSchema.None); InputService.Instance.ChangeInputSchema(InputSchema.None);
Proxy.Instance.EventBus.Raise(new ActionBeltDisableEvent Proxy.Instance.EventBus.Raise(new ActionBeltDisableEvent
{ {
ActionBeltManger = actionBeltManagerTag, ActionBeltManger = actionBeltManagerTag,
}); });
Proxy.Instance.EventBus.Raise(new PlayerCommandRevokedEvent());
State = JourneyGameplayGateState.Locked; State = JourneyGameplayGateState.Locked;
DLogger.LogDebug($"locked gameplay. Previous input schema: {previousInputSchema}. Request: {request}", ctx: this); DLogger.LogDebug($"locked gameplay. Previous input schema: {previousInputSchema}. Request: {request}", ctx: this);
@ -67,6 +70,8 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
{ {
ActionBeltManger = actionBeltManagerTag, ActionBeltManger = actionBeltManagerTag,
}); });
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
State = JourneyGameplayGateState.Open; State = JourneyGameplayGateState.Open;
@ -81,6 +86,8 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
{ {
ActionBeltManger = actionBeltManagerTag, ActionBeltManger = actionBeltManagerTag,
}); });
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
State = JourneyGameplayGateState.Open; State = JourneyGameplayGateState.Open;

View File

@ -5,7 +5,7 @@
"depth": 0, "depth": 0,
"source": "git", "source": "git",
"dependencies": {}, "dependencies": {},
"hash": "aff4fd3d1d9ba1bdc6a924b309e7af883e8cf191" "hash": "8b705cd47233eb0aaa29b302894b4cf1e256b919"
}, },
"com.unity.2d.animation": { "com.unity.2d.animation": {
"version": "13.0.5", "version": "13.0.5",