using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Fusion;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SSSGame.Network;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AskaServerListFilter
{
[BepInPlugin("de.teamvalhalla.aska.serverlistfilter", "Aska Server List Filter", "1.0.0")]
public class Plugin : BasePlugin
{
internal static ManualLogSource Logger;
private Harmony _harmony;
public override void Load()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("de.teamvalhalla.aska.serverlistfilter");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
_harmony = new Harmony("de.teamvalhalla.aska.serverlistfilter");
_harmony.PatchAll();
((BasePlugin)this).Log.LogInfo((object)"Harmony initialized. Sidebar will appear in server browser.");
((BasePlugin)this).AddComponent<ServerListUI>();
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "de.teamvalhalla.aska.serverlistfilter";
public const string PLUGIN_NAME = "Aska Server List Filter";
public const string PLUGIN_VERSION = "1.0.0";
}
public class ServerListFilter
{
public string SearchText { get; set; } = "";
public int MinPlayers { get; set; } = 0;
public bool ShowPasswordProtected { get; set; } = true;
public bool ShowFull { get; set; } = true;
public bool ShowEmpty { get; set; } = true;
public void Reset()
{
SearchText = "";
MinPlayers = 0;
ShowPasswordProtected = true;
ShowFull = true;
ShowEmpty = true;
}
}
[HarmonyPatch(typeof(NetworkSessionListTabPage), "UpdateSessionList")]
public class NetworkSessionListTabPage_UpdateSessionList_Patch
{
private static List<SessionInfo> _originalSessionList;
private static void Prefix(ref List<SessionInfo> sessionList)
{
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Expected O, but got Unknown
bool flag = default(bool);
try
{
if (sessionList == null || sessionList.Count == 0)
{
Plugin.Logger.LogDebug((object)"Session list is empty, nothing to filter");
return;
}
_originalSessionList = new List<SessionInfo>();
for (int i = 0; i < sessionList.Count; i++)
{
_originalSessionList.Add(sessionList[i]);
}
ManualLogSource logger = Plugin.Logger;
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(62, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cached original session list from UpdateSessionList: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_originalSessionList.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" sessions");
}
logger.LogDebug(val);
ServerListFilter serverListFilter = null;
serverListFilter = ServerListUI.Instance.GetFilter();
if (serverListFilter == null)
{
Plugin.Logger.LogDebug((object)"No UI instance available, no filtering applied");
return;
}
List<SessionInfo> list = new List<SessionInfo>();
for (int j = 0; j < sessionList.Count; j++)
{
list.Add(sessionList[j]);
}
List<SessionInfo> list2 = ApplyFilter(list, serverListFilter);
if (list.Count != list2.Count)
{
ManualLogSource logger2 = Plugin.Logger;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(19, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Filtered: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(list2.Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("/");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(list.Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" servers");
}
logger2.LogInfo(val2);
}
LogActiveFilters(serverListFilter);
sessionList.Clear();
foreach (SessionInfo item in list2)
{
sessionList.Add(item);
}
}
catch (Exception ex)
{
ManualLogSource logger3 = Plugin.Logger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error in server list filter: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
}
logger3.LogError(val3);
}
}
public static List<SessionInfo> GetOriginalSessionList()
{
return _originalSessionList;
}
private static List<SessionInfo> ApplyFilter(List<SessionInfo> sessions, ServerListFilter filter)
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Expected O, but got Unknown
if (!string.IsNullOrEmpty(filter.SearchText) || filter.MinPlayers > 0 || !filter.ShowPasswordProtected || !filter.ShowFull || !filter.ShowEmpty)
{
int num = 0;
int num2 = 0;
foreach (SessionInfo session in sessions)
{
if (session.PlayerCount == 1)
{
if (session.MaxPlayers >= 5)
{
num++;
}
else
{
num2++;
}
}
}
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(66, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Before filtering: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" empty dedicated (1/5+), ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" client host-only (1/4)");
}
logger.LogDebug(val);
if (sessions.Count > 0)
{
SessionInfo val2 = sessions[0];
string serverDisplayName = GetServerDisplayName(val2);
ManualLogSource logger2 = Plugin.Logger;
val = new BepInExDebugLogInterpolatedStringHandler(23, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Example: '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(serverDisplayName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val2.PlayerCount);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val2.MaxPlayers);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" players)");
}
logger2.LogDebug(val);
}
}
return sessions.Where(delegate(SessionInfo session)
{
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
try
{
if (!string.IsNullOrEmpty(filter.SearchText))
{
string serverDisplayName2 = GetServerDisplayName(session);
if (serverDisplayName2 == null || !serverDisplayName2.ToLower().Contains(filter.SearchText.ToLower()))
{
return false;
}
}
int playerCount = session.PlayerCount;
int maxPlayers = session.MaxPlayers;
int num3 = playerCount;
if (maxPlayers >= 5 && playerCount > 0)
{
num3 = playerCount - 1;
}
if (filter.MinPlayers > 0 && num3 < filter.MinPlayers)
{
return false;
}
if (!filter.ShowPasswordProtected && GetIsPrivateSession(session))
{
return false;
}
if (!filter.ShowFull && playerCount >= maxPlayers)
{
return false;
}
if (!filter.ShowEmpty)
{
if (maxPlayers >= 5 && playerCount == 1)
{
return false;
}
if (maxPlayers <= 4 && playerCount == 0)
{
return false;
}
}
return true;
}
catch (Exception ex)
{
ManualLogSource logger3 = Plugin.Logger;
bool flag2 = default(bool);
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(25, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error filtering session: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
}
logger3.LogWarning(val3);
return true;
}
}).ToList();
}
private static void LogActiveFilters(ServerListFilter filter)
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
List<string> list = new List<string>();
if (!string.IsNullOrEmpty(filter.SearchText))
{
list.Add("Search: '" + filter.SearchText + "'");
}
if (filter.MinPlayers > 0)
{
list.Add($"MinPlayers: {filter.MinPlayers}");
}
if (!filter.ShowPasswordProtected)
{
list.Add("Hide password-protected");
}
if (!filter.ShowFull)
{
list.Add("Hide full servers");
}
if (!filter.ShowEmpty)
{
list.Add("Hide empty dedicated servers (1/5+)");
}
if (list.Count > 0)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Active filters: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", list));
}
logger.LogDebug(val);
}
else
{
Plugin.Logger.LogDebug((object)"No active filters - showing all sessions");
}
}
private static string GetServerDisplayName(SessionInfo session)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
try
{
if (session.Properties != null && session.Properties.Count > 0)
{
string c_SessionDisplayNamePropKEy = NetworkSession.c_SessionDisplayNamePropKEy;
SessionProperty val = default(SessionProperty);
if (!string.IsNullOrEmpty(c_SessionDisplayNamePropKEy) && session.Properties.TryGetValue(c_SessionDisplayNamePropKEy, ref val) && val != null && val.PropertyValue != null)
{
string text = val.PropertyValue.ToString();
if (!string.IsNullOrEmpty(text))
{
return text;
}
}
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(44, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to get display name from Properties: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogDebug(val2);
}
return session.Name;
}
private static bool GetIsPrivateSession(SessionInfo session)
{
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
try
{
if (session.Properties != null && session.Properties.Count > 0)
{
string[] array = new string[6]
{
NetworkSession.c_IsPrivatePropKey,
NetworkSession.c_PasswordKey,
"p",
"IsPrivate",
"HasPassword",
"Private"
};
string[] array2 = array;
SessionProperty val = default(SessionProperty);
foreach (string text in array2)
{
if (string.IsNullOrEmpty(text) || !session.Properties.TryGetValue(text, ref val) || val == null || val.PropertyValue == null)
{
continue;
}
Object propertyValue = val.PropertyValue;
string text2 = propertyValue.ToString();
string name = ((object)propertyValue).GetType().Name;
if ((name.Contains("Boolean") || name == "bool") && bool.TryParse(text2, out var result))
{
return result;
}
if (name.Contains("String") || name == "string")
{
if (bool.TryParse(text2, out var result2))
{
return result2;
}
return text2.Equals("true", StringComparison.OrdinalIgnoreCase) || text2.Equals("1") || text2.Equals("yes", StringComparison.OrdinalIgnoreCase);
}
if (!text2.Equals("False", StringComparison.OrdinalIgnoreCase) && !text2.Equals("0"))
{
return true;
}
return false;
}
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(41, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to get IsPrivate from Properties: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogDebug(val2);
}
return false;
}
}
public class ServerListUI : MonoBehaviour
{
private Slider _pendingSlider;
private RectTransform _pendingHandleRect;
private RectTransform _pendingFillRect;
private float _pendingDefaultValue;
private ServerListFilter _filter;
private bool _isInitialized = false;
private NetworkSessionListTabPage _sessionListPage;
private GameObject _sidebarPanel;
private TMP_InputField _searchField;
private Slider _minPlayersSlider;
private Toggle _togglePasswordProtected;
private Toggle _toggleFullServers;
private Toggle _toggleEmptyServers;
private TMP_FontAsset _askaFont;
public static ServerListUI Instance { get; private set; }
static ServerListUI()
{
ClassInjector.RegisterTypeInIl2Cpp<ServerListUI>();
}
private void Awake()
{
if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
Instance = this;
_filter = new ServerListFilter();
}
private void Update()
{
UnityMainThreadDispatcher.Update();
NetworkSessionListTabPage val = Object.FindObjectOfType<NetworkSessionListTabPage>();
bool flag = (Object)(object)val != (Object)null;
if (flag && (Object)(object)_sessionListPage == (Object)null)
{
_sessionListPage = val;
BuildUI();
}
else if (!flag && (Object)(object)_sessionListPage != (Object)null)
{
_sessionListPage = null;
_isInitialized = false;
ResetFilters();
}
if ((Object)(object)_sidebarPanel != (Object)null)
{
bool flag2 = flag && _isInitialized;
if (_sidebarPanel.activeSelf != flag2)
{
_sidebarPanel.SetActive(flag2);
}
}
if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)114))
{
ResetFilters();
}
}
private void BuildUI()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
try
{
FindAskaFont();
CreateSidebar();
CreateSearchSection();
CreateDivider();
CreateMinPlayersSection();
CreateDivider();
CreateFiltersSection();
CreateDivider();
CreateActionsSection();
_isInitialized = true;
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to build UI: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogError(val);
}
}
private void FindAskaFont()
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
try
{
Il2CppArrayBase<TextMeshProUGUI> val = Object.FindObjectsOfType<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI item in val)
{
if ((Object)(object)((TMP_Text)item).font != (Object)null && ((Object)((TMP_Text)item).font).name.Contains("Njord"))
{
_askaFont = ((TMP_Text)item).font;
return;
}
}
Plugin.Logger.LogWarning((object)"ASKA font (Njord) not found, using default font");
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to find ASKA font: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val2);
}
}
private void CreateSidebar()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
Transform transform = ((Component)_sessionListPage).transform;
RectTransform component = ((Component)transform).GetComponent<RectTransform>();
_sidebarPanel = new GameObject("ASKA_FilterSidebar");
_sidebarPanel.transform.SetParent(transform.parent, false);
RectTransform val = _sidebarPanel.AddComponent<RectTransform>();
val.anchorMin = new Vector2(0f, 0.5f);
val.anchorMax = new Vector2(0f, 0.5f);
val.pivot = new Vector2(0f, 0.5f);
float num = 350f;
float num2 = component.sizeDelta.y * 1.1f;
val.anchoredPosition = new Vector2(20f, 0f);
val.sizeDelta = new Vector2(num, num2);
Image val2 = _sidebarPanel.AddComponent<Image>();
((Graphic)val2).color = Color32.op_Implicit(new Color32((byte)38, (byte)38, (byte)38, (byte)242));
Outline val3 = _sidebarPanel.AddComponent<Outline>();
((Shadow)val3).effectColor = Color32.op_Implicit(new Color32((byte)204, (byte)153, (byte)51, byte.MaxValue));
((Shadow)val3).effectDistance = new Vector2(2f, -2f);
VerticalLayoutGroup val4 = _sidebarPanel.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)val4).padding = new RectOffset(15, 15, 15, 15);
((HorizontalOrVerticalLayoutGroup)val4).spacing = 9f;
((LayoutGroup)val4).childAlignment = (TextAnchor)1;
((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
ScrollRect val5 = _sidebarPanel.AddComponent<ScrollRect>();
val5.vertical = true;
val5.horizontal = false;
val5.scrollSensitivity = 20f;
}
private void CreateDivider()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Divider");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 2f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)204, (byte)153, (byte)51, (byte)77));
LayoutElement val4 = val.AddComponent<LayoutElement>();
val4.preferredHeight = 2f;
val4.minHeight = 2f;
}
private void CreateSearchSection()
{
CreateTitle(" SEARCH ");
_searchField = CreateInputField("Server name...", delegate(string value)
{
_filter.SearchText = value;
ApplyFilters();
});
}
private void CreateMinPlayersSection()
{
CreateTitle(" MIN PLAYERS ");
_minPlayersSlider = CreateSlider("Minimum: Any (show all)", 0f, 4f, 0f, delegate(float value)
{
_filter.MinPlayers = (int)value;
ApplyFilters();
});
}
private void CreateFiltersSection()
{
CreateTitle(" FILTERS ");
_togglePasswordProtected = CreateToggle(" SHOW PASSWORD PROTECTED ", defaultValue: true, delegate(bool value)
{
_filter.ShowPasswordProtected = value;
ApplyFilters();
});
_toggleFullServers = CreateToggle(" SHOW FULL SERVERS ", defaultValue: true, delegate(bool value)
{
_filter.ShowFull = value;
ApplyFilters();
});
_toggleEmptyServers = CreateToggle(" SHOW EMPTY SERVERS ", defaultValue: true, delegate(bool value)
{
_filter.ShowEmpty = value;
ApplyFilters();
});
}
private void CreateActionsSection()
{
Button val = CreateButton(" RESET FILTERS ", delegate
{
ResetFilters();
ApplyFilters();
});
CreateInfoText("Press Ctrl+R to reset\nFilters auto-apply");
CreateImageWithLink("https://megaservers.de/wp-content/uploads/logo-ms.png", "https://megaservers.de", "MEGASERVERS.DE");
}
private void ApplyAskaFont(TextMeshProUGUI tmp)
{
if ((Object)(object)_askaFont != (Object)null && (Object)(object)tmp != (Object)null)
{
((TMP_Text)tmp).font = _askaFont;
}
}
private void CreateTitle(string text)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Title");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 30f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = text;
((TMP_Text)val3).fontSize = 16f;
((TMP_Text)val3).fontStyle = (FontStyles)1;
((Graphic)val3).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)217, (byte)102, byte.MaxValue));
((TMP_Text)val3).alignment = (TextAlignmentOptions)513;
ApplyAskaFont(val3);
LayoutElement val4 = val.AddComponent<LayoutElement>();
val4.preferredHeight = 30f;
}
[HideFromIl2Cpp]
private TMP_InputField CreateInputField(string placeholder, Action<string> onChange)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Expected O, but got Unknown
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("InputField");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 35f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)51, (byte)51, (byte)51, byte.MaxValue));
Outline val4 = val.AddComponent<Outline>();
((Shadow)val4).effectColor = Color32.op_Implicit(new Color32((byte)102, (byte)102, (byte)102, byte.MaxValue));
((Shadow)val4).effectDistance = new Vector2(1f, -1f);
TMP_InputField val5 = val.AddComponent<TMP_InputField>();
val5.contentType = (ContentType)0;
GameObject val6 = new GameObject("TextArea");
val6.transform.SetParent(val.transform, false);
RectTransform val7 = val6.AddComponent<RectTransform>();
val7.anchorMin = Vector2.zero;
val7.anchorMax = Vector2.one;
val7.offsetMin = new Vector2(10f, 0f);
val7.offsetMax = new Vector2(-10f, 0f);
GameObject val8 = new GameObject("Placeholder");
val8.transform.SetParent(val6.transform, false);
RectTransform val9 = val8.AddComponent<RectTransform>();
val9.anchorMin = Vector2.zero;
val9.anchorMax = Vector2.one;
val9.offsetMin = Vector2.zero;
val9.offsetMax = Vector2.zero;
TextMeshProUGUI val10 = val8.AddComponent<TextMeshProUGUI>();
((TMP_Text)val10).text = placeholder;
((TMP_Text)val10).fontSize = 14f;
((Graphic)val10).color = Color32.op_Implicit(new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue));
((TMP_Text)val10).alignment = (TextAlignmentOptions)513;
ApplyAskaFont(val10);
GameObject val11 = new GameObject("Text");
val11.transform.SetParent(val6.transform, false);
RectTransform val12 = val11.AddComponent<RectTransform>();
val12.anchorMin = Vector2.zero;
val12.anchorMax = Vector2.one;
val12.offsetMin = Vector2.zero;
val12.offsetMax = Vector2.zero;
TextMeshProUGUI val13 = val11.AddComponent<TextMeshProUGUI>();
((TMP_Text)val13).fontSize = 14f;
((Graphic)val13).color = Color.white;
((TMP_Text)val13).alignment = (TextAlignmentOptions)513;
ApplyAskaFont(val13);
val5.textViewport = val7;
val5.textComponent = (TMP_Text)(object)val13;
val5.placeholder = (Graphic)(object)val10;
if (onChange != null)
{
((UnityEvent<string>)(object)val5.onValueChanged).AddListener(UnityAction<string>.op_Implicit(onChange));
}
LayoutElement val14 = val.AddComponent<LayoutElement>();
val14.preferredHeight = 35f;
return val5;
}
[HideFromIl2Cpp]
private Toggle CreateToggle(string label, bool defaultValue, Action<bool> onChange)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Expected O, but got Unknown
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Expected O, but got Unknown
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Toggle");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 30f);
Toggle val3 = val.AddComponent<Toggle>();
val3.isOn = defaultValue;
GameObject val4 = new GameObject("Background");
val4.transform.SetParent(val.transform, false);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMin = new Vector2(0f, 0.5f);
val5.anchorMax = new Vector2(0f, 0.5f);
val5.pivot = new Vector2(0f, 0.5f);
val5.anchoredPosition = new Vector2(0f, 0f);
val5.sizeDelta = new Vector2(24f, 24f);
Image val6 = val4.AddComponent<Image>();
((Graphic)val6).color = Color32.op_Implicit(new Color32((byte)77, (byte)77, (byte)77, byte.MaxValue));
Texture2D val7 = CreateCircleTexture(48, 18f);
Sprite sprite = Sprite.Create(val7, new Rect(0f, 0f, 48f, 48f), new Vector2(0.5f, 0.5f), 48f);
val6.sprite = sprite;
Outline val8 = val4.AddComponent<Outline>();
((Shadow)val8).effectColor = Color32.op_Implicit(new Color32((byte)153, (byte)153, (byte)153, byte.MaxValue));
((Shadow)val8).effectDistance = new Vector2(0f, 0f);
((Selectable)val3).targetGraphic = (Graphic)(object)val6;
GameObject val9 = new GameObject("Checkmark");
val9.transform.SetParent(val4.transform, false);
RectTransform val10 = val9.AddComponent<RectTransform>();
val10.anchorMin = new Vector2(0.2f, 0.2f);
val10.anchorMax = new Vector2(0.8f, 0.8f);
val10.offsetMin = Vector2.zero;
val10.offsetMax = Vector2.zero;
Image val11 = val9.AddComponent<Image>();
((Graphic)val11).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)217, (byte)102, byte.MaxValue));
Texture2D val12 = CreateCircleTexture(36, 14f);
Sprite sprite2 = Sprite.Create(val12, new Rect(0f, 0f, 36f, 36f), new Vector2(0.5f, 0.5f), 36f);
val11.sprite = sprite2;
val3.graphic = (Graphic)(object)val11;
GameObject val13 = new GameObject("Label");
val13.transform.SetParent(val.transform, false);
RectTransform val14 = val13.AddComponent<RectTransform>();
val14.anchorMin = new Vector2(0f, 0f);
val14.anchorMax = new Vector2(1f, 1f);
val14.offsetMin = new Vector2(32f, 0f);
val14.offsetMax = new Vector2(0f, 0f);
TextMeshProUGUI val15 = val13.AddComponent<TextMeshProUGUI>();
((TMP_Text)val15).text = label;
((TMP_Text)val15).fontSize = 14f;
((Graphic)val15).color = Color.white;
((TMP_Text)val15).alignment = (TextAlignmentOptions)513;
ApplyAskaFont(val15);
if (onChange != null)
{
((UnityEvent<bool>)(object)val3.onValueChanged).AddListener(UnityAction<bool>.op_Implicit(onChange));
}
LayoutElement val16 = val.AddComponent<LayoutElement>();
val16.preferredHeight = 30f;
return val3;
}
[HideFromIl2Cpp]
private Button CreateButton(string text, Action onClick)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Button");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 40f);
Button val3 = val.AddComponent<Button>();
Image val4 = val.AddComponent<Image>();
((Graphic)val4).color = Color32.op_Implicit(new Color32((byte)77, (byte)64, (byte)51, byte.MaxValue));
Outline val5 = val.AddComponent<Outline>();
((Shadow)val5).effectColor = Color32.op_Implicit(new Color32((byte)204, (byte)153, (byte)51, byte.MaxValue));
((Shadow)val5).effectDistance = new Vector2(2f, -2f);
((Selectable)val3).targetGraphic = (Graphic)(object)val4;
ColorBlock colors = ((Selectable)val3).colors;
((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(new Color32((byte)77, (byte)64, (byte)51, byte.MaxValue));
((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)102, (byte)89, (byte)64, byte.MaxValue));
((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)128, (byte)102, (byte)77, byte.MaxValue));
((Selectable)val3).colors = colors;
GameObject val6 = new GameObject("Text");
val6.transform.SetParent(val.transform, false);
RectTransform val7 = val6.AddComponent<RectTransform>();
val7.anchorMin = Vector2.zero;
val7.anchorMax = Vector2.one;
val7.offsetMin = Vector2.zero;
val7.offsetMax = Vector2.zero;
TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
((TMP_Text)val8).text = text;
((TMP_Text)val8).fontSize = 14f;
((TMP_Text)val8).fontStyle = (FontStyles)1;
((Graphic)val8).color = Color.white;
((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
ApplyAskaFont(val8);
if (onClick != null)
{
((UnityEvent)val3.onClick).AddListener(UnityAction.op_Implicit(onClick));
}
LayoutElement val9 = val.AddComponent<LayoutElement>();
val9.preferredHeight = 40f;
return val3;
}
private void CreateInfoText(string text)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Info");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 40f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = text;
((TMP_Text)val3).fontSize = 12f;
((TMP_Text)val3).fontStyle = (FontStyles)2;
((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue));
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
ApplyAskaFont(val3);
LayoutElement val4 = val.AddComponent<LayoutElement>();
val4.preferredHeight = 40f;
}
[HideFromIl2Cpp]
private Slider CreateSlider(string labelText, float minValue, float maxValue, float defaultValue, Action<float> onChange)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Expected O, but got Unknown
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Expected O, but got Unknown
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Expected O, but got Unknown
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_038c: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Expected O, but got Unknown
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Expected O, but got Unknown
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_0543: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Unknown result type (might be due to invalid IL or missing references)
//IL_058e: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_064c: Unknown result type (might be due to invalid IL or missing references)
//IL_0653: Expected O, but got Unknown
GameObject val = new GameObject("SliderContainer");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 60f);
VerticalLayoutGroup val3 = val.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val3).spacing = 8f;
((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false;
GameObject val4 = new GameObject("ValueLabel");
val4.transform.SetParent(val.transform, false);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.sizeDelta = new Vector2(0f, 20f);
TextMeshProUGUI labelTmp = val4.AddComponent<TextMeshProUGUI>();
((TMP_Text)labelTmp).text = labelText;
((TMP_Text)labelTmp).fontSize = 13f;
((Graphic)labelTmp).color = Color32.op_Implicit(new Color32((byte)230, (byte)230, (byte)230, byte.MaxValue));
((TMP_Text)labelTmp).alignment = (TextAlignmentOptions)514;
ApplyAskaFont(labelTmp);
LayoutElement val6 = val4.AddComponent<LayoutElement>();
val6.preferredHeight = 20f;
GameObject val7 = new GameObject("Slider");
val7.transform.SetParent(val.transform, false);
RectTransform val8 = val7.AddComponent<RectTransform>();
val8.sizeDelta = new Vector2(0f, 30f);
Slider slider = val7.AddComponent<Slider>();
slider.minValue = minValue;
slider.maxValue = maxValue;
slider.value = defaultValue;
slider.wholeNumbers = true;
((Selectable)slider).interactable = true;
((Selectable)slider).transition = (Transition)1;
GameObject val9 = new GameObject("Background");
val9.transform.SetParent(val7.transform, false);
RectTransform val10 = val9.AddComponent<RectTransform>();
val10.anchorMin = new Vector2(0f, 0.3f);
val10.anchorMax = new Vector2(1f, 0.7f);
val10.offsetMin = Vector2.zero;
val10.offsetMax = Vector2.zero;
Image val11 = val9.AddComponent<Image>();
((Graphic)val11).color = Color32.op_Implicit(new Color32((byte)51, (byte)51, (byte)51, byte.MaxValue));
Outline val12 = val9.AddComponent<Outline>();
((Shadow)val12).effectColor = Color32.op_Implicit(new Color32((byte)102, (byte)102, (byte)102, (byte)100));
((Shadow)val12).effectDistance = new Vector2(0f, 0f);
GameObject val13 = new GameObject("Fill Area");
val13.transform.SetParent(val7.transform, false);
RectTransform val14 = val13.AddComponent<RectTransform>();
val14.anchorMin = new Vector2(0f, 0.3f);
val14.anchorMax = new Vector2(1f, 0.7f);
val14.offsetMin = new Vector2(0f, 0f);
val14.offsetMax = new Vector2(-5f, 0f);
GameObject val15 = new GameObject("Fill");
val15.transform.SetParent(val13.transform, false);
RectTransform fillRect = val15.AddComponent<RectTransform>();
fillRect.anchorMin = Vector2.zero;
fillRect.anchorMax = Vector2.one;
fillRect.offsetMin = Vector2.zero;
fillRect.offsetMax = Vector2.zero;
Image val16 = val15.AddComponent<Image>();
((Graphic)val16).color = Color32.op_Implicit(new Color32((byte)204, (byte)153, (byte)51, byte.MaxValue));
slider.fillRect = fillRect;
GameObject val17 = new GameObject("Handle Slide Area");
val17.transform.SetParent(val7.transform, false);
RectTransform val18 = val17.AddComponent<RectTransform>();
val18.anchorMin = Vector2.zero;
val18.anchorMax = Vector2.one;
val18.offsetMin = new Vector2(0f, 0f);
val18.offsetMax = new Vector2(-1f, 0f);
GameObject val19 = new GameObject("Handle");
val19.transform.SetParent(val17.transform, false);
RectTransform handleRect = val19.AddComponent<RectTransform>();
handleRect.anchorMin = new Vector2(0.5f, 0.5f);
handleRect.anchorMax = new Vector2(0.5f, 0.5f);
handleRect.pivot = new Vector2(0.5f, 0.5f);
handleRect.sizeDelta = new Vector2(30f, 30f);
Image val20 = val19.AddComponent<Image>();
((Graphic)val20).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)217, (byte)102, byte.MaxValue));
Texture2D val21 = CreateCircleTexture(48, 18f);
Sprite sprite = Sprite.Create(val21, new Rect(0f, 0f, 48f, 48f), new Vector2(0.5f, 0.5f), 48f);
val20.sprite = sprite;
Outline val22 = val19.AddComponent<Outline>();
((Shadow)val22).effectColor = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)100));
((Shadow)val22).effectDistance = new Vector2(0f, 0f);
Shadow val23 = val19.AddComponent<Shadow>();
val23.effectColor = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)80));
val23.effectDistance = new Vector2(1f, -1f);
slider.handleRect = null;
((Selectable)slider).targetGraphic = (Graphic)(object)val20;
slider.direction = (Direction)0;
_pendingSlider = slider;
_pendingHandleRect = handleRect;
_pendingFillRect = fillRect;
_pendingDefaultValue = defaultValue;
((MonoBehaviour)this).Invoke("DelayedHandlePositioning", 0.1f);
Navigation val24 = new Navigation();
val24.mode = (Mode)0;
((Selectable)slider).navigation = val24;
((UnityEvent<float>)(object)slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)delegate(float value)
{
int num = (int)value;
((TMP_Text)labelTmp).text = ((num == 0) ? "Minimum: Any (show all)" : $"Minimum: {num}+ players");
UpdateSliderHandlePosition(slider, handleRect, value);
UpdateSliderFill(fillRect, slider, value);
onChange?.Invoke(value);
}));
LayoutElement val25 = val7.AddComponent<LayoutElement>();
val25.preferredHeight = 30f;
LayoutElement val26 = val.AddComponent<LayoutElement>();
val26.preferredHeight = 44f;
return slider;
}
private void DelayedHandlePositioning()
{
if (!((Object)(object)_pendingSlider == (Object)null) && !((Object)(object)_pendingHandleRect == (Object)null))
{
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)((Transform)_pendingHandleRect).parent).GetComponent<RectTransform>());
UpdateSliderHandlePosition(_pendingSlider, _pendingHandleRect, _pendingDefaultValue);
UpdateSliderFill(_pendingFillRect, _pendingSlider, _pendingDefaultValue);
_pendingSlider = null;
_pendingHandleRect = null;
_pendingFillRect = null;
}
}
private void UpdateSliderFill(RectTransform fillRect, Slider slider, float value)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)fillRect == (Object)null))
{
float num = (value - slider.minValue) / (slider.maxValue - slider.minValue);
RectTransform component = ((Component)((Transform)fillRect).parent).GetComponent<RectTransform>();
if (!((Object)(object)component == (Object)null))
{
float num2 = 0.05f;
float num3 = Mathf.Max(num, num2);
fillRect.anchorMin = new Vector2(0f, 0f);
fillRect.anchorMax = new Vector2(num3, 1f);
fillRect.offsetMin = Vector2.zero;
fillRect.offsetMax = Vector2.zero;
}
}
}
private void UpdateSliderHandlePosition(Slider slider, RectTransform handleRect, float value)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)handleRect == (Object)null))
{
float num = (value - slider.minValue) / (slider.maxValue - slider.minValue);
RectTransform component = ((Component)((Transform)handleRect).parent).GetComponent<RectTransform>();
Rect rect = component.rect;
float width = ((Rect)(ref rect)).width;
float x = handleRect.sizeDelta.x;
float num2 = x * 0.5f;
float num3 = (0f - width) * 0.5f + num2;
float num4 = width * 0.5f - num2;
float num5 = Mathf.Lerp(num3, num4, num);
handleRect.anchoredPosition = new Vector2(num5, 0f);
}
}
private void CreateSpacer(float height)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Spacer");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, height);
LayoutElement val3 = val.AddComponent<LayoutElement>();
val3.preferredHeight = height;
}
private Texture2D CreateCircleTexture(int size, float radius)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(size, size);
Color32[] array = (Color32[])(object)new Color32[size * size];
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)size / 2f, (float)size / 2f);
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
float num = Vector2.Distance(new Vector2((float)j, (float)i), val2);
if (num <= radius)
{
array[i * size + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
}
else
{
array[i * size + j] = new Color32((byte)0, (byte)0, (byte)0, (byte)0);
}
}
}
val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array));
val.Apply();
return val;
}
private void CreateImageWithLink(string imageUrl, string linkUrl, string altText)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ImageWithLink");
val.transform.SetParent(_sidebarPanel.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(0f, 60f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)0));
Button val4 = val.AddComponent<Button>();
((Selectable)val4).targetGraphic = (Graphic)(object)val3;
((Selectable)val4).transition = (Transition)0;
AddHoverScaleEffect(val, val2);
GameObject val5 = new GameObject("Image");
val5.transform.SetParent(val.transform, false);
RectTransform val6 = val5.AddComponent<RectTransform>();
val6.anchorMin = new Vector2(0.05f, 0.15f);
val6.anchorMax = new Vector2(0.95f, 0.85f);
val6.offsetMin = Vector2.zero;
val6.offsetMax = Vector2.zero;
Image val7 = val5.AddComponent<Image>();
((Graphic)val7).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)0));
LoadImageFromURLAsync(imageUrl, val7, altText);
((UnityEvent)val4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
try
{
Application.OpenURL(linkUrl);
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val9 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("Could not open URL: ");
((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val9);
}
}));
LayoutElement val8 = val.AddComponent<LayoutElement>();
val8.preferredHeight = 60f;
}
private void LoadImageFromURLAsync(string url, Image targetImage, string altText)
{
Task.Run(delegate
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
try
{
using HttpClient httpClient = new HttpClient();
byte[] imageData = httpClient.GetByteArrayAsync(url).Result;
UnityMainThreadDispatcher.Enqueue(delegate
{
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)targetImage != (Object)null)
{
Texture2D val2 = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val2, Il2CppStructArray<byte>.op_Implicit(imageData)))
{
Sprite sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
targetImage.sprite = sprite;
targetImage.preserveAspect = true;
((Graphic)targetImage).color = Color.white;
}
else
{
Plugin.Logger.LogWarning((object)"Failed to load image into texture");
ShowPlaceholder(targetImage, altText);
}
}
else
{
Plugin.Logger.LogWarning((object)"Target image is null");
}
}
catch (Exception ex2)
{
ManualLogSource logger2 = Plugin.Logger;
bool flag2 = default(bool);
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error creating texture: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex2.Message);
}
logger2.LogError(val3);
ShowPlaceholder(targetImage, altText);
}
});
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error downloading image: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
UnityMainThreadDispatcher.Enqueue(delegate
{
ShowPlaceholder(targetImage, altText);
});
}
});
}
private void ShowPlaceholder(Image targetImage, string altText)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
((Graphic)targetImage).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)0));
GameObject val = new GameObject("PlaceholderText");
val.transform.SetParent(((Component)targetImage).transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchorMin = Vector2.zero;
val2.anchorMax = Vector2.one;
val2.offsetMin = Vector2.zero;
val2.offsetMax = Vector2.zero;
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "[" + altText + "]";
((TMP_Text)val3).fontSize = 10f;
((TMP_Text)val3).fontStyle = (FontStyles)2;
((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)150, (byte)150, (byte)150, (byte)200));
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
ApplyAskaFont(val3);
}
private void AddHoverScaleEffect(GameObject target, RectTransform rectTransform)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
Vector3 originalScale = ((Transform)rectTransform).localScale;
Vector3 hoverScale = new Vector3(1.05f, 1.05f, 1f);
EventTrigger val = target.AddComponent<EventTrigger>();
Entry val2 = new Entry();
val2.eventID = (EventTriggerType)0;
((UnityEvent<BaseEventData>)(object)val2.callback).AddListener(UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)delegate
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rectTransform != (Object)null)
{
((Transform)rectTransform).localScale = hoverScale;
}
}));
val.triggers.Add(val2);
Entry val3 = new Entry();
val3.eventID = (EventTriggerType)1;
((UnityEvent<BaseEventData>)(object)val3.callback).AddListener(UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)delegate
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rectTransform != (Object)null)
{
((Transform)rectTransform).localScale = originalScale;
}
}));
val.triggers.Add(val3);
}
private void ApplyFilters()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
try
{
List<SessionInfo> originalSessionList = NetworkSessionListTabPage_UpdateSessionList_Patch.GetOriginalSessionList();
if (originalSessionList != null && originalSessionList.Count > 0)
{
List<SessionInfo> val = new List<SessionInfo>();
for (int i = 0; i < originalSessionList.Count; i++)
{
val.Add(originalSessionList[i]);
}
if ((Object)(object)_sessionListPage != (Object)null)
{
_sessionListPage.UpdateSessionList(val);
}
}
else
{
Plugin.Logger.LogWarning((object)"No cached session list available - filters will apply on next server refresh");
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to apply filter: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
logger.LogError(val2);
}
}
private void ResetFilters()
{
_filter.Reset();
if ((Object)(object)_searchField != (Object)null)
{
_searchField.text = "";
}
if ((Object)(object)_minPlayersSlider != (Object)null)
{
_minPlayersSlider.value = 0f;
}
if ((Object)(object)_togglePasswordProtected != (Object)null)
{
_togglePasswordProtected.isOn = true;
}
if ((Object)(object)_toggleFullServers != (Object)null)
{
_toggleFullServers.isOn = true;
}
if ((Object)(object)_toggleEmptyServers != (Object)null)
{
_toggleEmptyServers.isOn = true;
}
}
[HideFromIl2Cpp]
public ServerListFilter GetFilter()
{
return _filter;
}
private void OnDestroy()
{
if ((Object)(object)Instance == (Object)(object)this)
{
Instance = null;
}
if ((Object)(object)_sidebarPanel != (Object)null)
{
Object.Destroy((Object)(object)_sidebarPanel);
}
}
}
public static class UnityMainThreadDispatcher
{
private static readonly Queue<Action> _executionQueue = new Queue<Action>();
public static void Enqueue(Action action)
{
lock (_executionQueue)
{
_executionQueue.Enqueue(action);
}
}
public static void Update()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
lock (_executionQueue)
{
bool flag = default(bool);
while (_executionQueue.Count > 0)
{
try
{
_executionQueue.Dequeue()?.Invoke();
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error in main thread dispatcher: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
}
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "AskaServerListFilter";
public const string PLUGIN_NAME = "AskaServerListFilter";
public const string PLUGIN_VERSION = "1.0.0";
}
}