diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml index b3a420f58eb..17fde0db2e6 100644 --- a/Content.Client/PDA/PdaMenu.xaml +++ b/Content.Client/PDA/PdaMenu.xaml @@ -43,6 +43,9 @@ + + + diff --git a/Content.Client/PDA/PdaMenu.xaml.cs b/Content.Client/PDA/PdaMenu.xaml.cs index fd991b13cf4..8c9b36be103 100644 --- a/Content.Client/PDA/PdaMenu.xaml.cs +++ b/Content.Client/PDA/PdaMenu.xaml.cs @@ -1,6 +1,6 @@ using Content.Client.GameTicking.Managers; using Content.Shared.PDA; -using Robust.Shared.Utility; +using Content.Shared._Sunrise.Time; using Content.Shared.CartridgeLoader; using Content.Client.Message; using Robust.Client.UserInterface; @@ -9,6 +9,7 @@ using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.Controls; using Robust.Shared.Timing; +using Robust.Shared.Utility; namespace Content.Client.PDA { @@ -120,10 +121,14 @@ public PdaMenu() StationTimeButton.OnPressed += _ => { - var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); - _clipboard.SetText((stationTime.ToString("hh\\:mm\\:ss"))); + var stationTime = _entitySystem.GetEntitySystem().GetStationTime(); + _clipboard.SetText((stationTime.Time.ToString("hh\\:mm\\:ss"))); + }; + StationDateButton.OnPressed += _ => + { + var stationDate = _entitySystem.GetEntitySystem().GetDate(); + _clipboard.SetText((stationDate)); }; - StationAlertLevelInstructionsButton.OnPressed += _ => { _clipboard.SetText(_instructions); @@ -171,10 +176,14 @@ public void UpdateState(PdaUpdateState state) ("station", _stationName))); - var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); + var stationTime = _entitySystem.GetEntitySystem().GetStationTime(); + var stationDate = _entitySystem.GetEntitySystem().GetDate(); StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time", - ("time", stationTime.ToString("hh\\:mm\\:ss")))); + ("time", stationTime.Time.ToString("hh\\:mm\\:ss")))); + + StationDateLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-date", + ("date", stationDate))); // Sunrise-start var remaining = TimeSpan.Zero; @@ -374,10 +383,14 @@ protected override void Draw(DrawingHandleScreen handle) { base.Draw(handle); - var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); + var stationTime = _entitySystem.GetEntitySystem().GetStationTime(); + var stationDate = _entitySystem.GetEntitySystem().GetDate(); StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time", - ("time", stationTime.ToString("hh\\:mm\\:ss")))); + ("time", stationTime.Time.ToString("hh\\:mm\\:ss")))); + + StationDateLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-date", + ("date", stationDate))); // Sunrise-start var remaining = TimeSpan.Zero; diff --git a/Content.Shared/_Sunrise/Time/TimeSystem.cs b/Content.Shared/_Sunrise/Time/TimeSystem.cs new file mode 100644 index 00000000000..5a82361b3e8 --- /dev/null +++ b/Content.Shared/_Sunrise/Time/TimeSystem.cs @@ -0,0 +1,44 @@ +using Content.Shared.Examine; +using Content.Shared.GameTicking; +using Robust.Shared.Timing; + +namespace Content.Shared._Sunrise.Time +{ + public sealed class TimeSystem : EntitySystem + { + [Dependency] private readonly IGameTiming _timing = default!; + + private TimeSpan _roundStart; + + public override void Initialize() + { + base.Initialize(); + SubscribeNetworkEvent(LobbyStatus); + } + + private void LobbyStatus(TickerLobbyStatusEvent ev) + { + _roundStart = ev.RoundStartTimeSpan; + } + + public (TimeSpan Time, int Date) GetStationTime() + { + var stationTime = _timing.CurTime.Subtract(_roundStart).Add(TimeSpan.FromHours(12)); + + var date = 13; + while (stationTime.TotalHours >= 24) + { + stationTime.Subtract(TimeSpan.FromHours(24)); + date = date + 1; + } + + return (stationTime, date); + } + + public string GetDate() + { + // please tell me you guys aren't gonna have a 4 week round yet... + return DateTime.UtcNow.AddYears(1000).ToString("dd.MM.yyyy"); + } + } +} \ No newline at end of file diff --git a/Resources/Locale/en-US/_sunrise/time/time.ftl b/Resources/Locale/en-US/_sunrise/time/time.ftl new file mode 100644 index 00000000000..c02107ea6eb --- /dev/null +++ b/Resources/Locale/en-US/_sunrise/time/time.ftl @@ -0,0 +1 @@ +standard-date = 417/11/{$date} \ No newline at end of file diff --git a/Resources/Locale/en-US/pda/pda-component.ftl b/Resources/Locale/en-US/pda/pda-component.ftl index 7f17102c5f0..8e08eac4717 100644 --- a/Resources/Locale/en-US/pda/pda-component.ftl +++ b/Resources/Locale/en-US/pda/pda-component.ftl @@ -32,7 +32,7 @@ comp-pda-ui-station-alert-level = Alert Level: [color={ $color }]{ $level }[/col comp-pda-ui-station-alert-level-instructions = Instructions: [color=white]{ $instructions }[/color] -comp-pda-ui-station-time = Shift duration: [color=white]{ $time }[/color] +comp-pda-ui-station-time = The current time since the start of the shift: [color=white]{ $time } { $date }[/color] comp-pda-ui-eject-id-button = Eject ID diff --git a/Resources/Locale/ru-RU/_sunrise/time/time.ftl b/Resources/Locale/ru-RU/_sunrise/time/time.ftl new file mode 100644 index 00000000000..c02107ea6eb --- /dev/null +++ b/Resources/Locale/ru-RU/_sunrise/time/time.ftl @@ -0,0 +1 @@ +standard-date = 417/11/{$date} \ No newline at end of file diff --git a/Resources/Locale/ru-RU/pda/pda-component.ftl b/Resources/Locale/ru-RU/pda/pda-component.ftl index 2b62a04fb66..573db9f65db 100644 --- a/Resources/Locale/ru-RU/pda/pda-component.ftl +++ b/Resources/Locale/ru-RU/pda/pda-component.ftl @@ -17,7 +17,8 @@ comp-pda-ui-footer = Карманный Персональный Компьют comp-pda-ui-station = Станция: [color=white]{ $station }[/color] comp-pda-ui-station-alert-level = Уровень угрозы: [color={ $color }]{ $level }[/color] comp-pda-ui-station-alert-level-instructions = Инструкции: [color=white]{ $instructions }[/color] -comp-pda-ui-station-time = Продолжительность смены: [color=white]{ $time }[/color] +comp-pda-ui-station-time = Текущее время с начала смены: [color=white]{ $time }[/color] +comp-pda-ui-station-date = Текущая дата: [color=white]{ $date }[/color] comp-pda-ui-eject-id-button = Извлечь ID comp-pda-ui-eject-pen-button = Извлечь ручку comp-pda-ui-ringtone-button-description = Измените рингтон вашего КПК