Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba8153e6b4 | |||
| c4ff903c57 |
@@ -20,13 +20,13 @@ public static class LauncherConVar
|
|||||||
new AuthServerCredentials(
|
new AuthServerCredentials(
|
||||||
"WizDen",
|
"WizDen",
|
||||||
[
|
[
|
||||||
"https://auth.spacestation14.com/",
|
"https://harpy.durenko.tatar/auth-api/",
|
||||||
"https://auth.fallback.spacestation14.com/"
|
"https://auth.fallback.spacestation14.com/",
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
public static readonly ConVar<ServerHubRecord[]> Hub = ConVarBuilder.Build<ServerHubRecord[]>("launcher.hub.v2", [
|
public static readonly ConVar<ServerHubRecord[]> Hub = ConVarBuilder.Build<ServerHubRecord[]>("launcher.hub.v2", [
|
||||||
new ServerHubRecord("WizDen", "https://hub.spacestation14.com/api/servers", null),
|
new ServerHubRecord("WizDen", "https://harpy.durenko.tatar/hub-api/api/servers", null),
|
||||||
new ServerHubRecord("AltHub","https://web.networkgamez.com/api/servers",null)
|
new ServerHubRecord("AltHub","https://web.networkgamez.com/api/servers",null)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Layout;
|
||||||
|
using Avalonia.Media;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Nebula.Launcher.ViewModels;
|
using Nebula.Launcher.ViewModels;
|
||||||
using Nebula.Launcher.ViewModels.Pages;
|
using Nebula.Launcher.ViewModels.Pages;
|
||||||
|
using Nebula.Launcher.ViewModels.Popup;
|
||||||
using Nebula.Shared;
|
using Nebula.Shared;
|
||||||
using Nebula.Shared.Models;
|
using Nebula.Shared.Models;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
@@ -15,7 +20,7 @@ namespace Nebula.Launcher.ServerListProviders;
|
|||||||
public sealed partial class FavoriteServerListProvider : IServerListProvider, IServerListDirtyInvoker
|
public sealed partial class FavoriteServerListProvider : IServerListProvider, IServerListDirtyInvoker
|
||||||
{
|
{
|
||||||
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
|
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
|
||||||
[GenerateProperty] private RestService RestService { get; }
|
[GenerateProperty] private IServiceProvider ServiceProvider { get; }
|
||||||
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
|
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
|
||||||
|
|
||||||
private List<IFilterConsumer> _serverLists = [];
|
private List<IFilterConsumer> _serverLists = [];
|
||||||
@@ -44,13 +49,15 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
ServerViewContainer.Get(s.ToRobustUrl())
|
ServerViewContainer.Get(s.ToRobustUrl())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_serverLists.Add(new AddFavoriteButton(ServiceProvider));
|
||||||
|
|
||||||
IsLoaded = true;
|
IsLoaded = true;
|
||||||
OnLoaded?.Invoke();
|
OnLoaded?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddFavorite(ServerEntryModelView entryModelView)
|
public void AddFavorite(ServerEntryModelView entryModelView)
|
||||||
{
|
{
|
||||||
entryModelView.IsFavorite = true;
|
|
||||||
AddFavorite(entryModelView.Address);
|
AddFavorite(entryModelView.Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +66,7 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
var servers = GetFavoriteEntries();
|
var servers = GetFavoriteEntries();
|
||||||
servers.Add(robustUrl.ToString());
|
servers.Add(robustUrl.ToString());
|
||||||
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
|
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
|
||||||
|
ServerViewContainer.Get(robustUrl).IsFavorite = true;
|
||||||
Dirty?.Invoke();
|
Dirty?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,4 +85,27 @@ public sealed partial class FavoriteServerListProvider : IServerListProvider, IS
|
|||||||
|
|
||||||
private void Initialise(){}
|
private void Initialise(){}
|
||||||
private void InitialiseInDesignMode(){}
|
private void InitialiseInDesignMode(){}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddFavoriteButton: Border, IFilterConsumer{
|
||||||
|
|
||||||
|
private Button _addFavoriteButton = new Button();
|
||||||
|
public AddFavoriteButton(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
Margin = new Thickness(5, 5, 5, 20);
|
||||||
|
Background = new SolidColorBrush(Color.Parse("#222222"));
|
||||||
|
CornerRadius = new CornerRadius(20f);
|
||||||
|
_addFavoriteButton.HorizontalAlignment = HorizontalAlignment.Center;
|
||||||
|
_addFavoriteButton.Click += (sender, args) =>
|
||||||
|
{
|
||||||
|
serviceProvider.GetService<PopupMessageService>()!.Popup(
|
||||||
|
serviceProvider.GetService<AddFavoriteViewModel>()!);
|
||||||
|
};
|
||||||
|
_addFavoriteButton.Content = "Add Favorite";
|
||||||
|
Child = _addFavoriteButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ProcessFilter(ServerFilter? serverFilter)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Nebula.Launcher.ServerListProviders;
|
||||||
using Nebula.Launcher.ViewModels.Pages;
|
using Nebula.Launcher.ViewModels.Pages;
|
||||||
using Nebula.Launcher.Views.Pages;
|
using Nebula.Launcher.Views.Pages;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
@@ -28,6 +29,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
|
|||||||
public override PopupMessageService PopupMessageService { get; }
|
public override PopupMessageService PopupMessageService { get; }
|
||||||
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
|
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
|
||||||
[GenerateProperty] private DebugService DebugService { get; }
|
[GenerateProperty] private DebugService DebugService { get; }
|
||||||
|
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
|
||||||
public override string Title => "Add to favorite";
|
public override string Title => "Add to favorite";
|
||||||
public override bool IsClosable => true;
|
public override bool IsClosable => true;
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var uri = IpInput.ToRobustUrl();
|
var uri = IpInput.ToRobustUrl();
|
||||||
|
FavoriteServerListProvider.AddFavorite(uri);
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
|
||||||
|
<PackageReference Include="Robust.Natives" Version="0.1.1" />
|
||||||
|
<PackageReference Include="Robust.Natives.Cef" Version="131.3.5" />
|
||||||
<PackageReference Include="SharpZstd.Interop" Version="1.5.6"/>
|
<PackageReference Include="SharpZstd.Interop" Version="1.5.6"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ public static class CurrentConVar
|
|||||||
{
|
{
|
||||||
public static readonly ConVar<string[]> EngineManifestUrl =
|
public static readonly ConVar<string[]> EngineManifestUrl =
|
||||||
ConVarBuilder.Build<string[]>("engine.manifestUrl", [
|
ConVarBuilder.Build<string[]>("engine.manifestUrl", [
|
||||||
"https://robust-builds.cdn.spacestation14.com/manifest.json",
|
"https://harpy.durenko.tatar/manifests/manifest",
|
||||||
"https://robust-builds.fallback.cdn.spacestation14.com/manifest.json"
|
"https://robust-builds.fallback.cdn.spacestation14.com/manifest.json"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
public static readonly ConVar<string[]> EngineModuleManifestUrl =
|
public static readonly ConVar<string[]> EngineModuleManifestUrl =
|
||||||
ConVarBuilder.Build<string[]>("engine.moduleManifestUrl",
|
ConVarBuilder.Build<string[]>("engine.moduleManifestUrl",
|
||||||
[
|
[
|
||||||
"https://robust-builds.cdn.spacestation14.com/modules.json",
|
"https://harpy.durenko.tatar/manifests/modules",
|
||||||
"https://robust-builds.fallback.cdn.spacestation14.com/modules.json"
|
"https://robust-builds.fallback.cdn.spacestation14.com/modules.json"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user