- tweak: style thinks

This commit is contained in:
2025-06-28 14:05:19 +03:00
parent 01ebe3219d
commit 9e95d68c4a
11 changed files with 27 additions and 38 deletions

View File

@@ -107,10 +107,10 @@
pages|StringUnitConfigControl.ConfigBorder, pages|StringUnitConfigControl.ConfigBorder,
pages|IntUnitConfigControl.ConfigBorder, pages|IntUnitConfigControl.ConfigBorder,
pages|FloatUnitConfigControl.ConfigBorder"> pages|FloatUnitConfigControl.ConfigBorder">
<Setter Property="Background" Value="#333333" /> <Setter Property="Background" Value="#33333355" />
<Setter Property="CornerRadius" Value="5"/> <Setter Property="CornerRadius" Value="0"/>
<Setter Property="BorderThickness" Value="1,0,1,2" /> <Setter Property="BorderThickness" Value="1,0,0,2" />
<Setter Property="BorderBrush" Value="Azure" /> <Setter Property="BorderBrush" Value="#3f3f3f5f" />
</Style> </Style>
</Styles> </Styles>

View File

@@ -45,6 +45,7 @@ filter-roleplay = Roleplay
filter-language = Language filter-language = Language
favorite-add = Add to favorites favorite-add = Add to favorites
servername-set = Set server name servername-set = Set server name
servername-clear = Clear server name
twofa-enabled = You have two-factor authentication enabled. Please enter the code. twofa-enabled = You have two-factor authentication enabled. Please enter the code.
twofa-set = Proceed twofa-set = Proceed

View File

@@ -45,6 +45,7 @@ filter-roleplay = Ролевая игра
filter-language = Язык filter-language = Язык
favorite-add = Добавить в избранное favorite-add = Добавить в избранное
servername-set = Установить имя сервера servername-set = Установить имя сервера
servername-clear = Очистить
twofa-enabled = У вас включена двухфакторная аутентификация. Введите код. twofa-enabled = У вас включена двухфакторная аутентификация. Введите код.
twofa-set = Продолжить twofa-set = Продолжить

View File

@@ -28,8 +28,7 @@ public partial class ServerOverviewModel : ViewModelBase
[ObservableProperty] private ServerListView _currentServerList = new(); [ObservableProperty] private ServerListView _currentServerList = new();
public readonly ServerFilter CurrentFilter = new(); public readonly ServerFilter CurrentFilter = new();
public Action? OnSearchChange;
[GenerateProperty] private IServiceProvider ServiceProvider { get; } [GenerateProperty] private IServiceProvider ServiceProvider { get; }
[GenerateProperty] private ConfigurationService ConfigurationService { get; } [GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; } [GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
@@ -71,13 +70,11 @@ public partial class ServerOverviewModel : ViewModelBase
Items = new ObservableCollection<ServerListTabTemplate>(tempItems); Items = new ObservableCollection<ServerListTabTemplate>(tempItems);
SelectedItem = Items[0]; SelectedItem = Items[0];
OnSearchChange += SearchChangeEvent;
} }
private void SearchChangeEvent() partial void OnSearchTextChanged(string value)
{ {
CurrentFilter.SearchText = SearchText; CurrentFilter.SearchText = value;
ApplyFilter(); ApplyFilter();
} }

View File

@@ -24,8 +24,7 @@ public sealed partial class EditServerNameViewModel : PopupViewModelBase
if (string.IsNullOrWhiteSpace(NameInput)) if (string.IsNullOrWhiteSpace(NameInput))
{ {
RemoveServerName(); OnClear();
Dispose();
return; return;
} }
@@ -33,6 +32,12 @@ public sealed partial class EditServerNameViewModel : PopupViewModelBase
Dispose(); Dispose();
} }
public void OnClear()
{
RemoveServerName();
Dispose();
}
private void AddServerName() private void AddServerName()
{ {
var currentNames = ConfigurationService.GetConfigValue(LauncherConVar.ServerCustomNames)!; var currentNames = ConfigurationService.GetConfigValue(LauncherConVar.ServerCustomNames)!;

View File

@@ -71,7 +71,6 @@
<TextBox <TextBox
Margin="25,0,0,0" Margin="25,0,0,0"
Text="{Binding SearchText}" Text="{Binding SearchText}"
TextChanged="TextBox_OnTextChanged"
VerticalAlignment="Center" VerticalAlignment="Center"
Watermark="{services:LocaledText 'server-search'}" /> Watermark="{services:LocaledText 'server-search'}" />
<Button <Button

View File

@@ -26,10 +26,4 @@ public partial class ServerOverviewView : UserControl
{ {
DataContext = viewModel; DataContext = viewModel;
} }
private void TextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
{
var context = (ServerOverviewModel?)DataContext;
context?.OnSearchChange?.Invoke();
}
} }

