- add: Favorites - start

This commit is contained in:
2025-01-28 19:59:35 +03:00
parent e1657d9234
commit 730e2e5529
11 changed files with 216 additions and 91 deletions

View File

@@ -2,4 +2,5 @@
<SolidColorBrush x:Key="DefaultBackground">#222222</SolidColorBrush> <SolidColorBrush x:Key="DefaultBackground">#222222</SolidColorBrush>
<SolidColorBrush x:Key="DefaultForeground">#121212</SolidColorBrush> <SolidColorBrush x:Key="DefaultForeground">#121212</SolidColorBrush>
<SolidColorBrush x:Key="DefaultSelected">#D95F59</SolidColorBrush> <SolidColorBrush x:Key="DefaultSelected">#D95F59</SolidColorBrush>
<BoxShadows x:Key="DefaultShadow">0 0 10 -1 #121212</BoxShadows>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -0,0 +1,79 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.Pages;
public partial class ServerListViewModel
{
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private RestService RestService { get; }
[ObservableProperty] private bool _favoriteVisible = false;
public List<(RobustUrl,ServerStatus)> FavoriteServers = new();
public ObservableCollection<ServerEntryModelView> SortedFavoriteServers { get; } = new();
private void SortFavorite()
{
SortedFavoriteServers.Clear();
FavoriteServers.Sort(new ServerComparer());
foreach (var server in FavoriteServers.Where(a => CheckServerThink(a.Item2)))
SortedFavoriteServers.Add(GetServerEntryModelView(server));
}
private ServerEntryModelView GetServerEntryModelView((RobustUrl, ServerStatus) server)
{
var model = ViewHelperService.GetViewModel<ServerEntryModelView>().WithData(server.Item1, server.Item2);
model.OnFavoriteToggle += ()=> RemoveFavorite(model);
return model;
}
private async void FetchFavorite()
{
FavoriteServers.Clear();
var servers = ConfigurationService.GetConfigValue(CurrentConVar.Favorites);
if (servers is null || servers.Length == 0)
{
FavoriteVisible = false;
return;
}
FavoriteVisible = true;
foreach (var server in servers)
{
var uri = server.ToRobustUrl();
var serverInfo = await RestService.GetAsync<ServerStatus>(uri.StatusUri, CancellationToken.None);
if (serverInfo.Value is null)
{
continue;
}
FavoriteServers.Add((uri, serverInfo.Value));
}
SortFavorite();
}
public void AddFavorite(ServerEntryModelView entryModelView)
{
var servers = (ConfigurationService.GetConfigValue(CurrentConVar.Favorites) ?? []).ToList();
servers.Add(entryModelView.Address.ToString());
ConfigurationService.SetConfigValue(CurrentConVar.Favorites, servers.ToArray());
}
public void RemoveFavorite(ServerEntryModelView entryModelView)
{
var servers = (ConfigurationService.GetConfigValue(CurrentConVar.Favorites) ?? []).ToList();
servers.Remove(entryModelView.Address.ToString());
ConfigurationService.SetConfigValue(CurrentConVar.Favorites, servers.ToArray());
}
}

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
@@ -8,6 +9,7 @@ using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Pages; using Nebula.Launcher.Views.Pages;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.Pages; namespace Nebula.Launcher.ViewModels.Pages;
@@ -26,6 +28,9 @@ public partial class ServerListViewModel : ViewModelBase
//Design think //Design think
protected override void InitialiseInDesignMode() protected override void InitialiseInDesignMode()
{ {
FavoriteVisible = true;
SortedFavoriteServers.Add(GetServerEntryModelView(("ss14://localhost".ToRobustUrl(),
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20))));
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost", ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), []))); new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), [])));
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost", ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
@@ -44,12 +49,14 @@ public partial class ServerListViewModel : ViewModelBase
OnSearchChange += OnChangeSearch; OnSearchChange += OnChangeSearch;
if (!HubService.IsUpdating) SortServers(); if (!HubService.IsUpdating) SortServers();
FetchFavorite();
} }
private void OnChangeSearch() private void OnChangeSearch()
{ {
if(string.IsNullOrEmpty(SearchText)) return; if(string.IsNullOrEmpty(SearchText)) return;
SortServers(); SortServers();
SortFavorite();
} }
private void HubServerChangedEventArgs(HubServerChangedEventArgs obj) private void HubServerChangedEventArgs(HubServerChangedEventArgs obj)
@@ -69,20 +76,20 @@ public partial class ServerListViewModel : ViewModelBase
{ {
ServerInfos.Clear(); ServerInfos.Clear();
UnsortedServers.Sort(new ServerComparer()); UnsortedServers.Sort(new ServerComparer());
foreach (var server in UnsortedServers.Where(CheckServerThink)) ServerInfos.Add(CreateServerView(server)); foreach (var server in UnsortedServers.Where(a => CheckServerThink(a.StatusData))) ServerInfos.Add(CreateServerView(server));
}); });
} }
private bool CheckServerThink(ServerHubInfo hubInfo) private bool CheckServerThink(ServerStatus hubInfo)
{ {
if (string.IsNullOrEmpty(SearchText)) return true; if (string.IsNullOrEmpty(SearchText)) return true;
return hubInfo.StatusData.Name.ToLower().Contains(SearchText.ToLower()); return hubInfo.Name.ToLower().Contains(SearchText.ToLower());
} }
private ServerEntryModelView CreateServerView(ServerHubInfo serverHubInfo) private ServerEntryModelView CreateServerView(ServerHubInfo serverHubInfo)
{ {
var svn = ViewHelperService.GetViewModel<ServerEntryModelView>(); var svn = ViewHelperService.GetViewModel<ServerEntryModelView>().WithData(serverHubInfo);
svn.ServerHubInfo = serverHubInfo; svn.OnFavoriteToggle += () => AddFavorite(svn);
return svn; return svn;
} }
@@ -96,7 +103,7 @@ public partial class ServerListViewModel : ViewModelBase
} }
} }
public class ServerComparer : IComparer<ServerHubInfo> public class ServerComparer : IComparer<ServerHubInfo>, IComparer<ServerStatus>, IComparer<(RobustUrl,ServerStatus)>
{ {
public int Compare(ServerHubInfo? x, ServerHubInfo? y) public int Compare(ServerHubInfo? x, ServerHubInfo? y)
{ {
@@ -107,6 +114,30 @@ public class ServerComparer : IComparer<ServerHubInfo>
if (ReferenceEquals(null, x)) if (ReferenceEquals(null, x))
return -1; return -1;
return y.StatusData.Players.CompareTo(x.StatusData.Players); return Compare(x.StatusData, y.StatusData);
}
public int Compare(ServerStatus? x, ServerStatus? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return y.Players.CompareTo(x.Players);
}
public int Compare((RobustUrl, ServerStatus) x, (RobustUrl, ServerStatus) y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return Compare(x.Item2, y.Item2);
} }
} }

