Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaClient/ClientSource/Social/SocialExtensions.cs
2024-03-28 18:34:33 +02:00

34 lines
958 B
C#

using Barotrauma.Networking;
using Barotrauma.Steam;
namespace Barotrauma;
static class SocialExtensions
{
public static LocalizedString ViewProfileLabel(this AccountId accountId)
=> accountId switch
{
SteamId => TextManager.Get("ViewSteamProfile"),
EpicAccountId => TextManager.Get("ViewEpicProfile"),
_ => "View profile of unknown origin"
};
public static void OpenProfile(this AccountId accountId)
{
string url = accountId switch
{
SteamId steamId => $"https://steamcommunity.com/profiles/{steamId.Value}",
EpicAccountId epicAccountId => $"https://store.epicgames.com/u/{epicAccountId.EosStringRepresentation}",
_ => ""
};
if (SteamManager.IsInitialized)
{
SteamManager.OverlayCustomUrl(url);
}
else
{
GameMain.ShowOpenUriPrompt(url);
}
}
}