0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 03:10:44 -05:00

Merge pull request 'master' (#6) from SPT-AKI/Launcher:master into master

Reviewed-on: waffle.lord/Launcher#6
This commit is contained in:
IsWaffle 2023-09-30 18:55:25 +00:00
commit 5a13abf403
17 changed files with 128 additions and 38 deletions

View File

@ -19,7 +19,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
## Requirements ## Requirements
- Escape From Tarkov 25837 - Escape From Tarkov 26215
- .NET 6 SDK - .NET 6 SDK
- Visual Studio Code - Visual Studio Code

View File

@ -176,6 +176,7 @@ namespace Aki.Launcher.Helpers
englishLocale.server_mods = "Server Mods"; englishLocale.server_mods = "Server Mods";
englishLocale.profile_mods = "Profile Mods"; englishLocale.profile_mods = "Profile Mods";
englishLocale.author = "Author"; englishLocale.author = "Author";
englishLocale.wipe_on_start = "Wipe profile on game start";
#endregion #endregion
Directory.CreateDirectory(LocalizationProvider.DefaultLocaleFolderPath); Directory.CreateDirectory(LocalizationProvider.DefaultLocaleFolderPath);
@ -1605,6 +1606,22 @@ namespace Aki.Launcher.Helpers
#endregion #endregion
#region wipe_on_start
private string _wipe_on_start;
public string wipe_on_start
{
get => _wipe_on_start;
set
{
if (_wipe_on_start != value)
{
_wipe_on_start = value;
RaisePropertyChanged(nameof(wipe_on_start));
}
}
}
#endregion
#endregion #endregion
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Autor", "author": "Autor",
"load_live_settings": "Wczytaj ustawienia EFT", "load_live_settings": "Wczytaj ustawienia EFT",
"load_live_settings_succeeded": "Ustawienia gry skopiowane z EFT", "load_live_settings_succeeded": "Ustawienia gry skopiowane z EFT",
"load_live_settings_failed": "Nie udało się skopiować ustawień EFT" "load_live_settings_failed": "Nie udało się skopiować ustawień EFT",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Автор", "author": "Автор",
"load_live_settings": "Загрузить настройкий онлайн-версии", "load_live_settings": "Загрузить настройкий онлайн-версии",
"load_live_settings_succeeded": "Настройки игры скопированы из онлайн-версии", "load_live_settings_succeeded": "Настройки игры скопированы из онлайн-версии",
"load_live_settings_failed": "Не удалось скопировать настройки онлайн-версии" "load_live_settings_failed": "Не удалось скопировать настройки онлайн-версии",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -85,5 +85,6 @@
"author": "Author", "author": "Author",
"load_live_settings": "Load Live Settings", "load_live_settings": "Load Live Settings",
"load_live_settings_succeeded": "Game settings copied from live", "load_live_settings_succeeded": "Game settings copied from live",
"load_live_settings_failed": "Failed to copy live settings" "load_live_settings_failed": "Failed to copy live settings",
"wipe_on_start": "Wipe profile on game start"
} }

View File

@ -8,6 +8,7 @@
<Button Content="Blah"/> <Button Content="Blah"/>
<TextBox Text="Some cool text here" Margin="5"/> <TextBox Text="Some cool text here" Margin="5"/>
<TextBox Watermark="This is a watermark" Margin="5"/> <TextBox Watermark="This is a watermark" Margin="5"/>
<CheckBox Content="This is a checkbox"/>
</StackPanel> </StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
@ -297,6 +298,14 @@
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/> <Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
</Style> </Style>
<Style Selector="CheckBox /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
</Style>
<Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_Yellow}"/>
</Style>
<Style Selector="CheckBox:pointerover /template/ ContentPresenter#ContentPresenter"> <Style Selector="CheckBox:pointerover /template/ ContentPresenter#ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Foreground_Light}" /> <Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Foreground_Light}" />
</Style> </Style>

View File