View File

@@ -1,18 +1,13 @@
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Avalonia;
using Avalonia.Media; using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nebula.Launcher.Services; using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Popup; using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views; using Nebula.Launcher.Views;
@@ -27,8 +22,9 @@ namespace Nebula.Launcher.ViewModels;
public partial class ServerEntryModelView : ViewModelBase public partial class ServerEntryModelView : ViewModelBase
{ {
private Process? _p; private Process? _p;
public RobustUrl Address { get; private set; }
public Action? OnFavoriteToggle;
public LogPopupModelView CurrLog; public LogPopupModelView CurrLog;
[GenerateProperty] private AuthService AuthService { get; } = default!; [GenerateProperty] private AuthService AuthService { get; } = default!;
[GenerateProperty] private ContentService ContentService { get; } = default!; [GenerateProperty] private ContentService ContentService { get; } = default!;
@@ -40,8 +36,13 @@ public partial class ServerEntryModelView : ViewModelBase
[GenerateProperty] private RestService RestService { get; } = default!; [GenerateProperty] private RestService RestService { get; } = default!;
[ObservableProperty] private string _description = "Fetching info..."; [ObservableProperty] private string _description = "Fetching info...";
public ObservableCollection<ServerLink> Links { get; } = new();
[ObservableProperty] private bool _expandInfo = false; [ObservableProperty] private bool _expandInfo = false;
[ObservableProperty] private bool _tagDataVisible = false;
public ServerStatus Status { get; set; } =
new("", "", [], "", -1, -1, -1, false, DateTime.Now, -1);
public ObservableCollection<ServerLink> Links { get; } = new();
public bool RunVisible => Process == null; public bool RunVisible => Process == null;
private ServerInfo? _serverInfo = null; private ServerInfo? _serverInfo = null;
@@ -51,7 +52,7 @@ public partial class ServerEntryModelView : ViewModelBase
if (_serverInfo == null) if (_serverInfo == null)
{ {
var result = var result =
await RestService.GetAsync<ServerInfo>(ServerHubInfo.Address.ToRobustUrl().InfoUri, CancellationService.Token); await RestService.GetAsync<ServerInfo>(Address.InfoUri, CancellationService.Token);
if (result.Value == null) return null; if (result.Value == null) return null;
_serverInfo = result.Value; _serverInfo = result.Value;
} }
@@ -59,27 +60,6 @@ public partial class ServerEntryModelView : ViewModelBase
return _serverInfo; return _serverInfo;
} }
private ServerHubInfo _serverHubInfo = default!;
public ServerHubInfo ServerHubInfo
{
get => _serverHubInfo;
set
{
Tags.Clear();
foreach (var tag in value.StatusData.Tags)
{
Tags.Add(tag);
}
foreach (var tag in value.InferredTags)
{
Tags.Add(tag);
}
_serverHubInfo = value;
OnPropertyChanged(nameof(ServerHubInfo));
}
}
public ObservableCollection<string> Tags { get; } = []; public ObservableCollection<string> Tags { get; } = [];
public ICommand OnLinkGo { get; }= new LinkGoCommand(); public ICommand OnLinkGo { get; }= new LinkGoCommand();
@@ -98,13 +78,12 @@ public partial class ServerEntryModelView : ViewModelBase
{ {
Description = "Server of meow girls! Nya~ \nNyaMeow\nOOOINK!!"; Description = "Server of meow girls! Nya~ \nNyaMeow\nOOOINK!!";
Links.Add(new ServerLink("Discord","discord","https://cinka.ru")); Links.Add(new ServerLink("Discord","discord","https://cinka.ru"));
ServerHubInfo = new ServerHubInfo("ss14://localhost", Status = new ServerStatus("Ameba",
new ServerStatus("Ameba", "Locala meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow ",
"Locala meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow meow ", ["rp:hrp", "18+"],
["rp:hrp", "18+"], "Antag", 15, 5, 1, false
"Antag", 15, 5, 1, false , DateTime.Now, 100);
, DateTime.Now, 100), Address = "ss14://localhost".ToRobustUrl();
["meow:rp"]);
} }
protected override void Initialise() protected override void Initialise()
@@ -112,6 +91,41 @@ public partial class ServerEntryModelView : ViewModelBase
CurrLog = ViewHelperService.GetViewModel<LogPopupModelView>(); CurrLog = ViewHelperService.GetViewModel<LogPopupModelView>();
} }
public ServerEntryModelView WithData(ServerHubInfo value)
{
Status = value.StatusData;
Address = value.Address.ToRobustUrl();
Tags.Clear();
foreach (var tag in Status.Tags)
{
Tags.Add(tag);
}
foreach (var tag in value.InferredTags)
{
Tags.Add(tag);
}
return this;
}
public ServerEntryModelView WithData(RobustUrl url, ServerStatus serverStatus)
{
Status = serverStatus;
Address = url;
Tags.Clear();
foreach (var tag in Status.Tags)
{
Tags.Add(tag);
}
return this;
}
public void ToggleFavorites()
{
OnFavoriteToggle?.Invoke();
}
public void RunInstance() public void RunInstance()
{ {
Task.Run(RunAsync); Task.Run(RunAsync);
@@ -124,7 +138,7 @@ public partial class ServerEntryModelView : ViewModelBase
var authProv = AuthService.SelectedAuth; var authProv = AuthService.SelectedAuth;
var buildInfo = var buildInfo =
await ContentService.GetBuildInfo(new RobustUrl(ServerHubInfo.Address), CancellationService.Token); await ContentService.GetBuildInfo(Address, CancellationService.Token);
using (var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>()) using (var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>())
{ {
@@ -145,7 +159,7 @@ public partial class ServerEntryModelView : ViewModelBase
{ "ROBUST_AUTH_TOKEN", authProv?.Token.Token }, { "ROBUST_AUTH_TOKEN", authProv?.Token.Token },
{ "ROBUST_AUTH_SERVER", authProv?.AuthLoginPassword.AuthServer }, { "ROBUST_AUTH_SERVER", authProv?.AuthLoginPassword.AuthServer },
{ "ROBUST_AUTH_PUBKEY", buildInfo.BuildInfo.Auth.PublicKey }, { "ROBUST_AUTH_PUBKEY", buildInfo.BuildInfo.Auth.PublicKey },
{ "GAME_URL", ServerHubInfo.Address }, { "GAME_URL", Address.ToString() },
{ "AUTH_LOGIN", authProv?.AuthLoginPassword.Login } { "AUTH_LOGIN", authProv?.AuthLoginPassword.Login }
}, },
CreateNoWindow = true, CreateNoWindow = true,

View File

@@ -1,5 +1,5 @@
<UserControl <UserControl
Background="{StaticResource DefaultBackground}" Background="#1a1a1a"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d" mc:Ignorable="d"
@@ -39,7 +39,7 @@
<SplitView.Pane> <SplitView.Pane>
<Border <Border
Background="{StaticResource DefaultBackground}" Background="{StaticResource DefaultBackground}"
BoxShadow="0 0 5 0 #121212" BoxShadow="0 0 15 -2 #121212"
CornerRadius="0,8,8,0" CornerRadius="0,8,8,0"
Grid.Column="0" Grid.Column="0"
Grid.Row="0" Grid.Row="0"
@@ -79,7 +79,7 @@
<Border <Border
Background="{StaticResource DefaultBackground}" Background="{StaticResource DefaultBackground}"
BoxShadow="0 0 5 0 #121212" BoxShadow="{StaticResource DefaultShadow}"
CornerRadius="0,0,0,0" CornerRadius="0,0,0,0"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
@@ -103,7 +103,7 @@
https://cinka.ru/nebula-launcher/ https://cinka.ru/nebula-launcher/
</TextBlock> </TextBlock>
</Button> </Button>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">prototype-product-v0.01</TextBlock> <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">v0.02-a</TextBlock>
</Panel> </Panel>
</Label> </Label>
</Border> </Border>
@@ -118,7 +118,7 @@
<Grid RowDefinitions="35,*,20"> <Grid RowDefinitions="35,*,20">
<Border <Border
BorderBrush="{StaticResource DefaultForeground}" BorderBrush="{StaticResource DefaultForeground}"
BorderThickness="0,0,0,2" BoxShadow="0 2 15 -2 #121212"
CornerRadius="10,10,0,0" CornerRadius="10,10,0,0"
Grid.Row="0"> Grid.Row="0">
<Panel Margin="12,0,0,0" VerticalAlignment="Center"> <Panel Margin="12,0,0,0" VerticalAlignment="Center">
@@ -141,7 +141,7 @@
<Border <Border
BorderBrush="{StaticResource DefaultForeground}" BorderBrush="{StaticResource DefaultForeground}"
BorderThickness="0,2,0,0" BoxShadow="0 -2 15 -2 #121212"
CornerRadius="0,0,10,10" CornerRadius="0,0,10,10"
Grid.Row="2"> Grid.Row="2">
<Panel Margin="12,0,12,0" VerticalAlignment="Center"> <Panel Margin="12,0,12,0" VerticalAlignment="Center">

View File

@@ -13,12 +13,13 @@
<pages:AccountInfoViewModel /> <pages:AccountInfoViewModel />
</Design.DataContext> </Design.DataContext>
<Grid <Grid
ColumnDefinitions="*,1.5*" ColumnDefinitions="*,1*"
Margin="15" Margin="15"
RowDefinitions="*"> RowDefinitions="*">
<StackPanel Grid.Column="1" Grid.Row="0"> <StackPanel Grid.Column="1" Grid.Row="0">
<Border <Border
BoxShadow="0 -1 15 0 #121212" Background="{StaticResource DefaultBackground}"
BoxShadow="0 -1 15 -2 #121212"
CornerRadius="10,10,0,0" CornerRadius="10,10,0,0"
Margin="5,5,5,0" Margin="5,5,5,0"
Padding="5"> Padding="5">
@@ -32,7 +33,8 @@
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type pages:AuthLoginPasswordModel}"> <DataTemplate DataType="{x:Type pages:AuthLoginPasswordModel}">
<Border <Border
BoxShadow="0 1 15 0 #121212" Background="{StaticResource DefaultBackground}"
BoxShadow="0 1 15 -2 #121212"
CornerRadius="0,10,0,10" CornerRadius="0,10,0,10"
Margin="5,5,5,5" Margin="5,5,5,5"
VerticalAlignment="Center"> VerticalAlignment="Center">
@@ -74,7 +76,8 @@
Grid.ColumnSpan="{Binding AuthViewSpan}" Grid.ColumnSpan="{Binding AuthViewSpan}"
Grid.Row="0"> Grid.Row="0">
<Border <Border
BoxShadow="0 0 15 0 #121212" Background="{StaticResource DefaultBackground}"
BoxShadow="{StaticResource DefaultShadow}"
CornerRadius="10" CornerRadius="10"
Margin="5" Margin="5"
Padding="15"> Padding="15">
@@ -109,7 +112,7 @@
</StackPanel> </StackPanel>
<Border <Border
BoxShadow="0 0 5 0 #121212" BoxShadow="{StaticResource DefaultShadow}"
CornerRadius="10" CornerRadius="10"
IsVisible="{Binding AuthUrlConfigExpand}"> IsVisible="{Binding AuthUrlConfigExpand}">
<ScrollViewer Height="80"> <ScrollViewer Height="80">
@@ -129,7 +132,7 @@
</ListBox> </ListBox>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
<Border BoxShadow="0 0 5 0 #121212"> <Border Background="{StaticResource DefaultSelected}" BoxShadow="{StaticResource DefaultShadow}">
<Button <Button
Command="{Binding DoAuth}" Command="{Binding DoAuth}"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@@ -160,12 +163,12 @@
Margin="5,20,5,5" Margin="5,20,5,5"
Orientation="Horizontal" Orientation="Horizontal"
Spacing="5"> Spacing="5">
<Border BoxShadow="0 0 5 0 #121212"> <Border BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding Logout}"> <Button Command="{Binding Logout}">
<Label>Logout</Label> <Label>Logout</Label>
</Button> </Button>
</Border> </Border>
<Border BoxShadow="0 0 5 0 #121212"> <Border BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding SaveProfileCommand}"> <Button Command="{Binding SaveProfileCommand}">
<Label>Save profile</Label> <Label>Save profile</Label>
</Button> </Button>

