finished the grounds for UI and transitions
This commit is contained in:
parent
cdc8f624fd
commit
5721986a74
@ -178,7 +178,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7de97ae883244ed6b181345e75dfa871, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
subscriptionId: ad34ca6cfdde4b00b5ddd46bb5bc02cd
|
||||
subscriptionId: event-listener.pda-device-ui
|
||||
managedWindow: {fileID: 5189104512823423114}
|
||||
device: {fileID: 11400000, guid: 5851ff4beee4547de8bb37a91c321af0, type: 2}
|
||||
operationalSystem: {fileID: 6195836449349636204}
|
||||
loadingProcess: {fileID: 6090578839837176443}
|
||||
@ -291,7 +292,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
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_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &7630895582552750376
|
||||
|
||||
@ -181,7 +181,20 @@ MonoBehaviour:
|
||||
windowData: {fileID: 11400000, guid: 1537ea5428e7543199d76b4e6bac3d96, type: 2}
|
||||
beforePushAction:
|
||||
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:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
@ -203,8 +216,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 8b925ea9b2014d7dbf49b1feccc31cb5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Entities.Sentinel.ActionBelt.UI.ActionBeltUI
|
||||
subscriptionId: a1df0a46cbe24e97947feeab90e3e4ed
|
||||
actionBeltWindow: {fileID: 8491231505598950554}
|
||||
subscriptionId: event-listener.action-belt-ui
|
||||
managedWindow: {fileID: 8491231505598950554}
|
||||
left: {fileID: 767535166410223100}
|
||||
right: {fileID: 3069517553568958000}
|
||||
center: {fileID: 402030598129591330}
|
||||
|
||||
@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 8803547296707761723}
|
||||
- component: {fileID: 6824141671802266881}
|
||||
- component: {fileID: 5611358189969385221}
|
||||
- component: {fileID: 8110345811091377059}
|
||||
m_Layer: 5
|
||||
m_Name: CadenceUI
|
||||
m_TagString: Untagged
|
||||
@ -75,6 +76,20 @@ MonoBehaviour:
|
||||
afterPopAction:
|
||||
m_PersistentCalls:
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 4900185607944954028}
|
||||
- component: {fileID: 460047827402522156}
|
||||
- component: {fileID: 531983622729822985}
|
||||
- component: {fileID: 2856903456991075389}
|
||||
m_Layer: 5
|
||||
m_Name: GadgetsUI
|
||||
m_TagString: Untagged
|
||||
@ -75,6 +76,20 @@ MonoBehaviour:
|
||||
afterPopAction:
|
||||
m_PersistentCalls:
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 56466203216048244}
|
||||
- component: {fileID: 7125298882751191058}
|
||||
- component: {fileID: 6633350990235118641}
|
||||
- component: {fileID: 4987402901937390553}
|
||||
m_Layer: 5
|
||||
m_Name: LifeShieldMeterUI
|
||||
m_TagString: Untagged
|
||||
@ -75,6 +76,20 @@ MonoBehaviour:
|
||||
afterPopAction:
|
||||
m_PersistentCalls:
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -13,6 +13,6 @@ MonoBehaviour:
|
||||
m_Name: action-belt.window.data
|
||||
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData
|
||||
id: a35f38b0d2af466c9b0557c538c1f733
|
||||
shouldBeKeptAlwaysEnabled: 1
|
||||
shouldBeKeptAlwaysEnabled: 0
|
||||
onEntry: {fileID: 11400000, guid: b12d41919e089475da15bef8808f80b8, type: 2}
|
||||
onExit: {fileID: 11400000, guid: 86176d631377e4d5fba70988ef37e9d9, type: 2}
|
||||
|
||||
@ -13,6 +13,6 @@ MonoBehaviour:
|
||||
m_Name: cadence.window.data
|
||||
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData
|
||||
id: 94df6e7abb5445c5b6e2fa0d446dfdb3
|
||||
shouldBeKeptAlwaysEnabled: 1
|
||||
shouldBeKeptAlwaysEnabled: 0
|
||||
onEntry: {fileID: 11400000, guid: efe1ca274d51c46a5886b3ac1fb216ac, type: 2}
|
||||
onExit: {fileID: 11400000, guid: 6bdbf19a007654ef49dafdce51db6e97, type: 2}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -21,6 +21,10 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
|
||||
public bool IsNotEmpty => !IsEmpty;
|
||||
public ActionBeltManagerTag ActionBeltManagerTag => actionBeltManagerTag;
|
||||
public ActionEnvelope Focus => ActionBelt.Focus;
|
||||
public ActionEnvelope PeekRight => ActionBelt.PeekRight;
|
||||
public ActionEnvelope PeekLeft => ActionBelt.PeekLeft;
|
||||
public int Count => ActionBelt.Count;
|
||||
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
@ -152,10 +156,11 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
|
||||
{
|
||||
Proxy.Instance.EventBus.Raise(new ActionBeltUIOpenEvent
|
||||
{
|
||||
GetFocusActionEnvelope = () => ActionBelt.Focus,
|
||||
SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight,
|
||||
SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft,
|
||||
GetSize = () => ActionBelt.Count,
|
||||
ActionBelt = ActionBelt,
|
||||
// GetFocusActionEnvelope = () => ActionBelt.Focus,
|
||||
// SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight,
|
||||
// SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft,
|
||||
// GetSize = () => ActionBelt.Count,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,11 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
|
||||
{
|
||||
public new bool Push(ActionEnvelope envelope)
|
||||
{
|
||||
if (envelope is { ActionIdentifier: null })
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var envelopesToRemove = Elements
|
||||
.Where(action => action.ActionIdentifier.Id.Equals(envelope.ActionIdentifier.Id))
|
||||
.ToList();
|
||||
|
||||
@ -5,9 +5,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events
|
||||
{
|
||||
public class ActionBeltUIOpenEvent : IEventBase
|
||||
{
|
||||
public Func<ActionEnvelope> GetFocusActionEnvelope { get; set; }
|
||||
public Func<ActionEnvelope> SneakPeekLeftActionEnvelope { get; set; }
|
||||
public Func<ActionEnvelope> SneakPeekRightActionEnvelope { get; set; }
|
||||
public Func<int> GetSize { get; set; }
|
||||
public ActionStackBelt ActionBelt { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Intrepid.Core.UI;
|
||||
using Intrepid.Core.UI.Dialog;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
|
||||
using Intrepid.Gameplay.Entities.Player.UI;
|
||||
using Intrepid.Gameplay.Themes;
|
||||
using Intrepid.SimpleEvents;
|
||||
using Intrepid.Utilities;
|
||||
using Intrepid.Utilities.Sprite;
|
||||
using Sirenix.OdinInspector;
|
||||
@ -13,9 +14,9 @@ using UnityEngine;
|
||||
|
||||
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] private DialogMinimalUI right;
|
||||
[GroupInjections, SerializeField] private DialogMinimalUI center;
|
||||
@ -26,14 +27,19 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
[GroupInjections, SerializeField, PropertySpace] private TextMeshProUGUI actionTextMeshPro;
|
||||
[GroupInjections, SerializeField] private NewsTickerUI localNewsTicker;
|
||||
|
||||
private UIActionBeltTheme CurrentTheme { get; set; }
|
||||
private Func<ActionEnvelope> GetFocus { get; set; }
|
||||
public Func<ActionEnvelope> SneakPeekRight { get; set; }
|
||||
public Func<ActionEnvelope> SneakPeekLeft { get; set; }
|
||||
private Func<ActionEnvelope> SneakPeekRight { get; set; }
|
||||
private Func<ActionEnvelope> SneakPeekLeft { get; set; }
|
||||
private Func<int> GetNumberOfActionsInBelt { get; set; } = () => 0;
|
||||
private bool IsOptionActive { get; set; }
|
||||
private bool IsOptionActive => GetNumberOfActionsInBelt() > 1;
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
GetFocus = () => actionBeltManager.Focus;
|
||||
SneakPeekRight = () => actionBeltManager.PeekRight;
|
||||
SneakPeekLeft = () => actionBeltManager.PeekLeft;
|
||||
GetNumberOfActionsInBelt = () => actionBeltManager.Count;
|
||||
}
|
||||
|
||||
protected override void OnBootstrap()
|
||||
@ -44,6 +50,8 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
private void UpdateTheme()
|
||||
{
|
||||
var theme = ThemeManager.Instance.CurrentTheme.ActionBeltTheme;
|
||||
if (CurrentTheme == theme) return;
|
||||
CurrentTheme = theme;
|
||||
left.Theme = theme.Option;
|
||||
right.Theme = theme.Option;
|
||||
center.Theme = theme.Main;
|
||||
@ -54,9 +62,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
|
||||
protected override void Subscriptions()
|
||||
{
|
||||
Subscribe<ActionBeltUIOpenEvent>(WhenActionBeltUIOpen);
|
||||
Subscribe<ActionBeltUICloseEvent>(WhenActionBeltUIClose);
|
||||
|
||||
Subscribe<ActionBeltUIToRightEvent>(WhenActionBeltNextRight);
|
||||
Subscribe<ActionBeltUIToLeftEvent>(WhenActionBeltNextLeft);
|
||||
|
||||
@ -69,22 +74,17 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
center.BlinkBorderDropped();
|
||||
if (local.gameObject.activeSelf) local.BlinkBorderDropped();
|
||||
}
|
||||
|
||||
private void WhenActionBeltUIOpen(ActionBeltUIOpenEvent e)
|
||||
|
||||
private IEnumerator UpdateContentNextFrame()
|
||||
{
|
||||
if (GetFocus is not null) return;
|
||||
GetFocus = e.GetFocusActionEnvelope;
|
||||
SneakPeekRight = e.SneakPeekRightActionEnvelope;
|
||||
SneakPeekLeft = e.SneakPeekLeftActionEnvelope;
|
||||
GetNumberOfActionsInBelt = e.GetSize;
|
||||
IsOptionActive = GetNumberOfActionsInBelt() > 1;
|
||||
actionBeltWindow.Open();
|
||||
yield return null;
|
||||
UpdateTheme();
|
||||
UpdateContent();
|
||||
}
|
||||
|
||||
private void WhenActionBeltUIClose(ActionBeltUICloseEvent e)
|
||||
|
||||
public void BeforeOpen()
|
||||
{
|
||||
Close();
|
||||
StartCoroutine(UpdateContentNextFrame());
|
||||
}
|
||||
|
||||
private void WhenActionBeltNextRight(ActionBeltUIToRightEvent e)
|
||||
@ -92,7 +92,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
if (!IsOptionActive) return;
|
||||
SwitchRight();
|
||||
contentIconAnimation.SpriteAnimation.Reset();
|
||||
UpdateContent();
|
||||
StartCoroutine(UpdateContentNextFrame());
|
||||
}
|
||||
|
||||
private void WhenActionBeltNextLeft(ActionBeltUIToLeftEvent e)
|
||||
@ -100,7 +100,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
if (!IsOptionActive) return;
|
||||
SwitchLeft();
|
||||
contentIconAnimation.SpriteAnimation.Reset();
|
||||
UpdateContent();
|
||||
StartCoroutine(UpdateContentNextFrame());
|
||||
}
|
||||
|
||||
private void WhenActionBeltUITakeAction(ActionBeltUITakeActionEvent e)
|
||||
@ -108,17 +108,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
center.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()
|
||||
{
|
||||
@ -143,18 +132,15 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
|
||||
switch (GetNumberOfActionsInBelt())
|
||||
{
|
||||
case 0:
|
||||
Close();
|
||||
IsOptionActive = false;
|
||||
Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent());
|
||||
return;
|
||||
case 1:
|
||||
left.gameObject.SetActive(false);
|
||||
right.gameObject.SetActive(false);
|
||||
IsOptionActive = false;
|
||||
break;
|
||||
case > 1:
|
||||
left.gameObject.SetActive(true);
|
||||
right.gameObject.SetActive(true);
|
||||
IsOptionActive = true;
|
||||
rightIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekRight().ActionCategory));
|
||||
leftIconAnimation.SpriteAnimation.ChangeAnimation(MapActionCategoryIDLE(SneakPeekLeft().ActionCategory));
|
||||
break;
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ee9661bddd34cb8a25c3d39a29da878
|
||||
timeCreated: 1782972804
|
||||
@ -0,0 +1,8 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Entities.Player.Events
|
||||
{
|
||||
public class PlayerCommandGrantedEvent : IEventBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c1c223e3ccc4eb3883530a36c95fc00
|
||||
timeCreated: 1782972809
|
||||
@ -0,0 +1,8 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Entities.Player.Events
|
||||
{
|
||||
public class PlayerCommandRevokedEvent : IEventBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b930b51213934eeca5d6935880268a50
|
||||
timeCreated: 1782972825
|
||||
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Entities.Player.PDA.Events;
|
||||
using Intrepid.SimpleEvents;
|
||||
using Intrepid.Gameplay.Entities.Player.UI;
|
||||
using Intrepid.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
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 PDAOperationalSystemUI operationalSystem;
|
||||
|
||||
@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7a1e29cc5ba44e68a73e3c9c3074c48
|
||||
timeCreated: 1782924857
|
||||
@ -1,5 +1,4 @@
|
||||
using Intrepid.Core.Entities;
|
||||
using Intrepid.Core.TimeControl;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
|
||||
|
||||
3
Assets/Scripts/Intrepid/Gameplay/Entities/Player/UI.meta
Normal file
3
Assets/Scripts/Intrepid/Gameplay/Entities/Player/UI.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 021af47d156c4e948a48b28a1d0c4d79
|
||||
timeCreated: 1782966859
|
||||
@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cca14f115cd4a088d33a323d24076e3
|
||||
timeCreated: 1782925751
|
||||
@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb0c8e637b1a4d8cb468318e2e55f337
|
||||
timeCreated: 1782925673
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 957d832adf514e89acbbd9647cf39f29
|
||||
timeCreated: 1782968207
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2dbddcd3c2848658bdbf062c764025b
|
||||
timeCreated: 1782966873
|
||||
@ -1,6 +1,7 @@
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
|
||||
using Intrepid.Gameplay.Entities.Player.Events;
|
||||
using Intrepid.Gameplay.Entities.Player.Tags;
|
||||
using Intrepid.Gameplay.Journey.Runtime.Messages;
|
||||
using Intrepid.Integration.Input;
|
||||
@ -28,12 +29,14 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
|
||||
var previousInputSchema = InputService.Instance.CurrentInputSchema;
|
||||
|
||||
InputService.Instance.ChangeInputSchema(InputSchema.None);
|
||||
|
||||
|
||||
Proxy.Instance.EventBus.Raise(new ActionBeltDisableEvent
|
||||
{
|
||||
ActionBeltManger = actionBeltManagerTag,
|
||||
});
|
||||
|
||||
|
||||
Proxy.Instance.EventBus.Raise(new PlayerCommandRevokedEvent());
|
||||
|
||||
State = JourneyGameplayGateState.Locked;
|
||||
|
||||
DLogger.LogDebug($"locked gameplay. Previous input schema: {previousInputSchema}. Request: {request}", ctx: this);
|
||||
@ -67,6 +70,8 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
|
||||
{
|
||||
ActionBeltManger = actionBeltManagerTag,
|
||||
});
|
||||
|
||||
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
|
||||
|
||||
State = JourneyGameplayGateState.Open;
|
||||
|
||||
@ -81,6 +86,8 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
|
||||
{
|
||||
ActionBeltManger = actionBeltManagerTag,
|
||||
});
|
||||
|
||||
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
|
||||
|
||||
State = JourneyGameplayGateState.Open;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "aff4fd3d1d9ba1bdc6a924b309e7af883e8cf191"
|
||||
"hash": "8b705cd47233eb0aaa29b302894b4cf1e256b919"
|
||||
},
|
||||
"com.unity.2d.animation": {
|
||||
"version": "13.0.5",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user