Add to PDA alert level, shift duration, instructions and ID access. Also fix uknown station name. (#15220)

* PDA update and fix

* fix alert level

* Fix color level

* Maybe this will look better

* PDA update and fix

* fix alert level

* Fix color level

* Maybe this will look better

* Now threat color is taken in the same way as for emergency lamps

* Minor improvements

* Fix alert level string

* AlertLevelChangedEvent for all PDAs

* StationAlert is also stored in PDAComponent

* Removed IdAccessLevels

* Removed Access from PDAMenu.xaml.cs and Draw time real-time

* AlertLevel updated from AlertLevelChangedEvent

* Removed garbage

* Removed garbage from PDAUpdateState.cs

* Change comp-pda-ui-station-time

* revert rename PDAOwnerInfo to PdaOwnerInfo

* remove not use short names jobs

* "ftl var should be lowercase"

* "ftl var should be lowercase" again

* transfer StationAlert to PDAIdInfoText

* transfer StationAlert to PDAIdInfoText

* Line breaks of parameter/argument lists conventions

* not randomly inline property attributes

* no broadcast AlertLevelChangedEvent

* fix cctualOwnerName

* GridModifiedEvent never called

* add alert-level-unknown-instructions

* UpdateAlertLevel for latejoin

* Add alert-level-unknown

* Revert "GridModifiedEvent never called"

This reverts commit fa7d1620

* remove garbage and fix quite long
This commit is contained in:
Daniil Sikinami
2023-05-17 23:35:40 +03:00
committed by GitHub
parent 5da40f0d88
commit 7ca7272a80
8 changed files with 128 additions and 26 deletions

View File

@@ -38,6 +38,9 @@
HorizontalExpand="True" />
</BoxContainer>
</PanelContainer>
<RichTextLabel Name="StationAlertLevelLabel" Access="Public" />
<RichTextLabel Name="StationTimeLabel" Access="Public" />
<RichTextLabel Name="StationAlertLevelInstructions" Access="Public" />
</BoxContainer>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="True">
<BoxContainer Orientation="Vertical"

View File

@@ -1,29 +1,38 @@
using Content.Client.Message;
using Content.Shared.CartridgeLoader;
using Content.Client.GameTicking.Managers;
using Content.Shared.PDA;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Content.Shared.CartridgeLoader;
using Content.Client.Message;
using Robust.Client.UserInterface;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.XAML;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
namespace Content.Client.PDA
{
[GenerateTypedNameReferences]
public sealed partial class PDAMenu : PDAWindow
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
private readonly ClientGameTicker _gameTicker;
public const int HomeView = 0;
public const int ProgramListView = 1;
public const int SettingsView = 2;
public const int ProgramContentView = 3;
private int _currentView = 0;
private int _currentView;
public event Action<EntityUid>? OnProgramItemPressed;
public event Action<EntityUid>? OnUninstallButtonPressed;
public event Action<EntityUid>? OnInstallButtonPressed;
public PDAMenu()
{
IoCManager.InjectDependencies(this);
_gameTicker = _entitySystem.GetEntitySystem<ClientGameTicker>();
RobustXamlLoader.Load(this);
ViewContainer.OnChildAdded += control => control.Visible = false;
@@ -86,22 +95,44 @@ namespace Content.Client.PDA
if (state.PDAOwnerInfo.ActualOwnerName != null)
{
PdaOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner",
("ActualOwnerName", state.PDAOwnerInfo.ActualOwnerName)));
("actualOwnerName", state.PDAOwnerInfo.ActualOwnerName)));
}
if (state.PDAOwnerInfo.IdOwner != null || state.PDAOwnerInfo.JobTitle != null)
{
IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui",
("Owner",state.PDAOwnerInfo.IdOwner ?? Loc.GetString("comp-pda-ui-unknown")),
("JobTitle",state.PDAOwnerInfo.JobTitle ?? Loc.GetString("comp-pda-ui-unassigned"))));
("owner",state.PDAOwnerInfo.IdOwner ?? Loc.GetString("comp-pda-ui-unknown")),
("jobTitle",state.PDAOwnerInfo.JobTitle ?? Loc.GetString("comp-pda-ui-unassigned"))));
}
else
{
IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank"));
}
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station", ("Station",state.StationName ?? Loc.GetString("comp-pda-ui-unknown"))));
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station",
("station",state.StationName ?? Loc.GetString("comp-pda-ui-unknown"))));
var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));
var alertLevel = state.PDAOwnerInfo.StationAlertLevel;
var alertColor = state.PDAOwnerInfo.StationAlertColor;
var alertLevelKey = alertLevel != null ? $"alert-level-{alertLevel}" : "alert-level-unknown";
StationAlertLevelLabel.SetMarkup(Loc.GetString(
"comp-pda-ui-station-alert-level",
("color", alertColor),
("level", Loc.GetString(alertLevelKey))
));
StationAlertLevelInstructions.SetMarkup(Loc.GetString(
"comp-pda-ui-station-alert-level-instructions",
("instructions", Loc.GetString($"{alertLevelKey}-instructions")))
);
AddressLabel.Text = state.Address?.ToUpper() ?? " - ";
EjectIdButton.IsActive = state.PDAOwnerInfo.IdOwner != null || state.PDAOwnerInfo.JobTitle != null;
@@ -249,5 +280,15 @@ namespace Content.Client.PDA
view.Visible = false;
}
}
protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);
var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));
}
}
}