Skip to content

Commit

Permalink
Use nullable in response
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Oct 14, 2024
1 parent a3c2d35 commit bbf54b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Fika.Core/Networking/Models/FikaPlayerPresenceResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public struct FikaPlayerPresence
public bool InRaid;

[DataMember(Name = "raidInformation")]
public RaidInformation RaidInformation;
public RaidInformation? RaidInformation;

public FikaPlayerPresence(string nickname, int level, bool inRaid, RaidInformation raidInformation)
public FikaPlayerPresence(string nickname, int level, bool inRaid, RaidInformation? raidInformation)
{
Nickname = nickname;
Level = level;
Expand Down
7 changes: 4 additions & 3 deletions Fika.Core/UI/Custom/MainMenuUIScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ private void SetupPlayers(ref FikaPlayerPresence[] responses)
GameObject newPlayer = GameObject.Instantiate(playerTemplate, playerTemplate.transform.parent);
MainMenuUIPlayer mainMenuUIPlayer = newPlayer.GetComponent<MainMenuUIPlayer>();
mainMenuUIPlayer.SetStatus(presence.Nickname, presence.Level, presence.InRaid);
if (presence.InRaid)
if (presence.InRaid && presence.RaidInformation.HasValue)
{
string side = presence.RaidInformation.Side == EFT.ESideType.Pmc ? "PMC" : "Scav";
RaidInformation information = presence.RaidInformation.Value;
string side = information.Side == EFT.ESideType.Pmc ? "PMC" : "Scav";
TooltipTextGetter tooltipTextGetter = new()
{
TooltipText = $"Playing as a {side} on {ColorUtils.ColorizeText(Colors.BLUE, presence.RaidInformation.Location.Localized())}"
TooltipText = $"Playing as a {side} on {ColorUtils.ColorizeText(Colors.BLUE, information.Location.Localized())}"
};
HoverTooltipArea tooltip = newPlayer.AddComponent<HoverTooltipArea>();
tooltip.enabled = true;
Expand Down
2 changes: 1 addition & 1 deletion Fika.Core/UI/Patches/TarkovApplication_method_18_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override MethodBase GetTargetMethod()
}

[PatchPostfix]
internal static void PatchPostfix()
internal static void Postfix()
{
Singleton<PreloaderUI>.Instance.gameObject.AddComponent<FikaNotificationManager>();
}
Expand Down

0 comments on commit bbf54b0

Please sign in to comment.