using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FishNet; using FishNet.Connection; using FishNet.Managing.Logging; using FishNet.Managing.Server; using FishNet.Object; using FishNet.Transporting; using HarmonyLib; using HostControl.Configuration; using HostControl.Localization; using HostControl.Runtime; using HostControl.UI; using HowtoFishLocalizationAPI.Api; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HostControl")] [assembly: AssemblyDescription("Host control tools for How to Fish by Ice Box Studio")] [assembly: AssemblyCompany("Ice Box Studio")] [assembly: AssemblyProduct("HostControl")] [assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")] [assembly: ComVisible(false)] [assembly: Guid("d83eb5ec-c32f-44cb-88e0-bfbcae1741d4")] [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 HostControl { [BepInPlugin("IceBoxStudio.HowToFish.HostControl", "HostControl", "1.0.0")] [BepInDependency("IceBoxStudio.HowToFish.LocalizationAPI", "1.0.0")] public sealed class HostControlPlugin : BaseUnityPlugin { private Harmony _harmony; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { Log.LogInfo((object)"============================================="); Log.LogInfo((object)("HostControl " + I18n.Text("plugin.initializing"))); Log.LogInfo((object)(I18n.Text("plugin.author_prefix") + "Ice Box Studio(https://steamcommunity.com/id/ibox666/)")); ConfigManager.Init(((BaseUnityPlugin)this).Config); ControlRuntime.Init(((BaseUnityPlugin)this).Logger); _harmony = new Harmony("IceBoxStudio.HowToFish.HostControl"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)("HostControl " + I18n.Text("plugin.initialized"))); Log.LogInfo((object)"============================================="); } catch (Exception arg) { Log.LogError((object)string.Format("Failed to initialize {0}: {1}", "HostControl", arg)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "IceBoxStudio.HowToFish.HostControl"; public const string PLUGIN_NAME = "HostControl"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace HostControl.UI { internal sealed class ControlUi : MonoBehaviour { private enum PendingAction { None, Kick, BanShort, BanForever, Kill, Unban } private static ControlUi _current; private static int _inputFrame = -1; private GameObject _mainScreen; private GameObject _optionsScreen; private GameObject _serverScreen; private GameObject _pauseButton; private GameObject _root; private GameObject _mainPage; private GameObject _confirmPage; private GameObject _bansPage; private GameObject _buttonTemplate; private Transform _rows; private Transform _bannedRows; private TextMeshProUGUI _title; private TextMeshProUGUI _selected; private TextMeshProUGUI _status; private TextMeshProUGUI _confirmTitle; private TextMeshProUGUI _confirmText; private TextMeshProUGUI _bansTitle; private TextMeshProUGUI _bansStatus; private TextMeshProUGUI _closeLabel; private TextMeshProUGUI _kickLabel; private TextMeshProUGUI _banShortLabel; private TextMeshProUGUI _banForeverLabel; private TextMeshProUGUI _killLabel; private TextMeshProUGUI _reviveLabel; private TextMeshProUGUI _teleportLabel; private TextMeshProUGUI _bansLabel; private TextMeshProUGUI _confirmLabel; private TextMeshProUGUI _cancelLabel; private TextMeshProUGUI _confirmBackLabel; private TextMeshProUGUI _bansBackLabel; private TextMeshProUGUI _pauseButtonLabel; private Button _closeButton; private Button _kickButton; private Button _banShortButton; private Button _banForeverButton; private Button _killButton; private Button _reviveButton; private Button _teleportButton; private Button _bansButton; private Button _confirmButton; private Button _cancelButton; private Button _bansBackButton; private Player _target; private ulong _pendingSteamId; private string _pendingBanName; private bool _returnToBans; private PendingAction _pending; private bool _built; private bool _open; internal static void Attach() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_current) && ControlRuntime.IsHost) { Transform fXCanvasTrans = PlayerUI.FXCanvasTrans; if (Object.op_Implicit((Object)(object)fXCanvasTrans)) { GameObject val = new GameObject("HostControl UI"); val.transform.SetParent(fXCanvasTrans, false); _current = val.AddComponent(); _current.Setup(); } } } internal static void Tick() { if (_inputFrame == Time.frameCount) { return; } _inputFrame = Time.frameCount; if (!ControlRuntime.IsHost || ChatManager.IsTyping || !ConfigManager.IsOpenPressed()) { return; } if (!Object.op_Implicit((Object)(object)_current)) { Attach(); } if (Object.op_Implicit((Object)(object)_current)) { if (_current._open) { _current.Hide(); } else { _current.Show(); } } } internal static void RefreshAll() { if (Object.op_Implicit((Object)(object)_current) && _current._open) { _current.Refresh(); } } internal static void Destroy() { if (Object.op_Implicit((Object)(object)_current)) { if (Object.op_Implicit((Object)(object)_current._root)) { Object.Destroy((Object)(object)_current._root); } if (Object.op_Implicit((Object)(object)_current._confirmPage)) { Object.Destroy((Object)(object)_current._confirmPage); } if (Object.op_Implicit((Object)(object)_current._bansPage)) { Object.Destroy((Object)(object)_current._bansPage); } if (Object.op_Implicit((Object)(object)_current._pauseButton)) { Object.Destroy((Object)(object)_current._pauseButton); } Object.Destroy((Object)(object)((Component)_current).gameObject); } _current = null; } private bool Build(PauseManager pause, GameObject holder) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Expected O, but got Unknown //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Expected O, but got Unknown //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Expected O, but got Unknown //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Expected O, but got Unknown //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Expected O, but got Unknown //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Expected O, but got Unknown _mainScreen = GetObject(pause, "_mainScreen"); _optionsScreen = GetObject(pause, "_optionsScreen"); _serverScreen = GetObject(pause, "_serverSettingsScreen"); if (!Object.op_Implicit((Object)(object)_serverScreen)) { return false; } _root = Object.Instantiate(_serverScreen, holder.transform, false); ((Object)_root).name = "HostControlScreen"; _root.SetActive(false); _mainPage = _root; Transform val = _root.transform.Find("PausedText"); Transform val2 = _root.transform.Find("ServerDisplay"); Transform val3 = _root.transform.Find("LowerButtonHolder/BackButton"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val3)) { return false; } _title = ((Component)val).GetComponent(); MoveTitle(val); _buttonTemplate = ((Component)val3).gameObject; DisableOther(_buttonTemplate); _closeButton = SetupButton(_buttonTemplate); _closeLabel = FindText(_buttonTemplate); if ((Object)(object)_title == (Object)null || (Object)(object)_closeButton == (Object)null || (Object)(object)_closeLabel == (Object)null) { return false; } SetupButtonText(_buttonTemplate, _closeLabel); ((UnityEvent)_closeButton.onClick).AddListener(new UnityAction(Hide)); DisableOther(((Component)_title).gameObject); GameObject gameObject = ((Component)val2).gameObject; TextMeshProUGUI componentInChildren = ((Component)val2).GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null) { return false; } foreach (Transform item in _root.transform) { Transform val4 = item; if ((Object)(object)val4 != (Object)(object)val && (Object)(object)val4 != (Object)(object)val2 && (Object)(object)val4 != (Object)(object)val3.parent) { ((Component)val4).gameObject.SetActive(false); } } foreach (Transform item2 in val2) { Transform val5 = item2; if (((Object)val5).name != "Outline") { ((Component)val5).gameObject.SetActive(false); } } RectTransform component = gameObject.GetComponent(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(900f, 640f); GameObject val6 = new GameObject("AdminContent"); val6.transform.SetParent(val2, false); RectTransform val7 = val6.AddComponent(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.offsetMin = new Vector2(28f, 24f); val7.offsetMax = new Vector2(-28f, -24f); ((Transform)val7).localScale = Vector3.one; ((Transform)val7).SetAsLastSibling(); VerticalLayoutGroup obj = val6.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 7f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; _selected = AddText(componentInChildren, (Transform)(object)val7, "Selected", 20f, 32f, (TextAlignmentOptions)513); _status = AddText(componentInChildren, (Transform)(object)val7, "Status", 18f, 30f, (TextAlignmentOptions)513); GameObject val8 = new GameObject("Players"); val8.transform.SetParent((Transform)(object)val7, false); val8.AddComponent().preferredHeight = 370f; _rows = val8.transform; VerticalLayoutGroup obj2 = val8.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; Transform parent = MakeRow((Transform)(object)val7, "Actions"); _kickButton = AddButton(_buttonTemplate, parent, "Kick", out _kickLabel); _banShortButton = AddButton(_buttonTemplate, parent, "BanShort", out _banShortLabel); _banForeverButton = AddButton(_buttonTemplate, parent, "BanForever", out _banForeverLabel); _killButton = AddButton(_buttonTemplate, parent, "Kill", out _killLabel); Transform parent2 = MakeRow((Transform)(object)val7, "Actions2"); _reviveButton = AddButton(_buttonTemplate, parent2, "Revive", out _reviveLabel); _teleportButton = AddButton(_buttonTemplate, parent2, "Teleport", out _teleportLabel); _bansButton = AddButton(_buttonTemplate, parent2, "Bans", out _bansLabel); if ((Object)(object)_kickButton == (Object)null || (Object)(object)_banShortButton == (Object)null || (Object)(object)_banForeverButton == (Object)null || (Object)(object)_killButton == (Object)null || (Object)(object)_reviveButton == (Object)null || (Object)(object)_teleportButton == (Object)null || (Object)(object)_bansButton == (Object)null) { return false; } ((UnityEvent)_kickButton.onClick).AddListener((UnityAction)delegate { Ask(PendingAction.Kick); }); ((UnityEvent)_banShortButton.onClick).AddListener((UnityAction)delegate { Ask(PendingAction.BanShort); }); ((UnityEvent)_banForeverButton.onClick).AddListener((UnityAction)delegate { Ask(PendingAction.BanForever); }); ((UnityEvent)_killButton.onClick).AddListener((UnityAction)delegate { Ask(PendingAction.Kill); }); ((UnityEvent)_reviveButton.onClick).AddListener(new UnityAction(Revive)); ((UnityEvent)_teleportButton.onClick).AddListener(new UnityAction(Teleport)); ((UnityEvent)_bansButton.onClick).AddListener(new UnityAction(ShowBans)); if (!BuildConfirm(holder, componentInChildren) || !BuildBans(holder, componentInChildren)) { return false; } if (!AddPauseButton()) { return false; } LocalizationApi.LanguageChanged += OnLanguageChanged; PlayerManager.OnPlayerAmountChange += RefreshAll; Refresh(); return true; } private bool BuildConfirm(GameObject holder, TextMeshProUGUI nativeText) { //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_0052: 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) //IL_0068: 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_0094: 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_0151: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown _confirmPage = Object.Instantiate(_serverScreen, holder.transform, false); if (!PreparePage(_confirmPage, "HostControlConfirmScreen", out var title, out var display, out var back, out var nativeText2)) { return false; } _confirmTitle = title; GameObject val = new GameObject("ConfirmContent"); val.transform.SetParent(display, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = new Vector2(40f, 70f); val2.offsetMax = new Vector2(-40f, -70f); VerticalLayoutGroup obj = val.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 18f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; _confirmText = AddText(nativeText2, (Transform)(object)val2, "ConfirmText", 28f, 150f, (TextAlignmentOptions)514); Transform parent = MakeRow((Transform)(object)val2, "ConfirmActions"); _confirmButton = AddButton(_buttonTemplate, parent, "Confirm", out _confirmLabel); _cancelButton = AddButton(_buttonTemplate, parent, "Cancel", out _cancelLabel); ((UnityEvent)_confirmButton.onClick).AddListener(new UnityAction(Confirm)); ((UnityEvent)_cancelButton.onClick).AddListener(new UnityAction(Cancel)); Button val3 = SetupButton(back); TextMeshProUGUI val4 = FindText(back); if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null) { return false; } ((TMP_Text)val4).text = string.Empty; SetupButtonText(back, val4); _confirmBackLabel = val4; ((UnityEvent)val3.onClick).AddListener(new UnityAction(Cancel)); if ((Object)(object)back.transform.parent != (Object)null) { ((Component)back.transform.parent).gameObject.SetActive(false); } return true; } private bool BuildBans(GameObject holder, TextMeshProUGUI nativeText) { //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_0052: 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) //IL_0068: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown _bansPage = Object.Instantiate(_serverScreen, holder.transform, false); if (!PreparePage(_bansPage, "HostControlBansScreen", out var title, out var display, out var back, out var nativeText2)) { return false; } _bansTitle = title; GameObject val = new GameObject("BansContent"); val.transform.SetParent(display, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = new Vector2(32f, 28f); val2.offsetMax = new Vector2(-32f, -28f); VerticalLayoutGroup obj = val.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 8f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; _bansStatus = AddText(nativeText2, (Transform)(object)val2, "BansStatus", 20f, 38f, (TextAlignmentOptions)513); GameObject val3 = new GameObject("BannedPlayers"); val3.transform.SetParent((Transform)(object)val2, false); val3.AddComponent().preferredHeight = 470f; _bannedRows = val3.transform; VerticalLayoutGroup obj2 = val3.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 5f; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; Button val4 = (_bansBackButton = SetupButton(back)); _bansBackLabel = FindText(back); if ((Object)(object)val4 == (Object)null || (Object)(object)_bansBackLabel == (Object)null) { return false; } SetupButtonText(back, _bansBackLabel); ((UnityEvent)val4.onClick).AddListener(new UnityAction(BackToMain)); return true; } private static bool PreparePage(GameObject page, string name, out TextMeshProUGUI title, out Transform display, out GameObject back, out TextMeshProUGUI nativeText) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) title = null; display = null; back = null; nativeText = null; if (!Object.op_Implicit((Object)(object)page)) { return false; } ((Object)page).name = name; page.SetActive(false); Transform val = page.transform.Find("PausedText"); display = page.transform.Find("ServerDisplay"); Transform val2 = page.transform.Find("LowerButtonHolder/BackButton"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)display) || !Object.op_Implicit((Object)(object)val2)) { return false; } title = ((Component)val).GetComponent(); nativeText = ((Component)display).GetComponentInChildren(true); back = ((Component)val2).gameObject; if (!Object.op_Implicit((Object)(object)title) || !Object.op_Implicit((Object)(object)nativeText)) { return false; } DisableOther(((Component)title).gameObject); MoveTitle(val); foreach (Transform item in page.transform) { Transform val3 = item; if ((Object)(object)val3 != (Object)(object)val && (Object)(object)val3 != (Object)(object)display && (Object)(object)val3 != (Object)(object)val2.parent) { ((Component)val3).gameObject.SetActive(false); } } foreach (Transform item2 in display) { Transform val4 = item2; if (((Object)val4).name != "Outline") { ((Component)val4).gameObject.SetActive(false); } } RectTransform component = ((Component)display).GetComponent(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(900f, 640f); return true; } private static void MoveTitle(Transform title) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (((Object)(object)title == (Object)null) ? null : ((Component)title).GetComponent()); if ((Object)(object)val != (Object)null) { val.anchoredPosition += new Vector2(0f, 35f); } } private bool Setup() { if (_built) { return true; } PauseManager val = Object.FindAnyObjectByType(); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? GetObject(val, "_pauseHolder") : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } if (Object.op_Implicit((Object)(object)_root)) { Object.Destroy((Object)(object)_root); _root = null; } if (Object.op_Implicit((Object)(object)_confirmPage)) { Object.Destroy((Object)(object)_confirmPage); _confirmPage = null; } if (Object.op_Implicit((Object)(object)_bansPage)) { Object.Destroy((Object)(object)_bansPage); _bansPage = null; } if (Object.op_Implicit((Object)(object)_pauseButton)) { Object.Destroy((Object)(object)_pauseButton); _pauseButton = null; } if (!Build(val, val2)) { if (Object.op_Implicit((Object)(object)_root)) { Object.Destroy((Object)(object)_root); _root = null; } if (Object.op_Implicit((Object)(object)_confirmPage)) { Object.Destroy((Object)(object)_confirmPage); _confirmPage = null; } if (Object.op_Implicit((Object)(object)_bansPage)) { Object.Destroy((Object)(object)_bansPage); _bansPage = null; } if (Object.op_Implicit((Object)(object)_pauseButton)) { Object.Destroy((Object)(object)_pauseButton); _pauseButton = null; } return false; } _built = true; return true; } private void Update() { if (ControlRuntime.IsHost && (_built || Setup()) && _open && Input.GetKeyDown((KeyCode)27)) { if (Object.op_Implicit((Object)(object)_confirmPage) && _confirmPage.activeSelf) { Cancel(); } else if (Object.op_Implicit((Object)(object)_bansPage) && _bansPage.activeSelf) { BackToMain(); } else { Hide(); } } } private void OnDestroy() { PlayerManager.OnPlayerAmountChange -= RefreshAll; LocalizationApi.LanguageChanged -= OnLanguageChanged; if ((Object)(object)_current == (Object)(object)this) { _current = null; } } private void OnLanguageChanged(string language) { Refresh(); } private bool AddPauseButton() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_mainScreen)) { return false; } Transform val = _mainScreen.transform.Find("ServerSettingsButton"); Transform val2 = _mainScreen.transform.Find("OptionsButton"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } _pauseButton = Object.Instantiate(((Component)val).gameObject, _mainScreen.transform, false); ((Object)_pauseButton).name = "HostControlPauseButton"; _pauseButton.SetActive(true); DisableOther(_pauseButton); Button val3 = SetupButton(_pauseButton); TextMeshProUGUI val4 = FindText(_pauseButton); if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null) { Object.Destroy((Object)(object)_pauseButton); _pauseButton = null; return false; } RectTransform component = _pauseButton.GetComponent(); RectTransform component2 = ((Component)val2).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2)) { Object.Destroy((Object)(object)_pauseButton); _pauseButton = null; return false; } ((Transform)component).SetSiblingIndex(((Transform)component2).GetSiblingIndex() + 1); Rect rect = component2.rect; float num = Mathf.Max(44f, Mathf.Abs(((Rect)(ref rect)).height) * 1.12f); Vector2 anchoredPosition = component2.anchoredPosition; anchoredPosition.y -= num; component.anchoredPosition = anchoredPosition; if ((Object)(object)((Component)val2.parent).GetComponent() == (Object)null) { RectTransform[] componentsInChildren = ((Component)val2.parent).GetComponentsInChildren(true); foreach (RectTransform val5 in componentsInChildren) { if ((Object)(object)((Transform)val5).parent == (Object)(object)val2.parent && (Object)(object)val5 != (Object)(object)component2 && (Object)(object)val5 != (Object)(object)component && val5.anchoredPosition.y < component2.anchoredPosition.y) { Vector2 anchoredPosition2 = val5.anchoredPosition; anchoredPosition2.y -= num; val5.anchoredPosition = anchoredPosition2; } } } SetupButtonText(_pauseButton, val4); _pauseButtonLabel = val4; ((TMP_Text)_pauseButtonLabel).text = I18n.Text("admin.ui.pause_button"); ((UnityEvent)val3.onClick).AddListener(new UnityAction(Show)); return true; } private void Show() { if (!_built && !Setup()) { return; } if (_open) { Refresh(); return; } _open = true; _root.SetActive(true); _confirmPage.SetActive(false); _bansPage.SetActive(false); HideNative(); PauseManager.TogglePause(true); HideNative(); _root.SetActive(true); Refresh(); if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)_closeButton != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)_closeButton).gameObject); } } private void Hide() { if (_open) { _open = false; Cancel(); if (Object.op_Implicit((Object)(object)_root)) { _root.SetActive(false); } if (Object.op_Implicit((Object)(object)_bansPage)) { _bansPage.SetActive(false); } PauseManager.TogglePause(false); } } private void HideNative() { if (Object.op_Implicit((Object)(object)_mainScreen)) { _mainScreen.SetActive(false); } if (Object.op_Implicit((Object)(object)_optionsScreen)) { _optionsScreen.SetActive(false); } if (Object.op_Implicit((Object)(object)_serverScreen)) { _serverScreen.SetActive(false); } } private void Ask(PendingAction action) { if (!((action == PendingAction.Kick || action == PendingAction.BanShort || action == PendingAction.BanForever) ? CanModerate() : CanSelect())) { ((TMP_Text)_status).text = I18n.Text("admin.ui.none"); return; } _pending = action; _pendingSteamId = 0uL; _pendingBanName = ControlRuntime.DisplayName(_target); _returnToBans = false; ShowConfirm(); } private void AskUnban(ControlRuntime.BanEntry entry) { if (ControlRuntime.IsHost && entry != null && entry.SteamID != 0L) { _pending = PendingAction.Unban; _pendingSteamId = entry.SteamID; _pendingBanName = ControlRuntime.DisplayName(entry); _returnToBans = true; ShowConfirm(); } } private void ShowConfirm() { if (Object.op_Implicit((Object)(object)_confirmPage) && Object.op_Implicit((Object)(object)_confirmText)) { _root.SetActive(false); _bansPage.SetActive(false); _confirmPage.SetActive(true); RefreshConfirm(); if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)_confirmButton != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)_confirmButton).gameObject); } } } private void RefreshConfirmText() { if (!((Object)(object)_confirmText == (Object)null)) { string key = ((_pending == PendingAction.Kick) ? "admin.ui.confirm_kick" : ((_pending == PendingAction.Kill) ? "admin.ui.confirm_kill" : ((_pending == PendingAction.Unban) ? "admin.ui.confirm_unban" : "admin.ui.confirm_ban"))); ((TMP_Text)_confirmText).text = I18n.Text(key, _pendingBanName); } } private void RefreshConfirm() { if ((Object)(object)_confirmTitle != (Object)null) { ((TMP_Text)_confirmTitle).text = I18n.Text("admin.ui.confirm_title"); } if ((Object)(object)_confirmLabel != (Object)null) { ((TMP_Text)_confirmLabel).text = I18n.Text("admin.ui.confirm"); } if ((Object)(object)_cancelLabel != (Object)null) { ((TMP_Text)_cancelLabel).text = I18n.Text("admin.ui.cancel"); } if ((Object)(object)_confirmBackLabel != (Object)null) { ((TMP_Text)_confirmBackLabel).text = I18n.Text("admin.ui.cancel"); } RefreshConfirmText(); } private void Confirm() { if (!CanConfirm()) { Cancel(); return; } bool flag = _pending switch { PendingAction.Kick => ControlRuntime.Kick(_target), PendingAction.BanShort => ControlRuntime.Ban(_target, permanent: false), PendingAction.BanForever => ControlRuntime.Ban(_target, permanent: true), PendingAction.Kill => ControlRuntime.Kill(_target), PendingAction.Unban => ControlRuntime.Unban(_pendingSteamId), _ => false, }; _pending = PendingAction.None; _pendingSteamId = 0uL; _confirmPage.SetActive(false); if (_returnToBans) { _bansPage.SetActive(true); RefreshBans(); } else { _root.SetActive(true); ((TMP_Text)_status).text = I18n.Text(flag ? "admin.ui.done" : "admin.ui.denied"); RefreshRows(); RefreshButtons(); } _returnToBans = false; } private void Cancel() { _pending = PendingAction.None; _pendingSteamId = 0uL; if ((Object)(object)_confirmPage != (Object)null) { _confirmPage.SetActive(false); } if (_returnToBans && (Object)(object)_bansPage != (Object)null) { _bansPage.SetActive(true); RefreshBans(); } else if ((Object)(object)_root != (Object)null && _open) { _root.SetActive(true); Refresh(); } _returnToBans = false; } private void ShowBans() { if (_open && Object.op_Implicit((Object)(object)_bansPage)) { _root.SetActive(false); _confirmPage.SetActive(false); _bansPage.SetActive(true); RefreshBans(); if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)_bansBackButton != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)_bansBackButton).gameObject); } } } private void BackToMain() { Cancel(); if (Object.op_Implicit((Object)(object)_bansPage)) { _bansPage.SetActive(false); } if (Object.op_Implicit((Object)(object)_root) && _open) { _root.SetActive(true); Refresh(); } } private void Revive() { bool flag = CanSelect() && ControlRuntime.Revive(_target); ((TMP_Text)_status).text = I18n.Text(flag ? "admin.ui.done" : "admin.ui.denied"); RefreshRows(); RefreshButtons(); } private void Teleport() { bool flag = CanSelect() && ControlRuntime.TeleportToHost(_target); ((TMP_Text)_status).text = I18n.Text(flag ? "admin.ui.done" : "admin.ui.denied"); RefreshRows(); RefreshButtons(); } private bool CanSelect() { if (ControlRuntime.IsHost && (Object)(object)_target != (Object)null && !((NetworkBehaviour)_target).IsDeinitializing) { return ((NetworkBehaviour)_target).Owner != (NetworkConnection)null; } return false; } private bool CanModerate() { if (CanSelect()) { return (Object)(object)_target != (Object)(object)Player.LocalPlayer; } return false; } private bool CanConfirm() { if (_pending != PendingAction.Unban) { if (_pending != PendingAction.Kick && _pending != PendingAction.BanShort && _pending != PendingAction.BanForever) { return CanSelect(); } return CanModerate(); } if (ControlRuntime.IsHost) { return _pendingSteamId != 0; } return false; } private void Refresh() { if (!((Object)(object)_title == (Object)null) && !((Object)(object)_selected == (Object)null) && !((Object)(object)_status == (Object)null) && !((Object)(object)_closeLabel == (Object)null)) { ((TMP_Text)_title).text = I18n.Text("admin.ui.title"); if ((Object)(object)_pauseButtonLabel != (Object)null) { ((TMP_Text)_pauseButtonLabel).text = I18n.Text("admin.ui.pause_button"); } ((TMP_Text)_closeLabel).text = I18n.Text("admin.ui.close"); ((TMP_Text)_kickLabel).text = I18n.Text("admin.ui.kick"); ((TMP_Text)_banShortLabel).text = I18n.Text("admin.ui.ban_short"); ((TMP_Text)_banForeverLabel).text = I18n.Text("admin.ui.ban_forever"); ((TMP_Text)_killLabel).text = I18n.Text("admin.ui.kill"); ((TMP_Text)_reviveLabel).text = I18n.Text("admin.ui.revive"); ((TMP_Text)_teleportLabel).text = I18n.Text("admin.ui.to_host"); ((TMP_Text)_bansLabel).text = I18n.Text("admin.ui.bans"); ((TMP_Text)_status).text = I18n.Text("admin.ui.none"); RefreshSelected(); RefreshRows(); RefreshButtons(); if (Object.op_Implicit((Object)(object)_confirmPage) && _confirmPage.activeSelf) { RefreshConfirm(); } if (Object.op_Implicit((Object)(object)_bansPage) && _bansPage.activeSelf) { RefreshBans(); } } } private void RefreshSelected() { ((TMP_Text)_selected).text = (((Object)(object)_target == (Object)null) ? I18n.Text("admin.ui.none") : I18n.Text("admin.ui.selected", ControlRuntime.DisplayName(_target))); } private void RefreshRows() { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown if ((Object)(object)_rows == (Object)null) { return; } for (int num = _rows.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_rows.GetChild(num)).gameObject); } bool flag = false; for (int i = 0; i < PlayerManager.Players.Count; i++) { Player val = PlayerManager.Players[i]; if ((Object)(object)val == (Object)null) { continue; } string text = (((Object)(object)val.Dying != (Object)null && val.Dying.IsDead) ? I18n.Text("admin.ui.dead") : I18n.Text("admin.ui.alive")); if (val.IsAfk) { text = text + " / " + I18n.Text("admin.ui.afk"); } string text2 = ControlRuntime.DisplayName(val); if ((Object)(object)val == (Object)(object)Player.LocalPlayer) { text2 = text2 + " " + I18n.Text("admin.ui.host"); } GameObject val2 = MakeButton(_buttonTemplate, _rows, "Player " + val.SteamID); if (!SetupSplitRow(val2, text2, val.SteamID + "\n" + ((((NetworkBehaviour)val).Owner == (NetworkConnection)null) ? I18n.Text("admin.ui.disconnected") : I18n.Text("admin.ui.connected")) + " / " + text, 46f, out var row)) { Object.Destroy((Object)(object)val2); continue; } Player selected = val; ((UnityEvent)row.onClick).AddListener((UnityAction)delegate { Select(selected); }); flag = true; } if (!flag) { ((TMP_Text)AddText(FindText(_buttonTemplate), _rows, "Empty", 18f, 42f, (TextAlignmentOptions)514)).text = I18n.Text("admin.ui.empty"); } } private void RefreshBans() { //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown if ((Object)(object)_bannedRows == (Object)null || (Object)(object)_bansStatus == (Object)null) { return; } ((TMP_Text)_bansTitle).text = I18n.Text("admin.ui.bans"); ((TMP_Text)_bansBackLabel).text = I18n.Text("admin.ui.back"); List bans = ControlRuntime.GetBans(); ((TMP_Text)_bansStatus).text = I18n.Text((bans.Count == 0) ? "admin.ui.no_bans" : "admin.ui.bans_count", bans.Count); for (int num = _bannedRows.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_bannedRows.GetChild(num)).gameObject); } if (bans.Count == 0) { ((TMP_Text)AddText(FindText(_buttonTemplate), _bannedRows, "EmptyBans", 20f, 42f, (TextAlignmentOptions)514)).text = I18n.Text("admin.ui.empty_bans"); return; } for (int i = 0; i < bans.Count; i++) { ControlRuntime.BanEntry banEntry = bans[i]; GameObject val = MakeButton(_buttonTemplate, _bannedRows, "Ban " + banEntry.SteamID); if (!SetupSplitRow(val, ControlRuntime.DisplayName(banEntry), banEntry.SteamID + "\n" + ControlRuntime.BanExpiry(banEntry) + " / " + I18n.Text("admin.ui.unban"), 58f, out var row)) { Object.Destroy((Object)(object)val); continue; } ControlRuntime.BanEntry selected = banEntry; ((UnityEvent)row.onClick).AddListener((UnityAction)delegate { AskUnban(selected); }); } } private void Select(Player player) { _target = player; Cancel(); RefreshSelected(); RefreshButtons(); } private void RefreshButtons() { bool flag = CanSelect(); bool flag2 = CanModerate(); if ((Object)(object)_kickButton != (Object)null) { ((Selectable)_kickButton).interactable = flag2; } bool interactable = flag2 && _target.SteamID != 0; if ((Object)(object)_banShortButton != (Object)null) { ((Selectable)_banShortButton).interactable = interactable; } if ((Object)(object)_banForeverButton != (Object)null) { ((Selectable)_banForeverButton).interactable = interactable; } if ((Object)(object)_killButton != (Object)null) { ((Selectable)_killButton).interactable = flag && (Object)(object)_target.Vitals != (Object)null && _target.Vitals.Health > 0; } if ((Object)(object)_reviveButton != (Object)null) { ((Selectable)_reviveButton).interactable = flag && (Object)(object)_target.Vitals != (Object)null && _target.Vitals.Health <= 0; } if ((Object)(object)_teleportButton != (Object)null) { ((Selectable)_teleportButton).interactable = flag; } } private static Transform MakeRow(Transform parent, string name) { //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) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent().preferredHeight = 48f; HorizontalLayoutGroup obj = val.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 6f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; return val.transform; } private static bool SetupSplitRow(GameObject rowObject, string leftText, string rightText, float height, out Button row) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) row = FindButton(rowObject); TextMeshProUGUI val = FindText(rowObject); if ((Object)(object)row == (Object)null || (Object)(object)val == (Object)null) { return false; } Button obj = row; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)3; ((Selectable)obj).navigation = navigation; (rowObject.GetComponent() ?? rowObject.AddComponent()).preferredHeight = height; ((TMP_Text)val).transform.SetParent(rowObject.transform, false); SetupRowText(val, leftText, new Vector2(0.04f, 0.08f), new Vector2(0.58f, 0.92f), (TextAlignmentOptions)4097, 13f, 23f); TextMeshProUGUI obj2 = Object.Instantiate(val, rowObject.transform, false); ((Object)((Component)obj2).gameObject).name = "Right"; SetupRowText(obj2, rightText, new Vector2(0.6f, 0.08f), new Vector2(0.96f, 0.92f), (TextAlignmentOptions)4100, 11f, 19f); return true; } private static void SetupRowText(TextMeshProUGUI text, string value, Vector2 anchorMin, Vector2 anchorMax, TextAlignmentOptions alignment, float minSize, float maxSize) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((TMP_Text)text).rectTransform; rectTransform.anchorMin = anchorMin; rectTransform.anchorMax = anchorMax; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((TMP_Text)text).text = value; ((TMP_Text)text).alignment = alignment; ((TMP_Text)text).enableAutoSizing = true; ((TMP_Text)text).fontSizeMin = minSize; ((TMP_Text)text).fontSizeMax = maxSize; ((TMP_Text)text).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)text).overflowMode = (TextOverflowModes)1; ((Graphic)text).raycastTarget = false; } private static Button AddButton(GameObject template, Transform parent, string name, out TextMeshProUGUI label) { GameObject val = MakeButton(template, parent, name); Button obj = FindButton(val); label = FindText(val); if ((Object)(object)obj != (Object)null) { (val.GetComponent() ?? val.AddComponent()).preferredHeight = 46f; SetupButtonText(val, label); } return obj; } private static void SetupButtonText(GameObject buttonObject, TextMeshProUGUI text) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) if (!((Object)(object)buttonObject == (Object)null) && !((Object)(object)text == (Object)null)) { ((TMP_Text)text).transform.SetParent(buttonObject.transform, false); RectTransform rectTransform = ((TMP_Text)text).rectTransform; rectTransform.anchorMin = new Vector2(0.04f, 0.06f); rectTransform.anchorMax = new Vector2(0.96f, 0.94f); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((TMP_Text)text).alignment = (TextAlignmentOptions)514; ((TMP_Text)text).enableAutoSizing = true; ((TMP_Text)text).fontSizeMin = 12f; ((TMP_Text)text).fontSizeMax = Mathf.Max(18f, Mathf.Min(32f, ((TMP_Text)text).fontSize)); ((TMP_Text)text).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)text).overflowMode = (TextOverflowModes)1; ((Graphic)text).raycastTarget = false; } } private static TextMeshProUGUI AddText(TextMeshProUGUI template, Transform parent, string name, float size, float height, TextAlignmentOptions alignment) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Object.Instantiate(template, parent, false); ((Object)((Component)val).gameObject).name = name; ((Component)val).gameObject.SetActive(true); DisableOther(((Component)val).gameObject); ((TMP_Text)val).fontSize = size; ((TMP_Text)val).alignment = alignment; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)1; (((Component)val).GetComponent() ?? ((Component)val).gameObject.AddComponent()).preferredHeight = height; return val; } private static GameObject MakeButton(GameObject template, Transform parent, string name) { GameObject obj = Object.Instantiate(template, parent, false); ((Object)obj).name = name; obj.SetActive(true); DisableOther(obj); SetupButton(obj); TextMeshProUGUI val = FindText(obj); if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = string.Empty; } return obj; } private static Button SetupButton(GameObject buttonObject) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Button val = (((Object)(object)buttonObject == (Object)null) ? null : buttonObject.GetComponent