View File

@@ -1,11 +0,0 @@
<UserControl
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.Pages.FavoriteServerListView"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Welcome to Avalonia!
</UserControl>

View File

@@ -1,11 +0,0 @@
using Avalonia.Controls;
namespace Nebula.Launcher.Views.Pages;
public partial class FavoriteServerListView : UserControl
{
public FavoriteServerListView()
{
InitializeComponent();
}
}

View File

@@ -22,7 +22,24 @@
Grid.RowSpan="2" Grid.RowSpan="2"
Margin="0,0,0,10" Margin="0,0,0,10"
Padding="0,0,10,0"> Padding="0,0,10,0">
<ItemsControl ItemsSource="{Binding ServerInfos}" Padding="0" /> <StackPanel Spacing="5">
<Border
Background="{StaticResource DefaultSelected}"
BoxShadow="{StaticResource DefaultShadow}"
IsVisible="{Binding FavoriteVisible}"
Margin="5">
<StackPanel Margin="0,10,0,10" Spacing="5">
<Label
HorizontalAlignment="Center"
Margin="5"
VerticalAlignment="Center">
Favorites
</Label>
<ItemsControl ItemsSource="{Binding SortedFavoriteServers}" Padding="0" />
</StackPanel>
</Border>
<ItemsControl ItemsSource="{Binding ServerInfos}" Padding="0" />
</StackPanel>
</ScrollViewer> </ScrollViewer>
<Border <Border

