Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EWPForDummies v0.2.0
plugins/EWPForDummies.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using UIScriptingForEWP.Model; using UIScriptingForEWP.Net; using UIScriptingForEWP.Skin; using UIScriptingForEWP.Ui; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("EWP for Dummies")] [assembly: AssemblyProduct("EWPForDummies")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("0.1.9.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.1.9.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 UIScriptingForEWP { internal sealed class ConfigurationManagerAttributes { public bool? Browsable; public bool? IsAdvanced; public int? Order; public string Category; } [BepInPlugin("com.Fire.EWPForDummies", "EWP for Dummies", "0.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.Fire.EWPForDummies"; public const string DisplayName = "EWP for Dummies"; public const string Version = "0.2.0"; public const string EwpGuid = "expand_world_prefabs"; public const string TargetEwp = "1.65.0"; internal static ManualLogSource Log; internal static Plugin Instance; internal static ConfigEntry<KeyboardShortcut> Hotkey; internal static ConfigEntry<bool> ClickDebug; internal static ConfigEntry<float> WinX; internal static ConfigEntry<float> WinY; internal static ConfigEntry<float> WinW; internal static ConfigEntry<float> WinH; internal static ConfigEntry<float> Opacity; internal static ConfigEntry<float> ScrollSpeed; internal static ConfigEntry<float> UiScale; internal static ConfigEntry<string> PreviewPlace; internal static ConfigEntry<bool> PreviewDockButtons; internal static ConfigEntry<float> PvFloatX; internal static ConfigEntry<float> PvFloatY; internal static ConfigEntry<float> PvFloatW; internal static ConfigEntry<float> PvFloatH; internal static ConfigEntry<string> Language; private float _nextPeerScan; private Harmony _harmony; private void Awake() { //IL_0034: 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_0089: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Expected O, but got Unknown //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Hotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Open key", new KeyboardShortcut((KeyCode)293, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Opens the script window. Anyone may look; saving and other server actions need admin on the server."); ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Browsable = false }; WinX = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "X", -1f, new ConfigDescription("Window left edge (-1 = centred).", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); WinY = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Y", -1f, new ConfigDescription("Window top edge (-1 = centred).", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); WinW = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Width", -1f, new ConfigDescription("Window width (-1 = default 1100 at 1080p, scaled).", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); WinH = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Height", -1f, new ConfigDescription("Window height (-1 = default 760 at 1080p, scaled).", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); Opacity = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Opacity", 1f, new ConfigDescription("Window opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.4f, 1f), new object[1] { configurationManagerAttributes })); ScrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Scroll speed", 1f, new ConfigDescription("Mouse-wheel speed multiplier (1 = 120 px per notch, the Fires family speed).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), new object[1] { configurationManagerAttributes })); UiScale = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "UI scale", 1f, new ConfigDescription("Extra size multiplier on top of the automatic screen-height scale (1080p = 1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), new object[1] { configurationManagerAttributes })); PreviewPlace = ((BaseUnityPlugin)this).Config.Bind<string>("Layout", "Preview place", "Auto", new ConfigDescription("Where the Write tab's preview sits: Auto (on the right when the window is wider than tall, otherwise under the recipe), Right, Left or Below. Right and Left need a window wide enough for three columns; otherwise it goes Below. Floating = its own panel (drag the Preview title in game to dock or float it).", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[5] { "Auto", "Right", "Left", "Below", "Floating" }), Array.Empty<object>())); PvFloatX = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Preview float x", -1f, "Floating preview position x (pixels; -1 = next to the window). Set by dragging."); PvFloatY = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Preview float y", -1f, "Floating preview position y (pixels; -1 = next to the window). Set by dragging."); PvFloatW = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Preview float width", -1f, "Floating preview width at 1080p (-1 = default). Set by resizing."); PvFloatH = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Preview float height", -1f, "Floating preview height at 1080p (-1 = default). Set by resizing."); PreviewDockButtons = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "Preview dock buttons", false, "Shows small Left / Below / Right / Auto buttons on the preview to move it (they change 'Preview place'). Off by default."); Language = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Language", "Auto", new ConfigDescription("Language of the window: Auto (the game's language), en, fr, es, pt or vi. The texts are in BepInEx/config/EWPForDummies/lang and can be edited.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[6] { "Auto", "en", "fr", "es", "pt", "vi" }), Array.Empty<object>())); Loc.Init(Language.Value); Language.SettingChanged += delegate { Loc.Init(Language.Value); }; ClickDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Click debug", false, new ConfigDescription("Logs footer button rects and every click in the window, outlines the buttons, and logs requests/replies. Off = no cost.", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); if (Mathf.Approximately(Opacity.Value, 0.96f)) { Opacity.Value = 1f; } _harmony = new Harmony("com.Fire.EWPForDummies"); _harmony.PatchAll(typeof(Plugin).Assembly); UIScriptingForEWP.Net.Trace.Install(_harmony); EwpLogTap.Install(); ((Component)this).gameObject.AddComponent<UisWindow>(); Log.LogInfo((object)"EWP for Dummies 0.2.0 loaded."); } private void Update() { if (ZRoutedRpc.instance != null) { Rpc.EnsureRegistered(); } if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { UIScriptingForEWP.Net.Trace.Flush(); if (Time.time > _nextPeerScan) { _nextPeerScan = Time.time + 5f; SavedKeys.TrackPeers(); } } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace UIScriptingForEWP.Ui { internal static class ClickBlocker { private static GameObject s_root; private static readonly List<RectTransform> s_panes = new List<RectTransform>(); public static void Cover(IList<Rect> rects) { //IL_00b8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (rects == null || rects.Count == 0) { if ((Object)(object)s_root != (Object)null && s_root.activeSelf) { s_root.SetActive(false); } return; } if ((Object)(object)s_root == (Object)null) { Build(); } if (!s_root.activeSelf) { s_root.SetActive(true); } while (s_panes.Count < rects.Count) { s_panes.Add(NewPane()); } for (int i = 0; i < s_panes.Count; i++) { RectTransform val = s_panes[i]; bool flag = i < rects.Count; if (((Component)val).gameObject.activeSelf != flag) { ((Component)val).gameObject.SetActive(flag); } if (flag) { Rect val2 = rects[i]; val.anchoredPosition = new Vector2(((Rect)(ref val2)).x, (float)Screen.height - ((Rect)(ref val2)).y - ((Rect)(ref val2)).height); val.sizeDelta = new Vector2(((Rect)(ref val2)).width, ((Rect)(ref val2)).height); } } } private static void Build() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown s_root = new GameObject("EWPFD_ClickBlocker"); Object.DontDestroyOnLoad((Object)(object)s_root); Canvas obj = s_root.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 32760; s_root.AddComponent<GraphicRaycaster>(); } private static RectTransform NewPane() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_005b: 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) //IL_0076: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown GameObject val = new GameObject("pane", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(s_root.transform, false); Image component = val.GetComponent<Image>(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0f); ((Graphic)component).raycastTarget = true; RectTransform val2 = (RectTransform)val.transform; Vector2 anchorMin = (val2.anchorMax = Vector2.zero); val2.anchorMin = anchorMin; val2.pivot = Vector2.zero; return val2; } } internal static class SearchDropdown { private const int MaxRows = 12; internal static Action<string> ClosedRectHook; private static string s_open; private static string s_query = ""; private static int s_highlight; private static Vector2 s_areaMin; private static Vector2 s_areaMax; private static Vector2 s_fieldMin; private static Vector2 s_fieldMax; private static string s_focusNext; private static Vector2 s_scroll; private static bool s_scrollTo; private static int s_openFrame = -10; public static string NextHeader; public static bool AnyOpen => s_open != null; public static bool OpenFieldList { get { if (s_open != null && s_open != "savefile") { return s_open != "savedata"; } return false; } } public static bool JustOpened => Time.frameCount - s_openFrame <= 1; private static float FieldH => Mathf.Max(UisLook.Input.CalcHeight(new GUIContent("Ag"), 100f), UisLook.Dropdown.CalcHeight(new GUIContent("Ag"), 100f)); public static void CloseAll() { s_open = null; } public static bool AreaContains(Vector2 screen) { //IL_0000: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (screen.x >= s_areaMin.x && screen.x <= s_areaMax.x && screen.y >= s_areaMin.y) { return screen.y <= s_areaMax.y; } return false; } public static bool IsOpen(string id) { return s_open == id; } public static string Draw(string id, string value, IList<string> items, Func<string, string> display = null, bool freeText = true, string button = null, params GUILayoutOption[] opts) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_0203: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Invalid comparison between Unknown and I4 //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Invalid comparison between Unknown and I4 //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Invalid comparison between Unknown and I4 //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Invalid comparison between Unknown and I4 //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Expected O, but got Unknown //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: 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_0594: Invalid comparison between Unknown and I4 //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Invalid comparison between Unknown and I4 //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0820: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_0889: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) string text = "uisdd_" + id; bool flag = s_open == id; Event current = Event.current; if (flag && (int)current.type == 4 && current.character != 0 && Time.frameCount - s_openFrame < 3) { current.Use(); } if (flag && (int)current.type == 4) { List<string> list = Filter(items, s_query); if ((int)current.keyCode == 274) { s_highlight = Math.Min(s_highlight + 1, list.Count - 1); s_scrollTo = true; current.Use(); } else if ((int)current.keyCode == 273) { s_highlight = Math.Max(0, s_highlight - 1); s_scrollTo = true; current.Use(); } else { if ((int)current.keyCode == 13 || (int)current.keyCode == 271) { if (list.Count > 0) { value = list[Mathf.Clamp(s_highlight, 0, list.Count - 1)]; } else if (freeText) { value = s_query; } Close(); current.Use(); GUI.changed = true; return value; } if ((int)current.keyCode == 27) { Close(); current.Use(); return value; } } } float num = UisScale.S(22f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (flag) { Rect rect = GUILayoutUtility.GetRect(new GUIContent(s_query ?? ""), UisLook.Input, WithHeight(opts)); if ((int)Event.current.type == 7) { s_fieldMin = GUIUtility.GUIToScreenPoint(((Rect)(ref rect)).min); s_fieldMax = GUIUtility.GUIToScreenPoint(((Rect)(ref rect)).max); } if (GUI.Button(new Rect(((Rect)(ref rect)).xMax - num - UisScale.S(4f), ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - num) / 2f, num, num), "×", UisLook.Icon)) { Close(); } GUI.SetNextControlName(text); GUIStyle val = new GUIStyle(UisLook.Input); RectOffset padding = val.padding; padding.right += (int)(num + UisScale.S(6f)); string text2 = GUI.TextField(rect, s_query ?? "", val); if (text2 != s_query) { s_query = text2; s_highlight = 0; s_scroll = Vector2.zero; if (freeText) { value = text2; } } if (string.IsNullOrEmpty(s_query) && (int)current.type == 7) { Rect val2 = rect; string text3 = ((display != null) ? display(value) : value); GUI.Label(val2, string.IsNullOrEmpty(text3) ? Loc.T("dropdown.type_to_search", "type to search") : text3, UisLook.Placeholder); } } else { string text4 = ((display != null) ? display(value) : value); bool num2 = ((button != null) ? GUILayout.Button(button, UisLook.Btn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }) : GUILayout.Button(string.IsNullOrEmpty(text4) ? ("<color=#c4b8a2>" + Loc.T("dropdown.click_to_pick", "click to pick...") + "</color>") : text4, UisLook.Dropdown, WithHeight(opts))); if (button == null && (int)Event.current.type == 7) { Rect val3 = SafeRect.Last(); GUI.Label(new Rect(((Rect)(ref val3)).xMax - UisScale.S(20f), ((Rect)(ref val3)).y, UisScale.S(16f), ((Rect)(ref val3)).height), "▼", UisLook.Sub); } ClosedRectHook?.Invoke(id); if (num2) { s_open = id; s_query = (freeText ? (value ?? "") : ""); s_highlight = 0; s_openFrame = Time.frameCount; s_scroll = Vector2.zero; List<string> list2 = Filter(items, s_query); int num3 = (string.IsNullOrEmpty(value) ? (-1) : list2.FindIndex((string x) => x == value || (x ?? "").StartsWith(value + " - "))); if (num3 >= 0) { s_highlight = num3; s_scrollTo = true; } GUI.FocusControl((string)null); s_focusNext = text; } } GUILayout.EndHorizontal(); if (flag && s_focusNext == text && (int)current.type == 7) { GUI.FocusControl(text); s_focusNext = null; } string nextHeader = NextHeader; NextHeader = null; if (flag) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); if (!string.IsNullOrEmpty(nextHeader)) { GUILayout.Label(nextHeader, UisLook.Sub, Array.Empty<GUILayoutOption>()); } List<string> list3 = Filter(items, s_query); float num4 = UisLook.Nav.CalcHeight(new GUIContent("Ag"), 100f) + (float)UisLook.Nav.margin.vertical; float num5 = (float)Math.Min(12, Math.Max(1, list3.Count)) * num4; if (s_scrollTo) { float num6 = (float)s_highlight * num4; if (num6 < s_scroll.y) { s_scroll.y = num6; } else if (num6 + num4 > s_scroll.y + num5) { s_scroll.y = num6 + num4 - num5; } s_scrollTo = false; } Event current2 = Event.current; if ((int)current2.type == 6 && AreaContains(GUIUtility.GUIToScreenPoint(current2.mousePosition))) { s_scroll.y = Mathf.Clamp(s_scroll.y + current2.delta.y / 3f * num4 * 3f * Mathf.Max(0.1f, Plugin.ScrollSpeed?.Value ?? 1f), 0f, Mathf.Max(0f, (float)list3.Count * num4 - num5)); current2.Use(); } s_scroll = GUILayout.BeginScrollView(s_scroll, false, list3.Count > 12, GUIStyle.none, GUI.skin.verticalScrollbar, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num5) }); Rect rect2 = GUILayoutUtility.GetRect(10f, (float)list3.Count * num4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); int num7 = Math.Max(0, (int)(s_scroll.y / num4)); int num8 = Math.Min(list3.Count, num7 + 12 + 2); Rect val4 = default(Rect); for (int num9 = num7; num9 < num8; num9++) { ((Rect)(ref val4))..ctor(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).y + (float)num9 * num4, ((Rect)(ref rect2)).width, num4 - (float)UisLook.Nav.margin.vertical); if (list3[num9].StartsWith("----")) { GUI.Label(val4, list3[num9], UisLook.Sub); continue; } string text5 = list3[num9]; string text6 = text5; string text7 = null; int num10 = text5.IndexOf(" - ", StringComparison.Ordinal); if (num10 > 0) { text7 = text5.Substring(num10 + 4).Trim(); text6 = text5.Substring(0, num10).TrimEnd(Array.Empty<char>()) + " <color=#9c907e>" + text7 + "</color>"; } bool num11 = GUI.Button(val4, text6, (num9 == s_highlight) ? UisLook.NavRowSel : UisLook.NavRow); if (text7 != null) { UisSkin.MarkHintRect(val4, text7); } if (num11) { value = list3[num9]; Close(); GUI.changed = true; } } GUILayout.EndScrollView(); if ((int)Event.current.type == 7) { Rect val5 = SafeRect.Last(); Vector2 val6 = GUIUtility.GUIToScreenPoint(((Rect)(ref val5)).min); Vector2 val7 = GUIUtility.GUIToScreenPoint(new Vector2(((Rect)(ref val5)).xMax, ((Rect)(ref val5)).yMax + UisScale.S(28f))); s_areaMin = new Vector2(Mathf.Min(s_fieldMin.x, val6.x), Mathf.Min(s_fieldMin.y, val6.y)); s_areaMax = new Vector2(Mathf.Max(s_fieldMax.x, val7.x), Mathf.Max(s_fieldMax.y, val7.y)); } if (list3.Count > 12) { GUILayout.Label(Loc.F("dropdown.matches_scroll", "{0} matches: scroll, or type to narrow it down.", list3.Count), UisLook.Sub, Array.Empty<GUILayoutOption>()); } if (list3.Count == 0) { GUILayout.Label(freeText ? Loc.T("dropdown.no_match_free_text", "No match: Enter keeps what you typed.") : Loc.T("dropdown.no_match", "No match."), UisLook.Sub, Array.Empty<GUILayoutOption>()); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } return value; } public static void Open(string id) { s_open = id; s_query = ""; s_highlight = 0; s_openFrame = Time.frameCount; GUI.FocusControl((string)null); s_focusNext = "uisdd_" + id; } private static GUILayoutOption[] WithHeight(GUILayoutOption[] opts) { return ((IEnumerable<GUILayoutOption>)(((object)opts) ?? ((object)new GUILayoutOption[0]))).Concat((IEnumerable<GUILayoutOption>)(object)new GUILayoutOption[1] { GUILayout.Height(FieldH) }).ToArray(); } private static void Close() { s_open = null; s_query = ""; GUI.FocusControl((string)null); } private static List<string> Filter(IList<string> items, string q) { if (items == null) { return new List<string>(); } if (string.IsNullOrEmpty(q)) { return items.ToList(); } string value = q.ToLowerInvariant(); List<string> list = new List<string>(); List<string> list2 = new List<string>(); foreach (string item in items) { string text = (item ?? "").ToLowerInvariant(); if (text.StartsWith(value)) { list.Add(item); } else if (text.Contains(value)) { list2.Add(item); } } list.AddRange(list2); return list; } } internal sealed class UisWindow : MonoBehaviour { private sealed class Listed { public string Id; public string Name; public ScriptModel Model; } private sealed class Checked { public RemoteFile File; public FileReport Report; public int Problems; public List<KeyValuePair<string, Note>> DataNotes = new List<KeyValuePair<string, Note>>(); } private sealed class UpgradeView { public string Before; public string After; public string Why; public string File; public string CheckedText; public string CheckResult; public string Title; public string Hl; public string SugFrom; public string SugTo; public int Line; public int Index; public bool Edit; } private sealed class NoteCtx { public string File; public string Text; public string Title; public int Line; public int Index; } private sealed class InPlace { public string ModelId; public string File; public string Before; public int Index; public int Line; } private const int MainId = 21984; private const int ConfirmId = 21985; private const int DataId = 21986; private const int TemplateId = 21987; private const int ContextId = 21988; private const int TooltipId = 21989; private static UisWindow s_inst; private Rect _rect; private Rect _confirmRect; private Rect _dataRect; private Rect _templateRect; private bool _resizing; private int _tab; private string _status = ""; private string _search = ""; private bool _statusError; private Vector2 _scrollL; private Vector2 _scrollR; private Vector2 _scrollPrev; private Vector2 _scrollCL; private Vector2 _scrollCR; private int _seenVersion = -1; private List<Listed> _mine = new List<Listed>(); private List<Listed> _myData = new List<Listed>(); private ScriptModel _model; private bool _dirty; private bool _showTemplates; private bool _confirmDelete; private readonly HashSet<string> _collapsed = new HashSet<string> { "words", "prev" }; private List<Note> _notes = new List<Note>(); private string _builtYaml = ""; private ScriptModel _data; private Action<string> _dataTarget; private Vector2 _scrollData; private List<Checked> _checked = new List<Checked>(); private int _checkSel; private bool _traceOn; private float _testTraceUntil; private string _testKey; private static List<string> s_prefabs; private bool _notAdmin; private bool _aliveLogged; private readonly List<Rect> _blockRects = new List<Rect>(); private readonly List<KeyValuePair<string, Rect>> _footBtns = new List<KeyValuePair<string, Rect>>(); private Vector2 _clickDown = new Vector2(-1f, -1f); private Vector2 _loggedSize; private static GUIStyle s_statusLine; private static int s_statusKey = -1; private readonly List<KeyValuePair<string, Rect>> _tabBtns = new List<KeyValuePair<string, Rect>>(); private Vector2 _winOrigin; private bool _wasPopup; private string _loggedNames = ""; private string _layoutKey; private static readonly string[] ExecOrder = new string[16] { "log", "exec", "commands", "objectRpc", "clientRpc", "cancel", "owner", "remove", "data", "attach", "items", "spawn", "swap", "poke", "terrain", "drops" }; private readonly HashSet<string> _guided = new HashSet<string>(); private readonly HashSet<string> _worldWide = new HashSet<string>(); private readonly Dictionary<string, int> _guideNext = new Dictionary<string, int>(); private bool _expert; private Vector2 _scrollPv; private string _words = ""; private const bool WordsBoxEnabled = false; private readonly HashSet<string> _openSections = new HashSet<string>(); private bool _stepOpen; private const string NewFileItem = "New file..."; private readonly string[] _saveTo = new string[2]; private readonly string[] _saveFor = new string[2]; private readonly string[] _newName = new string[2] { "", "" }; private readonly bool[] _newMode = new bool[2]; private Rect _saveBtnRect; private static Texture2D s_popBg; private static readonly string[] CommonFilters = new string[9] { "biomes", "day", "night", "minDistance", "maxDistance", "minAltitude", "maxAltitude", "environments", "globalKeys" }; private static readonly string[] AdvancedFilters = new string[7] { "condition", "minX", "maxX", "minY", "maxY", "minZ", "maxZ" }; private readonly HashSet<string> _biomeText = new HashSet<string>(); private const string NewDataItem = "New data preset..."; private static readonly string[] BoolItems = new string[2] { "true", "false" }; private bool _docked; private Rect _undockRect; private float _dockUntil; private string _dockWhat; private int _tabBeforeTest = -1; private static bool s_shrunk; private NoteCtx _noteCtx; private Note _ctxNote; private NoteCtx _ctxFor; private Rect _ctxRect; private InPlace _inPlace; private readonly Dictionary<string, Vector2> _lineScroll = new Dictionary<string, Vector2>(); private bool _overPopup; private static Texture2D DimTex; private Vector2 _scrollFiles; private Vector2 _scrollStart; private UpgradeView _upgrade; private Vector2 _scrollUp; private string _plKey; private List<PokeLinks.Link> _plBy = new List<PokeLinks.Link>(); private List<PokeLinks.Link> _plPokes = new List<PokeLinks.Link>(); private static Texture2D HlTex; private string _pendingText; private float _pendingAt; private int _pendingMine; private static Texture2D PendingBg; private static Texture2D HlBar; private static readonly Regex Quoted = new Regex("'([^']+)'"); private bool _resizingPop; public static bool MouseOverWindow; private const string MyDataFile = "expand_data_EWPForDummies.yaml"; private int _leftMode; private List<DataRef> _dataIndex = new List<DataRef>(); private DataRef _editRef; private ScriptModel _edit; private bool _editDirty; private List<Note> _editNotes = new List<Note>(); private string _keysFilter = ""; private int _keysGroupBy; private bool _keysSortValue; private string _confirmKind = "script"; private string _confirmKey; private string _confirmValue; private readonly Dictionary<string, string> _keyEdits = new Dictionary<string, string>(); private Dictionary<string, List<string>> _keyWriters = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); private Dictionary<string, List<string>> _keyReaders = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); private List<KeyValuePair<string, ScriptReport>> _allScripts = new List<KeyValuePair<string, ScriptReport>>(); private readonly Dictionary<ScriptModel, string> _dataFor = new Dictionary<ScriptModel, string>(); private string _editBefore; private object _itemsFor; private const string GroupTag = " [group]"; private static List<string> s_items; private static Dictionary<string, string> s_prefabCase; private const string ParPrefix = "uispar_"; private string _parHoverNow; private string _parHoverPrev; private bool _parExplain; private bool _parEditEx; private bool _parUseTrace; private readonly Dictionary<int, string> _parEx = new Dictionary<int, string>(); private string _parExType; private int _parExtra; private readonly HashSet<string> _parExplainOpen = new HashSet<string>(); private readonly HashSet<string> _checkExplain = new HashSet<string>(); private Dictionary<string, string> _parStore; private string _parKey; private string _parName; private int _parCaret; private int _parSelect; private bool _parAtEnd; private string _parRefocus; private int _parRefocusCaret; private string _parPopup; private readonly Dictionary<string, float> _parCaretX = new Dictionary<string, float>(); private readonly List<Action> _parLater = new List<Action>(); private readonly Dictionary<string, GUIStyle> _parChip = new Dictionary<string, GUIStyle>(); private int _parChipScale = -1; private const string FnColor = "#d8c08a"; private const string UnknownColor = "#f28282"; private const string RichColor = "#9c907e"; private string[] _traceArgs; private float _traceArgsAt = -10f; private const int PreviewWinId = 21990; private const int PreviewGhostId = 21991; private bool _pvDrag; private Vector2 _pvGrab; private string _pvZone; private Rect _pvRect; private bool _pvResizing; private string _scriptFile; private bool _newScript; private string _newScriptName = ""; private Checked _ctxSecFile; private ScriptReport _ctxSec; private Rect _ctxSecRect; private Checked _rmFile; private ScriptReport _rmSec; private static float MinW => S(720f); private static float MinH => S(520f); private static float Grip => S(18f); private static float LeftW => S(260f); public static bool IsOpen { get; private set; } private bool TraceShownOn { get { if (!_traceOn) { return Time.realtimeSinceStartup < _testTraceUntil; } return true; } } private bool NoAdmin { get { if (!_notAdmin) { if (Rpc.AdminAnswered) { return !Rpc.IsLocalAdmin(); } return false; } return true; } } private static string NoAdminHint => Loc.T("window.tip_no_admin", "Only server admins can save or delete. You can look around."); private static GUIStyle StatusLine { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown if (s_statusLine == null || s_statusKey != UisScale.Key) { s_statusKey = UisScale.Key; s_statusLine = new GUIStyle(UisLook.Status) { wordWrap = false, clipping = (TextClipping)1, alignment = (TextAnchor)3 }; } return s_statusLine; } } private static bool ClickDebug { get { if (Plugin.ClickDebug != null) { return Plugin.ClickDebug.Value; } return false; } } private static float TopH => S(50f) + 1f; private float FooterRowH => Mathf.Max(S(30f), UisLook.Btn.CalcHeight(new GUIContent("Ag"), 100f)) + (float)UisLook.Btn.margin.vertical; private bool TwoRowFooter => ((Rect)(ref _rect)).width < S(1150f); private float FooterH => 1f + S(10f) + FooterRowH + (TwoRowFooter ? (FooterRowH + S(6f)) : 0f) + S(10f) + 2f; private bool ThreeCol { get { if (((Rect)(ref _rect)).width > ((Rect)(ref _rect)).height) { return ((Rect)(ref _rect)).width >= S(1080f); } return false; } } private string PreviewSide { get { string text = Plugin.PreviewPlace?.Value ?? "Auto"; if (text == "Floating") { return "Floating"; } bool flag = ((Rect)(ref _rect)).width >= S(1080f); switch (text) { case "Right": case "Left": if (!flag) { return "Below"; } return text; case "Below": return "Below"; default: if (!ThreeCol) { return "Below"; } return "Right"; } } } private static float PreviewW => S(420f); private bool SaveRowData { get { if ((_leftMode == 1 || _leftMode == 2) && _edit != null) { return !EditReadOnly; } return false; } } private bool SaveRow { get { if (_leftMode != 0 || _model == null) { return SaveRowData; } return true; } } private static string AdvancedDivider => Loc.T("window.advanced_divider", "---- Advanced ----"); private static IEnumerable<string> PlainLeads => Analyzer.PlainLeads.Concat(new string[5] { "Heavy on the server:", "A bit heavy:", "Small cost:", "Good to know:", "Won't fire yet:" }); private static float KeyW => S(120f); public static bool Shrunk => s_shrunk; private static float CheckColW => S(340f); private bool PopupOpen { get { if (!_confirmDelete && _data == null && _upgrade == null && !_showTemplates) { return _ctxNote != null; } return true; } } private bool InPlaceActive { get { if (_inPlace != null && _model != null) { return _inPlace.ModelId == _model.Id; } return false; } } private bool EditReadOnly => false; private bool EditInPlace { get { if (_editRef != null) { return !_editRef.Mine; } return false; } } private static string DataHelp => Loc.F("datawin.help_data", "A data entry is a named set of values that a script puts on an object: a creature's level, a sign's text, a chest's items... Scripts use it by name in a 'data' field (the name is case-sensitive). Filters, add/remove items and Expand World Data locations, vegetation, drops, spawns and blueprints can use it too. Saved in {0}, which both Expand World Prefabs and Expand World Data load.", "expand_data_EWPForDummies.yaml"); private static string GroupHelp => Loc.T("datawin.help_group", "A value group is a named list, e.g. 'bosses' = Eikthyr, gd_king, Bonemass. Write the group name in a prefab field (prefab: bosses) and the script works for every object in it (object names are case-sensitive, group names are not). Inside a value, <bosses> picks one at random; in a condition it means any of them. Listing a value twice makes it more likely to be picked (in a prefab field the copies count once). A group named like a real object is ignored in prefab fields. Built-in groups: creature, structure, component names (Tameable, Piece), material_Wood, itemtype_Consumable. material_<build item> (e.g. material_Bronze): Expand World Prefabs 1.63+ only."); private string ParType => (_model?.Get("@type") ?? "").Trim().ToLowerInvariant(); private string ParParam => _model?.Get("@param") ?? ""; private bool PreviewFloating => (Plugin.PreviewPlace?.Value ?? "Auto") == "Floating"; private bool PreviewFloatShown { get { if (PreviewFloating && IsOpen && !_docked && _tab == 0 && _leftMode == 0) { return _model != null; } return false; } } private Rect ZoneLeft => new Rect(((Rect)(ref _rect)).x, ((Rect)(ref _rect)).y + S(50f), Mathf.Max(S(80f), ((Rect)(ref _rect)).width * 0.18f), ((Rect)(ref _rect)).height - S(50f) - FooterH); private Rect ZoneRight { get { //IL_0062: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(S(80f), ((Rect)(ref _rect)).width * 0.18f); return new Rect(((Rect)(ref _rect)).xMax - num, ((Rect)(ref _rect)).y + S(50f), num, ((Rect)(ref _rect)).height - S(50f) - FooterH); } } private Rect ZoneBelow { get { //IL_0064: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(S(70f), ((Rect)(ref _rect)).height * 0.22f); return new Rect(((Rect)(ref _rect)).x + ((Rect)(ref _rect)).width * 0.18f, ((Rect)(ref _rect)).yMax - FooterH - num, ((Rect)(ref _rect)).width * 0.64f, num); } } private static float S(float px) { return UisScale.S(px); } private static GUILayoutOption WFit(string text, GUIStyle style, float minW) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) return GUILayout.Width(Mathf.Max(S(minW), style.CalcSize(new GUIContent(text)).x + S(4f))); } private void Awake() { s_inst = this; Rpc.OnMessage = delegate(bool ok, string msg) { if (!ok && msg != null && msg.IndexOf("Only admins", StringComparison.OrdinalIgnoreCase) >= 0) { _notAdmin = true; } else if (ok) { _notAdmin = false; } Status(msg, !ok); }; } private bool AdminBtn(string text, GUIStyle style, float minW = 64f, string log = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) bool noAdmin = NoAdmin; bool enabled = GUI.enabled; if (noAdmin) { GUI.enabled = false; } bool flag = FootBtn(text, style, minW, log); GUI.enabled = enabled; if (noAdmin) { Rect val = SafeRect.Last(); if (((Rect)(ref val)).Contains(Event.current.mousePosition)) { UisSkin.MarkHint(NoAdminHint); } } if (flag) { return !noAdmin; } return false; } private void Update() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (!_aliveLogged && ClickDebug) { _aliveLogged = true; Plugin.Log.LogInfo((object)$"UisWindow Update alive (enabled={((Behaviour)this).enabled}, active={((Component)this).gameObject.activeInHierarchy}, go={((Object)((Component)this).gameObject).name})."); } KeyboardShortcut value; if (!IsOpen) { value = Plugin.Hotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { string text = CanOpenReason(); if (ClickDebug) { Plugin.Log.LogInfo((object)("Open key IsDown fired; CanOpen=" + (text == null) + ((text == null) ? "" : (" (" + text + ")")))); } if (text == null) { Open(); } } return; } value = Plugin.Hotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Close(); return; } if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)ZNet.instance == (Object)null) { Close(); return; } if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } if (Rpc.Version != _seenVersion) { _seenVersion = Rpc.Version; try { Rebuild(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Rebuilding the lists failed: " + ex)); Status(Loc.F("window.status_read_failed", "Couldn't read the server files: {0}", ex.Message), error: true); } } Rpc.CheckTimeout(); UpdateClickBlocker(); } private void UpdateClickBlocker() { //IL_001c: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) _blockRects.Clear(); if (IsOpen) { _blockRects.Add(_rect); if (PreviewFloatShown && ((Rect)(ref _pvRect)).width > 1f) { _blockRects.Add(_pvRect); } if (_confirmDelete && ((Rect)(ref _confirmRect)).width > 1f) { _blockRects.Add(_confirmRect); } if (_data != null && ((Rect)(ref _dataRect)).width > 1f) { _blockRects.Add(_dataRect); } if ((_upgrade != null || _showTemplates) && ((Rect)(ref _templateRect)).width > 1f) { _blockRects.Add(_templateRect); } if (_ctxNote != null) { _blockRects.Add(_ctxRect); } if (_ctxSec != null) { _blockRects.Add(_ctxSecRect); } } ClickBlocker.Cover(_blockRects); } private static string CanOpenReason() { if ((Object)(object)ZNet.instance == (Object)null) { return "no ZNet"; } if ((Object)(object)Player.m_localPlayer == (Object)null) { return "no player"; } if (Console.IsVisible()) { return "console visible"; } if ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) { return "chat focus"; } if (TextInput.IsVisible()) { return "text input"; } return null; } private void Open() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) UisScale.Update(); float num = Mathf.Clamp(S((Plugin.WinW.Value > 0f) ? Plugin.WinW.Value : 1560f), MinW, Mathf.Max(MinW, (float)Screen.width - S(40f))); float num2 = Mathf.Clamp(S((Plugin.WinH.Value > 0f) ? Plugin.WinH.Value : 900f), MinH, Mathf.Max(MinH, (float)Screen.height - S(40f))); float num3 = ((Plugin.WinX.Value >= 0f) ? Plugin.WinX.Value : (((float)Screen.width - num) / 2f)); float num4 = ((Plugin.WinY.Value >= 0f) ? Plugin.WinY.Value : (((float)Screen.height - num2) / 2f)); _rect = new Rect(num3, num4, num, num2); Clamp(); IsOpen = true; s_shrunk = false; Plugin.Log.LogInfo((object)"Window open: game keys are blocked until it closes (Ctrl+F12 / Esc / x close it)."); if (ClickDebug) { Plugin.Log.LogInfo((object)"Window opened."); } Rpc.RequestMine(); if (Rpc.Files.Count == 0) { Rpc.RequestCheck(); } Status(Loc.T("window.status_reading_scripts", "Reading your scripts from the server...")); } private void Close() { if (IsOpen) { IsOpen = false; _pvDrag = false; ClickBlocker.Cover(null); Plugin.Log.LogInfo((object)"Window closed: game keys are free again."); SearchDropdown.CloseAll(); if (_docked) { Undock(); } Plugin.WinX.Value = ((Rect)(ref _rect)).x; Plugin.WinY.Value = ((Rect)(ref _rect)).y; Plugin.WinW.Value = Mathf.Round(((Rect)(ref _rect)).width / UisScale.Value); Plugin.WinH.Value = Mathf.Round(((Rect)(ref _rect)).height / UisScale.Value); if (_traceOn) { _traceOn = false; Rpc.SetTrace(on: false); } } } private void Clamp() { float num = (_docked ? S(300f) : MinW); ((Rect)(ref _rect)).width = Mathf.Clamp(((Rect)(ref _rect)).width, num, Mathf.Max(num, (float)Screen.width)); ((Rect)(ref _rect)).height = Mathf.Clamp(((Rect)(ref _rect)).height, MinH, Mathf.Max(MinH, (float)Screen.height)); ((Rect)(ref _rect)).x = Mathf.Clamp(((Rect)(ref _rect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _rect)).width)); ((Rect)(ref _rect)).y = Mathf.Clamp(((Rect)(ref _rect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _rect)).height)); } private void Status(string msg, bool error = false) { _status = msg ?? ""; _statusError = error; if (error) { Plugin.Log.LogWarning((object)("Status: " + _status)); } } private void Rebuild() { if (_pendingText != null && Rpc.MineReplies != _pendingMine) { _pendingText = null; } _mine = ParseBlocks(Rpc.ScriptsText); _myData = ParseBlocks(Rpc.DataText); RebuildData(); _checked = Rpc.Files.Select(delegate(RemoteFile f) { bool flag = f.Name.Contains("expand_data") || f.Name.StartsWith("data/"); FileReport fileReport; try { fileReport = (flag ? new FileReport { File = f.Name, ParseError = EwpYaml.Check(f.Text, data: true) } : Analyzer.AnalyzeFile(f.Name, f.Text)); } catch (Exception ex) { Plugin.Log.LogWarning((object)$"Checking {f.Name} failed: {ex}"); fileReport = new FileReport { File = f.Name, ParseError = Loc.F("window.checker_failed", "The checker failed on this file: {0}", ex.Message) }; } Checked obj2 = new Checked { File = f, Report = fileReport, Problems = ((fileReport.ParseError != null) ? 1 : 0) + fileReport.Scripts.Sum((ScriptReport s) => s.Notes.Count((Note n) => n.Severity >= 1)) }; foreach (DataRef d in _dataIndex.Where((DataRef x) => x.File == f.Name)) { foreach (Note item in DataTools.CheckMap(d.Map, from o in _dataIndex where o != d select o.Name)) { obj2.DataNotes.Add(new KeyValuePair<string, Note>(string.Format("{0} '{1}' (line {2})", d.Group ? "group" : "data", d.Name, d.Line), item)); } } return obj2; }).ToList(); PokeLinks.Build(_checked.Select((Checked x) => new KeyValuePair<string, FileReport>(ShortFile(x.File.Name), x.Report))); foreach (DataRef g in _dataIndex.Where((DataRef x) => x.Group && !x.NotData)) { Checked obj = _checked.FirstOrDefault((Checked x) => x.File.Name == g.File); if (obj != null && !_checked.Any((Checked x) => x.Report.Scripts.Any((ScriptReport s) => DataTools.UsedBy(g.Name, new KeyValuePair<string, ScriptReport>[1] { new KeyValuePair<string, ScriptReport>("", s) }, group: true).Count > 0)) && !_dataIndex.Any((DataRef o) => o != g && Analyzer.AllText(o.Map).IndexOf("<" + g.Name + ">", StringComparison.OrdinalIgnoreCase) >= 0)) { obj.DataNotes.Add(new KeyValuePair<string, Note>($"group '{g.Name}' (line {g.Line})", new Note(0, Loc.F("window.note_group_unused", "No file we read uses group '{0}' (other mods' files are not checked).", g.Name), Loc.F("window.fix_group_unused", "Use it in a prefab field, or as <{0}> in a value.", g.Name)))); } } foreach (Checked item2 in _checked) { item2.Problems += item2.DataNotes.Count((KeyValuePair<string, Note> n) => n.Value.Severity >= 1); } RebuildKeyUse(); if (_model == null && _mine.Count > 0) { Select(_mine[0]); } Recheck(); RecheckEdit(); } private static List<Listed> ParseBlocks(string text) { List<Listed> list = new List<Listed>(); string header; foreach (KeyValuePair<string, string> item in FileStore.Blocks(text, out header)) { string[] array = item.Value.Split(new char[1] { '\n' }); string text2 = array[0].Substring("# UIS:".Length); int num = text2.IndexOf(' '); string name = ((num > 0) ? text2.Substring(num + 1) : text2); string text3 = array.FirstOrDefault((string l) => l.StartsWith("# UISDATA:")); ScriptModel scriptModel = ((text3 != null) ? ScriptModel.Decode(text3.Substring("# UISDATA:".Length)) : null); if (scriptModel != null) { scriptModel.Id = item.Key; } list.Add(new Listed { Id = item.Key, Name = name, Model = scriptModel }); } return list; } private void Select(Listed l) { if (l.Model == null) { Status(Loc.F("window.status_hand_edited", "'{0}' was edited by hand and can't be opened here. Use 'Check scripts' to read it.", l.Name), error: true); } else { _model = l.Model.Clone(); _dirty = false; Recheck(); } } private void Recheck() { if (_model == null) { _notes.Clear(); _builtYaml = ""; } else { _builtYaml = (InPlaceActive ? KeepOuterComments(_inPlace.Before, YamlWriter.BuildRule(_model)) : YamlWriter.BuildBlock(_model)); string error; object obj = EwpYaml.AsList(EwpYaml.ParseGeneric(YamlWriter.BuildRule(_model), out error)).FirstOrDefault(); _notes = ((obj != null) ? Analyzer.AnalyzeScript(EwpYaml.AsMap(obj)).Notes : new List<Note>()); } } private void OnGUI() { //IL_0055: 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_0061: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_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_0036: 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) //IL_00f0: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01bd: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Expected O, but got Unknown //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Invalid comparison between Unknown and I4 //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Invalid comparison between Unknown and I4 //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Invalid comparison between Unknown and I4 //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Invalid comparison between Unknown and I4 //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Invalid comparison between Unknown and I4 //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Expected O, but got Unknown //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Invalid comparison between Unknown and I4 //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Expected O, but got Unknown //IL_06b9: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } ParOnGui(); if (UisScale.Update()) { _confirmRect = (_dataRect = (_templateRect = default(Rect))); Clamp(); } UisSkin.Ensure(1f); UisLook.Ensure(); Vector2 mousePosition = Event.current.mousePosition; MouseOverWindow = ((Rect)(ref _rect)).Contains(mousePosition) || (PreviewFloatShown && ((Rect)(ref _pvRect)).Contains(mousePosition)) || (_data != null && ((Rect)(ref _dataRect)).Contains(mousePosition)) || ((_upgrade != null || _showTemplates) && ((Rect)(ref _templateRect)).Contains(mousePosition)) || (_confirmDelete && ((Rect)(ref _confirmRect)).Contains(mousePosition)); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Plugin.Opacity.Value); _overPopup = (_confirmDelete && ((Rect)(ref _confirmRect)).Contains(mousePosition)) || (_data != null && ((Rect)(ref _dataRect)).Contains(mousePosition)) || ((_upgrade != null || _showTemplates) && ((Rect)(ref _templateRect)).Contains(mousePosition)) || (_ctxNote != null && ((Rect)(ref _ctxRect)).Contains(mousePosition)) || (_ctxSec != null && ((Rect)(ref _ctxSecRect)).Contains(mousePosition)) || (PreviewFloatShown && ((Rect)(ref _pvRect)).Contains(mousePosition)); PreviewDragEvents(); _rect = GUI.Window(21984, _rect, new WindowFunction(DrawMain), "", UisLook.Window); DrawPreviewFloat(); GUI.color = Color.white; if (_confirmDelete) { if (((Rect)(ref _confirmRect)).width < 1f) { _confirmRect = new Rect(((Rect)(ref _rect)).x + ((Rect)(ref _rect)).width / 2f - S(200f), ((Rect)(ref _rect)).y + S(120f), S(400f), S(170f)); } _confirmRect = GUI.Window(21985, _confirmRect, new WindowFunction(DrawConfirm), "", UisLook.PopupWindow); GUI.BringWindowToFront(21985); } if (_data != null) { if (((Rect)(ref _dataRect)).width < 1f) { _dataRect = new Rect(((Rect)(ref _rect)).x + S(80f), ((Rect)(ref _rect)).y + S(60f), Mathf.Min(S(680f), ((Rect)(ref _rect)).width - S(100f)), Mathf.Min(S(560f), ((Rect)(ref _rect)).height - S(80f))); } _dataRect = GUI.Window(21986, _dataRect, new WindowFunction(DrawData), "", UisLook.PopupWindow); GUI.BringWindowToFront(21986); } if (_upgrade != null) { _showTemplates = false; if (((Rect)(ref _templateRect)).width < 1f) { _templateRect = new Rect(((Rect)(ref _rect)).x + S(30f), ((Rect)(ref _rect)).y + S(50f), Mathf.Max(S(420f), ((Rect)(ref _rect)).width - S(60f)), Mathf.Min(S(620f), ((Rect)(ref _rect)).height - S(100f))); } _templateRect = GUI.Window(21987, _templateRect, new WindowFunction(DrawUpgrade), "", UisLook.PopupWindow); GUI.BringWindowToFront(21987); } if (_ctxSec != null) { Event current = Event.current; if ((int)current.type == 0 && !((Rect)(ref _ctxSecRect)).Contains(current.mousePosition)) { _ctxSec = null; } else if ((int)current.type == 4 && (int)current.keyCode == 27) { _ctxSec = null; current.Use(); } else { _ctxSecRect = GUI.Window(22004, _ctxSecRect, new WindowFunction(DrawSectionMenu), "", UisLook.PopupWindow); GUI.BringWindowToFront(22004); } } if (_ctxNote != null) { Event current2 = Event.current; if ((int)current2.type == 0 && !((Rect)(ref _ctxRect)).Contains(current2.mousePosition)) { _ctxNote = null; } else if ((int)current2.type == 4 && (int)current2.keyCode == 27) { _ctxNote = null; current2.Use(); } else { _ctxRect = GUI.Window(21988, _ctxRect, new WindowFunction(DrawNoteMenu), "", UisLook.PopupWindow); GUI.BringWindowToFront(21988); } } else if (_showTemplates) { if (((Rect)(ref _templateRect)).width < 1f) { _templateRect = new Rect(((Rect)(ref _rect)).x + S(60f), ((Rect)(ref _rect)).y + S(60f), S(560f), Mathf.Min(S(520f), ((Rect)(ref _rect)).height - S(80f))); } _templateRect = GUI.Window(21987, _templateRect, new WindowFunction(DrawTemplates), "", UisLook.PopupWindow); GUI.BringWindowToFront(21987); } GUI.color = color; Clamp(); Event current3 = Event.current; if ((int)current3.type == 4 && (int)current3.keyCode == 27 && !SearchDropdown.AnyOpen && !PopupOpen && _ctxSec == null) { current3.Use(); Close(); return; } DrawPreviewGhost(); if (UisSkin.PendingTooltip(UisSkin.Tip, out var rect, out var content)) { Rect tr = rect; GUIContent tc = content; GUI.Window(21989, tr, (WindowFunction)delegate { //IL_0020: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(0f, 0f, ((Rect)(ref tr)).width, ((Rect)(ref tr)).height), tc, UisSkin.Tip); }, "", GUIStyle.none); GUI.BringWindowToFront(21989); } } private bool FootBtn(string text, GUIStyle style, float minW = 64f, string log = null) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_000f: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) string text2 = log ?? text; float x = style.CalcSize(new GUIContent(text)).x; bool flag = GUILayout.Button(text, style, (GUILayoutOption[])(object)new GUILayoutOption[3] { GUILayout.MinHeight(S(30f)), GUILayout.MinWidth(Mathf.Max(S(minW), x)), GUILayout.ExpandWidth(false) }); if (ClickDebug) { Rect val = SafeRect.Last(); if ((int)Event.current.type == 7) { _footBtns.Add(new KeyValuePair<string, Rect>(text2, new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + ((Rect)(ref _rect)).height - FooterH, ((Rect)(ref val)).width, ((Rect)(ref val)).height))); Color c = default(Color); ((Color)(ref c))..ctor(0.2f, 1f, 0.4f, 0.9f); UisLook.Outline(val, c); } if (flag) { Plugin.Log.LogInfo((object)$"[click] '{text2}' pressed (rect {val})."); } } return flag; } private void TabRect(string logName, float dy = 0f) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: 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_0030: Unknown result type (might be due to invalid IL or missing references) if (ClickDebug && (int)Event.current.type == 7) { Rect value = SafeRect.Last(); ((Rect)(ref value)).y = ((Rect)(ref value)).y + dy; _tabBtns.Add(new KeyValuePair<string, Rect>(logName, value)); } } private void DbgRect(string logName) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0032: 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) //IL_0040: 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) if (ClickDebug && (int)Event.current.type == 7) { Rect val = SafeRect.Last(); Vector2 val2 = GUIUtility.GUIToScreenPoint(((Rect)(ref val)).position) - _winOrigin; _tabBtns.Add(new KeyValuePair<string, Rect>(logName, new Rect(val2.x, val2.y, ((Rect)(ref val)).width, ((Rect)(ref val)).height))); } } private void ClickDebugBefore() { //IL_000f: 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_001d: Unknown result type (might be due to invalid IL or missing references) if (ClickDebug) { Event current = Event.current; if ((int)current.type == 0) { _clickDown = current.mousePosition; } } } private void ClickDebugAfter() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (!ClickDebug) { return; } Event current = Event.current; string text = (((int)current.type == 7) ? string.Join(",", _tabBtns.Select((KeyValuePair<string, Rect> b) => b.Key)) : _loggedNames); if ((int)current.type == 7 && _footBtns.Count > 0 && (_loggedSize.x != ((Rect)(ref _rect)).width || _loggedSize.y != ((Rect)(ref _rect)).height || text != _loggedNames)) { _loggedSize = new Vector2(((Rect)(ref _rect)).width, ((Rect)(ref _rect)).height); _loggedNames = text; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref _rect)).width - Grip - S(8f), ((Rect)(ref _rect)).height - Grip - S(8f), Grip, Grip); Plugin.Log.LogInfo((object)($"[click] window {_rect}, scale {UisScale.Value:0.###}, grip {val}; footer: " + string.Join("; ", from b in _footBtns.Concat(_tabBtns) select b.Key + " " + ((object)b.Value/*cast due to .constrained prefix*/).ToString()))); } } private void ClickDebugEnd() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_003b: 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_0050: 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_0031: 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) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 if (!ClickDebug || _clickDown.x < 0f) { return; } Event current = Event.current; if ((int)current.type == 12 || (int)current.type == 0) { Vector2 p = _clickDown; _clickDown = new Vector2(-1f, -1f); string text = (from b in _footBtns.Where(delegate(KeyValuePair<string, Rect> b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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) Rect value = b.Value; return ((Rect)(ref value)).Contains(p); }) select b.Key).FirstOrDefault() ?? "(no footer button)"; Plugin.Log.LogInfo((object)$"[click] MouseDown at {p} (window-local), used={(int)current.type == 12}, hotControl={GUIUtility.hotControl}, keyboardControl={GUIUtility.keyboardControl}, over={text}, resizing={_resizing}."); } } private string StructKey() { return _tab + "|" + _leftMode + "|" + (_model?.Id ?? "-") + "|" + InPlaceActive + "|" + ((_edit != null) ? _edit.GetHashCode() : 0) + "|" + _docked + "|" + _newScript + "|" + SaveRowData + "|" + SaveStripOpen(data: true) + "|" + SaveStripOpen(data: false) + "|" + TwoRowFooter + "|" + _confirmDelete + "|" + _showTemplates + "|" + (_upgrade != null) + "|" + (_data != null) + "|" + (_ctxSec != null) + "|" + (_ctxNote != null) + "|" + PreviewSide + "|" + ThreeCol; } private void LayoutGuard() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 Event current = Event.current; if (current == null) { return; } if ((int)current.type == 8) { if (_layoutKey == null) { _layoutKey = StructKey(); } } else if (_layoutKey != null && StructKey() != _layoutKey) { _layoutKey = null; GUIUtility.ExitGUI(); } } private void DrawMain(int id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0035: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_032f: 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_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Invalid comparison between Unknown and I4 //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_039b: 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_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Invalid comparison between Unknown and I4 //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Invalid comparison between Unknown and I4 //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 8) { _layoutKey = StructKey(); } else { LayoutGuard(); } ClickDebugBefore(); if ((int)Event.current.type == 7) { _winOrigin = GUIUtility.GUIToScreenPoint(Vector2.zero); } if (SearchDropdown.OpenFieldList && (int)Event.current.type == 0 && !SearchDropdown.JustOpened && !SearchDropdown.AreaContains(GUIUtility.GUIToScreenPoint(Event.current.mousePosition))) { SearchDropdown.CloseAll(); } bool popupOpen = PopupOpen; if (popupOpen && !_wasPopup && SearchDropdown.OpenFieldList) { SearchDropdown.CloseAll(); } _wasPopup = popupOpen; SearchDropdown.ClosedRectHook = (ClickDebug ? ((Action<string>)delegate(string ddId) { DbgRect("Tab DD " + ddId); }) : null); UisSkin.ResetTooltip(); UisSkin.SuppressTips = _overPopup; UisScroll.Pick("main"); GUILayout.BeginHorizontal(Pad(14, 14, 10, 10), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(S(50f)) }); GUILayout.Label("EWP for Dummies", UisLook.Title, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if ((int)Event.current.type == 7) { _tabBtns.Clear(); } if (GUILayout.Button(Loc.T("window.tab_write", "Write"), (_tab == 0) ? UisLook.TabOn : UisLook.Tab, Array.Empty<GUILayoutOption>()) && _tab != 0) { _tab = 0; Status(""); } TabRect("Tab Write"); GUILayout.Space(S(12f)); if (GUILayout.Button(Loc.T("window.tab_check_scripts", "Check scripts"), (_tab == 1) ? UisLook.TabOn : UisLook.Tab, Array.Empty<GUILayoutOption>()) && _tab != 1) { _tab = 1; Status(Loc.T("window.status_reading_files", "Reading the server files...")); Rpc.RequestCheck(); } TabRect("Tab Check scripts"); GUILayout.Space(S(12f)); GUILayout.Label(Loc.T("window.opacity", "Opacity"), UisLook.Sub, Array.Empty<GUILayoutOption>()); Plugin.Opacity.Value = UisKit.Slider(Plugin.Opacity.Value, 0.4f, 1f, "", S(120f)); if (GUILayout.Button("×", UisLook.Close, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(S(28f)) })) { Close(); } GUILayout.EndHorizontal(); UisLook.HLine(); float num = S(50f) + 1f; float footerH = FooterH; Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, ((Rect)(ref _rect)).height - footerH, ((Rect)(ref _rect)).width, footerH); LayoutGuard(); GUILayout.BeginArea(val); DrawFooter(); GUILayout.EndArea(); LayoutGuard(); Event current = Event.current; bool flag = _tab == 0 && SaveRow && SearchDropdown.IsOpen(SaveRowData ? "savedata" : "savefile"); Rect val2; Rect val3; if (!flag) { val2 = default(Rect); val3 = val2; } else { val3 = SavePopupRect(val); } Rect r = val3; if (flag && (int)current.type == 0 && !((Rect)(ref r)).Contains(current.mousePosition)) { val2 = new Rect(((Rect)(ref val)).x + ((Rect)(ref _saveBtnRect)).x, ((Rect)(ref val)).y + ((Rect)(ref _saveBtnRect)).y, ((Rect)(ref _saveBtnRect)).width, ((Rect)(ref _saveBtnRect)).height); if (!((Rect)(ref val2)).Contains(current.mousePosition)) { SearchDropdown.CloseAll(); flag = false; } } bool flag2 = (current.isMouse || (int)current.type == 6) && (((Rect)(ref val)).Contains(current.mousePosition) || (flag && ((Rect)(ref r)).Contains(current.mousePosition))); EventType type = current.type; if (flag2) { current.type = (EventType)11; } float num2 = Mathf.Max(S(100f), ((Rect)(ref _rect)).height - num - footerH); GUILayout.BeginArea(new Rect(0f, num, ((Rect)(ref _rect)).width, num2)); float num3 = 0f; if (NoAdmin) { GUILayout.Label(Loc.T("window.banner_not_admin", "<color=#F0A898>You are not an admin on this server: you can look, but not save.</color>"), StatusLine, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(S(26f)) }); num3 = S(26f) + (float)StatusLine.margin.vertical; } if (Rpc.ServerEwpOlder) { GUILayout.Label(Loc.F("window.banner_older_ewp", "<color=#F0D080>This server runs Expand World Prefabs {0}; this tool is made for {1}. Things only the newer version has are marked, and the tool won't write them.</color>", Rpc.ServerEwpVersion, "1.65.0"), StatusLine, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(S(26f)) }); num3 += S(26f) + (float)StatusLine.margin.vertical; } if (_docked) { DrawDockedTest(num2 - num3); } else if (_tab == 0) { DrawMine(num2 - num3); } else { DrawCheck(num2 - num3); } GUILayout.EndArea(); if (flag2 && (int)current.type == 11) { current.type = type; } if (flag) { DrawSavePopup(r, SaveRowData, SaveRowData ? _edit.Id : _model.Id); } DrawPending(); if (PopupOpen && (int)Event.current.type == 7) { GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _rect)).width, ((Rect)(ref _rect)).height), (Texture)(object)(DimTex ?? (DimTex = UisLook.Solid(new Color(0f, 0f, 0f, 0.38f))))); } UisSkin.SuppressTips = false; ClickDebugAfter(); HandleResizeGrip(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width - S(480f), S(46f))); ClickDebugEnd(); } private void DrawFooter() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0070: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0222: Expected O, but got Unknown //IL_03f4: Unknown result type (might be due to invalid IL or missing references) UisLook.HLine(); if ((int)Event.current.type == 7) { _footBtns.Clear(); } GUIStyle val = new GUIStyle(GUIStyle.none) { padding = new RectOffset((int)S(14f), (int)(Grip + S(8f) + S(12f)), (int)S(10f), (int)S(10f)) }; GUILayout.BeginHorizontal(val, Array.Empty<GUILayoutOption>()); string text = ((_status.Length > 0) ? _status : Loc.T("window.status_ready", "Ready")); GUILayout.Label(_statusError ? ("<color=#F0A898>" + text + "</color>") : text, StatusLine, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(Mathf.Clamp(StatusLine.CalcSize(new GUIContent(text)).x + 2f, S(60f), Mathf.Max(S(120f), ((Rect)(ref _rect)).width * ((_tab == 0 && SaveRow) ? 0.2f : 0.45f)))), GUILayout.MinHeight(S(30f)) }); float x = StatusLine.CalcSize(new GUIContent(text)).x; Rect val2 = SafeRect.Last(); UisSkin.MarkHint((x > ((Rect)(ref val2)).width + 1f) ? text : null); if (_tab == 0 && SaveRowData && !SaveStripOpen(SaveRowData)) { GUILayout.Space(S(16f)); DrawSaveToFooter(SaveRowData, SaveRowData ? _edit.Id : _model.Id); } if (TwoRowFooter) { GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUIStyle(val) { padding = new RectOffset(val.padding.left, val.padding.right, (int)S(6f), 0) }, Array.Empty<GUILayoutOption>()); } GUILayout.FlexibleSpace(); if (_tab == 0 && (_leftMode == 1 || _leftMode == 2)) { DrawDataFooter(); } else if (_tab == 0 && _leftMode == 3) { if (FootBtn(Loc.T("window.btn_refresh_keys", "Refresh keys"), UisLook.Btn, 64f, "Refresh keys")) { Rpc.RequestKeys(); } } else if (_tab == 0) { if (FootBtn(Loc.T("window.btn_new", "New"), UisLook.Btn, 64f, "New")) { _showTemplates = true; } UisSkin.MarkHint(Loc.T("window.tip_new_section", "Start a new section from a template.")); GUI.enabled = _model != null; if (FootBtn(Loc.T("window.btn_test_section", "Test this section"), UisLook.Btn, 64f, "Test this script")) { TestModel(); } UisSkin.MarkHint((_model == null) ? Loc.T("window.tip_pick_section_first", "Pick a section first.") : Loc.T("window.tip_test_section", "Spawns this section's object next to you and shows the live trace (for sections that run on create or destroy).")); GUI.enabled = _model != null; if (AdminBtn(Loc.T("window.btn_remove_section", "Remove section"), UisLook.Btn, 64f, "Delete")) { Checked obj = (InPlaceActive ? _checked.FirstOrDefault((Checked c) => c.File.Name == _inPlace.File) : null); ScriptReport scriptReport = obj?.Report.Scripts.FirstOrDefault((ScriptReport s) => s.Index + 1 == _inPlace.Index); if (obj != null && scriptReport != null) { _rmFile = obj; _rmSec = scriptReport; _confirmKind = "section"; _confirmDelete = true; _confirmRect = default(Rect); } else { _model = null; _inPlace = null; Status(Loc.T("window.status_section_dropped", "The new section was not saved; it is gone.")); } } if (!NoAdmin) { UisSkin.MarkHint((_model == null) ? Loc.T("window.tip_pick_section_first", "Pick a section first.") : (InPlaceActive ? Loc.T("window.tip_delete_in_place", "A server script opened with Edit in writer is not deleted from here: remove it with Edit in text if you really want it gone.") : Loc.T("window.tip_remove_section", "Removes this section from its script. The rest of the script stays. Asks first."))); } GUI.enabled = _model != null && !GuideWaiting(_model); string log = "Save script" + (_dirty ? " *" : ""); string text2 = Loc.T("window.btn_save_script", "Save script") + (_dirty ? " *" : ""); if (AdminBtn(text2, UisLook.BtnGold, 130f, log)) { OnSave(); } if (!NoAdmin) { UisSkin.MarkHint((_model == null) ? Loc.T("window.tip_pick_section_first", "Pick a section first.") : (InPlaceActive ? Loc.T("window.tip_save_in_place", "Writes this script back over the original in its server file. The whole file is checked first: nothing is written if EWP couldn't load it.") : (Loc.T("window.tip_save_script", "Saves the script (the whole yaml file) on the server; only this section's lines change. The file is checked first: nothing is written if EWP couldn't load it.") + (_dirty ? "" : (" " + Loc.T("window.tip_save_nothing_changed", "(Nothing changed since the last save.)")))))); } GUI.enabled = true; } else { if (FootBtn(Loc.T("window.btn_read_files_again", "Read files again"), UisLook.Btn, 64f, "Read files again")) { Rpc.RequestCheck(); } bool traceShownOn = TraceShownOn; if (FootBtn(traceShownOn ? Loc.T("window.btn_trace_on", "Live trace: ON") : Loc.T("window.btn_trace_off", "Live trace: OFF"), traceShownOn ? UisLook.BtnGold : UisLook.Btn, 64f, traceShownOn ? "Live trace: ON" : "Live trace: OFF")) { if (traceShownOn) { _traceOn = false; _testTraceUntil = 0f; Rpc.SetTrace(on: false); } else { _traceOn = true; Rpc.SetTrace(on: true); } } if (FootBtn(Loc.T("window.btn_clear_trace", "Clear trace"), UisLook.Btn, 64f, "Clear trace")) { lock (Rpc.TraceLines) { Rpc.TraceLines.Clear(); } } } GUILayout.EndHorizontal(); } private void DrawMine(float h) { //IL_00bb: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Invalid comparison between Unknown and I4 //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0351: 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) GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(h) }); GUILayout.BeginVertical(Pad(10, 10, 10, 10), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(LeftW) }); _search = GUILayout.TextField(_search ?? "", UisLook.Input, Array.Empty<GUILayoutOption>()); if (_search.Length == 0 && (int)Event.current.type == 7) { GUI.Label(SafeRect.Last(), (_leftMode == 0) ? Loc.T("window.find_script_section", "Find a script or section") : Loc.T("window.find", "Find"), UisLook.Placeholder); } DrawLeftModeTabs(); _scrollL = UisScroll.Begin("main/l", _scrollL, GUIStyle.none, GUIStyle.none); if (_leftMode == 1 || _leftMode == 2) { DrawLeftData(_leftMode == 2); } else if (_leftMode == 3) { DrawLeftKeys(); } else { DrawLeftScripts(h); GUILayout.Space(S(8f)); bool num = FileSection("sec/start", Loc.T("window.section_start_from", "Start from"), EwpSchema.Templates.Count, forceOpen: false); DbgRect("Tab Sec Start from"); if (num) { _scrollStart = UisScroll.Begin("main/lstart", _scrollStart, GUILayout.Height(Mathf.Max(S(140f), h * 0.3f))); int num2 = 0; foreach (Template template in EwpSchema.Templates) { if (GUILayout.Button((string)template.Title, UisLook.Nav, Array.Empty<GUILayoutOption>())) { _model = StartFrom(template); _dirty = true; Recheck(); Status(Loc.T("window.status_template_loaded_section", "New section from a template: pick its script above, edit, then Save script.")); } DbgRect("Tab Tpl " + num2++); UisSkin.MarkHint(string.Concat(template.Title, "\n", template.Hint)); } UisScroll.End("main/lstart"); } } UisScroll.End("main/l"); GUILayout.EndVertical(); LayoutGuard(); Rect rect = GUILayoutUtility.GetRect(1f, h, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(S(1f)), GUILayout.ExpandHeight(true) }); if ((int)Event.current.type == 7) { GUI.DrawTexture(rect, (Texture)(object)(UisLook.LineSolid ?? (UisLook.LineSolid = UisLook.Solid(UisLook.Line)))); } if (PreviewSide == "Left" && _leftMode == 0 && _model != null) { DrawPreviewColumn(h, left: true); } GUILayout.BeginVertical(Pad(16, 10, 10, 0), Array.Empty<GUILayoutOption>()); bool saveRowData = SaveRowData; bool flag = SaveRow && SaveStripOpen(saveRowData); float num3 = (flag ? SaveRowH(saveRowData) : 0f); _scrollR = UisScroll.Begin("main/r", _scrollR, GUILayout.Height(Mathf.Max(S(60f), h - S(10f) - num3)), GUILayout.ExpandHeight(false)); if (_leftMode == 1 || _leftMode == 2) { DrawRightData(); } else if (_leftMode == 3) { DrawRightKeys(); } else if (_model == null) { GUILayout.Label(Loc.T("window.pick_section", "Pick a section on the left, or start from a template."), UisLook.Sub, Array.Empty<GUILayoutOption>()); } else { GUI.changed = false; DrawEditor(); if (GUI.changed) { _dirty = true; Recheck(); } } GUILayout.Space(S(56f)); UisScroll.End("main/r"); if (flag) { GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(num3), GUILayout.ExpandHeight(false) }); UisLook.HLine(); DrawSaveTo(saveRowData, saveRowData ? _edit.Id : _model.Id); GUILayout.EndVertical(); } GUILayout.EndVertical(); if (PreviewSide == "Right" && _leftMode == 0 && _model != null) { DrawPreviewColumn(h, left: false); } GUILayout.EndHorizontal(); } private void DrawEditor() { ScriptModel m = _model; DrawScriptHeader(m); TriggerChoice trig = EwpSchema.Trigger((m.Get("@choice").Length > 0) ? m.Get("@choice") : "create"); int num = StepsOpen(m, trig); bool ww = WorldWide(m, trig); StepBegin(1, Loc.T("window.step_prefab", "Prefab"), Loc.T("window.step_prefab_sub", "which object the script watches"), "Prefab"); if (trig.Global) { GUILayout.Label(Loc.T("window.prefab_world_wide", "This type is world-wide: it has no prefab."), UisSkin.Desc, Array.Empty<GUILayoutOption>()); } else if (trig.FixedPrefab != null) { GUILayout.Label(Loc.F("window.prefab_fixed", "prefab: {0} (set by the type below).", trig.FixedPrefab), UisSkin.Desc, Array.Empty<GUILayoutOption>()); } else if (ww) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(Loc.T("window.guide_world_wide", "No object: a world-wide script (a timer, a world key, an event...)."), UisSkin.Desc, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(Loc.T("window.guide_btn_pick_object", "Pick an object instead"), UisLook.BtnSmall, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _worldWide.Remove(m.Id); GUI.changed = true; } GUILayout.EndHorizontal(); } else { if (Guided(m) && m.Get("prefab").Trim().Length == 0) { if (GUILayout.Button(Loc.T("window.guide_btn_no_object", "No object: a world-wide script"), UisLook.BtnSmall, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _worldWide.Add(m.Id); GUI.changed = true; } UisSkin.MarkHint(Loc.T("window.tip_guide_no_object", "For scripts that run on a timer, a world key, a raid or a setting, not on one object.")); } RowStart("prefab"); m.Rule["prefab"] = SearchDropdown.Draw("prefab", m.Get("prefab"), Prefabs(), (string v) => (!(v == "*")) ? v : Loc.T("window.prefab_any_item", "* (any object: costly)"), true, null); RowEnd(Loc.T("window.hint_prefab", "Pick the object. * = any object. Groups: creature, structure, Tameable, Piece... Comma list allowed."), Loc.F("window.tip_ewp_key", "EWP key: {0}", "prefab")); if (m.Rule.ContainsKey("excludePrefab")) { if (FieldRow(EwpSchema.RuleField("excludePrefab"), m.Rule, removable: true)) { m.Rule.Remove("excludePrefab"); GUI.changed = true; } } else if (GUILayout.Button(Loc.T("window.btn_add_exclude_prefab", "+ excludePrefab (skip some objects)"), UisLook.BtnSmall, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { m.Rule["excludePrefab"] = ""; GUI.changed = true; } } if (num >= 2) { StepBegin(2, Loc.T("window.step_trigger", "Trigger (type:)"), Loc.T("window.step_trigger_sub", "the event that starts it"), "Trigger (type:)"); List<TriggerChoice> list = EwpSchema.Triggers.Where((TriggerChoice t) => _expert || t.Id == trig.Id || PrefabKind.TriggerFits(t, m.Get("prefab"), ww)).ToList(); List<string> list2 = list.Select(TriggerItem).ToList(); bool flag = m.Get("@choice").Length == 0; RowStart("type"); string item = SearchDropdown.Draw("trigger", flag ? "" : Trig