This commit is contained in:
TemporalOroboros
2023-06-28 05:02:06 -07:00
committed by GitHub
parent 638026878e
commit d9de405859
35 changed files with 965 additions and 1005 deletions

View File

@@ -1,63 +0,0 @@
using Content.Client.AME.Components;
using Robust.Client.GameObjects;
using static Content.Shared.AME.SharedAMEControllerComponent;
namespace Content.Client.AME;
public sealed class AMEControllerVisualizerSystem : VisualizerSystem<AMEControllerVisualsComponent>
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AMEControllerVisualsComponent, ComponentInit>(OnComponentInit);
}
private void OnComponentInit(EntityUid uid, AMEControllerVisualsComponent component, ComponentInit args)
{
if (TryComp<SpriteComponent>(uid, out var sprite))
{
sprite.LayerMapSet(AMEControllerVisualLayers.Display, sprite.AddLayerState("control_on"));
sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false);
}
}
protected override void OnAppearanceChange(EntityUid uid, AMEControllerVisualsComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);
if (args.Sprite == null
|| !AppearanceSystem.TryGetData<string>(uid, AMEControllerVisuals.DisplayState, out var state, args.Component))
{
return;
}
switch (state)
{
case "on":
args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_on");
args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true);
break;
case "critical":
args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_critical");
args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true);
break;
case "fuck":
args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_fuck");
args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true);
break;
case "off":
args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false);
break;
default:
args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false);
break;
}
}
}
public enum AMEControllerVisualLayers : byte
{
Display
}

View File

@@ -1,70 +0,0 @@
using Content.Client.AME.Components;
using Robust.Client.GameObjects;
using static Content.Shared.AME.SharedAMEShieldComponent;
namespace Content.Client.AME;
public sealed class AMEShieldingVisualizerSystem : VisualizerSystem<AMEShieldingVisualsComponent>
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AMEShieldingVisualsComponent, ComponentInit>(OnComponentInit);
}
private void OnComponentInit(EntityUid uid, AMEShieldingVisualsComponent component, ComponentInit args)
{
if (TryComp<SpriteComponent>(uid, out var sprite))
{
sprite.LayerMapSet(AMEShieldingVisualsLayer.Core, sprite.AddLayerState("core"));
sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, false);
sprite.LayerMapSet(AMEShieldingVisualsLayer.CoreState, sprite.AddLayerState("core_weak"));
sprite.LayerSetVisible(AMEShieldingVisualsLayer.CoreState, false);
}
}
protected override void OnAppearanceChange(EntityUid uid, AMEShieldingVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (AppearanceSystem.TryGetData<string>(uid, AMEShieldVisuals.Core, out var core, args.Component))
{
if (core == "isCore")
{
args.Sprite.LayerSetState(AMEShieldingVisualsLayer.Core, "core");
args.Sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, true);
}
else
{
args.Sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, false);
}
}
if (AppearanceSystem.TryGetData<string>(uid, AMEShieldVisuals.CoreState, out var coreState, args.Component))
{
switch (coreState)
{
case "weak":
args.Sprite.LayerSetState(AMEShieldingVisualsLayer.CoreState, "core_weak");
args.Sprite.LayerSetVisible(AMEShieldingVisualsLayer.CoreState, true);
break;
case "strong":
args.Sprite.LayerSetState(AMEShieldingVisualsLayer.CoreState, "core_strong");
args.Sprite.LayerSetVisible(AMEShieldingVisualsLayer.CoreState, true);
break;
case "off":
args.Sprite.LayerSetVisible(AMEShieldingVisualsLayer.CoreState, false);
break;
}
}
}
}
public enum AMEShieldingVisualsLayer : byte
{
Core,
CoreState,
}

View File

@@ -1,9 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Robust.Shared.GameObjects;
namespace Content.Client.AME.Components;
[RegisterComponent]
public sealed class AMEControllerVisualsComponent : Component
{
}

View File

@@ -1,9 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Robust.Shared.GameObjects;
namespace Content.Client.AME.Components;
[RegisterComponent]
public sealed class AMEShieldingVisualsComponent : Component
{
}

View File

@@ -1,17 +1,15 @@
using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Ame;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.AME.SharedAMEControllerComponent;
namespace Content.Client.AME.UI
namespace Content.Client.Ame.UI
{
[UsedImplicitly]
public sealed class AMEControllerBoundUserInterface : BoundUserInterface
public sealed class AmeControllerBoundUserInterface : BoundUserInterface
{
private AMEWindow? _window;
private AmeWindow? _window;
public AMEControllerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
public AmeControllerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
{
}
@@ -19,7 +17,7 @@ namespace Content.Client.AME.UI
{
base.Open();
_window = new AMEWindow(this);
_window = new AmeWindow(this);
_window.OnClose += Close;
_window.OpenCentered();
}
@@ -35,11 +33,11 @@ namespace Content.Client.AME.UI
{
base.UpdateState(state);
var castState = (AMEControllerBoundUserInterfaceState) state;
var castState = (AmeControllerBoundUserInterfaceState) state;
_window?.UpdateState(castState); //Update window state
}
public void ButtonPressed(UiButton button, int dispenseIndex = -1)
public void ButtonPressed(UiButton button)
{
SendMessage(new UiButtonPressedMessage(button));
}

View File

@@ -1,20 +1,15 @@
using Content.Client.UserInterface;
using Content.Shared.Ame;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using static Content.Shared.AME.SharedAMEControllerComponent;
namespace Content.Client.AME.UI
namespace Content.Client.Ame.UI
{
[GenerateTypedNameReferences]
public sealed partial class AMEWindow : DefaultWindow
public sealed partial class AmeWindow : DefaultWindow
{
public AMEWindow(AMEControllerBoundUserInterface ui)
public AmeWindow(AmeControllerBoundUserInterface ui)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
@@ -31,7 +26,7 @@ namespace Content.Client.AME.UI
/// <param name="state">State data sent by the server.</param>
public void UpdateState(BoundUserInterfaceState state)
{
var castState = (AMEControllerBoundUserInterfaceState) state;
var castState = (AmeControllerBoundUserInterfaceState) state;
// Disable all buttons if not powered
if (Contents.Children != null)

View File

@@ -21,7 +21,7 @@ using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Shared.Administration;
using Content.Shared.AME;
using Content.Shared.Ame;
using Content.Shared.Gravity;
using Content.Shared.Localizations;
using Robust.Client;
@@ -91,7 +91,7 @@ namespace Content.Client.Entry
// Do not add to these, they are legacy.
_componentFactory.RegisterClass<SharedGravityGeneratorComponent>();
_componentFactory.RegisterClass<SharedAMEControllerComponent>();
_componentFactory.RegisterClass<SharedAmeControllerComponent>();
// Do not add to the above, they are legacy
_prototypeManager.RegisterIgnore("utilityQuery");