0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 21:30:43 -05:00

Merge pull request 'added edition tooltips, cleaned up some namespaces' (!3) from waffle.lord/Launcher:add-edition-tooltips into master

Reviewed-on: SPT-AKI/Launcher#3
This commit is contained in:
chomp 2023-03-16 10:26:12 +00:00
commit 08d0c6ed4f
11 changed files with 64 additions and 24 deletions

View File

@ -0,0 +1,17 @@
using Aki.Launcher;
namespace Aki.Launcher.Models.Aki
{
public class AkiEdition
{
public string Name { get; set; }
public string Description { get; set; }
public AkiEdition(string name)
{
Name = name;
ServerManager.SelectedServer.profileDescriptions.TryGetValue(name, out string desc);
Description = desc;
}
}
}

View File

@ -1,6 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
namespace Aki.Launch.Models.Aki namespace Aki.Launcher.Models.Aki
{ {
public class AkiVersion : INotifyPropertyChanged public class AkiVersion : INotifyPropertyChanged
{ {

View File

@ -7,6 +7,8 @@
*/ */
using System.Collections.Generic;
namespace Aki.Launcher namespace Aki.Launcher
{ {
public class ServerInfo public class ServerInfo
@ -14,12 +16,14 @@ namespace Aki.Launcher
public string backendUrl; public string backendUrl;
public string name; public string name;
public string[] editions; public string[] editions;
public Dictionary<string, string> profileDescriptions;
public ServerInfo() public ServerInfo()
{ {
backendUrl = "http://127.0.0.1:6969"; backendUrl = "http://127.0.0.1:6969";
name = "Local SPT-AKI Server"; name = "Local SPT-AKI Server";
editions = new string[0]; editions = new string[0];
profileDescriptions = new Dictionary<string, string>();
} }
} }
} }

View File

@ -7,6 +7,7 @@
*/ */
using Aki.Launcher.Models.Aki;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
@ -41,8 +42,8 @@ namespace Aki.Launcher.Models.Launcher
} }
} }
private string _SelectedEdition; private AkiEdition _SelectedEdition;
public string SelectedEdition public AkiEdition SelectedEdition
{ {
get => _SelectedEdition; get => _SelectedEdition;
set set
@ -55,11 +56,16 @@ namespace Aki.Launcher.Models.Launcher
} }
} }
} }
public ObservableCollection<string> AvailableEditions { get; private set; } = new ObservableCollection<string>(ServerManager.SelectedServer.editions); public ObservableCollection<AkiEdition> AvailableEditions { get; private set; } = new ObservableCollection<AkiEdition>();
public EditionCollection() public EditionCollection()
{ {
SelectedEditionIndex = 0; SelectedEditionIndex = 0;
foreach(var edition in ServerManager.SelectedServer.editions)
{
AvailableEditions.Add(new AkiEdition(edition));
}
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

View File

@ -6,7 +6,6 @@
* waffle.lord * waffle.lord
*/ */
using Aki.Launch.Models.Aki;
using Aki.Launcher.Helpers; using Aki.Launcher.Helpers;
using Aki.Launcher.MiniCommon; using Aki.Launcher.MiniCommon;
using Aki.Launcher.Models.Aki; using Aki.Launcher.Models.Aki;

View File

@ -1,4 +1,4 @@
using Aki.Launch.Models.Aki; using Aki.Launcher.Models.Aki;
using Aki.Launcher.Helpers; using Aki.Launcher.Helpers;
using Aki.Launcher.Models.Launcher; using Aki.Launcher.Models.Launcher;
using ReactiveUI; using ReactiveUI;

View File

@ -50,9 +50,9 @@ namespace Aki.Launcher.ViewModels
{ {
var result = await ShowDialog(new RegisterDialogViewModel(null, Login.Username)); var result = await ShowDialog(new RegisterDialogViewModel(null, Login.Username));
if (result != null && result is string edition) if (result != null && result is AkiEdition edition)
{ {
AccountStatus registerResult = await AccountManager.RegisterAsync(Login.Username, Login.Password, edition); AccountStatus registerResult = await AccountManager.RegisterAsync(Login.Username, Login.Password, edition.Name);
switch (registerResult) switch (registerResult)
{ {

View File

@ -5,7 +5,7 @@ using Aki.Launcher.Models;
using Aki.Launcher.MiniCommon; using Aki.Launcher.MiniCommon;
using System.IO; using System.IO;
using Splat; using Splat;
using Aki.Launch.Models.Aki; using Aki.Launcher.Models.Aki;
using Aki.Launcher.Helpers; using Aki.Launcher.Helpers;
namespace Aki.Launcher.ViewModels namespace Aki.Launcher.ViewModels

View File

@ -11,6 +11,7 @@ using Avalonia.Threading;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using Aki.Launcher.Models.Aki;
namespace Aki.Launcher.ViewModels namespace Aki.Launcher.ViewModels
{ {
@ -161,9 +162,9 @@ namespace Aki.Launcher.ViewModels
{ {
var result = await ShowDialog(new ChangeEditionDialogViewModel(null)); var result = await ShowDialog(new ChangeEditionDialogViewModel(null));
if(result != null && result is string edition) if(result != null && result is AkiEdition edition)
{ {
AccountStatus status = await AccountManager.WipeAsync(edition); AccountStatus status = await AccountManager.WipeAsync(edition.Name);
switch (status) switch (status)
{ {

View File

@ -15,11 +15,17 @@
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_warning}" Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_warning}"
Foreground="IndianRed" Foreground="IndianRed"
/> />
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" <ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Items="{Binding editions.AvailableEditions}" Items="{Binding editions.AvailableEditions}"
SelectedItem="{Binding editions.SelectedEdition}" SelectedItem="{Binding editions.SelectedEdition}"
PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}" PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}"
/> >
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<StackPanel Spacing="10" Grid.Row="3" Grid.Column="2" Orientation="Horizontal"> <StackPanel Spacing="10" Grid.Row="3" Grid.Column="2" Orientation="Horizontal">
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=update}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=update}"

View File

@ -14,14 +14,21 @@
<TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15" <TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15"
Foreground="{StaticResource AKI_Foreground_Light}" Foreground="{StaticResource AKI_Foreground_Light}"
/> />
<ComboBox Items="{Binding Editions.AvailableEditions}" <ComboBox Items="{Binding Editions.AvailableEditions}"
Margin="0 10" Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2" Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}" SelectedItem="{Binding Editions.SelectedEdition}"
PlaceholderText="{Binding ComboBoxPlaceholderText}" PlaceholderText="{Binding ComboBoxPlaceholderText}"
/> >
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<StackPanel Grid.Row="2" Grid.Column="1" <StackPanel Grid.Row="2" Grid.Column="1"
Orientation="Horizontal" Spacing="10" Orientation="Horizontal" Spacing="10"