View File

@@ -19,8 +19,8 @@
</Design.DataContext> </Design.DataContext>
<Border <Border
Background="Transparent" Background="{StaticResource DefaultBackground}"
BoxShadow="-2 0 18 -1 #121212" BoxShadow="-2 0 5 -1 #121212"
CornerRadius="10" CornerRadius="10"
Margin="5"> Margin="5">
<Grid ColumnDefinitions="*,80,50" RowDefinitions="35,*,*"> <Grid ColumnDefinitions="*,80,50" RowDefinitions="35,*,*">
@@ -46,7 +46,7 @@
VerticalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"
x:Name="AutoScrollViewer"> x:Name="AutoScrollViewer">
<Label VerticalAlignment="Center"> <Label VerticalAlignment="Center">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Name}" /> <TextBlock Text="{Binding Status.Name}" />
</Label> </Label>
</ScrollViewer> </ScrollViewer>
</Button> </Button>
@@ -58,15 +58,14 @@
Orientation="Horizontal" Orientation="Horizontal"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Label> <Label>
<TextBlock Text="{Binding ServerHubInfo.StatusData.Players}" /> <TextBlock Text="{Binding Status.Players}" />
</Label> </Label>
<Label>/</Label> <Label>/</Label>
<Label> <Label>
<TextBlock Text="{Binding ServerHubInfo.StatusData.SoftMaxPlayers}" /> <TextBlock Text="{Binding Status.SoftMaxPlayers}" />
</Label> </Label>
</StackPanel> </StackPanel>
<Panel <Panel
Grid.Column="2" Grid.Column="2"
Grid.Row="0" Grid.Row="0"
@@ -152,7 +151,7 @@
Margin="5" Margin="5"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Label FontSize="10" Margin="5,0,5,0"> <Label FontSize="10" Margin="5,0,5,0">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Map}" /> <TextBlock Text="{Binding Status.Map}" />
</Label> </Label>
</Border> </Border>
</StackPanel> </StackPanel>
@@ -167,7 +166,7 @@
Margin="5" Margin="5"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Label FontSize="10" Margin="5,0,5,0"> <Label FontSize="10" Margin="5,0,5,0">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Preset}" /> <TextBlock Text="{Binding Status.Preset}" />
</Label> </Label>
</Border> </Border>
</StackPanel> </StackPanel>

View File

@@ -29,4 +29,7 @@ public static class CurrentConVar
public static readonly ConVar<AuthLoginPassword> AuthCurrent = public static readonly ConVar<AuthLoginPassword> AuthCurrent =
ConVarBuilder.Build<AuthLoginPassword>("auth.current"); ConVarBuilder.Build<AuthLoginPassword>("auth.current");
public static readonly ConVar<string[]> Favorites =
ConVarBuilder.Build<string[]>("server.favorites", []);
} }