mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
remove useless translation calls + order players
This commit is contained in:
5 files changed
+12
-9
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MiraAPI.GameOptions.OptionTypes;
|
using MiraAPI.GameOptions.OptionTypes;
|
||||||
using MiraAPI.Translation;
|
|
||||||
|
|
||||||
namespace MiraAPI.GameOptions.Attributes;
|
namespace MiraAPI.GameOptions.Attributes;
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ public class ModdedEnumOptionAttribute(string title, Type enumType, string[]? va
|
|||||||
{
|
{
|
||||||
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
||||||
{
|
{
|
||||||
var opt = new ModdedEnumOption(Title.Translate(), (int)(value ?? 0), enumType, values);
|
var opt = new ModdedEnumOption(Title, (int)(value ?? 0), enumType, values);
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MiraAPI.GameOptions.OptionTypes;
|
using MiraAPI.GameOptions.OptionTypes;
|
||||||
using MiraAPI.Translation;
|
|
||||||
using MiraAPI.Utilities;
|
using MiraAPI.Utilities;
|
||||||
|
|
||||||
namespace MiraAPI.GameOptions.Attributes;
|
namespace MiraAPI.GameOptions.Attributes;
|
||||||
@@ -30,7 +29,7 @@ public class ModdedNumberOptionAttribute(
|
|||||||
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
||||||
{
|
{
|
||||||
return new ModdedNumberOption(
|
return new ModdedNumberOption(
|
||||||
Title.Translate(),
|
Title,
|
||||||
(float)(value ?? min + increment),
|
(float)(value ?? min + increment),
|
||||||
min,
|
min,
|
||||||
max,
|
max,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MiraAPI.GameOptions.OptionTypes;
|
using MiraAPI.GameOptions.OptionTypes;
|
||||||
using MiraAPI.Translation;
|
|
||||||
|
|
||||||
namespace MiraAPI.GameOptions.Attributes;
|
namespace MiraAPI.GameOptions.Attributes;
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ public class ModdedStringOptionAttribute(
|
|||||||
{
|
{
|
||||||
internal override IModdedOption? CreateOption(object? value, PropertyInfo property)
|
internal override IModdedOption? CreateOption(object? value, PropertyInfo property)
|
||||||
{
|
{
|
||||||
var option = new ModdedStringOption(Title.Translate(), (string)(value ?? string.Empty), values);
|
var option = new ModdedStringOption(Title, (string)(value ?? string.Empty), values);
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MiraAPI.GameOptions.OptionTypes;
|
using MiraAPI.GameOptions.OptionTypes;
|
||||||
using MiraAPI.Translation;
|
|
||||||
|
|
||||||
namespace MiraAPI.GameOptions.Attributes;
|
namespace MiraAPI.GameOptions.Attributes;
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ public class ModdedToggleOptionAttribute(string title) : ModdedOptionAttribute(t
|
|||||||
{
|
{
|
||||||
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
||||||
{
|
{
|
||||||
var toggleOpt = new ModdedToggleOption(Title.Translate(), (bool)(value ?? false));
|
var toggleOpt = new ModdedToggleOption(Title, (bool)(value ?? false));
|
||||||
return toggleOpt;
|
return toggleOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,14 @@ public class ModdedPlayerOption : ModdedOption<int>
|
|||||||
/// <returns>A list of filtered players.</returns>
|
/// <returns>A list of filtered players.</returns>
|
||||||
public List<NetworkedPlayerInfo> GetFilteredPlayers()
|
public List<NetworkedPlayerInfo> GetFilteredPlayers()
|
||||||
{
|
{
|
||||||
return [.. GameData.Instance.AllPlayers.ToArray().Where(x => PlayerFilter?.Invoke(x) ?? true)];
|
var players = GameData.Instance.AllPlayers.ToArray();
|
||||||
|
|
||||||
|
IEnumerable<NetworkedPlayerInfo> filtered = players;
|
||||||
|
|
||||||
|
if (PlayerFilter != null)
|
||||||
|
filtered = players.Where(PlayerFilter);
|
||||||
|
|
||||||
|
return [.. filtered.OrderBy(x => x.PlayerId)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in new issue
Block a user