View File

@@ -23,5 +23,10 @@
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="servername-set"/> <customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="servername-set"/>
</Button> </Button>
</Border> </Border>
<Border Background="{StaticResource DefaultSelected}" BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding OnClear}" HorizontalAlignment="Stretch">
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="servername-clear"/>
</Button>
</Border>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@@ -28,21 +28,14 @@ public sealed class App(RunnerService runnerService, ContentService contentServi
var args = new List<string> var args = new List<string>
{ {
// Pass username to launched client.
// We don't load username from client_config.toml when launched via launcher.
"--username", login, "--username", login,
// Tell game we are launcher
"--cvar", "launch.launcher=true" "--cvar", "launch.launcher=true"
}; };
var connectionString = url.ToString(); var connectionString = url.ToString();
if (!string.IsNullOrEmpty(buildInfo.BuildInfo.ConnectAddress)) if (!string.IsNullOrEmpty(buildInfo.BuildInfo.ConnectAddress))
connectionString = buildInfo.BuildInfo.ConnectAddress; connectionString = buildInfo.BuildInfo.ConnectAddress;
// We are using the launcher. Don't show main menu etc..
// Note: --launcher also implied --connect.
// For this reason, content bundles do not set --launcher.
args.Add("--launcher"); args.Add("--launcher");
args.Add("--connect-address"); args.Add("--connect-address");

View File

@@ -39,7 +39,6 @@ public class HarmonyService(ReflectionService reflectionService)
static bool Prefix() static bool Prefix()
{ {
// Returning false skips the execution of the original static constructor
return false; return false;
} }
} }

View File

@@ -91,23 +91,18 @@ public static class MetricsEnabledPatcher
public static void ApplyPatch(ReflectionService reflectionService, HarmonyService harmonyService) public static void ApplyPatch(ReflectionService reflectionService, HarmonyService harmonyService)
{ {
var harmony = harmonyService.Instance.Harmony; var harmony = harmonyService.Instance.Harmony;
// Get the target method: the getter of MetricsEnabled
var targetType = reflectionService.GetType("Robust.Shared.GameObjects.EntitySystemManager"); var targetType = reflectionService.GetType("Robust.Shared.GameObjects.EntitySystemManager");
var targetMethod = targetType.GetProperty("MetricsEnabled").GetGetMethod(); var targetMethod = targetType.GetProperty("MetricsEnabled").GetGetMethod();
// Get MethodInfo for the prefix
var prefix = typeof(MetricsEnabledPatcher).GetMethod(nameof(MetricsEnabledGetterPrefix), var prefix = typeof(MetricsEnabledPatcher).GetMethod(nameof(MetricsEnabledGetterPrefix),
BindingFlags.Static | BindingFlags.NonPublic); BindingFlags.Static | BindingFlags.NonPublic);
// Create HarmonyMethod
var prefixMethod = new HarmonyMethod(prefix); var prefixMethod = new HarmonyMethod(prefix);
// Patch it!
harmony.Patch(targetMethod, prefix: prefixMethod); harmony.Patch(targetMethod, prefix: prefixMethod);
} }
// This prefix will override the getter and force return true
private static bool MetricsEnabledGetterPrefix(ref bool __result) private static bool MetricsEnabledGetterPrefix(ref bool __result)
{ {
__result = true; __result = true;