Decompiled source of UXAssist v1.2.8
UXAssist.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CommonAPI; using CommonAPI.Systems; using HarmonyLib; using Microsoft.CodeAnalysis; using UXAssist.Common; using UXAssist.Functions; using UXAssist.ModsCompat; using UXAssist.Patches; using UXAssist.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Serialization; using UnityEngine.UI; using crecheng.DSPModSave; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("UXAssist")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("DSP MOD - UXAssist")] [assembly: AssemblyFileVersion("1.2.8.0")] [assembly: AssemblyInformationalVersion("1.2.8+0de9f3c06a04e48b36505ec216be8ca7cf5260dd")] [assembly: AssemblyProduct("UXAssist")] [assembly: AssemblyTitle("UXAssist")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UXAssist { public static class UIConfigWindow { private class OcMapper : MyWindow.ValueMapper<int> { public override int Min => 0; public override int Max => 40; public override string FormatValue(string format, int value) { if (value != 0) { return base.FormatValue(format, value); } return Localization.Translate("max"); } } private class AngleMapper : MyWindow.ValueMapper<float> { public override int Min => 0; public override int Max => 20; public override float IndexToValue(int index) { return (float)index - 10f; } public override int ValueToIndex(float value) { return Mathf.RoundToInt(value + 10f); } } private class DistanceMapper : MyWindow.ValueMapper<double> { public override int Min => 1; public override int Max => 40; public override double IndexToValue(int index) { return (double)index * 0.5; } public override int ValueToIndex(double value) { return Mathf.RoundToInt((float)(value * 2.0)); } } private class UpsMapper : MyWindow.ValueMapper<double> { public override int Min => 1; public override int Max => 100; public override double IndexToValue(int index) { return (double)index * 0.1; } public override int ValueToIndex(double value) { return Mathf.RoundToInt((float)(value * 10.0)); } } [CompilerGenerated] private static class <>O { public static Action<MyConfigWindow, RectTransform> <0>__CreateUI; public static Action <1>__UpdateUI; public static UnityAction <2>__ShowCPUInfo; public static UnityAction <3>__BuildOrbitalCollectors; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__9_14; public static Response <>9__9_15; public static UnityAction <>9__9_4; public static Response <>9__9_16; public static UnityAction <>9__9_5; public static Response <>9__9_17; public static UnityAction <>9__9_11; public static UnityAction <>9__9_12; public static UnityAction <>9__9_13; internal void <CreateUI>b__9_14() { GamePatch.GameUpsFactor.Value = 1.0; } internal void <CreateUI>b__9_4() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text = Localization.Translate("Initialize This Planet"); string text2 = Localization.Translate("Initialize This Planet Confirm"); string text3 = Localization.Translate("取消"); string text4 = Localization.Translate("确定"); object obj = <>9__9_15; if (obj == null) { Response val = delegate { PlanetFunctions.RecreatePlanet(revertReform: true); }; <>9__9_15 = val; obj = (object)val; } UIMessageBox.Show(text, text2, text3, text4, 2, (Response)null, (Response)obj); } internal void <CreateUI>b__9_15() { PlanetFunctions.RecreatePlanet(revertReform: true); } internal void <CreateUI>b__9_5() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text = Localization.Translate("Dismantle All Buildings"); string text2 = Localization.Translate("Dismantle All Buildings Confirm"); string text3 = Localization.Translate("取消"); string text4 = Localization.Translate("确定"); object obj = <>9__9_16; if (obj == null) { Response val = delegate { PlanetFunctions.DismantleAll(toBag: false); }; <>9__9_16 = val; obj = (object)val; } UIMessageBox.Show(text, text2, text3, text4, 2, (Response)null, (Response)obj); } internal void <CreateUI>b__9_16() { PlanetFunctions.DismantleAll(toBag: false); } internal void <CreateUI>b__9_11() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text = Localization.Translate("Initialize Dyson Sphere"); string text2 = Localization.Translate("Initialize Dyson Sphere Confirm"); string text3 = Localization.Translate("取消"); string text4 = Localization.Translate("确定"); object obj = <>9__9_17; if (obj == null) { Response val = delegate { DysonSphereFunctions.InitCurrentDysonLayer(null, -1); }; <>9__9_17 = val; obj = (object)val; } UIMessageBox.Show(text, text2, text3, text4, 2, (Response)null, (Response)obj); } internal void <CreateUI>b__9_17() { DysonSphereFunctions.InitCurrentDysonLayer(null, -1); } internal void <CreateUI>b__9_12() { //IL_0034: 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) GameHistoryData val = GameMain.data?.history; if (val == null) { return; } val.inserterStackCountObsolete = 1; for (int i = 3301; i <= 3305; i++) { val.techStates.TryGetValue(i, out var value); if (value.unlocked) { value.unlocked = false; value.hashUploaded = 0L; val.techStates[i] = value; } } } internal void <CreateUI>b__9_13() { GameData data = GameMain.data; if (data != null && data.gameDesc.isCombatMode) { UIGame uiGame = UIRoot.instance.uiGame; uiGame.ShutPlayerInventory(); uiGame.CloseEnemyBriefInfo(); uiGame.OpenCommunicatorWindow(5); } } } private static RectTransform _windowTrans; private static RectTransform _dysonTab; private static UIButton _dysonInitBtn; private static readonly UIButton[] DysonLayerBtn = (UIButton[])(object)new UIButton[10]; public static void Init() { I18N.Add("UXAssist", "UXAssist", "UX助手"); I18N.Add("General", "General", "常规"); I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂"); I18N.Add("Player/Mecha", "Player/Mecha", "玩家/机甲"); I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球"); I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗"); I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)"); I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小"); I18N.Add("Scale up mouse cursor", "Scale up mouse cursor", "放大鼠标指针"); I18N.Add("Convert old saves to Combat Mode on loading", "Convert old saves to Combat Mode on loading (Use settings in new game panel)", "读取旧档时转为战斗模式(使用新游戏面板的战斗难度设置)"); I18N.Add("Profile-based save folder", "Mod manager profile based save folder", "基于mod管理器配置档案名的存档文件夹"); I18N.Add("Profile-based save folder tips", "Save files are stored in 'Save\\<ProfileName>' folder.\nWill use original save location if matching default profile name", "存档文件会存储在'Save\\<ProfileName>'文件夹中\n如果匹配默认配置档案名则使用原始存档位置"); I18N.Add("Default profile name", "Default profile name", "默认配置档案名"); I18N.Add("Logical Frame Rate", "Logical Frame Rate", "逻辑帧倍率"); I18N.Add("Reset", "Reset", "重置"); I18N.Add("Process priority", "Process priority", "进程优先级"); I18N.Add("High", "High", "高"); I18N.Add("Above Normal", "Above Normal", "高于正常"); I18N.Add("Normal", "Normal", "正常"); I18N.Add("Below Normal", "Below Normal", "低于正常"); I18N.Add("Idle", "Idle", "空闲"); I18N.Add("Enabled CPUs", "Enabled CPU Threads", "使用CPU线程"); I18N.Add("All CPUs", "All CPUs", "所有CPU"); I18N.Add("First {0} CPUs", "First {0} CPUs", "前{0}个CPU"); I18N.Add("First 8 CPUs", "First 8 CPUs", "前8个CPU"); I18N.Add("First CPU only", "First CPU only", "仅第一个CPU"); I18N.Add("All P-Cores", "All P-Cores", "所有性能(P)核心"); I18N.Add("All E-Cores", "All E-Cores", "所有能效(E)核心"); I18N.Add("CPU Info", "CPU Info", "CPU信息"); I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离"); I18N.Add("Night Light", "Sunlight at night", "夜间日光灯"); I18N.Add("Angle X:", "Angle X:", "入射角度X:"); I18N.Add("Remove some build conditions", "Remove some build conditions", "移除部分不影响游戏逻辑的建造条件"); I18N.Add("Remove build range limit", "Remove build count and range limit", "移除建造数量和距离限制"); I18N.Add("Larger area for upgrade and dismantle", "Larger area for upgrade and dismantle", "范围升级和拆除的最大区域扩大"); I18N.Add("Larger area for terraform", "Larger area for terraform", "范围铺设地基的最大区域扩大"); I18N.Add("Off-grid building and stepped rotation", "Off-grid building and stepped rotation (Hold Shift)", "脱离网格建造以及小角度旋转(按住Shift)"); I18N.Add("Enable player actions in globe view", "Enable player actions in globe view", "在行星视图中允许玩家操作"); I18N.Add("Hide tips for soil piles changes", "Hide tips for soil piles changes", "隐藏沙土数量变动的提示"); I18N.Add("Enhance control for logistic storage limits", "Enhance control for logistic storage limits", "物流塔存储限制控制改进"); I18N.Add("Enhance control for logistic storage limits tips", "Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n ←/→: -/+10 ↓↑: -/+100", "当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制:\n ←→: -/+10 ↓↑: -/+100"); I18N.Add("Enhanced count control for hand-make", "Enhanced count control for hand-make", "手动制造物品的数量控制改进"); I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量"); I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs/storages/tanks(hold shift)", "快速建造和拆除堆叠研究站/储物仓/储液罐(按住shift)"); I18N.Add("Fast fill in to and take out from tanks", "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体"); I18N.Add("Speed Ratio", "Speed Ratio", "速度倍率"); I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽"); I18N.Add("Protect veins from exhaustion tips", "By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`", "默认矿脉数量保护于剩余100,采油速保护于速度1.0/s,你可以在配置文件中自行设置。\n当达到保护值时,矿脉和油井将不再被开采。\n关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。\n"); I18N.Add("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)"); I18N.Add("Drag building power poles in maximum connection range", "Drag building power poles in maximum connection range", "拖动建造电线杆时自动使用最大连接距离间隔"); I18N.Add("Build Tesla Tower and Wireless Power Tower alternately", "Build Tesla Tower and Wireless Power Tower alternately", "交替建造电力感应塔和无线输电塔"); I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出"); I18N.Add("Belt signals for buy out dark fog items automatically", "Belt signals for buy out dark fog items automatically", "用于自动购买黑雾物品的传送带信号"); I18N.Add("Logistics Control Panel Improvement", "Logistics Control Panel Improvement", "物流控制面板改进"); I18N.Add("Logistics Control Panel Improvement tips", "Auto apply filter with item under mouse cursor while opening the panel\nQuick-set item filter while right-clicking item icons in storage list on the panel", "打开面板时自动将鼠标指向物品设为筛选条件\n在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件"); I18N.Add("Real-time logistic stations info panel", "Real-time logistic stations info panel", "物流运输站实时信息面板"); I18N.Add("Show status bars for storage items", "Show status bars for storage items", "显示存储物品状态条"); I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航"); I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航"); I18N.Add("Auto boost", "Auto boost", "自动加速"); I18N.Add("Distance to use warp", "Distance to use warp (AU)", "使用曲速的距离(AU)"); I18N.Add("Treat stack items as single in monitor components", "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品"); I18N.Add("Initialize This Planet", "Initialize this planet", "初始化本行星"); I18N.Add("Initialize This Planet Confirm", "This operation will destroy all buildings and revert terrains on this planet, are you sure?", "此操作将会摧毁本行星上的所有建筑并恢复地形,确定吗?"); I18N.Add("Dismantle All Buildings", "Dismantle all buildings", "拆除所有建筑"); I18N.Add("Dismantle All Buildings Confirm", "This operation will dismantle all buildings on this planet, are you sure?", "此操作将会拆除本行星上的所有建筑,确定吗?"); I18N.Add("Quick build Orbital Collectors", "Quick build Orbital Collectors", "快速建造轨道采集器"); I18N.Add("Maximum count to build", "Maximum count to build", "最大建造数量"); I18N.Add("max", "max", "最大"); I18N.Add("Stop ejectors when available nodes are all filled up", "Stop ejectors when available nodes are all filled up", "可用节点全部造完时停止弹射"); I18N.Add("Construct only structure points but frames", "Construct only structure points but frames", "只造节点不造框架"); I18N.Add("Initialize Dyson Sphere", "Initialize Dyson Sphere", "初始化戴森球"); I18N.Add("Initialize Dyson Sphere Confirm", "This operation will destroy all layers on this dyson sphere, are you sure?", "此操作将会摧毁戴森球上的所有层级,确定吗?"); I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳"); I18N.Add("Dismantle selected layer", "Dismantle selected layer", "拆除选中的戴森壳"); I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?"); I18N.Add("Auto Fast Build Speed Multiplier", "Auto Fast Build Speed Multiplier", "自动快速建造速度倍率"); I18N.Add("Restore upgrades of \"Sorter Cargo Stacking\" on panel", "Restore upgrades of \"Sorter Cargo Stacking\" on panel", "在升级面板上恢复\"分拣器货物叠加\"的升级"); I18N.Add("Buy out techs with their prerequisites", "Buy out techs with their prerequisites", "购买科技也同时购买所有前置科技"); I18N.Add("Set \"Sorter Cargo Stacking\" to unresearched state", "Set \"Sorter Cargo Stacking\" to unresearched state", "将\"分拣器货物叠加\"设为未研究状态"); I18N.Add("Open Dark Fog Communicator", "Open Dark Fog Communicator", "打开黑雾通讯器"); I18N.Apply(); MyConfigWindow.OnUICreated = (Action<MyConfigWindow, RectTransform>)Delegate.Combine(MyConfigWindow.OnUICreated, new Action<MyConfigWindow, RectTransform>(CreateUI)); MyConfigWindow.OnUpdateUI = (Action)Delegate.Combine(MyConfigWindow.OnUpdateUI, new Action(UpdateUI)); } private static void CreateUI(MyConfigWindow wnd, RectTransform trans) { //IL_0250: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Expected O, but got Unknown //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Expected O, but got Unknown //IL_087f: 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_088a: Expected O, but got Unknown //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Expected O, but got Unknown //IL_0ccb: Unknown result type (might be due to invalid IL or missing references) //IL_0cd0: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: Expected O, but got Unknown //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Expected O, but got Unknown //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d74: Unknown result type (might be due to invalid IL or missing references) //IL_0e9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) //IL_0ea6: Expected O, but got Unknown //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0eeb: Unknown result type (might be due to invalid IL or missing references) //IL_0ef1: Expected O, but got Unknown _windowTrans = trans; wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist"); RectTransform parent = wnd.AddTab(trans, "General"); float num = 0f; float num2 = 10f; wnd.AddCheckBox(num, num2, parent, GamePatch.EnableWindowResizeEnabled, "Enable game window resize"); num2 += 36f; wnd.AddCheckBox(num, num2, parent, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit"); num2 += 36f; Text val = wnd.AddText2(num + 2f, num2, parent, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor"); wnd.AddSlider(num + val.preferredWidth + 7f, num2 + 6f, parent, GamePatch.MouseCursorScaleUpMultiplier, new int[4] { 1, 2, 3, 4 }, "0x", 100f); num2 += 36f; wnd.AddCheckBox(num, num2, parent, GamePatch.ConvertSavesFromPeaceEnabled, "Convert old saves to Combat Mode on loading"); MyCheckBox myCheckBox; if (WindowFunctions.ProfileName != null) { num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent, GamePatch.ProfileBasedSaveFolderEnabled, "Profile-based save folder"); wnd.AddTipsButton2(myCheckBox.Width + 5f, num2 + 6f, parent, "Profile-based save folder", "Profile-based save folder tips", "btn-profile-based-save-folder-tips"); num2 += 30f; wnd.AddText2(num + 2f, num2, parent, "Default profile name", 15, "text-default-profile-name"); num2 += 24f; wnd.AddInputField(num + 2f, num2, 200f, parent, GamePatch.DefaultProfileName, 15, "input-profile-save-folder"); num2 += 18f; } if (!BulletTimeWrapper.HasBulletTime) { num2 += 36f; val = wnd.AddText2(num + 2f, num2, parent, "Logical Frame Rate", 15, "game-frame-rate"); num += val.preferredWidth + 7f; wnd.AddSlider(num, num2 + 6f, parent, GamePatch.GameUpsFactor, new UpsMapper(), "0.0x", 100f).WithSmallerHandle(); float x = num + 104f; float y = num2 + 6f; object obj = <>c.<>9__9_14; if (obj == null) { UnityAction val2 = delegate { GamePatch.GameUpsFactor.Value = 1.0; }; <>c.<>9__9_14 = val2; obj = (object)val2; } ((RectTransform)((Component)wnd.AddFlatButton(x, y, parent, "Reset", 13, "reset-game-frame-rate", (UnityAction)obj)).transform).sizeDelta = new Vector2(40f, 20f); num = 0f; } num2 += 36f; wnd.AddComboBox(num + 2f, num2, parent, "Process priority").WithItems("High", "Above Normal", "Normal", "Below Normal", "Idle").WithSize(100f, 0f) .WithConfigEntry(WindowFunctions.ProcessPriority); WinApi.LogicalProcessorDetails processorDetails = WindowFunctions.ProcessorDetails; string[] array = ((!processorDetails.HybridArchitecture) ? new string[3] : new string[5] { null, null, null, "All P-Cores", "All E-Cores" }); array[0] = "All CPUs"; array[1] = string.Format(Localization.Translate("First {0} CPUs"), processorDetails.ThreadCount / 2); array[2] = ((processorDetails.ThreadCount > 16) ? "First 8 CPUs" : "First CPU only"); num2 += 36f; wnd.AddComboBox(num + 2f, num2, parent, "Enabled CPUs").WithItems(array).WithSize(200f, 0f) .WithConfigEntry(WindowFunctions.ProcessAffinity); num2 += 36f; float x2 = num; float y2 = num2; object obj2 = <>O.<2>__ShowCPUInfo; if (obj2 == null) { UnityAction val3 = WindowFunctions.ShowCPUInfo; <>O.<2>__ShowCPUInfo = val3; obj2 = (object)val3; } ((RectTransform)((Component)wnd.AddButton(x2, y2, parent, "CPU Info", 16, "button-show-cpu-info", (UnityAction)obj2)).transform).sizeDelta = new Vector2(100f, 25f); RectTransform parent2 = wnd.AddTab(trans, "Planet/Factory"); num = 0f; num2 = 10f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit"); num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent2, FactoryPatch.NightLightEnabled, "Night Light"); num += myCheckBox.Width + 5f + 10f; val = wnd.AddText2(num, num2 + 2f, parent2, "Angle X:", 13, "text-nightlight-angle-x"); num += val.preferredWidth + 5f; wnd.AddSlider(num, num2 + 7f, parent2, FactoryPatch.NightLightAngleX, new AngleMapper(), "0", 60f).WithSmallerHandle(); num += 70f; val = wnd.AddText2(num, num2 + 2f, parent2, "Y:", 13, "text-nightlight-angle-y"); wnd.AddSlider(num + val.preferredWidth + 5f, num2 + 7f, parent2, FactoryPatch.NightLightAngleY, new AngleMapper(), "0", 60f).WithSmallerHandle(); num = 0f; num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.LargerAreaForTerraformEnabled, "Larger area for terraform"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation"); num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components"); wnd.AddTipsButton2(num + myCheckBox.Width + 5f, num2 + 6f, parent2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs"); num2 += 36f; MyCheckBox myCheckBox2 = wnd.AddCheckBox(num, num2, parent2, FactoryPatch.TankFastFillInAndTakeOutEnabled, "Fast fill in to and take out from tanks"); num += myCheckBox2.Width + 5f; val = wnd.AddText2(num, num2 + 2f, parent2, "Speed Ratio", 13, "text-tank-fast-fill-speed-ratio"); MySlider tankSlider = wnd.AddSlider(num + val.preferredWidth + 5f, num2 + 7f, parent2, FactoryPatch.TankFastFillInAndTakeOutMultiplier, new int[8] { 2, 5, 10, 20, 50, 100, 500, 1000 }, "G", 100f).WithSmallerHandle(); EventHandler tankSettingChanged = delegate { tankSlider.SetEnable(FactoryPatch.TankFastFillInAndTakeOutEnabled.Value); }; FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged += tankSettingChanged; wnd.OnFree += delegate { FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged -= tankSettingChanged; }; tankSettingChanged(null, null); num = 0f; num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion"); wnd.AddTipsButton2(num + myCheckBox.Width + 5f, num2 + 6f, parent2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range"); num2 += 36f; MyCheckBox alternatelyCheckBox = wnd.AddCheckBox(num + 20f, num2, parent2, FactoryPatch.DragBuildPowerPolesAlternatelyEnabled, "Build Tesla Tower and Wireless Power Tower alternately", 13); EventHandler alternatelyCheckBoxChanged = delegate { alternatelyCheckBox.SetEnable(FactoryPatch.DragBuildPowerPolesEnabled.Value); }; FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged += alternatelyCheckBoxChanged; wnd.OnFree += delegate { FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged -= alternatelyCheckBoxChanged; }; alternatelyCheckBoxChanged(null, null); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically"); num = 400f; num2 = 10f; float x3 = num; float y3 = num2; object obj3 = <>c.<>9__9_4; if (obj3 == null) { UnityAction val4 = delegate { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text9 = Localization.Translate("Initialize This Planet"); string text10 = Localization.Translate("Initialize This Planet Confirm"); string text11 = Localization.Translate("取消"); string text12 = Localization.Translate("确定"); object obj11 = <>c.<>9__9_15; if (obj11 == null) { Response val15 = delegate { PlanetFunctions.RecreatePlanet(revertReform: true); }; <>c.<>9__9_15 = val15; obj11 = (object)val15; } UIMessageBox.Show(text9, text10, text11, text12, 2, (Response)null, (Response)obj11); }; <>c.<>9__9_4 = val4; obj3 = (object)val4; } wnd.AddButton(x3, y3, parent2, "Initialize This Planet", 16, "button-init-planet", (UnityAction)obj3); num2 += 36f; float x4 = num; float y4 = num2; object obj4 = <>c.<>9__9_5; if (obj4 == null) { UnityAction val5 = delegate { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text5 = Localization.Translate("Dismantle All Buildings"); string text6 = Localization.Translate("Dismantle All Buildings Confirm"); string text7 = Localization.Translate("取消"); string text8 = Localization.Translate("确定"); object obj10 = <>c.<>9__9_16; if (obj10 == null) { Response val14 = delegate { PlanetFunctions.DismantleAll(toBag: false); }; <>c.<>9__9_16 = val14; obj10 = (object)val14; } UIMessageBox.Show(text5, text6, text7, text8, 2, (Response)null, (Response)obj10); }; <>c.<>9__9_5 = val5; obj4 = (object)val5; } wnd.AddButton(x4, y4, parent2, "Dismantle All Buildings", 16, "button-dismantle-all", (UnityAction)obj4); num2 += 72f; float x5 = num; float y5 = num2; object obj5 = <>O.<3>__BuildOrbitalCollectors; if (obj5 == null) { UnityAction val6 = PlanetFunctions.BuildOrbitalCollectors; <>O.<3>__BuildOrbitalCollectors = val6; obj5 = (object)val6; } wnd.AddButton(x5, y5, 200f, parent2, "Quick build Orbital Collectors", 16, "button-init-planet", (UnityAction)obj5); num2 += 30f; wnd.AddText2(num + 10f, num2, parent2, "Maximum count to build", 15, "text-oc-build-count"); num2 += 24f; wnd.AddSlider(num + 10f, num2, parent2, PlanetFunctions.OrbitalCollectorMaxBuildCount, new OcMapper(), "G", 200f); num = 400f; num2 += 54f; wnd.AddCheckBox(num, num2, parent2, LogisticsPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits"); num2 += 36f; wnd.AddCheckBox(num, num2, parent2, LogisticsPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines"); num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent2, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement"); wnd.AddTipsButton2(num + myCheckBox.Width + 5f, num2 + 6f, parent2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips"); num2 += 36f; MyCheckBox cb0 = wnd.AddCheckBox(num, num2, parent2, LogisticsPatch.RealtimeLogisticsInfoPanelEnabled, "Real-time logistic stations info panel"); num2 += 36f; MyCheckBox cb1 = wnd.AddCheckBox(num + 20f, num2, parent2, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13); EventHandler anySettingsChanged = delegate { if (AuxilaryfunctionWrapper.ShowStationInfo == null) { cb0.SetEnable(on: true); cb1.SetEnable(LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value); } else { bool flag = !AuxilaryfunctionWrapper.ShowStationInfo.Value; cb0.SetEnable(flag); cb1.SetEnable(flag & LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value); if (!flag) { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false; } } }; if (AuxilaryfunctionWrapper.ShowStationInfo != null) { AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += anySettingsChanged; wnd.OnFree += delegate { AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= anySettingsChanged; }; } LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += anySettingsChanged; wnd.OnFree += delegate { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged -= anySettingsChanged; }; anySettingsChanged(null, null); RectTransform parent3 = wnd.AddTab(trans, "Player/Mecha"); num = 0f; num2 = 10f; wnd.AddCheckBox(num, num2, parent3, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range"); num2 += 36f; wnd.AddCheckBox(num, num2, parent3, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view"); num2 += 36f; wnd.AddCheckBox(num, num2, parent3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes"); num2 += 36f; myCheckBox = wnd.AddCheckBox(num, num2, parent3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make"); wnd.AddTipsButton2(num + myCheckBox.Width + 5f, num2 + 6f, parent3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips"); num2 += 36f; wnd.AddCheckBox(num, num2, parent3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings"); num2 += 26f; MyCheckBox navcb1 = wnd.AddCheckBox(num + 20f, num2, parent3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13); num2 += 26f; MyCheckBox navcb2 = wnd.AddCheckBox(num + 20f, num2, parent3, PlayerPatch.AutoBoostEnabled, "Auto boost", 13); num2 += 32f; val = wnd.AddText2(num + 20f, num2, parent3, "Distance to use warp", 15, "text-distance-to-warp"); MySlider navSlider = wnd.AddSlider(num + 20f + val.preferredWidth + 5f, num2 + 6f, parent3, PlayerPatch.DistanceToWarp, new DistanceMapper(), "0.0", 100f); EventHandler navSettingChanged = delegate { navcb1.SetEnable(PlayerPatch.AutoNavigationEnabled.Value); navcb2.SetEnable(PlayerPatch.AutoNavigationEnabled.Value); navSlider.SetEnable(PlayerPatch.AutoNavigationEnabled.Value); }; PlayerPatch.AutoNavigationEnabled.SettingChanged += navSettingChanged; wnd.OnFree += delegate { PlayerPatch.AutoNavigationEnabled.SettingChanged -= navSettingChanged; }; navSettingChanged(null, null); RectTransform val7 = wnd.AddTab(trans, "Dyson Sphere"); num = 0f; num2 = 10f; wnd.AddCheckBox(num, num2, val7, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up"); num2 += 36f; wnd.AddCheckBox(num, num2, val7, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only structure points but frames"); num = 400f; num2 = 10f; float x6 = num; float y6 = num2; object obj6 = <>c.<>9__9_11; if (obj6 == null) { UnityAction val8 = delegate { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown string text = Localization.Translate("Initialize Dyson Sphere"); string text2 = Localization.Translate("Initialize Dyson Sphere Confirm"); string text3 = Localization.Translate("取消"); string text4 = Localization.Translate("确定"); object obj9 = <>c.<>9__9_17; if (obj9 == null) { Response val13 = delegate { DysonSphereFunctions.InitCurrentDysonLayer(null, -1); }; <>c.<>9__9_17 = val13; obj9 = (object)val13; } UIMessageBox.Show(text, text2, text3, text4, 2, (Response)null, (Response)obj9); }; <>c.<>9__9_11 = val8; obj6 = (object)val8; } _dysonInitBtn = wnd.AddButton(x6, y6, val7, "Initialize Dyson Sphere", 16, "init-dyson-sphere", (UnityAction)obj6); num2 += 36f; wnd.AddText2(num, num2, val7, "Click to dismantle selected layer", 16, "text-dismantle-layer"); num2 += 26f; for (int i = 0; i < 10; i++) { int id = i + 1; UIButton val9 = wnd.AddFlatButton(num, num2, val7, id.ToString(), 12, "dismantle-layer-" + id, (UnityAction)delegate { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown StarData star = DysonSphereFunctions.CurrentStarForDysonSystem(); UIMessageBox.Show(Localization.Translate("Dismantle selected layer"), Localization.Translate("Dismantle selected layer Confirm"), Localization.Translate("取消"), Localization.Translate("确定"), 2, (Response)null, (Response)delegate { DysonSphereFunctions.InitCurrentDysonLayer(star, id); }); }); ((RectTransform)((Component)val9).transform).sizeDelta = new Vector2(40f, 20f); DysonLayerBtn[i] = val9; if (i == 4) { num -= 160f; num2 += 20f; } else { num += 40f; } } num = 400f; num2 += 36f; wnd.AddText2(num, num2, val7, "Auto Fast Build Speed Multiplier", 15, "text-auto-fast-build-multiplier"); num2 += 24f; wnd.AddSlider(num, num2, val7, DysonSpherePatch.AutoConstructMultiplier, new int[7] { 1, 2, 5, 10, 20, 50, 100 }, "0", 200f); _dysonTab = val7; RectTransform parent4 = wnd.AddTab(_windowTrans, "Tech/Combat"); num = 10f; num2 = 10f; wnd.AddCheckBox(num, num2, parent4, TechPatch.BatchBuyoutTechEnabled, "Buy out techs with their prerequisites"); num2 += 36f; wnd.AddCheckBox(num, num2, parent4, TechPatch.SorterCargoStackingEnabled, "Restore upgrades of \"Sorter Cargo Stacking\" on panel"); num2 += 36f; float x7 = num; float y7 = num2; object obj7 = <>c.<>9__9_12; if (obj7 == null) { UnityAction val10 = delegate { //IL_0034: 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) GameHistoryData val12 = GameMain.data?.history; if (val12 != null) { val12.inserterStackCountObsolete = 1; for (int j = 3301; j <= 3305; j++) { val12.techStates.TryGetValue(j, out var value); if (value.unlocked) { value.unlocked = false; value.hashUploaded = 0L; val12.techStates[j] = value; } } } }; <>c.<>9__9_12 = val10; obj7 = (object)val10; } wnd.AddButton(x7, y7, 300f, parent4, "Set \"Sorter Cargo Stacking\" to unresearched state", 16, "button-remove-cargo-stacking", (UnityAction)obj7); num2 += 36f; num2 += 36f; float x8 = num; float y8 = num2; object obj8 = <>c.<>9__9_13; if (obj8 == null) { UnityAction val11 = delegate { GameData data = GameMain.data; if (data != null && data.gameDesc.isCombatMode) { UIGame uiGame = UIRoot.instance.uiGame; uiGame.ShutPlayerInventory(); uiGame.CloseEnemyBriefInfo(); uiGame.OpenCommunicatorWindow(5); } }; <>c.<>9__9_13 = val11; obj8 = (object)val11; } wnd.AddButton(x8, y8, 300f, parent4, "Open Dark Fog Communicator", 16, "button-open-df-communicator", (UnityAction)obj8); } private static void UpdateUI() { UpdateDysonShells(); } private static void UpdateDysonShells() { if (!((Component)_dysonTab).gameObject.activeSelf) { return; } StarData val = DysonSphereFunctions.CurrentStarForDysonSystem(); if (val == null) { for (int i = 0; i < 10; i++) { ((Selectable)DysonLayerBtn[i].button).interactable = false; } return; } DysonSphere[] array = GameMain.data?.dysonSpheres; if (((array != null) ? array[val.index] : null) != null) { DysonSphere val2 = array[val.index]; for (int j = 1; j <= 10; j++) { DysonSphereLayer val3 = val2.layersIdBased[j]; ((Selectable)DysonLayerBtn[j - 1].button).interactable = val3 != null && val3.id == j; } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [CommonAPISubmoduleDependency(new string[] { "CustomKeyBindSystem" })] [BepInPlugin("org.soardev.uxassist", "UXAssist", "1.2.8")] public class UXAssist : BaseUnityPlugin, IModCanSave { [PatchGuid("org.soardev.uxassist")] private class UIPatch : PatchImpl<UIPatch> { [CompilerGenerated] private static class <>O { public static UnityAction <0>__ToggleConfigWindow; } private static GameObject _buttonOnPlanetGlobe; protected override void OnEnable() { InitMenuButtons(); } private static void InitMenuButtons() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) if (_initialized) { return; } UIRoot instance = UIRoot.instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } UIMainMenu uiMainMenu = instance.uiMainMenu; UIMainMenuButton newGameButton = uiMainMenu.newGameButton; Transform parent = ((Component)newGameButton).transform.parent; UIMainMenuButton btn2 = Object.Instantiate<UIMainMenuButton>(newGameButton, parent); ((Object)btn2).name = "button-cheatenabler-config"; Localizer component = ((Component)btn2.text).GetComponent<Localizer>(); if ((Object)(object)component != (Object)null) { component.stringKey = "UXAssist Config"; component.translation = Localization.Translate("UXAssist Config"); } btn2.text.text = Localization.Translate("UXAssist Config"); btn2.text.fontSize = btn2.text.fontSize * 7 / 8; I18N.OnInitialized = (Action)Delegate.Combine(I18N.OnInitialized, (Action)delegate { btn2.text.text = Localization.Translate("UXAssist Config"); }); Vector3 anchoredPosition3D = ((RectTransform)((Component)uiMainMenu.exitButton).transform).anchoredPosition3D; Vector3 anchoredPosition3D2 = ((RectTransform)((Component)uiMainMenu.creditsButton).transform).anchoredPosition3D; ((RectTransform)((Component)btn2).transform).anchoredPosition3D = new Vector3(anchoredPosition3D.x, anchoredPosition3D.y + (anchoredPosition3D.y - anchoredPosition3D2.y) * 2f, anchoredPosition3D.z); ((UnityEventBase)btn2.button.onClick).RemoveAllListeners(); ButtonClickedEvent onClick = btn2.button.onClick; object obj = <>O.<0>__ToggleConfigWindow; if (obj == null) { UnityAction val = ToggleConfigWindow; <>O.<0>__ToggleConfigWindow = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); Button button = instance.uiGame.planetGlobe.button2; Transform obj2 = ((Component)instance.uiGame.sandboxMenu.categoryButtons[6]).transform.Find("icon"); object obj3; if (obj2 == null) { obj3 = null; } else { Image component2 = ((Component)obj2).GetComponent<Image>(); obj3 = ((component2 != null) ? component2.sprite : null); } Sprite sprite = (Sprite)obj3; Button val2 = Object.Instantiate<Button>(button, ((Component)button).transform.parent); _buttonOnPlanetGlobe = ((Component)val2).gameObject; RectTransform val3 = (RectTransform)_buttonOnPlanetGlobe.transform; UIButton btn = _buttonOnPlanetGlobe.GetComponent<UIButton>(); Transform obj4 = _buttonOnPlanetGlobe.transform.Find("button-2/icon"); Image val4 = ((obj4 != null) ? ((Component)obj4).GetComponent<Image>() : null); if ((Object)(object)val4 != (Object)null) { val4.sprite = sprite; } if ((Object)(object)_buttonOnPlanetGlobe != (Object)null && (Object)(object)btn != (Object)null) { ((Object)_buttonOnPlanetGlobe).name = "open-uxassist-config"; ((Transform)val3).localScale = new Vector3(0.6f, 0.6f, 0.6f); val3.anchoredPosition3D = new Vector3(64f, -5f, 0f); ((UnityEventBase)val2.onClick).RemoveAllListeners(); btn.onClick += delegate { ToggleConfigWindow(); }; btn.tips.tipTitle = "UXAssist Config"; I18N.OnInitialized = (Action)Delegate.Combine(I18N.OnInitialized, (Action)delegate { btn.tips.tipTitle = Localization.Translate("UXAssist Config"); }); btn.tips.tipText = null; btn.tips.corner = 9; btn.tips.offset = new Vector2(-20f, -20f); _buttonOnPlanetGlobe.SetActive(true); } _initialized = true; } [HarmonyPostfix] [HarmonyPatch(typeof(UIRoot), "_OnOpen")] public static void UIRoot__OnOpen_Postfix() { InitMenuButtons(); } [HarmonyPostfix] [HarmonyPatch(typeof(UIPlanetGlobe), "DistributeButtons")] private static void UIPlanetGlobe_DistributeButtons_Postfix(UIPlanetGlobe __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_buttonOnPlanetGlobe == (Object)null)) { RectTransform val = (RectTransform)_buttonOnPlanetGlobe.transform; if (__instance.dysonSphereSystemUnlocked || __instance.logisticsSystemUnlocked) { val.anchoredPosition3D = new Vector3(64f, -5f, 0f); } else { val.anchoredPosition3D = new Vector3(128f, -100f, 0f); } } } } public static readonly ManualLogSource Logger = Logger.CreateLogSource("UXAssist"); private static bool _configWinInitialized; private static MyConfigWindow _configWin; private static bool _initialized; private static PressKeyBind _toggleKey; private static ConfigFile _dummyConfig; private Type[] _patches; private Type[] _compats; private const ushort ModSaveVersion = 1; public void Export(BinaryWriter w) { w.Write((ushort)1); FactoryPatch.Export(w); } public void Import(BinaryReader r) { if (r.ReadUInt16() > 0) { FactoryPatch.Import(r); } } public void IntoOtherSave() { } private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0023: 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) //IL_0035: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown _dummyConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "org.soardev.uxassist_dummy.cfg"), false) { SaveOnConfigSet = false }; BuiltinKey key = default(BuiltinKey); key.key = new CombineKey(96, (byte)4, (ECombineKeyAction)0, false); key.conflictGroup = 2821; key.name = "OpenUXAssistConfigWindow"; key.canOverride = true; _toggleKey = KeyBindings.RegisterKeyBinding(key); GamePatch.EnableWindowResizeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Game", "EnableWindowResize", false, "Enable game window resize (maximum box and thick frame)"); GamePatch.LoadLastWindowRectEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Game", "LoadLastWindowRect", false, "Load last window position and size when game starts"); GamePatch.LastWindowRect = ((BaseUnityPlugin)this).Config.Bind<Vector4>("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f), "Last window position and size"); GamePatch.MouseCursorScaleUpMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "MouseCursorScaleUpMultiplier", 1, "Mouse cursor scale up multiplier"); GamePatch.ProfileBasedSaveFolderEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Game", "ProfileBasedSaveFolder", false, "Profile-based save folder"); GamePatch.DefaultProfileName = ((BaseUnityPlugin)this).Config.Bind<string>("Game", "DefaultProfileName", "Default", "Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched"); GamePatch.ConvertSavesFromPeaceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Game", "ConvertSavesFromPeace", false, "Convert saves from Peace mode to Combat mode on save loading"); GamePatch.GameUpsFactor = _dummyConfig.Bind<double>("Game", "GameUpsFactor", 1.0, "Game UPS factor (1.0 for normal speed)"); WindowFunctions.ProcessPriority = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "ProcessPriority", 2, new ConfigDescription("Game process priority\n 0: High 1: Above Normal 2: Normal 3: Below Normal 4: Idle", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>())); WindowFunctions.ProcessAffinity = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "CPUAffinity", -1, new ConfigDescription("Game process CPU affinity\r\n 0: All 1: First-half CPUs 2. First 8 CPUs (if total CPUs are greater than 16)\r\n 3. All Performance Cores(If Intel 13th or greater) 4. All Efficiency Cores(If Intel 13th or greater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>())); FactoryPatch.UnlimitInteractiveEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "UnlimitInteractive", false, "Unlimit interactive range"); FactoryPatch.RemoveSomeConditionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "RemoveSomeBuildConditionCheck", false, "Remove part of build condition checks that does not affect game logic"); FactoryPatch.NightLightEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "NightLight", false, "Night light"); FactoryPatch.NightLightAngleX = ((BaseUnityPlugin)this).Config.Bind<float>("Factory", "NightLightAngleX", -8f, "Night light angle X"); FactoryPatch.NightLightAngleY = ((BaseUnityPlugin)this).Config.Bind<float>("Factory", "NightLightAngleY", -2f, "Night light angle Y"); PlanetPatch.PlayerActionsInGlobeViewEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Planet", "PlayerActionsInGlobeView", false, "Enable player actions in globe view"); FactoryPatch.RemoveBuildRangeLimitEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "RemoveBuildRangeLimit", false, "Remove limit for build range and maximum count of drag building belts/buildings\nNote: this does not affect range limit for mecha drones' action"); FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "LargerAreaForUpgradeAndDismantle", false, "Increase maximum area size for upgrade and dismantle to 31x31 (from 11x11)"); FactoryPatch.LargerAreaForTerraformEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "LargerAreaForTerraform", false, "Increase maximum area size for terraform to 30x30 (from 10x10)\nNote: this may impact game performance while using large area"); FactoryPatch.OffGridBuildingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "OffGridBuilding", false, "Enable off grid building and stepped rotation"); FactoryPatch.TreatStackingAsSingleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "TreatStackingAsSingle", false, "Treat stack items as single in monitor components"); FactoryPatch.QuickBuildAndDismantleLabsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "QuickBuildAndDismantleLab", false, "Quick build and dismantle stacking labs"); FactoryPatch.ProtectVeinsFromExhaustionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "ProtectVeinsFromExhaustion", false, "Protect veins from exhaustion"); FactoryPatch.ProtectVeinsFromExhaustion.KeepVeinAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Factory", "KeepVeinAmount", 1000, new ConfigDescription("Keep veins amount (0 to disable)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10000), Array.Empty<object>())).Value; FactoryPatch.ProtectVeinsFromExhaustion.KeepOilSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Factory", "KeepOilSpeed", 1f, new ConfigDescription("Keep minimal oil speed (< 0.1 to disable)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())).Value; FactoryPatch.DoNotRenderEntitiesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "DoNotRenderEntities", false, "Do not render factory entities"); FactoryPatch.DragBuildPowerPolesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "DragBuildPowerPoles", false, "Drag building power poles in maximum connection range"); FactoryPatch.DragBuildPowerPolesAlternatelyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "DragBuildPowerPolesAlternately", true, "Build Tesla Tower and Wireless Power Tower alternately"); FactoryPatch.BeltSignalsForBuyOutEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "BeltSignalsForBuyOut", false, "Belt signals for buy out dark fog items automatically"); FactoryPatch.TankFastFillInAndTakeOutEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "TankFastFillInAndTakeOut", false, "Fast fill in to and take out from tanks"); FactoryPatch.TankFastFillInAndTakeOutMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks"); LogisticsPatch.LogisticsCapacityTweaksEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "LogisticsCapacityTweaks", true, "Logistics capacity related tweaks"); LogisticsPatch.AllowOverflowInLogisticsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "AllowOverflowInLogistics", false, "Allow overflow in logistic stations"); LogisticsPatch.LogisticsConstrolPanelImprovementEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "LogisticsConstrolPanelImprovement", false, "Logistics control panel improvement"); LogisticsPatch.RealtimeLogisticsInfoPanelEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "RealtimeLogisticsInfoPanel", false, "Realtime logistics info panel"); LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Factory", "RealtimeLogisticsInfoPanelBars", false, "Realtime logistics info panel - Show status bars for storage item"); PlanetFunctions.OrbitalCollectorMaxBuildCount = ((BaseUnityPlugin)this).Config.Bind<int>("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible"); PlayerPatch.EnhancedMechaForgeCountControlEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "EnhancedMechaForgeCountControl", false, "Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly"); PlayerPatch.HideTipsForSandsChangesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "HideTipsForGettingSands", false, "Hide tips for getting soil piles"); PlayerPatch.AutoNavigationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "AutoNavigation", false, "Auto navigation"); PlayerPatch.AutoCruiseEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "AutoCruise", false, "Auto-cruise enabled"); PlayerPatch.AutoBoostEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "AutoBoost", false, "Auto boost speed with auto-cruise enabled"); PlayerPatch.DistanceToWarp = ((BaseUnityPlugin)this).Config.Bind<double>("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)"); TechPatch.SorterCargoStackingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Tech", "SorterCargoStacking", false, "Restore upgrades of `Sorter Cargo Stacking` on panel"); TechPatch.BatchBuyoutTechEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Tech", "BatchBuyoutTech", false, "Can buy out techs with their prerequisites"); DysonSpherePatch.StopEjectOnNodeCompleteEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "StopEjectOnNodeComplete", false, "Stop ejectors when available nodes are all filled up"); DysonSpherePatch.OnlyConstructNodesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "OnlyConstructNodes", false, "Construct only nodes but frames"); DysonSpherePatch.AutoConstructMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("DysonSphere", "AutoConstructMultiplier", 1, "Dyson Sphere auto-construct speed multiplier"); I18N.Init(); I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置"); I18N.Add("KEYOpenUXAssistConfigWindow", "Open UXAssist Config Window", "打开UX助手设置面板"); I18N.Add("KEYToggleAutoCruise", "Toggle auto-cruise", "切换自动巡航"); PatchImpl<GameLogic>.Enable(enable: true); UIConfigWindow.Init(); _patches = global::UXAssist.Common.Util.GetTypesFiltered(Assembly.GetExecutingAssembly(), (Type t) => string.Equals(t.Namespace, "UXAssist.Patches", StringComparison.Ordinal) || string.Equals(t.Namespace, "UXAssist.Functions", StringComparison.Ordinal)); Type[] patches = _patches; if (patches != null) { CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type) { type.GetMethod("Init")?.Invoke(null, null); }); } _compats = global::UXAssist.Common.Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "UXAssist.ModsCompat"); Type[] compats = _compats; if (compats != null) { CollectionExtensions.Do<Type>((IEnumerable<Type>)compats, (Action<Type>)delegate(Type type) { type.GetMethod("Init")?.Invoke(null, null); }); } I18N.Apply(); I18N.OnInitialized = (Action)Delegate.Combine(I18N.OnInitialized, new Action(RecreateConfigWindow)); } private void Start() { MyWindowManager.InitBaseObjects(); MyWindowManager.Enable(on: true); PatchImpl<UIPatch>.Enable(enable: true); Type[] patches = _patches; if (patches != null) { CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type) { type.GetMethod("Start")?.Invoke(null, null); }); } object[] parameters = new object[1] { PatchImpl<UIPatch>.GetHarmony() }; Type[] compats = _compats; if (compats != null) { CollectionExtensions.Do<Type>((IEnumerable<Type>)compats, (Action<Type>)delegate(Type type) { type.GetMethod("Start")?.Invoke(null, parameters); }); } } private void OnDestroy() { Type[] patches = _patches; if (patches != null) { CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type) { type.GetMethod("Uninit")?.Invoke(null, null); }); } PatchImpl<UIPatch>.Enable(enable: false); MyWindowManager.Enable(on: false); PatchImpl<GameLogic>.Enable(enable: false); } private void Update() { if (!VFInput.inputing) { if (VFInput.onGUI) { LogisticsPatch.LogisticsCapacityTweaks.UpdateInput(); } if (_toggleKey.keyValue) { ToggleConfigWindow(); } GamePatch.OnUpdate(); FactoryPatch.OnUpdate(); PlayerPatch.OnUpdate(); LogisticsPatch.OnUpdate(); } } private static void ToggleConfigWindow() { if (!_configWinInitialized) { if (!I18N.Initialized()) { return; } _configWinInitialized = true; _configWin = MyConfigWindow.CreateInstance(); } if (((ManualBehaviour)_configWin).active) { ((ManualBehaviour)_configWin)._Close(); } else { _configWin.Open(); } } private static void RecreateConfigWindow() { if (_configWinInitialized) { bool active = ((ManualBehaviour)_configWin).active; if (active) { ((ManualBehaviour)_configWin)._Close(); } MyConfigWindow.DestroyInstance(_configWin); _configWinInitialized = false; if (active) { ToggleConfigWindow(); } } } } public static class PluginInfo { public const string PLUGIN_GUID = "org.soardev.uxassist"; public const string PLUGIN_NAME = "UXAssist"; public const string PLUGIN_VERSION = "1.2.8"; } } namespace UXAssist.UI { public class MyCheckBox : MonoBehaviour { public RectTransform rectTrans; public UIButton uiButton; public Image boxImage; public Image checkImage; public Text labelText; private bool _checked; private static GameObject _baseObject; private static readonly Color BoxColor = new Color(1f, 1f, 1f, 20f / 51f); private static readonly Color CheckColor = new Color(1f, 1f, 1f, 1f); private static readonly Color TextColor = new Color(0.69803923f, 0.69803923f, 0.69803923f, 56f / 85f); private EventHandler _configChanged; private Action _checkedChanged; private ConfigEntry<bool> _config; public bool Checked { get { return _checked; } set { _checked = value; ((Behaviour)checkImage).enabled = value; } } public float Width => rectTrans.sizeDelta.x + ((Graphic)labelText).rectTransform.sizeDelta.x; public float Height => Math.Max(rectTrans.sizeDelta.y, ((Graphic)labelText).rectTransform.sizeDelta.y); public event Action OnChecked; public static void InitBaseObject() { if (Object.op_Implicit((Object)(object)_baseObject)) { return; } GameObject obj = Object.Instantiate<GameObject>(((Component)UIRoot.instance.uiGame.buildMenu.uxFacilityCheck).gameObject); ((Object)obj).name = "my-checkbox"; obj.SetActive(false); Transform val = obj.transform.Find("text"); if (Object.op_Implicit((Object)(object)val)) { Text component = ((Component)val).GetComponent<Text>(); if (Object.op_Implicit((Object)(object)component)) { component.text = ""; } Localizer component2 = ((Component)val).GetComponent<Localizer>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } } _baseObject = obj; } protected void OnDestroy() { _config.SettingChanged -= _configChanged; } public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, ConfigEntry<bool> config, string label = "", int fontSize = 15) { return CreateCheckBox(x, y, parent, config.Value, label, fontSize).WithConfigEntry(config); } public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, bool check, string label = "", int fontSize = 15) { return CreateCheckBox(x, y, parent, fontSize).WithCheck(check).WithLabelText(label); } public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, int fontSize = 15) { GameObject val = Object.Instantiate<GameObject>(_baseObject); ((Object)val).name = "my-checkbox"; val.SetActive(true); MyCheckBox myCheckBox = val.AddComponent<MyCheckBox>(); RectTransform val2 = Util.NormalizeRectWithTopLeft((Component)(object)myCheckBox, x, y, (Transform)(object)parent); myCheckBox.rectTrans = val2; myCheckBox.uiButton = val.GetComponent<UIButton>(); myCheckBox.boxImage = ((Component)val.transform).GetComponent<Image>(); Transform obj = val.transform.Find("checked"); myCheckBox.checkImage = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); Transform val3 = val.transform.Find("text"); if ((Object)(object)val3 != (Object)null) { myCheckBox.labelText = ((Component)val3).GetComponent<Text>(); if (Object.op_Implicit((Object)(object)myCheckBox.labelText)) { myCheckBox.labelText.text = ""; myCheckBox.labelText.fontSize = fontSize; myCheckBox.UpdateLabelTextWidth(); } } myCheckBox.uiButton.onClick += myCheckBox.OnClick; return myCheckBox; } private void UpdateLabelTextWidth() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)labelText)) { ((Graphic)labelText).rectTransform.sizeDelta = new Vector2(labelText.preferredWidth, ((Graphic)labelText).rectTransform.sizeDelta.y); } } public void SetLabelText(string val) { if ((Object)(object)labelText != (Object)null) { labelText.text = Localization.Translate(val); UpdateLabelTextWidth(); } } public void SetEnable(bool on) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) if (Object.op_Implicit((Object)(object)uiButton)) { ((Behaviour)uiButton).enabled = on; } if (on) { if (Object.op_Implicit((Object)(object)boxImage)) { ((Graphic)boxImage).color = BoxColor; } if (Object.op_Implicit((Object)(object)checkImage)) { ((Graphic)checkImage).color = CheckColor; } if (Object.op_Implicit((Object)(object)labelText)) { ((Graphic)labelText).color = TextColor; } return; } Color val; if (Object.op_Implicit((Object)(object)boxImage)) { Image obj = boxImage; val = BoxColor; ((Graphic)obj).color = ((Color)(ref val)).RGBMultiplied(0.5f); } if (Object.op_Implicit((Object)(object)checkImage)) { Image obj2 = checkImage; val = CheckColor; ((Graphic)obj2).color = ((Color)(ref val)).RGBMultiplied(0.5f); } if (Object.op_Implicit((Object)(object)labelText)) { Text obj3 = labelText; val = TextColor; ((Graphic)obj3).color = ((Color)(ref val)).RGBMultiplied(0.5f); } } public void SetConfigEntry(ConfigEntry<bool> config) { if (_checkedChanged != null) { OnChecked -= _checkedChanged; } if (_configChanged != null) { config.SettingChanged -= _configChanged; } _config = config; _checkedChanged = delegate { config.Value = !config.Value; }; OnChecked += _checkedChanged; _configChanged = delegate { Checked = config.Value; }; config.SettingChanged += _configChanged; } public MyCheckBox WithLabelText(string val) { SetLabelText(val); return this; } public MyCheckBox WithCheck(bool check) { Checked = check; return this; } public MyCheckBox WithEnable(bool on) { SetEnable(on); return this; } public MyCheckBox WithConfigEntry(ConfigEntry<bool> config) { SetConfigEntry(config); return this; } public void OnClick(int obj) { _checked = !_checked; ((Behaviour)checkImage).enabled = _checked; this.OnChecked?.Invoke(); } } public class MyComboBox : MonoBehaviour { private RectTransform _rectTrans; private UIComboBox _comboBox; private Text _text; public Action<int> OnSelChanged; private static GameObject _baseObject; private EventHandler _configChanged; private Action<int> _selChanged; private ConfigEntry<int> _config; public float Width => _rectTrans.sizeDelta.x; public float Height => _rectTrans.sizeDelta.y; public static void InitBaseObject() { //IL_00fb: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_baseObject)) { return; } Transform obj = ((Component)UIRoot.instance.uiGame.buildMenu.uxFacilityCheck).transform.Find("text"); Text val = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null); GameObject val2 = Object.Instantiate<GameObject>(((Component)((Component)UIRoot.instance.optionWindow.resolutionComp).transform.parent).gameObject); ((Object)val2).name = "my-combobox"; val2.SetActive(false); Text component = val2.GetComponent<Text>(); if (Object.op_Implicit((Object)(object)component)) { component.text = ""; } if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)val)) { component.font = val.font; component.fontSize = val.fontSize; component.fontStyle = val.fontStyle; ((Graphic)component).color = new Color(1f, 1f, 1f, 0.6f); } Localizer component2 = val2.GetComponent<Localizer>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } UIComboBox component3 = ((Component)((Component)(RectTransform)val2.transform).transform.Find("ComboBox")).GetComponent<UIComboBox>(); foreach (Button itemButton in component3.ItemButtons) { Object.Destroy((Object)(object)((Component)itemButton).gameObject); } component3.Items.Clear(); component3.ItemButtons.Clear(); if (Object.op_Implicit((Object)(object)val)) { Text componentInChildren = ((Component)component3.m_ListItemRes).GetComponentInChildren<Text>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.font = val.font; componentInChildren.fontSize = val.fontSize; componentInChildren.fontStyle = val.fontStyle; } Transform obj2 = ((Component)component3).transform.Find("Main Button"); componentInChildren = ((obj2 != null) ? ((Component)obj2).GetComponentInChildren<Text>() : null); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.font = val.font; componentInChildren.fontSize = val.fontSize; componentInChildren.fontStyle = val.fontStyle; } } ((UnityEventBase)component3.onSubmit).RemoveAllListeners(); ((UnityEventBase)component3.onItemIndexChange).RemoveAllListeners(); _baseObject = val2; } public static MyComboBox CreateComboBox(float x, float y, RectTransform parent) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(_baseObject); ((Object)val).name = "my-combobox"; val.SetActive(true); MyComboBox cb = val.AddComponent<MyComboBox>(); RectTransform val2 = Util.NormalizeRectWithTopLeft((Component)(object)cb, x, y, (Transform)(object)parent); cb._rectTrans = val2; cb._text = val.GetComponent<Text>(); UIComboBox box = ((Component)((Transform)val2).Find("ComboBox")).GetComponent<UIComboBox>(); cb._comboBox = box; ((UnityEvent)box.onItemIndexChange).AddListener((UnityAction)delegate { cb.OnSelChanged?.Invoke(box.itemIndex); }); cb.UpdateComboBoxPosition(); return cb; } protected void OnDestroy() { _config.SettingChanged -= _configChanged; } private void UpdateComboBoxPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)_comboBox).transform; Vector3 localPosition = ((Transform)val).localPosition; float preferredWidth = _text.preferredWidth; ((Transform)val).localPosition = new Vector3(preferredWidth + 5f, localPosition.y, localPosition.z); _rectTrans.sizeDelta = new Vector2(((Transform)val).localPosition.x + val.sizeDelta.x, _rectTrans.sizeDelta.y); } public void SetPrompt(string prompt) { _text.text = Localization.Translate(prompt); UpdateComboBoxPosition(); } public void SetFontSize(int size) { _text.fontSize = size; _comboBox.ItemButtons.ForEach(delegate(Button b) { ((Component)b).GetComponentInChildren<Text>().fontSize = size; }); ((Component)_comboBox.m_ListItemRes).GetComponentInChildren<Text>().fontSize = size; Transform obj = ((Component)_comboBox).transform.Find("Main Button"); Text val = ((obj != null) ? ((Component)obj).GetComponentInChildren<Text>() : null); if (Object.op_Implicit((Object)(object)val)) { val.fontSize = size; } UpdateComboBoxPosition(); } public void SetItems(params string[] items) { _comboBox.Items = items.Select((string s) => Localization.Translate(s)).ToList(); } public void SetIndex(int index) { _comboBox.itemIndex = index; } public void SetSize(float width, float height) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001b: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_006b: 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) RectTransform val = (RectTransform)((Component)_comboBox).transform; val.sizeDelta = new Vector2((width > 0f) ? width : val.sizeDelta.x, (height > 0f) ? height : val.sizeDelta.y); _rectTrans.sizeDelta = new Vector2(((Transform)val).localPosition.x + val.sizeDelta.x, _rectTrans.sizeDelta.y); } public void AddOnSelChanged(Action<int> action) { OnSelChanged = (Action<int>)Delegate.Combine(OnSelChanged, action); } public void SetConfigEntry(ConfigEntry<int> config) { if (_selChanged != null) { OnSelChanged = (Action<int>)Delegate.Remove(OnSelChanged, _selChanged); } if (_configChanged != null) { config.SettingChanged -= _configChanged; } _comboBox.itemIndex = config.Value; _config = config; _selChanged = delegate(int value) { config.Value = value; }; OnSelChanged = (Action<int>)Delegate.Combine(OnSelChanged, _selChanged); _configChanged = delegate { SetIndex(config.Value); }; config.SettingChanged += _configChanged; } public MyComboBox WithPrompt(string prompt) { SetPrompt(prompt); return this; } public MyComboBox WithFontSize(int size) { SetFontSize(size); return this; } public MyComboBox WithItems(params string[] items) { SetItems(items); return this; } public MyComboBox WithIndex(int index) { SetIndex(index); return this; } public MyComboBox WithSize(float width, float height) { SetSize(width, height); return this; } public MyComboBox WithOnSelChanged(params Action<int>[] action) { foreach (Action<int> action2 in action) { AddOnSelChanged(action2); } return this; } public MyComboBox WithConfigEntry(ConfigEntry<int> config) { SetConfigEntry(config); return this; } } public class MyConfigWindow : MyWindowWithTabs { public static Action<MyConfigWindow, RectTransform> OnUICreated; public static Action OnUpdateUI; private RectTransform _windowTrans; public static MyConfigWindow CreateInstance() { return MyWindowManager.CreateWindow<MyConfigWindow>("UXAConfigWindow", "UXAssist Config"); } public static void DestroyInstance(MyConfigWindow win) { MyWindowManager.DestroyWindow((ManualBehaviour)(object)win); } public override void _OnCreate() { ((ManualBehaviour)this)._OnCreate(); _windowTrans = ((Component)this).GetComponent<RectTransform>(); OnUICreated?.Invoke(this, _windowTrans); AutoFitWindowSize(); SetCurrentTab(0); OnUpdateUI?.Invoke(); } public override void _OnDestroy() { _windowTrans = null; ((ManualBehaviour)this)._OnDestroy(); } public override bool _OnInit() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((ManualBehaviour)this)._OnInit()) { return false; } _windowTrans.anchoredPosition = new Vector2(0f, 0f); return true; } public override void _OnUpdate() { ((ManualBehaviour)this)._OnUpdate(); if (VFInput.escape && !VFInput.inputing) { VFInput.UseEscape(); ((ManualBehaviour)this)._Close(); } else { OnUpdateUI?.Invoke(); } } } public class MyKeyBinder : MonoBehaviour { private ConfigEntry<KeyboardShortcut> _config; [SerializeField] public Text functionText; [SerializeField] public Text keyText; [SerializeField] public InputField setTheKeyInput; [SerializeField] public Toggle setTheKeyToggle; [SerializeField] public RectTransform rectTrans; [SerializeField] public UIButton inputUIButton; [SerializeField] public Text conflictText; [SerializeField] public Text waitingText; [SerializeField] public UIButton setDefaultUIButton; [SerializeField] public UIButton setNoneKeyUIButton; private bool _nextNotOn; private KeyCode _lastKey; private static readonly KeyCode[] ModKeys; protected event Action OnFree; protected void OnDestroy() { this.OnFree?.Invoke(); } public static RectTransform CreateKeyBinder(float x, float y, RectTransform parent, ConfigEntry<KeyboardShortcut> config, string label = "", int fontSize = 17) { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) UIKeyEntry val = Object.Instantiate<UIKeyEntry>(UIRoot.instance.optionWindow.entryPrefab); GameObject gameObject; (gameObject = ((Component)val).gameObject).SetActive(true); ((Object)gameObject).name = "my-keybinder"; MyKeyBinder kb = gameObject.AddComponent<MyKeyBinder>(); kb._config = config; kb.functionText = val.functionText; kb.keyText = val.keyText; kb.setTheKeyInput = val.setTheKeyInput; kb.setTheKeyToggle = val.setTheKeyToggle; kb.rectTrans = val.rectTrans; kb.inputUIButton = val.inputUIButton; kb.conflictText = val.conflictText; kb.waitingText = val.waitingText; kb.setDefaultUIButton = val.setDefaultUIButton; kb.setNoneKeyUIButton = val.setNoneKeyUIButton; kb.functionText.text = Localization.Translate(label); kb.functionText.fontSize = 17; ((RectTransform)((Component)kb.keyText).transform).anchoredPosition = new Vector2(20f, -27f); kb.keyText.fontSize = 17; ((RectTransform)((Component)((Component)kb.inputUIButton).transform.parent).transform).anchoredPosition = new Vector2(20f, -57f); ((RectTransform)((Component)kb.setDefaultUIButton).transform).anchoredPosition = new Vector2(160f, -57f); ((RectTransform)((Component)kb.setNoneKeyUIButton).transform).anchoredPosition = new Vector2(260f, -57f); RectTransform val2 = Util.NormalizeRectWithTopLeft((Component)(object)kb, x, y, (Transform)(object)parent); kb.rectTrans = val2; Object.Destroy((Object)(object)val); ((Component)kb.setNoneKeyUIButton).gameObject.SetActive(false); EventHandler func = delegate { kb.SettingChanged(); }; kb.SettingChanged(); config.SettingChanged += func; kb.OnFree += delegate { config.SettingChanged -= func; }; kb.inputUIButton.onClick += kb.OnInputUIButtonClick; kb.setDefaultUIButton.onClick += kb.OnSetDefaultKeyClick; Transform transform = gameObject.transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } private void Update() { if (!setTheKeyToggle.isOn && inputUIButton.highlighted) { setTheKeyToggle.isOn = true; } if (!setTheKeyToggle.isOn) { return; } if (!inputUIButton._isPointerEnter && Input.GetKeyDown((KeyCode)323)) { inputUIButton.highlighted = false; setTheKeyToggle.isOn = false; Reset(); return; } if (!inputUIButton.highlighted) { setTheKeyToggle.isOn = false; Reset(); return; } ((Component)waitingText).gameObject.SetActive(true); if (TrySetValue()) { setTheKeyToggle.isOn = false; inputUIButton.highlighted = false; Reset(); } } private bool TrySetValue() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) if (Input.GetKey((KeyCode)27)) { VFInput.UseEscape(); return true; } if (Input.GetKey((KeyCode)323) || Input.GetKey((KeyCode)324)) { return true; } if (GetIunptKeys() || (int)_lastKey == 0) { return false; } string pressedKey = GetPressedKey(); if (string.IsNullOrEmpty(pressedKey)) { return false; } _lastKey = (KeyCode)0; _config.Value = KeyboardShortcut.Deserialize(pressedKey); return true; } private string GetPressedKey() { //IL_002f: 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) string text = ((object)(KeyCode)(ref _lastKey)).ToString(); if (string.IsNullOrEmpty(text)) { return null; } string text2 = ""; KeyCode[] modKeys = ModKeys; for (int i = 0; i < modKeys.Length; i++) { KeyCode val = modKeys[i]; if (Input.GetKey(val)) { text2 = text2 + "+" + ((object)(KeyCode)(ref val)).ToString(); } } if (!string.IsNullOrEmpty(text2)) { text += text2; } return text; } private bool GetIunptKeys() { //IL_001f: 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_0025: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) bool result = false; foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if ((int)value != 0 && !ModKeys.Contains(value) && Input.GetKey(value)) { _lastKey = value; result = true; } } return result; } public void Reset() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) ((Component)conflictText).gameObject.SetActive(false); ((Component)waitingText).gameObject.SetActive(false); ((Selectable)setDefaultUIButton.button).Select(); _lastKey = (KeyCode)0; } public void OnInputUIButtonClick(int data) { inputUIButton.highlighted = true; if (_nextNotOn) { _nextNotOn = false; inputUIButton.highlighted = false; setTheKeyToggle.isOn = false; ((Component)waitingText).gameObject.SetActive(false); } } public void OnSetDefaultKeyClick(int data) { //IL_0011: 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_002c: Unknown result type (might be due to invalid IL or missing references) _config.Value = (KeyboardShortcut)((ConfigEntryBase)_config).DefaultValue; Text obj = keyText; KeyboardShortcut value = _config.Value; obj.text = ((KeyboardShortcut)(ref value)).Serialize(); } public void OnSetNoneKeyClick(int data) { //IL_0011: 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_002c: Unknown result type (might be due to invalid IL or missing references) _config.Value = (KeyboardShortcut)((ConfigEntryBase)_config).DefaultValue; Text obj = keyText; KeyboardShortcut value = _config.Value; obj.text = ((KeyboardShortcut)(ref value)).Serialize(); } public void SettingChanged() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Text obj = keyText; KeyboardShortcut value = _config.Value; obj.text = ((KeyboardShortcut)(ref value)).Serialize(); } static MyKeyBinder() { KeyCode[] array = new KeyCode[12]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ModKeys = (KeyCode[])(object)array; } } public class MySlider : MonoBehaviour { public RectTransform rectTrans; public Slider slider; public RectTransform handleSlideArea; public Text labelText; public string labelFormat; public float Value { get { return slider.value; } set { float num = value; if (!num.Equals(slider.value)) { if (num > slider.maxValue) { num = slider.maxValue; } else if (num < slider.minValue) { num = slider.minValue; } slider.value = num; UpdateLabel(); } } } public event Action OnValueChanged; public static MySlider CreateSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f) { return CreateSlider(x, y, parent, width).WithLabelFormat(format).WithMinMaxValue(minValue, maxValue).WithValue(value); } public static MySlider CreateSlider(float x, float y, RectTransform parent, float width = 0f) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)UIRoot.instance.optionWindow.audioVolumeComp).gameObject); ((Object)val).name = "my-slider"; val.SetActive(true); MySlider mySlider = val.AddComponent<MySlider>(); RectTransform val2 = (mySlider.rectTrans = Util.NormalizeRectWithTopLeft((Component)(object)mySlider, x, y, (Transform)(object)parent)); if (width > 0f) { val2.sizeDelta = new Vector2(width, val2.sizeDelta.y); } mySlider.slider = val.GetComponent<Slider>(); mySlider.slider.minValue = 0f; mySlider.slider.maxValue = 100f; ((UnityEventBase)mySlider.slider.onValueChanged).RemoveAllListeners(); ((UnityEvent<float>)(object)mySlider.slider.onValueChanged).AddListener((UnityAction<float>)mySlider.SliderChanged); mySlider.Value = 0f; Transform obj = ((Transform)mySlider.slider.handleRect).Find("Text"); mySlider.labelText = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null); if (Object.op_Implicit((Object)(object)mySlider.labelText)) { mySlider.labelText.fontSize = 14; Transform transform = ((Component)mySlider.labelText).transform; RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val3 != null) { val3.sizeDelta = new Vector2(22f, 22f); } } mySlider.labelFormat = "G"; Transform obj2 = ((Component)mySlider).transform.Find("Handle Slide Area"); mySlider.handleSlideArea = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null); Transform obj3 = ((Component)mySlider.slider).transform.Find("Background"); Image val4 = ((obj3 != null) ? ((Component)obj3).GetComponent<Image>() : null); if ((Object)(object)val4 != (Object)null) { ((Graphic)val4).color = new Color(0.5f, 0.5f, 0.5f, 0.5f); } Image component = ((Component)mySlider.slider.fillRect).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = new Color(1f, 1f, 1f, 0.28f); } mySlider.UpdateLabel(); return mySlider; } public void SetEnable(bool on) { lock (this) { if (Object.op_Implicit((Object)(object)slider)) { ((Selectable)slider).interactable = on; } } } public MySlider WithValue(float value) { Value = value; return this; } public MySlider WithMinMaxValue(float min, float max) { slider.minValue = min; slider.maxValue = max; return this; } public MySlider WithLabelFormat(string format) { if (format == labelFormat) { return this; } labelFormat = format; UpdateLabel(); return this; } public MySlider WithEnable(bool on) { SetEnable(on); return this; } public void UpdateLabel() { if ((Object)(object)labelText != (Object)null) { labelText.text = slider.value.ToString(labelFormat); } } public void SetLabelText(string text) { if ((Object)(object)labelText != (Object)null) { labelText.text = text; } } public MySlider WithSmallerHandle(float deltaX = 10f, float deltaY = 0f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) Vector2 sizeDelta = slider.handleRect.sizeDelta; slider.handleRect.sizeDelta = new Vector2(sizeDelta.x - deltaX, sizeDelta.y - deltaY); handleSlideArea.offsetMin = new Vector2(handleSlideArea.offsetMin.x - deltaX / 2f, handleSlideArea.offsetMin.y); handleSlideArea.offsetMax = new Vector2(handleSlideArea.offsetMax.x + deltaX / 2f, handleSlideArea.offsetMax.y); return this; } public void SliderChanged(float val) { lock (this) { UpdateLabel(); this.OnValueChanged?.Invoke(); } } } public class MyWindow : ManualBehaviour { public class ValueMapper<T> { public virtual int Min => 1; public virtual int Max => 100; public virtual int ValueToIndex(T value) { return (int)Convert.ChangeType(value, typeof(int), CultureInfo.InvariantCulture); } public virtual T IndexToValue(int index) { return (T)Convert.ChangeType(index, typeof(T), CultureInfo.InvariantCulture); } public virtual string FormatValue(string format, T value) { return string.Format("{0:" + format + "}", value); } } private class ArrayMapper<T> : ValueMapper<T> { private readonly T[] _values; public override int Min => 0; public override int Max => _values.Length - 1; public ArrayMapper(T[] values) { Array.Sort(values); _values = values; } public override int ValueToIndex(T value) { return Array.BinarySearch(_values, value); } public override T IndexToValue(int index) { return _values[(index >= 0 && index < _values.Length) ? index : 0]; } } private float _maxX; protected float MaxY; protected const float TitleHeight = 48f; protected const float TabWidth = 105f; protected const float TabHeight = 27f; protected const float Margin = 30f; protected const float Spacing = 10f; private static GameObject _baseObject; public event Action OnFree; public static void InitBaseObject() { if (Object.op_Implicit((Object)(object)_baseObject)) { return; } GameObject val = Object.Instantiate<GameObject>(((Component)UIRoot.instance.uiGame.tankWindow).gameObject); val.SetActive(false); ((Object)val).name = "my-window"; Object.Destroy((Object)(object)val.GetComponent<UITankWindow>()); for (int i = 0; i < val.transform.childCount; i++) { GameObject gameObject = ((Component)val.transform.GetChild(i)).gameObject; if (((Object)gameObject).name != "panel-bg" && ((Object)gameObject).name != "shadow" && ((Object)gameObject).name != "panel-bg") { Object.Destroy((Object)(object)gameObject); } } _baseObject = val; } public static T Create<T>(string name, string title = "") where T : MyWindow { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(_baseObject, ((Component)UIRoot.instance.uiGame).transform.parent); ((Object)val).name = name; val.SetActive(false); MyWindow myWindow = val.AddComponent<T>(); if (!Object.op_Implicit((Object)(object)myWindow)) { return null; } Transform obj = val.transform.Find("panel-bg"); Button val2 = ((obj != null) ? ((Component)obj).gameObject.GetComponentInChildren<Button>() : null); if (Object.op_Implicit((Object)(object)val2)) { ((UnityEvent)val2.onClick).AddListener(new UnityAction(((ManualBehaviour)myWindow)._Close)); } myWindow.SetTitle(title); ((ManualBehaviour)myWindow)._Create(); if (MyWindowManager.Initialized) { ((ManualBehaviour)myWindow)._Init(((ManualBehaviour)myWindow).data); } return (T)myWindow; } public override void _OnFree() { this.OnFree?.Invoke(); } public virtual void TryClose() { ((ManualBehaviour)this)._Close(); } public virtual bool IsWindowFunctional() { return true; } public void Open() { ((ManualBehaviour)this)._Open(); ((Component)this).transform.SetAsLastSibling(); } public void Close() { ((ManualBehaviour)this)._Close(); } public void SetTitle(string title) { Transform obj = ((Component)this).gameObject.transform.Find("panel-bg/title-text"); Text val = ((obj != null) ? ((Component)obj).gameObject.GetComponent<Text>() : null); if (Object.op_Implicit((Object)(object)val)) { val.text = Localization.Translate(title); } } public void AutoFitWindowSize() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) ((Component)this).GetComponent<RectTransform>().sizeDelta = new Vector2(_maxX + 30f + 105f + 10f + 30f, MaxY + 48f + 30f); } private static void AddElement(float x, float y, RectTransform rect, RectTransform parent = null) { if ((Object)(object)rect != (Object)null) { Util.NormalizeRectWithTopLeft((Component)(object)rect, x, y, (Transform)(object)parent); } } public static Text AddText(float x, float y, RectTransform parent, string label, int fontSize = 14, string objName = "label") { //IL_0048: 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) Text val = Object.Instantiate<Text>(UIRoot.instance.uiGame.assemblerWindow.stateText); ((Object)((Component)val).gameObject).name = objName; val.text = Localization.Translate(label); ((Graphic)val).color = new Color(1f, 1f, 1f, 0.4f); val.alignment = (TextAnchor)3; val.fontSize = fontSize; ((Graphic)val).rectTransform.sizeDelta = new Vector2(val.preferredWidth + 8f, val.preferredHeight + 8f); AddElement(x, y, ((Graphic)val).rectTransform, parent); return val; } public Text AddText2(float x, float y, RectTransform parent, string label, int fontSize = 14, string objName = "label") { //IL_001d: 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) Text val = AddText(x, y, parent, label, fontSize, objName); _maxX = Math.Max(_maxX, x + ((Graphic)val).rectTransform.sizeDelta.x); MaxY = Math.Max(MaxY, y + ((Graphic)val).rectTransform.sizeDelta.y); return val; } public static UIButton AddTipsButton(float x, float y, RectTransform parent, string label, string tip, string content, string objName = "tips-button") { Transform obj = Object.Instantiate<Transform>(((Component)UIRoot.instance.galaxySelect.sandboxToggle).gameObject.transform.parent.Find("tip-button")); ((Object)((Component)obj).gameObject).name = objName;