2025-01-20 12:10:30 -06:00
|
|
|
@using LANCommander.Launcher.Data.Models
|
|
|
|
|
@using LANCommander.Launcher.Models
|
|
|
|
|
@inject UserService UserService
|
2025-01-18 20:25:39 -06:00
|
|
|
@inject ProfileService ProfileService
|
|
|
|
|
@inject AuthenticationService AuthenticationService
|
2024-10-06 17:11:35 -05:00
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
@inject ModalService ModalService
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2024-10-06 17:11:35 -05:00
|
|
|
|
|
|
|
|
<Dropdown>
|
|
|
|
|
<Overlay>
|
|
|
|
|
<Menu>
|
2025-01-18 20:25:39 -06:00
|
|
|
<MenuItem OnClick="ChangeAlias" Disabled="ConnectionState.OfflineModeEnabled">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("ChangeName")
|
2024-10-06 17:11:35 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
<MenuItem OnClick="@(() => NavigationManager.NavigateTo("/Settings"))">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("Settings")
|
2024-10-06 17:11:35 -05:00
|
|
|
</MenuItem>
|
|
|
|
|
|
2025-06-10 01:53:02 +02:00
|
|
|
@if (!Settings.Authentication.OfflineMode)
|
|
|
|
|
{
|
|
|
|
|
<MenuItem OnClick="SwitchToOfflineMode">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("SwitchToOfflineMode")
|
2025-06-10 01:53:02 +02:00
|
|
|
</MenuItem>
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-15 22:25:58 +02:00
|
|
|
<MenuItem OnClick="Logout">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("Logout")
|
2025-06-15 22:25:58 +02:00
|
|
|
</MenuItem>
|
2024-10-06 17:11:35 -05:00
|
|
|
</Menu>
|
|
|
|
|
</Overlay>
|
|
|
|
|
|
|
|
|
|
<ChildContent>
|
2024-12-31 18:21:41 -06:00
|
|
|
<Button Type="ButtonType.Primary" Class="appbar-profile-button">
|
2025-01-25 15:22:25 -06:00
|
|
|
@if (AvatarId != Guid.Empty)
|
2024-10-06 17:11:35 -05:00
|
|
|
{
|
2025-01-25 15:22:25 -06:00
|
|
|
<MediaImage Id="AvatarId" />
|
2024-10-06 17:11:35 -05:00
|
|
|
}
|
|
|
|
|
|
2025-01-25 15:22:25 -06:00
|
|
|
<span>@Alias</span>
|
2024-10-06 17:11:35 -05:00
|
|
|
</Button>
|
|
|
|
|
</ChildContent>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
|
|
|
|
|
@code {
|
2025-01-18 20:25:39 -06:00
|
|
|
[CascadingParameter] public ConnectionState ConnectionState { get; set; }
|
2025-06-10 01:53:02 +02:00
|
|
|
Models.Settings Settings = SettingService.GetSettings();
|
2024-10-06 17:11:35 -05:00
|
|
|
|
2025-01-20 12:10:30 -06:00
|
|
|
User User;
|
2025-01-25 15:22:25 -06:00
|
|
|
Guid AvatarId = Guid.Empty;
|
2025-05-13 00:17:14 +02:00
|
|
|
string Alias = Settings.DEFAULT_GAME_USERNAME;
|
2025-01-20 12:10:30 -06:00
|
|
|
|
2024-10-06 17:11:35 -05:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
2025-02-16 16:46:31 -06:00
|
|
|
ProfileService.OnProfileDownloaded += async (sender, args) =>
|
|
|
|
|
{
|
|
|
|
|
User = await UserService.GetCurrentUser();
|
2025-01-25 15:22:25 -06:00
|
|
|
|
2025-02-16 16:46:31 -06:00
|
|
|
AvatarId = User?.Avatar?.Id ?? Guid.Empty;
|
2025-05-13 00:17:14 +02:00
|
|
|
Alias = String.IsNullOrWhiteSpace(User?.Alias) ? User?.UserName ?? Settings.DEFAULT_GAME_USERNAME : User.Alias;
|
2025-02-16 16:46:31 -06:00
|
|
|
};
|
2025-06-09 20:07:39 +02:00
|
|
|
|
|
|
|
|
if (ConnectionState.OfflineModeEnabled)
|
|
|
|
|
{
|
|
|
|
|
string userName = AuthenticationService.GetCurrentUserName();
|
|
|
|
|
Alias = string.IsNullOrEmpty(userName) ? Alias : userName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await ProfileService.DownloadProfileInfoAsync();
|
|
|
|
|
}
|
2024-10-06 17:11:35 -05:00
|
|
|
}
|
2025-02-16 16:46:31 -06:00
|
|
|
|
2024-10-06 17:11:35 -05:00
|
|
|
|
|
|
|
|
async Task ChangeAlias()
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions()
|
|
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
Title = LocalizationService.GetString("ChangeName"),
|
2024-10-06 17:11:35 -05:00
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
Centered = true
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-20 12:10:30 -06:00
|
|
|
var modalRef = ModalService.CreateModal<ChangeAliasDialog, string, string>(modalOptions, User.Alias);
|
2024-10-06 17:11:35 -05:00
|
|
|
|
|
|
|
|
modalRef.OnOk = async (newName) =>
|
|
|
|
|
{
|
|
|
|
|
await ProfileService.ChangeAlias(newName);
|
2025-01-25 02:58:10 -06:00
|
|
|
await ProfileService.DownloadProfileInfoAsync();
|
2024-10-06 17:11:35 -05:00
|
|
|
|
|
|
|
|
Settings = SettingService.GetSettings();
|
|
|
|
|
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task Logout()
|
|
|
|
|
{
|
2025-01-18 20:25:39 -06:00
|
|
|
await AuthenticationService.Logout();
|
2024-10-06 17:11:35 -05:00
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("/Authenticate");
|
|
|
|
|
}
|
2025-06-10 01:53:02 +02:00
|
|
|
|
|
|
|
|
void SwitchToOfflineMode()
|
|
|
|
|
{
|
|
|
|
|
AuthenticationService.SetOfflineMode(true);
|
|
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("/", forceLoad: true);
|
|
|
|
|
}
|
2024-10-06 17:11:35 -05:00
|
|
|
}
|