Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

фикс времени пда #142

Merged
merged 5 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Content.Client/PDA/PdaMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
<ContainerButton Name="StationTimeButton">
<RichTextLabel Name="StationTimeLabel" Access="Public"/>
</ContainerButton>
<ContainerButton Name="StationDateButton">
<RichTextLabel Name="StationDateLabel" Access="Public"/>
</ContainerButton>
<ContainerButton Name="ShuttleTimeButton">
<RichTextLabel Name="ShuttleTimeLabel" Access="Public"/>
</ContainerButton>
Expand Down
20 changes: 5 additions & 15 deletions Content.Client/PDA/PdaMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ public PdaMenu()
StationTimeButton.OnPressed += _ =>
{
var stationTime = _entitySystem.GetEntitySystem<TimeSystem>().GetStationTime();
_clipboard.SetText((stationTime.Time.ToString("hh\\:mm\\:ss")));
};
StationDateButton.OnPressed += _ =>
{
var stationDate = _entitySystem.GetEntitySystem<TimeSystem>().GetDate();
_clipboard.SetText((stationDate));
_clipboard.SetText($"{stationTime.Date} {stationTime.Time:hh\\:mm\\:ss}");
};

StationAlertLevelInstructionsButton.OnPressed += _ =>
{
_clipboard.SetText(_instructions);
Expand Down Expand Up @@ -180,10 +176,7 @@ public void UpdateState(PdaUpdateState state)
var stationDate = _entitySystem.GetEntitySystem<TimeSystem>().GetDate();

StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.Time.ToString("hh\\:mm\\:ss"))));

StationDateLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-date",
("date", stationDate)));
("time", stationTime.Time.ToString("hh\\:mm\\:ss")), ("date", stationDate)));

// Sunrise-start
var remaining = TimeSpan.Zero;
Expand Down Expand Up @@ -385,12 +378,9 @@ protected override void Draw(DrawingHandleScreen handle)

var stationTime = _entitySystem.GetEntitySystem<TimeSystem>().GetStationTime();
var stationDate = _entitySystem.GetEntitySystem<TimeSystem>().GetDate();

StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.Time.ToString("hh\\:mm\\:ss"))));

StationDateLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-date",
("date", stationDate)));
StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.Time.ToString("hh\\:mm\\:ss")), ("date", stationDate)));

// Sunrise-start
var remaining = TimeSpan.Zero;
Expand Down
38 changes: 18 additions & 20 deletions Content.Shared/_Sunrise/Time/TimeSystem.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
using Content.Shared.Examine;
using Content.Shared.GameTicking;
using Robust.Shared.Timing;
using System;

namespace Content.Shared._Sunrise.Time
namespace Content.Shared._Sunrise.Time;

public sealed class TimeSystem : EntitySystem
{
public sealed class TimeSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IGameTiming _timing = default!;

private TimeSpan _roundStart;
private TimeSpan _roundStart;

public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
}
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
}

private void LobbyStatus(TickerLobbyStatusEvent ev)
{
Expand All @@ -23,22 +24,19 @@ private void LobbyStatus(TickerLobbyStatusEvent ev)

public (TimeSpan Time, int Date) GetStationTime()
{
var stationTime = _timing.CurTime.Subtract(_roundStart).Add(TimeSpan.FromHours(12));
var moscowTime = DateTime.UtcNow + TimeSpan.FromHours(3);
var stationTime = moscowTime.TimeOfDay;

var date = 13;
while (stationTime.TotalHours >= 24)
{
stationTime.Subtract(TimeSpan.FromHours(24));
date = date + 1;
}
var daysPassed = (int)stationTime.TotalHours / 24;
stationTime = stationTime.Subtract(TimeSpan.FromHours(daysPassed * 24));

var date = 13 + daysPassed;

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");
return DateTime.Now.AddYears(1000).ToString("dd.MM.yyyy");
}
}
}
1 change: 0 additions & 1 deletion Resources/Locale/en-US/_sunrise/time/time.ftl

This file was deleted.

4 changes: 2 additions & 2 deletions Resources/Locale/en-US/pda/pda-component.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ 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 = Time: [color=white]{ $time }[/color]
comp-pda-ui-station-time = Date and Time: [color=white]{ $time }, { $date }[/color]

comp-pda-ui-station-date = Date: [color=white]{ $date }[/color]
comp-pda-ui-server-time = Server time: [color=white]{ $time }[/color]

comp-pda-ui-eject-id-button = Eject ID

Expand Down
1 change: 0 additions & 1 deletion Resources/Locale/ru-RU/_sunrise/time/time.ftl

This file was deleted.

22 changes: 20 additions & 2 deletions Resources/Locale/ru-RU/pda/pda-component.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@

# For the PDA screen
comp-pda-ui = ID: [color=white]{ $owner }[/color], [color=yellow]{ CAPITALIZE($jobTitle) }[/color]

comp-pda-ui-blank = ID:

comp-pda-ui-owner = Владелец: [color=white]{ $actualOwnerName }[/color]

comp-pda-io-program-list-button = Программы

comp-pda-io-settings-button = Настройки

comp-pda-io-program-fallback-title = Программа

comp-pda-io-no-programs-available = Нет доступных программ

pda-bound-user-interface-show-uplink-title = Открыть аплинк

pda-bound-user-interface-show-uplink-description = Получите доступ к своему аплинку

pda-bound-user-interface-lock-uplink-title = Закрыть аплинк

pda-bound-user-interface-lock-uplink-description = Предотвратите доступ к вашему аплинку персон без кода

comp-pda-ui-menu-title = КПК

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-date = Текущая дата: [color=white]{ $date }[/color]

comp-pda-ui-station-time = Время и дата: [color=white]{ $time }, { $date }[/color]

comp-pda-ui-server-time = Время сервера: [color=white]{ $time }[/color]

comp-pda-ui-eject-id-button = Извлечь ID
comp-pda-ui-eject-pen-button = Извлечь ручку
comp-pda-ui-ringtone-button-description = Измените рингтон вашего КПК
Expand Down
Loading