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

added edition tooltips, cleaned up some namespaces

This commit is contained in:
IsWaffle 2023-03-15 19:34:29 -04:00
parent ea6cd3640e
commit c1679ff141
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;
namespace Aki.Launch.Models.Aki
namespace Aki.Launcher.Models.Aki
{
public class AkiVersion : INotifyPropertyChanged
{

View File

@ -7,6 +7,8 @@
*/
using System.Collections.Generic;
namespace Aki.Launcher
{
public class ServerInfo
@ -14,12 +16,14 @@ namespace Aki.Launcher
public string backendUrl;
public string name;
public string[] editions;
public Dictionary<string, string> profileDescriptions;
public ServerInfo()
{
backendUrl = "http://127.0.0.1:6969";
name = "Local SPT-AKI Server";
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.ComponentModel;
@ -41,8 +42,8 @@ namespace Aki.Launcher.Models.Launcher
}
}
private string _SelectedEdition;
public string SelectedEdition
private AkiEdition _SelectedEdition;
public AkiEdition SelectedEdition
{
get => _SelectedEdition;
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()
{
SelectedEditionIndex = 0;
foreach(var edition in ServerManager.SelectedServer.editions)
{
AvailableEditions.Add(new AkiEdition(edition));
}
}
public event PropertyChangedEventHandler PropertyChanged;

View File

@ -6,7 +6,6 @@
* waffle.lord
*/
using Aki.Launch.Models.Aki;
using Aki.Launcher.Helpers;
using Aki.Launcher.MiniCommon;
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.Models.Launcher;
using ReactiveUI;

View File

@ -50,9 +50,9 @@ namespace Aki.Launcher.ViewModels
{
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)
{

View File

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

View File

@ -11,6 +11,7 @@ using Avalonia.Threading;
using System.Reactive.Disposables;
using System.Diagnostics;
using System.IO;
using Aki.Launcher.Models.Aki;
namespace Aki.Launcher.ViewModels
{
@ -161,9 +162,9 @@ namespace Aki.Launcher.ViewModels
{
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)
{

View File

@ -15,11 +15,17 @@
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_warning}"
Foreground="IndianRed"
/>
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Items="{Binding editions.AvailableEditions}"
SelectedItem="{Binding editions.SelectedEdition}"
PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}"
/>
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Items="{Binding editions.AvailableEditions}"
SelectedItem="{Binding editions.SelectedEdition}"
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">
<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"
Foreground="{StaticResource AKI_Foreground_Light}"
/>
<ComboBox Items="{Binding Editions.AvailableEditions}"
Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}"
PlaceholderText="{Binding ComboBoxPlaceholderText}"
/>
<ComboBox Items="{Binding Editions.AvailableEditions}"
Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}"
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"
Orientation="Horizontal" Spacing="10"