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

Show correct time on static time maps #238

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all 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
23 changes: 21 additions & 2 deletions Fika.Core/UI/Custom/MainMenuUIScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ private DateTime BackendTime
}
}

private DateTime StaticTime
{
get
{
return new DateTime(2016, 8, 4, 15, 28, 0);
}
}

protected void Start()
{
instance = this;
Expand Down Expand Up @@ -163,8 +171,14 @@ private void ClearAndQueryPlayers()
SetupPlayers(ref response);
}

private string ConvertToTime(EDateTime dateTime)
private string ConvertToTime(EDateTime dateTime, bool staticTime)
{
if (staticTime)
{
DateTime staticDate = StaticTime;
return dateTime == EDateTime.CURR ? staticDate.ToString("HH:mm:ss") : staticDate.AddHours(-12).ToString("HH:mm:ss");
}

DateTime backendTime = BackendTime;
if (backendTime == DateTime.MinValue)
{
Expand All @@ -173,6 +187,11 @@ private string ConvertToTime(EDateTime dateTime)
return dateTime == EDateTime.CURR ? backendTime.ToString("HH:mm:ss") : backendTime.AddHours(-12).ToString("HH:mm:ss");
}

private bool IsStaticTimeLocation(string location)
{
return location is "factory4_day" or "factory4_night" or "laboratory";
}

private void SetupPlayers(ref FikaPlayerPresence[] responses)
{
foreach (FikaPlayerPresence presence in responses)
Expand All @@ -184,7 +203,7 @@ private void SetupPlayers(ref FikaPlayerPresence[] responses)
{
RaidInformation information = presence.RaidInformation.Value;
string side = information.Side == ESideType.Pmc ? "RaidSidePmc".Localized() : "RaidSideScav".Localized();
string time = ConvertToTime(information.Time);
string time = ConvertToTime(information.Time, IsStaticTimeLocation(information.Location));
HoverTooltipArea tooltip = newPlayer.AddComponent<HoverTooltipArea>();
tooltip.enabled = true;
tooltip.SetMessageText(string.Format(LocaleUtils.UI_MMUI_RAID_DETAILS.Localized(), side,
Expand Down
Loading