-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1aaa7eb
commit 357bedf
Showing
86 changed files
with
2,765 additions
and
23 deletions.
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
Content.Client/_Starlight/Antags/Abductor/AbductorCameraConsoleBui.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
using Content.Shared.Starlight.Antags.Abductor; | ||
using JetBrains.Annotations; | ||
using static Content.Shared.Pinpointer.SharedNavMapSystem; | ||
|
||
namespace Content.Client._Starlight.Antags.Abductor; | ||
|
||
[UsedImplicitly] | ||
public sealed class AbductorCameraConsoleBui : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private AbductorCameraConsoleWindow? _window; | ||
private int? _station; | ||
public AbductorCameraConsoleBui(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
protected override void Open() => UpdateState(State); | ||
protected override void UpdateState(BoundUserInterfaceState? state) | ||
{ | ||
if (state is AbductorCameraConsoleBuiState s) | ||
Update(s); | ||
} | ||
|
||
private void Update(AbductorCameraConsoleBuiState state) | ||
{ | ||
TryInitWindow(); | ||
|
||
View(ViewType.Stations); | ||
|
||
RefreshUI(); | ||
|
||
if (!_window!.IsOpen) | ||
_window.OpenCentered(); | ||
} | ||
|
||
private void TryInitWindow() | ||
{ | ||
if (_window != null) return; | ||
_window = new AbductorCameraConsoleWindow(); | ||
_window.OnClose += Close; | ||
_window.Title = "Intercepted cameras."; | ||
|
||
_window.StationsButton.OnPressed += _ => | ||
{ | ||
_station = null; | ||
View(ViewType.Stations); | ||
}; | ||
} | ||
|
||
private void OnStationPressed(int station, List<NavMapBeacon> beacons) | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
_station = station; | ||
|
||
foreach (var beacon in beacons) | ||
{ | ||
var beaconButton = new ChoiceControl(); | ||
|
||
beaconButton.Set(beacon.Text, null); | ||
beaconButton.Button.Modulate = beacon.Color; | ||
beaconButton.Button.OnPressed += _ => | ||
{ | ||
SendMessage(new AbductorBeaconChosenBuiMsg() | ||
{ | ||
Beacon = beacon, | ||
}); | ||
Close(); | ||
}; | ||
_window.Beacons.AddChild(beaconButton); | ||
} | ||
View(ViewType.Beacons); | ||
} | ||
|
||
private void RefreshUI() | ||
{ | ||
if (_window == null || State is not AbductorCameraConsoleBuiState state) | ||
return; | ||
|
||
_window!.Stations.DisposeAllChildren(); | ||
_window.Beacons.DisposeAllChildren(); | ||
|
||
foreach (var station in state.Stations) | ||
{ | ||
var stationButton = new ChoiceControl(); | ||
|
||
stationButton.Set(station.Value.Name, null); | ||
stationButton.Button.OnPressed += _ => OnStationPressed(station.Key, station.Value.Beacons); | ||
|
||
_window.Stations.AddChild(stationButton); | ||
|
||
if (station.Key == _station) OnStationPressed(station.Key, station.Value.Beacons); | ||
} | ||
} | ||
|
||
private void View(ViewType type) | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
_window.StationsButton.Parent!.Margin = new Thickness(0, 0, 0, 10); | ||
|
||
_window.Stations.Visible = type == ViewType.Stations; | ||
_window.StationsButton.Visible = true; | ||
|
||
_window.Beacons.Visible = type == ViewType.Beacons; | ||
_window.BeaconsButton.Disabled = type != ViewType.Beacons; | ||
|
||
_window.Title = State is not AbductorCameraConsoleBuiState state | ||
|| _station == null | ||
|| !state.Stations.TryGetValue(_station.Value, out var station) | ||
? "Stations" | ||
: $"Station - {station.Name}"; | ||
} | ||
|
||
private enum ViewType | ||
{ | ||
Stations, | ||
Beacons, | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (disposing) | ||
_window?.Dispose(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Content.Client/_Starlight/Antags/Abductor/AbductorCameraConsoleWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<controls:AbductorCameraConsoleWindow | ||
xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client._Starlight.Antags.Abductor" | ||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
MinSize="400 400"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 0 0 10"> | ||
<Button Name="StationsButton" Access="Public" Text="< Stations" | ||
HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
<Button Name="BeaconsButton" Access="Public" Text="{Loc 'abductors-ui-beacons'}" | ||
HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
</BoxContainer> | ||
<cc:HSeparator Color="#A04B81" /> | ||
<ScrollContainer VScrollEnabled="True" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Name="Stations" Access="Public" Orientation="Vertical" Visible="False" /> | ||
<BoxContainer Name="Beacons" Access="Public" Orientation="Vertical" Visible="False" /> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</controls:AbductorCameraConsoleWindow> |
118 changes: 118 additions & 0 deletions
118
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleBui.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using Content.Shared.Starlight.Antags.Abductor; | ||
using JetBrains.Annotations; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.RichText; | ||
using Robust.Shared.Utility; | ||
using static Content.Shared.Pinpointer.SharedNavMapSystem; | ||
|
||
namespace Content.Client._Starlight.Antags.Abductor; | ||
|
||
[UsedImplicitly] | ||
public sealed class AbductorConsoleBui : BoundUserInterface | ||
{ | ||
[Dependency] private readonly IEntityManager _entities = default!; | ||
|
||
[ViewVariables] | ||
private AbductorConsoleWindow? _window; | ||
public AbductorConsoleBui(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
|
||
} | ||
protected override void Open() => UpdateState(State); | ||
protected override void UpdateState(BoundUserInterfaceState? state) | ||
{ | ||
if (state is AbductorConsoleBuiState s) | ||
Update(s); | ||
} | ||
|
||
private void Update(AbductorConsoleBuiState state) | ||
{ | ||
TryInitWindow(); | ||
|
||
View(ViewType.Teleport); | ||
|
||
RefreshUI(); | ||
|
||
if (!_window!.IsOpen) | ||
_window.OpenCentered(); | ||
} | ||
|
||
private void TryInitWindow() | ||
{ | ||
if (_window != null) return; | ||
_window = new AbductorConsoleWindow(); | ||
_window.OnClose += Close; | ||
_window.Title = "console"; | ||
|
||
_window.TeleportTabButton.OnPressed += _ => View(ViewType.Teleport); | ||
|
||
_window.ExperimentTabButton.OnPressed += _ => View(ViewType.Experiment); | ||
} | ||
|
||
private void RefreshUI() | ||
{ | ||
if (_window == null || State is not AbductorConsoleBuiState state) | ||
return; | ||
|
||
// teleportTab | ||
_window.TargetLabel.Children.Clear(); | ||
|
||
var padMsg = new FormattedMessage(); | ||
padMsg.AddMarkupOrThrow(state.AlienPadFound ? "pad: [color=green]connected[/color]" : "pad: [color=red]not found[/color]"); | ||
_window.PadLabel.SetMessage(padMsg); | ||
|
||
var msg = new FormattedMessage(); | ||
msg.AddMarkupOrThrow(state.Target == null ? "target: [color=red]NONE[/color]" : $"target: [color=green]{state.TargetName}[/color]"); | ||
_window.TeleportButton.Disabled = state.Target == null || !state.AlienPadFound; | ||
_window.TeleportButton.OnPressed += _ => | ||
{ | ||
SendMessage(new AbductorAttractBuiMsg()); | ||
Close(); | ||
}; | ||
_window.TargetLabel.SetMessage(msg, new Type[1] { typeof(ColorTag) }); | ||
|
||
// experiment tab | ||
|
||
var experimentatorMsg = new FormattedMessage(); | ||
experimentatorMsg.AddMarkupOrThrow(state.AlienPadFound ? "experimentator: [color=green]connected[/color]" : "experimentator: [color=red]not found[/color]"); | ||
_window.ExperimentatorLabel.SetMessage(experimentatorMsg); | ||
|
||
var victimMsg = new FormattedMessage(); | ||
victimMsg.AddMarkupOrThrow(state.VictimName == null ? "victim: [color=red]NONE[/color]" : $"victim: [color=green]{state.VictimName}[/color]"); | ||
_window.VictimLabel.SetMessage(victimMsg); | ||
|
||
_window.CompleteExperimentButton.Disabled = state.VictimName == null; | ||
_window.CompleteExperimentButton.OnPressed += _ => | ||
{ | ||
SendMessage(new AbductorCompleteExperimentBuiMsg()); | ||
Close(); | ||
}; | ||
} | ||
|
||
private void View(ViewType type) | ||
{ | ||
if (_window == null) | ||
return; | ||
|
||
_window.TeleportTabButton.Parent!.Margin = new Thickness(0, 0, 0, 10); | ||
|
||
_window.TeleportTabButton.Disabled = type == ViewType.Teleport; | ||
_window.ExperimentTabButton.Disabled = type == ViewType.Experiment; | ||
_window.TeleportTab.Visible = type == ViewType.Teleport; | ||
_window.ExperimentTab.Visible = type == ViewType.Experiment; | ||
} | ||
|
||
private enum ViewType | ||
{ | ||
Teleport, | ||
Experiment | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (disposing) | ||
_window?.Dispose(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<controls:AbductorConsoleWindow | ||
xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client._Starlight.Antags.Abductor" | ||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
MinSize="400 400"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 0 0 10"> | ||
<Button Name="TeleportTabButton" Access="Public" Text="{Loc 'abductors-ui-teleport'}" HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
<Button Name="ExperimentTabButton" Access="Public" Text="{Loc 'abductors-ui-experiment'}" HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
</BoxContainer> | ||
<cc:HSeparator Color="#A04B81" /> | ||
<ScrollContainer VScrollEnabled="True" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Name="TeleportTab" Access="Public" Orientation="Vertical" Visible="False"> | ||
<RichTextLabel Name="PadLabel" Access="Public"/> | ||
<RichTextLabel Name="TargetLabel" Access="Public" /> | ||
<Button Name="TeleportButton" Access="Public" Text="{Loc 'abductors-ui-attract'}" HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
</BoxContainer> | ||
<BoxContainer Name="ExperimentTab" Access="Public" Orientation="Vertical" Visible="False"> | ||
<RichTextLabel Name="ExperimentLabel" Access="Public"/> | ||
<RichTextLabel Name="ExperimentatorLabel" Access="Public"/> | ||
<RichTextLabel Name="VictimLabel" Access="Public"/> | ||
<Button Name="CompleteExperimentButton" Access="Public" Text="{Loc 'abductors-ui-complete-experiment'}" HorizontalExpand="True" StyleClasses="OpenBoth" /> | ||
</BoxContainer> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</controls:AbductorConsoleWindow> |
10 changes: 10 additions & 0 deletions
10
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._Starlight.Antags.Abductor; | ||
[GenerateTypedNameReferences] | ||
public sealed partial class AbductorConsoleWindow : DefaultWindow | ||
{ | ||
public AbductorConsoleWindow() => RobustXamlLoader.Load(this); | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Client/_Starlight/Antags/Abductor/AbductorSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Content.Shared.Starlight.Antags.Abductor; | ||
|
||
namespace Content.Client._Starlight.Antags.Abductor; | ||
|
||
public sealed class AbductorSystem : SharedAbductorSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
} | ||
} |
Oops, something went wrong.