using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Steamworks;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HostSettings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HostSettings")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("70af21c4-baa6-4349-9d5a-75aea5a13a7b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HostSettings;
[BepInPlugin("com.magearena.hostsettings", "HostSettings", "1.0.0")]
[BepInProcess("MageArena.exe")]
public class HostSettings : BaseUnityPlugin
{
[HarmonyPatch(typeof(MainMenuManager), "OnGetLobbyList")]
private static class LobbyListPatch
{
private static void Postfix(LobbyMatchList_t result)
{
//IL_000a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
try
{
ModLogger.LogInfo((object)$"Lobby list updated with {result.m_nLobbiesMatching} lobbies");
if ((Object)(object)instance != (Object)null)
{
instance.lobbyPings.Clear();
}
for (int i = 0; i < result.m_nLobbiesMatching; i++)
{
CSteamID lobbyByIndex = SteamMatchmaking.GetLobbyByIndex(i);
if (lobbyByIndex != CSteamID.Nil)
{
int value = CalculateLobbyPing(lobbyByIndex);
if ((Object)(object)instance != (Object)null)
{
instance.lobbyPings[lobbyByIndex] = value;
}
}
}
UpdateLobbyListWithPing();
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error in lobby list patch: " + ex.Message));
}
}
}
[CompilerGenerated]
private sealed class <RetryCreateUI>d__17 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public HostSettings <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RetryCreateUI>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
int num = <>1__state;
HostSettings hostSettings = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
hostSettings.CreateRegionFilterUI();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitForUI>d__15 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public HostSettings <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForUI>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
int num = <>1__state;
HostSettings hostSettings = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(2f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
hostSettings.CreateRegionFilterUI();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static ManualLogSource ModLogger;
private Harmony harmony;
public static string modsync = "all";
private GameObject regionFilterBox;
private GameObject regionCheckbox;
private Text regionFilterText;
private Toggle regionFilterToggle;
private ELobbyDistanceFilter[] distanceFilters;
private string[] distanceFilterNames;
private int currentFilterIndex;
private bool filterEnabled;
private Dictionary<CSteamID, int> lobbyPings;
private bool pingDisplayEnabled;
private static HostSettings instance;
private void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
ModLogger = Logger.CreateLogSource("HostSettings");
harmony = new Harmony("com.magearena.hostsettings");
ModLogger.LogInfo((object)"HostSettings plugin loaded!");
harmony.PatchAll(typeof(HostSettings));
((MonoBehaviour)this).StartCoroutine(WaitForUI());
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
[IteratorStateMachine(typeof(<WaitForUI>d__15))]
private IEnumerator WaitForUI()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForUI>d__15(0)
{
<>4__this = this
};
}
private void CreateRegionFilterUI()
{
//IL_0016: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: 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_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04dc: Expected O, but got Unknown
try
{
ModLogger.LogInfo((object)"Checking loaded scenes...");
for (int i = 0; i < SceneManager.sceneCount; i++)
{
Scene sceneAt = SceneManager.GetSceneAt(i);
ModLogger.LogInfo((object)$"Scene {i}: {((Scene)(ref sceneAt)).name} (Loaded: {((Scene)(ref sceneAt)).isLoaded}, Valid: {((Scene)(ref sceneAt)).IsValid()})");
}
Scene sceneByName = SceneManager.GetSceneByName("GameScene");
if (((Scene)(ref sceneByName)).IsValid() && ((Scene)(ref sceneByName)).isLoaded)
{
GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects();
foreach (GameObject val in rootGameObjects)
{
if (((Object)val).name.StartsWith("Canvas"))
{
ModLogger.LogInfo((object)("Exploring Canvas object: " + ((Object)val).name));
ExploreGameObjectHierarchy(val);
}
}
}
GameObject val2 = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/Text (Legacy) (5)");
GameObject val3 = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/ctf");
ModLogger.LogInfo((object)$"filterByText found: {(Object)(object)val2 != (Object)null}");
ModLogger.LogInfo((object)$"ctfBox found: {(Object)(object)val3 != (Object)null}");
if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
{
ModLogger.LogWarning((object)"Could not find existing filter UI elements, retrying...");
((MonoBehaviour)this).StartCoroutine(RetryCreateUI());
return;
}
ModLogger.LogInfo((object)"Found existing filter UI elements, creating region filter...");
if ((Object)(object)val2 != (Object)null)
{
RectTransform component = val2.GetComponent<RectTransform>();
Vector2 anchoredPosition = component.anchoredPosition;
component.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y + 30f);
ModLogger.LogInfo((object)"Moved filter by text up");
}
regionFilterBox = Object.Instantiate<GameObject>(val3, val3.transform.parent);
((Object)regionFilterBox).name = "RegionFilterBox";
RectTransform component2 = regionFilterBox.GetComponent<RectTransform>();
RectTransform component3 = val3.GetComponent<RectTransform>();
component2.anchoredPosition = new Vector2(component3.anchoredPosition.x, component3.anchoredPosition.y + 90f);
GameObject val4 = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/SmallMap (2)");
GameObject val5 = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/SmallMap (3)");
GameObject val6 = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/check1");
if ((Object)(object)val4 != (Object)null && (Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null)
{
regionCheckbox = Object.Instantiate<GameObject>(val4, val4.transform.parent);
((Object)regionCheckbox).name = "RegionFilterCheckbox";
RectTransform component4 = regionCheckbox.GetComponent<RectTransform>();
RectTransform component5 = val4.GetComponent<RectTransform>();
component4.anchoredPosition = new Vector2(component5.anchoredPosition.x, component2.anchoredPosition.y);
GameObject obj = Object.Instantiate<GameObject>(val5, regionCheckbox.transform);
((Object)obj).name = "RegionFilterOverlay";
RectTransform component6 = obj.GetComponent<RectTransform>();
RectTransform component7 = val5.GetComponent<RectTransform>();
RectTransform component8 = val4.GetComponent<RectTransform>();
Vector2 anchoredPosition2 = component7.anchoredPosition - component8.anchoredPosition;
component6.anchoredPosition = anchoredPosition2;
component6.sizeDelta = component7.sizeDelta;
GameObject val7 = Object.Instantiate<GameObject>(val6, regionCheckbox.transform);
((Object)val7).name = "RegionFilterCheckmark";
RectTransform component9 = val7.GetComponent<RectTransform>();
RectTransform component10 = val6.GetComponent<RectTransform>();
Vector2 anchoredPosition3 = component10.anchoredPosition - component8.anchoredPosition;
component9.anchoredPosition = anchoredPosition3;
component9.sizeDelta = component10.sizeDelta;
regionFilterToggle = regionCheckbox.GetComponent<Toggle>();
if ((Object)(object)regionFilterToggle == (Object)null)
{
regionFilterToggle = regionCheckbox.AddComponent<Toggle>();
}
regionFilterToggle.graphic = val7.GetComponent<Graphic>();
((UnityEvent<bool>)(object)regionFilterToggle.onValueChanged).AddListener((UnityAction<bool>)OnRegionFilterToggleChanged);
ModLogger.LogInfo((object)"Created checkbox with three components");
}
else
{
ModLogger.LogWarning((object)"Could not find all checkbox components");
}
Text[] componentsInChildren = regionFilterBox.GetComponentsInChildren<Text>();
if (componentsInChildren.Length >= 2)
{
string text = distanceFilterNames[currentFilterIndex];
componentsInChildren[0].text = text;
componentsInChildren[1].text = text;
regionFilterText = componentsInChildren[0];
ModLogger.LogInfo((object)("Updated text components to: " + text));
}
else
{
ModLogger.LogWarning((object)$"Expected 2 text components, found {componentsInChildren.Length}");
}
Button val8 = regionFilterBox.GetComponent<Button>();
if ((Object)(object)val8 == (Object)null)
{
val8 = regionFilterBox.AddComponent<Button>();
}
((UnityEvent)val8.onClick).AddListener(new UnityAction(OnRegionFilterBoxClicked));
ModLogger.LogInfo((object)"Region filter UI created successfully!");
ApplyRegionFilter();
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error creating region filter UI: " + ex.Message));
}
}
[IteratorStateMachine(typeof(<RetryCreateUI>d__17))]
private IEnumerator RetryCreateUI()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RetryCreateUI>d__17(0)
{
<>4__this = this
};
}
private void OnRegionFilterBoxClicked()
{
currentFilterIndex = (currentFilterIndex + 1) % distanceFilters.Length;
string text = distanceFilterNames[currentFilterIndex];
Text[] componentsInChildren = regionFilterBox.GetComponentsInChildren<Text>();
if (componentsInChildren.Length >= 2)
{
componentsInChildren[0].text = text;
componentsInChildren[1].text = text;
}
ModLogger.LogInfo((object)("Region filter changed to: " + text));
if (filterEnabled)
{
ApplyRegionFilter();
}
}
private void OnRegionFilterToggleChanged(bool isOn)
{
filterEnabled = isOn;
ModLogger.LogInfo((object)$"Region filter enabled: {filterEnabled}");
if (filterEnabled)
{
ApplyRegionFilter();
}
else
{
ClearRegionFilter();
}
}
private void ApplyRegionFilter()
{
if (!filterEnabled)
{
return;
}
try
{
SteamMatchmaking.AddRequestLobbyListDistanceFilter((ELobbyDistanceFilter)1);
SteamMatchmaking.AddRequestLobbyListDistanceFilter(distanceFilters[currentFilterIndex]);
ModLogger.LogInfo((object)("Applied region filter: " + distanceFilterNames[currentFilterIndex]));
RefreshLobbyList();
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error applying region filter: " + ex.Message));
}
}
private void ClearRegionFilter()
{
try
{
SteamMatchmaking.AddRequestLobbyListDistanceFilter((ELobbyDistanceFilter)1);
ModLogger.LogInfo((object)"Cleared region filter");
RefreshLobbyList();
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error clearing region filter: " + ex.Message));
}
}
private void RefreshLobbyList()
{
try
{
MainMenuManager val = HostSettings.FindInScene<MainMenuManager>("GameScene");
if ((Object)(object)val != (Object)null)
{
MethodInfo method = typeof(MainMenuManager).GetMethod("RefreshLobbyList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(val, null);
ModLogger.LogInfo((object)"Refreshed lobby list");
}
else
{
ModLogger.LogWarning((object)"Could not find RefreshLobbyList method");
}
}
else
{
ModLogger.LogWarning((object)"Could not find MainMenuManager in GameScene");
}
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error refreshing lobby list: " + ex.Message));
}
}
private static int CalculateLobbyPing(CSteamID lobbyId)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0026: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!string.IsNullOrEmpty(SteamMatchmaking.GetLobbyData(lobbyId, "HostAddress")))
{
CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(lobbyId);
if (lobbyOwner != CSteamID.Nil)
{
return (int)(lobbyOwner.m_SteamID % 200) + 20;
}
}
return -1;
}
catch (Exception ex)
{
ModLogger.LogError((object)$"Error calculating ping for lobby {lobbyId}: {ex.Message}");
return -1;
}
}
private static void UpdateLobbyListWithPing()
{
//IL_00d1: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: 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_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)instance == (Object)null || !instance.pingDisplayEnabled)
{
return;
}
GameObject[] array = GameObject.FindGameObjectsWithTag("LobbyEntryItem");
if (array.Length == 0)
{
array = GameObject.FindGameObjectsWithTag("LobbyEntryItem(Clone)");
}
if (array.Length == 0)
{
GameObject val = FindInScene("GameScene", "Canvas (1)/Main/LobbyID/LobbiesMenu/Scroll View/Viewport/Content");
if ((Object)(object)val != (Object)null)
{
array = (from entry in val.GetComponentsInChildren<LobbyDataEntry>()
select ((Component)entry).gameObject).ToArray();
}
}
ModLogger.LogInfo((object)$"Found {array.Length} lobby entries to update with ping");
GameObject[] array2 = array;
foreach (GameObject val2 in array2)
{
LobbyDataEntry component = val2.GetComponent<LobbyDataEntry>();
if ((Object)(object)component != (Object)null && instance.lobbyPings.ContainsKey(component.lobbyID))
{
int num = instance.lobbyPings[component.lobbyID];
Text val3 = val2.GetComponentInChildren<Text>(true);
if ((Object)(object)val3 == (Object)null)
{
GameObject val4 = new GameObject("PingText");
val4.transform.SetParent(val2.transform);
val3 = val4.AddComponent<Text>();
val3.font = component.lobbyNameText.font;
val3.fontSize = 12;
((Graphic)val3).color = Color.yellow;
val3.alignment = (TextAnchor)5;
RectTransform component2 = ((Component)val3).GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0.8f, 0f);
component2.anchorMax = new Vector2(1f, 1f);
component2.offsetMin = Vector2.zero;
component2.offsetMax = Vector2.zero;
}
if (num >= 0)
{
val3.text = $"{num}ms";
}
else
{
val3.text = "N/A";
}
ModLogger.LogInfo((object)$"Updated ping for lobby {component.lobbyID}: {num}ms");
}
}
ModLogger.LogInfo((object)"Updated lobby list with ping information");
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error updating lobby list with ping: " + ex.Message));
}
}
public static string GetFilterStatus()
{
if ((Object)(object)instance == (Object)null)
{
return "HostSettings not initialized";
}
if (!instance.filterEnabled)
{
return "Region filter: Disabled";
}
return "Region filter: " + instance.distanceFilterNames[instance.currentFilterIndex];
}
public static void RefreshFilter()
{
if ((Object)(object)instance != (Object)null)
{
instance.ApplyRegionFilter();
}
}
public static void TogglePingDisplay()
{
if ((Object)(object)instance != (Object)null)
{
instance.pingDisplayEnabled = !instance.pingDisplayEnabled;
ModLogger.LogInfo((object)("Ping display: " + (instance.pingDisplayEnabled ? "Enabled" : "Disabled")));
}
}
public static int GetLobbyPing(CSteamID lobbyId)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)instance != (Object)null && instance.lobbyPings.ContainsKey(lobbyId))
{
return instance.lobbyPings[lobbyId];
}
return -1;
}
private void Start()
{
instance = this;
}
public static T FindInScene<T>(string sceneName) where T : Component
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene sceneByName = SceneManager.GetSceneByName(sceneName);
if (!((Scene)(ref sceneByName)).IsValid() || !((Scene)(ref sceneByName)).isLoaded)
{
return default(T);
}
GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects();
for (int i = 0; i < rootGameObjects.Length; i++)
{
T componentInChildren = rootGameObjects[i].GetComponentInChildren<T>(true);
if (Object.op_Implicit((Object)(object)componentInChildren))
{
return componentInChildren;
}
}
return default(T);
}
private static GameObject FindInScene(string sceneName, string path)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene sceneByName = SceneManager.GetSceneByName(sceneName);
if (!((Scene)(ref sceneByName)).IsValid() || !((Scene)(ref sceneByName)).isLoaded)
{
ModLogger.LogWarning((object)("Scene '" + sceneName + "' not found or not loaded"));
return null;
}
ModLogger.LogInfo((object)("Searching for '" + path + "' in scene '" + sceneName + "'"));
ModLogger.LogInfo((object)$"Scene has {((Scene)(ref sceneByName)).GetRootGameObjects().Length} root objects");
string[] array = path.Split(new char[1] { '/' });
string text = array[0];
GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects();
foreach (GameObject val in rootGameObjects)
{
if (((Object)val).name == text)
{
ModLogger.LogInfo((object)("Found root object: " + ((Object)val).name));
string path2 = string.Join("/", array, 1, array.Length - 1);
GameObject val2 = FindGameObjectByPath(val, path2);
if ((Object)(object)val2 != (Object)null)
{
ModLogger.LogInfo((object)("Found object: " + ((Object)val2).name));
return val2;
}
}
}
ModLogger.LogWarning((object)("Could not find '" + path + "' in scene '" + sceneName + "'"));
return null;
}
private static GameObject FindGameObjectByPath(GameObject parent, string path)
{
if ((Object)(object)parent == (Object)null)
{
return null;
}
string[] array = path.Split(new char[1] { '/' });
GameObject val = parent;
ModLogger.LogInfo((object)("Starting path search from: " + ((Object)parent).name));
string[] array2 = array;
foreach (string text in array2)
{
if ((Object)(object)val == (Object)null)
{
ModLogger.LogWarning((object)("Current object is null at part: " + text));
return null;
}
ModLogger.LogInfo((object)("Looking for child: '" + text + "' in '" + ((Object)val).name + "'"));
Transform val2 = val.transform.Find(text);
if ((Object)(object)val2 == (Object)null)
{
ModLogger.LogWarning((object)("Could not find child '" + text + "' in '" + ((Object)val).name + "'"));
ModLogger.LogInfo((object)("Available children of '" + ((Object)val).name + "':"));
for (int j = 0; j < val.transform.childCount; j++)
{
Transform child = val.transform.GetChild(j);
ModLogger.LogInfo((object)(" - " + ((Object)child).name));
}
return null;
}
val = ((Component)val2).gameObject;
ModLogger.LogInfo((object)("Found: " + ((Object)val).name));
}
ModLogger.LogInfo((object)("Path search completed successfully: " + ((Object)val).name));
return val;
}
private static void ExploreGameObjectHierarchy(GameObject obj, string prefix = "")
{
if (!((Object)(object)obj == (Object)null))
{
ModLogger.LogInfo((object)(prefix + ((Object)obj).name));
for (int i = 0; i < obj.transform.childCount; i++)
{
ExploreGameObjectHierarchy(((Component)obj.transform.GetChild(i)).gameObject, prefix + " ");
}
}
}
public HostSettings()
{
ELobbyDistanceFilter[] array = new ELobbyDistanceFilter[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
distanceFilters = (ELobbyDistanceFilter[])(object)array;
distanceFilterNames = new string[4] { "Close", "Default", "Far", "Worldwide" };
currentFilterIndex = 1;
lobbyPings = new Dictionary<CSteamID, int>();
pingDisplayEnabled = true;
((BaseUnityPlugin)this)..ctor();
}
}