@ -34,6 +34,20 @@ namespace Aki.Launcher.ViewModels
set => this.RaiseAndSetIfChanged(ref _ModsListIsVisible, value); set => this.RaiseAndSetIfChanged(ref _ModsListIsVisible, value);
} }
private bool _WipeProfileOnStart;
public bool WipeProfileOnStart
{
get => _WipeProfileOnStart;
set => this.RaiseAndSetIfChanged(ref _WipeProfileOnStart, value);
}
private bool _ProfileWipePending;
public bool ProfileWipePending
{
get => _ProfileWipePending;
set => this.RaiseAndSetIfChanged(ref _ProfileWipePending, value);
}
public string CurrentID { get; set; } public string CurrentID { get; set; }
public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo; public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo;
@ -144,6 +158,19 @@ namespace Aki.Launcher.ViewModels
LauncherSettingsProvider.Instance.GameRunning = true; LauncherSettingsProvider.Instance.GameRunning = true;
if (WipeProfileOnStart)
{
var wipeStatus = await WipeProfile(AccountManager.SelectedAccount.edition);
if (wipeStatus != AccountStatus.OK)
{
LauncherSettingsProvider.Instance.GameRunning = false;
return;
}
WipeProfileOnStart = false;
}
GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath); GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath);
if (gameStartResult.Succeeded) if (gameStartResult.Succeeded)
@ -171,18 +198,15 @@ namespace Aki.Launcher.ViewModels
} }
} }
public async Task ChangeEditionCommand() private async Task<AccountStatus> WipeProfile(string edition)
{ {
var result = await ShowDialog(new ChangeEditionDialogViewModel(null)); AccountStatus status = await AccountManager.WipeAsync(edition);
if(result != null && result is AkiEdition edition)
{
AccountStatus status = await AccountManager.WipeAsync(edition.Name);
switch (status) switch (status)
{ {
case AccountStatus.OK: case AccountStatus.OK:
{ {
ProfileWipePending = true;
CurrentEdition = AccountManager.SelectedAccount.edition; CurrentEdition = AccountManager.SelectedAccount.edition;
SendNotification("", LocalizationProvider.Instance.account_updated); SendNotification("", LocalizationProvider.Instance.account_updated);
break; break;
@ -198,6 +222,17 @@ namespace Aki.Launcher.ViewModels
break; break;
} }
} }
return status;
}
public async Task ChangeEditionCommand()
{
var result = await ShowDialog(new ChangeEditionDialogViewModel(null));
if(result != null && result is AkiEdition edition)
{
await WipeProfile(edition.Name);
} }
} }
@ -285,6 +320,7 @@ namespace Aki.Launcher.ViewModels
case LauncherAction.MinimizeAction: case LauncherAction.MinimizeAction:
{ {
ChangeWindowState(Avalonia.Controls.WindowState.Normal); ChangeWindowState(Avalonia.Controls.WindowState.Normal);
ProfileWipePending = false;
break; break;
} }

View File

@ -19,13 +19,13 @@
<Border Grid.Row="1" Grid.Column="1" CornerRadius="5" <Border Grid.Row="1" Grid.Column="1" CornerRadius="5"
BorderBrush="{StaticResource AKI_Background_Dark}" BorderBrush="{StaticResource AKI_Background_Dark}"
BorderThickness="5"> BorderThickness="5">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10" <Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10"
Background="{StaticResource AKI_Background_Dark}" Background="{StaticResource AKI_Background_Dark}"
> >
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1"> <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding CurrentUsername}" Margin="5 0"/> <Label Content="{Binding CurrentUsername}" Margin="5 0"/>
<!--Grid.Row="1" Grid.Column="4"--> <!-- profile name and version -->
<Label x:Name="akiVersion" <Label x:Name="akiVersion"
Background="Transparent" Background="Transparent"
ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}" ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}"
@ -41,19 +41,36 @@
</Label> </Label>
</StackPanel> </StackPanel>
<!-- delete profile button -->
<Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" <Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2"
Classes="icon" Classes="icon"
Command="{Binding RemoveProfileCommand}" Command="{Binding RemoveProfileCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
> >
<Path Data="{StaticResource Delete}" Fill="IndianRed"/> <Path Data="{StaticResource Delete}" Fill="IndianRed"/>
</Button> </Button>
<!-- profile id button -->
<Button Content="{Binding CurrentID}" Classes="link" <Button Content="{Binding CurrentID}" Classes="link"
Grid.Row="2" Grid.Column="1" Grid.Row="2" Grid.Column="1"
Command="{Binding CopyCommand}" Command="{Binding CopyCommand}"
CommandParameter="{Binding CurrentID}"/> CommandParameter="{Binding CurrentID}"
/>
<!-- profile edition button -->
<Button Content="{Binding CurrentEdition}" Classes="link" <Button Content="{Binding CurrentEdition}" Classes="link"
Grid.Row="3" Grid.Column="1" Grid.Row="3" Grid.Column="1"
Command="{Binding ChangeEditionCommand}"/> Command="{Binding ChangeEditionCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
/>
<!-- wipe profile checkbox -->
<CheckBox Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_on_start}"
Grid.Row="4" Grid.Column="1"
IsChecked="{Binding WipeProfileOnStart}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
IsVisible="{Binding !ProfileWipePending}"
/>
</Grid> </Grid>
</Border> </Border>