Decompiled source of TerrainCustomiser Fix v1.0.1
TerrainCustomiser.dll
Decompiled 12 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; 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.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using ImGuiNET; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Peak; using Peak.Network; using Photon.Pun; using Photon.Realtime; using PhotonCustomPropsUtils; using Sirenix.Serialization; using Steamworks; using TerrainCustomiser.Localization; using TerrainCustomiser.Managers; using TerrainCustomiser.Map; using TerrainCustomiser.Map.Serialization; using TerrainCustomiser.Patches; using TerrainCustomiser.Session; using TerrainCustomiser.UI; using TerrainCustomiser.UI.Modals; using TerrainCustomiser.UI.Windows; using TerrainCustomiser.Utils; using UBImGui; using Unity.Burst; using Unity.Collections; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RegisterFormatter(typeof(GameObjectFormatter), 10)] [assembly: RegisterFormatter(typeof(MaterialFormatter), 10)] [assembly: RegisterFormatter(typeof(TransformFormatter), 10)] [assembly: RegisterFormatter(typeof(RandomScaleFormatter), 10)] [assembly: IgnoresAccessChecksTo("Accessibility")] [assembly: IgnoresAccessChecksTo("Ashley.MeshSplitter")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")] [assembly: IgnoresAccessChecksTo("DemiLib")] [assembly: IgnoresAccessChecksTo("DOTween")] [assembly: IgnoresAccessChecksTo("DOTweenPro")] [assembly: IgnoresAccessChecksTo("EpicCommon")] [assembly: IgnoresAccessChecksTo("EpicOnlineService")] [assembly: IgnoresAccessChecksTo("HBAO.Runtime")] [assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")] [assembly: IgnoresAccessChecksTo("LightVolume.Runtime")] [assembly: IgnoresAccessChecksTo("Managers")] [assembly: IgnoresAccessChecksTo("Mono.Posix")] [assembly: IgnoresAccessChecksTo("Mono.Security")] [assembly: IgnoresAccessChecksTo("Mono.WebBrowser")] [assembly: IgnoresAccessChecksTo("Newtonsoft.Json")] [assembly: IgnoresAccessChecksTo("Photon")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("PlatformProviders")] [assembly: IgnoresAccessChecksTo("Platforms")] [assembly: IgnoresAccessChecksTo("PortningsbolagetMemory")] [assembly: IgnoresAccessChecksTo("pworld")] [assembly: IgnoresAccessChecksTo("sc.posteffects.runtime")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("SteamCommon")] [assembly: IgnoresAccessChecksTo("SteamManagerAssembly")] [assembly: IgnoresAccessChecksTo("Tayx.Graphy")] [assembly: IgnoresAccessChecksTo("unity-websocket-sharp")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Cinemachine")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.RebindingUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.004")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Microsoft.GDK")] [assembly: IgnoresAccessChecksTo("Unity.Microsoft.GDK.Tools")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Center.Common")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipeline.Universal.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime.Shared")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.GPUDriven.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.2D.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Shaders")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication.PlayerAccounts")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.Multiplayer")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Wire.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.UnifiedRayTracing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.AccessibilityModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AdaptivePerformanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AMDModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GraphicsStateCollectionSerializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HierarchyCoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HierarchyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IdentifiersModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputForUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InsightsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.MarshallingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.MultiplayerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsBackendPhysXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RenderAs2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ShaderRuntimeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ShaderVariantAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConsentModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VectorGraphicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")] [assembly: IgnoresAccessChecksTo("UnityUIExtensions")] [assembly: IgnoresAccessChecksTo("User")] [assembly: IgnoresAccessChecksTo("Utilities")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: IgnoresAccessChecksTo("Whinarn.UnityMeshSimplifier.Runtime")] [assembly: IgnoresAccessChecksTo("XblPCSandbox")] [assembly: IgnoresAccessChecksTo("Zorro.AutoLOD")] [assembly: IgnoresAccessChecksTo("Zorro.ControllerSupport")] [assembly: IgnoresAccessChecksTo("Zorro.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Zorro.JiggleBones")] [assembly: IgnoresAccessChecksTo("Zorro.PhotonUtility")] [assembly: IgnoresAccessChecksTo("Zorro.Settings.Runtime")] [assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TerrainCustomiser")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+c4bc9d7e16c96e56ed95e468fb8ea8fe235a171f")] [assembly: AssemblyProduct("TerrainCustomiser")] [assembly: AssemblyTitle("TerrainCustomiser")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public sealed class GameObjectFormatter : MinimalBaseFormatter<GameObject> { private static Dictionary<string, GameObject> _fallbackByName; public static void ResetFallback() { _fallbackByName = null; } public override GameObject GetUninitializedObject() { return null; } public override void Read(ref GameObject value, IDataReader reader) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown EntryType val; string text = default(string); string kv = default(string); while ((int)(val = reader.PeekEntry(ref text)) != 8 && (int)val != 15) { if (text != "name" && text != "targetId") { reader.SkipEntry(); } else { if (!reader.ReadString(ref kv)) { continue; } if (text == "name") { GameObject val2 = ResourceManager.GameObjectResources.Find((GameObject x) => (Object)x != (Object)null && ((Object)x).name == kv); if ((Object)val2 == (Object)null) { val2 = FindFallback(kv); Debug.LogWarning((object)("[TC] prop 资源 '" + kv + "' 预收集未命中 → 全量兜底: " + (((Object)val2 != (Object)null) ? "命中" : "仍未找到(该prop将缺失)"))); } value = val2; } else { value = MapSerializer.GetOrCreateReferencePlaceholder(kv); } } } base.RegisterReferenceID(value, reader); } private static GameObject FindFallback(string name) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (_fallbackByName == null) { _fallbackByName = new Dictionary<string, GameObject>(); GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); foreach (GameObject val in array) { if ((Object)val != (Object)null) { string name2 = ((Object)val).name; if (!_fallbackByName.ContainsKey(name2)) { _fallbackByName[name2] = val; } } } } if (!_fallbackByName.TryGetValue(name, out var value)) { return null; } return value; } public override void Write(ref GameObject value, IDataWriter writer) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown GameObject go = value.gameObject; KeyValuePair<string, GameObject> keyValuePair = MapSerializer.GameObjectReferences.FirstOrDefault((KeyValuePair<string, GameObject> x) => (Object)x.Value == (Object)go); if ((Object)keyValuePair.Value == (Object)null) { writer.WriteString("name", ((Object)value).name); } else { writer.WriteString("targetId", keyValuePair.Key); } } } public sealed class MaterialFormatter : MinimalBaseFormatter<Material> { public override Material GetUninitializedObject() { return null; } public override void Read(ref Material value, IDataReader reader) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 EntryType val; string text = default(string); string kv = default(string); while ((int)(val = reader.PeekEntry(ref text)) != 8 && (int)val != 15) { if (text != "name") { reader.SkipEntry(); } else if (reader.ReadString(ref kv)) { Material val2 = ResourceManager.MaterialResources.Find((Material x) => (Object)(object)x != (Object)null && ((Object)x).name == kv); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)("[TC] 材质 '" + kv + "' 未找到(对应prop将用默认材质)")); } value = val2; } } base.RegisterReferenceID(value, reader); } public override void Write(ref Material value, IDataWriter writer) { writer.WriteString("name", ((Object)value).name); } } public sealed class TransformFormatter : MinimalBaseFormatter<Transform> { public override Transform GetUninitializedObject() { return null; } public override void Read(ref Transform value, IDataReader reader) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown EntryType val; string text = default(string); string text2 = default(string); while ((int)(val = reader.PeekEntry(ref text)) != 8 && (int)val != 15) { if (text != "refid" && text != "refpath") { reader.SkipEntry(); } else { if (!reader.ReadString(ref text2)) { continue; } if (text == "refid") { value = MapSerializer.GetOrCreateReferencePlaceholder(text2).transform; } else if (text == "refpath") { GameObject val2 = GameObject.Find(text2); if ((Object)val2 != (Object)null) { value = val2.transform; } else { value = null; } } } } base.RegisterReferenceID(value, reader); } public override void Write(ref Transform value, IDataWriter writer) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown GameObject go = ((Component)value).gameObject; KeyValuePair<string, GameObject> keyValuePair = MapSerializer.GameObjectReferences.FirstOrDefault((KeyValuePair<string, GameObject> x) => (Object)x.Value == (Object)go); if ((Object)keyValuePair.Value == (Object)null) { string pathFromGameObject = MapSerializer.GetPathFromGameObject(go); writer.WriteString("refpath", pathFromGameObject); } else { writer.WriteString("refid", keyValuePair.Key); } } } namespace TerrainCustomiser { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.snosz.terraincustomiser", "TerrainCustomiser", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string RteFixMarker = "rte-fix"; public static Plugin Instance; internal static bool IslandLoadSent; private static Harmony _harmony; private float _nextGuardTick; private void Awake() { Instance = this; MapSerializer.EnsureFormattersRegistered(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[TC] Save formatters ready: GameObjectFormatter, MaterialFormatter, TransformFormatter, RandomScaleFormatter."); ConfigManager.Setup(); Loc.Init(ConfigManager.Language.Value); BundleManager.Setup(); PlayerInfoManager.Setup(); WindowsManager.Setup(); _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); LocalizationPatches.Bootstrap(_harmony); } private void OnDestroy() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown _harmony.UnpatchSelf(); BundleManager.UnloadAll(); Object.Destroy((Object)Singleton<EditorManager>.Instance); } private void Update() { if (!(Time.unscaledTime < _nextGuardTick)) { _nextGuardTick = Time.unscaledTime + 2f; SceneLoadGuard.Tick(); StormSync.Tick(); } } public void LoadWilIsland() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown AirportCheckInKiosk val = Object.FindFirstObjectByType<AirportCheckInKiosk>(); if ((Object)val == (Object)null) { Debug.LogError((object)"[TC] Failed to find airportkiosk"); return; } IslandLoadSent = true; int ascentIndex = GUIManager.instance.boardingPass.ascentIndex; ((MonoBehaviourPun)val).photonView.RPC("BeginIslandLoadRPC", (RpcTarget)0, new object[3] { "WilIsland", ascentIndex, RunSettings.GetSerializedRunSettings() }); } } } namespace TerrainCustomiser.Utils { public class DebugVisualiser : MonoBehaviour { private abstract class Shape { public Color color; public float duration; public float startTime; private int startFrame; public bool alwaysOnTop; public bool Expired { get { if (!(duration <= 0f)) { return Time.time - startTime > duration; } return Time.frameCount > startFrame; } } protected Shape(Color color, float duration, bool alwaysOnTop) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.color = color; this.duration = duration; this.alwaysOnTop = alwaysOnTop; startTime = Time.time; startFrame = Time.frameCount; } public abstract void Draw(); } private class MeshShape : Shape { private Mesh mesh; private Transform transform; public MeshShape(Mesh mesh, Transform transform, Color color, float duration, bool alwaysOnTop) : base(color, duration, alwaysOnTop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) this.mesh = mesh; this.transform = transform; } public override void Draw() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)mesh == (Object)null) && !((Object)transform == (Object)null)) { Vector3[] vertices = mesh.vertices; int[] triangles = mesh.triangles; for (int i = 0; i < triangles.Length; i += 3) { int num = triangles[i]; int num2 = triangles[i + 1]; int num3 = triangles[i + 2]; Vector3 val = transform.TransformPoint(vertices[num]); Vector3 val2 = transform.TransformPoint(vertices[num2]); Vector3 val3 = transform.TransformPoint(vertices[num3]); GL.Color(color); GL.Vertex(val); GL.Vertex(val2); GL.Vertex(val2); GL.Vertex(val3); GL.Vertex(val3); GL.Vertex(val); } } } } private class BoxShape : Shape { private Vector3 center; private Vector3 size; private Quaternion rotation; public BoxShape(Vector3 center, Vector3 size, Quaternion rotation, Color color, float duration, bool alwaysOnTop) : base(color, duration, alwaysOnTop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001b: 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) this.center = center; this.size = size; this.rotation = rotation; } public override void Draw() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = size * 0.5f; Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(0f - val.x, 0f - val.y, 0f - val.z), new Vector3(val.x, 0f - val.y, 0f - val.z), new Vector3(val.x, 0f - val.y, val.z), new Vector3(0f - val.x, 0f - val.y, val.z), new Vector3(0f - val.x, val.y, 0f - val.z), new Vector3(val.x, val.y, 0f - val.z), new Vector3(val.x, val.y, val.z), new Vector3(0f - val.x, val.y, val.z) }; for (int i = 0; i < array.Length; i++) { array[i] = center + rotation * array[i]; } int[,] array2 = new int[12, 2] { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; GL.Color(color); for (int j = 0; j < array2.GetLength(0); j++) { GL.Vertex(array[array2[j, 0]]); GL.Vertex(array[array2[j, 1]]); } } } private class RayShape : Shape { private Vector3 from; private Vector3 dir; public RayShape(Vector3 from, Vector3 dir, Color color, float duration, bool alwaysOnTop) : base(color, duration, alwaysOnTop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) this.from = from; this.dir = dir; } public override void Draw() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) GL.Color(color); GL.Vertex(from); GL.Vertex(from + dir); } } private class LineShape : Shape { private Vector3 from; private Vector3 to; public LineShape(Vector3 from, Vector3 to, Color color, float duration, bool alwaysOnTop) : base(color, duration, alwaysOnTop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) this.from = from; this.to = to; } public override void Draw() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) GL.Color(color); GL.Vertex(from); GL.Vertex(to); } } private class SphereShape : Shape { private Vector3 pos; private float radius; public SphereShape(Vector3 pos, float radius, Color color, float duration, bool alwaysOnTop) : base(color, duration, alwaysOnTop) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) this.pos = pos; this.radius = radius; } public override void Draw() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) int num = 24; for (int i = 0; i < num; i++) { float num2 = (float)i / (float)num * MathF.PI * 2f; float num3 = (float)(i + 1) / (float)num * MathF.PI * 2f; Vector3 val = pos + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * radius; Vector3 val2 = pos + new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * radius; GL.Color(color); GL.Vertex(val); GL.Vertex(val2); Vector3 val3 = pos + new Vector3(0f, Mathf.Cos(num2), Mathf.Sin(num2)) * radius; Vector3 val4 = pos + new Vector3(0f, Mathf.Cos(num3), Mathf.Sin(num3)) * radius; GL.Vertex(val3); GL.Vertex(val4); Vector3 val5 = pos + new Vector3(Mathf.Cos(num2), Mathf.Sin(num2), 0f) * radius; Vector3 val6 = pos + new Vector3(Mathf.Cos(num3), Mathf.Sin(num3), 0f) * radius; GL.Vertex(val5); GL.Vertex(val6); } } } private static DebugVisualiser _instance; private List<Shape> _shapes = new List<Shape>(); private Material lineMaterialNormal; private Material lineMaterialOverlay; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if ((Object)_instance == (Object)null) { _instance = this; } else { Object.Destroy((Object)((Component)this).gameObject); } lineMaterialNormal = new Material(Shader.Find("Hidden/Internal-Colored")); lineMaterialOverlay = new Material(Shader.Find("Hidden/Internal-Colored")); lineMaterialOverlay.SetInt("_ZTest", 8); RenderPipelineManager.endCameraRendering += OnEndCameraRendering; } private void OnDisable() { RenderPipelineManager.endCameraRendering -= OnEndCameraRendering; } private void OnEndCameraRendering(ScriptableRenderContext ctx, Camera cam) { if (_shapes.Count != 0) { DrawShapes(overlay: false, lineMaterialNormal); DrawShapes(overlay: true, lineMaterialOverlay); } } public static void DrawRay(Vector3 from, Vector3 dir, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)_instance == (Object)null) { CreateInstance(); } _instance._shapes.Add(new RayShape(from, dir, color, duration, alwaysOnTop)); } public static void DrawSphere(Vector3 pos, float radius, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)_instance == (Object)null) { CreateInstance(); } _instance._shapes.Add(new SphereShape(pos, radius, color, duration, alwaysOnTop)); } public static void DrawLine(Vector3 from, Vector3 to, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)_instance == (Object)null) { CreateInstance(); } _instance._shapes.Add(new LineShape(from, to, color, duration, alwaysOnTop)); } public static void DrawBox(Vector3 center, Vector3 size, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) DrawBox(center, size, Quaternion.identity, color, duration, alwaysOnTop); } public static void DrawBox(Vector3 center, Vector3 size, Quaternion rotation, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)_instance == (Object)null) { CreateInstance(); } _instance._shapes.Add(new BoxShape(center, size, rotation, color, duration, alwaysOnTop)); } public static void DrawMeshCollider(MeshCollider collider, Color color, float duration = 0f, bool alwaysOnTop = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)collider == (Object)null) && !((Object)collider.sharedMesh == (Object)null)) { if ((Object)_instance == (Object)null) { CreateInstance(); } _instance._shapes.Add(new MeshShape(collider.sharedMesh, ((Component)collider).transform, color, duration, alwaysOnTop)); } } private static void CreateInstance() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _instance = new GameObject("TC_DebugVisualiser") { hideFlags = (HideFlags)61 }.AddComponent<DebugVisualiser>(); } private void DrawShapes(bool overlay, Material mat) { mat.SetPass(0); GL.Begin(1); for (int num = _shapes.Count - 1; num >= 0; num--) { if (_shapes[num].Expired) { _shapes.RemoveAt(num); } else if (_shapes[num].alwaysOnTop == overlay) { _shapes[num].Draw(); } } GL.End(); } } public static class GizmoUtils { public class RendererMaterialCache { public Renderer Renderer; public Material[] OriginalMaterials; public Material OverlayMaterial; } internal static Shader SelectionOverlayShader; public static void TryDrawGizmos(Transform target, Component component) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0042: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (component is PropSpawner) { PropSpawner val = (PropSpawner)component; DrawPropSpawnerGizmos(component.transform, val.area, val.rayLength, val.rayNearCutoff); } else if (component is PropSpawner_Line) { PropSpawner_Line val2 = (PropSpawner_Line)component; Vector3 to = ((Component)val2).transform.position + val2.height * 0.5f * ((Component)val2).transform.up; DebugVisualiser.DrawLine(((Component)val2).transform.position - val2.height * 0.5f * ((Component)val2).transform.up, to, Color.white); } else if (component is PropSpawner_Sphere) { PropSpawner_Sphere val3 = (PropSpawner_Sphere)component; DebugVisualiser.DrawSphere(((Component)val3).transform.position, ((PropSpawner)val3).rayLength, Color.white); } else if (component is SpecialDayZone) { SpecialDayZone val4 = (SpecialDayZone)component; DebugVisualiser.DrawBox(((Component)val4).transform.position, ((Bounds)(ref val4.bounds)).size, Color.white); } } public static void TryDrawOverlays(Transform target) { } public static void TryRestoreMaterials() { } public static void DrawPropSpawnerGizmos(Transform target, Vector2 area, float rayLength, float rayNearCutoff) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_019b: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target.position + area.y * 0.5f * target.up; Vector3 val2 = target.position - area.y * 0.5f * target.up; Vector3 val3 = target.position - area.x * 0.5f * target.right; Vector3 val4 = target.position + area.x * 0.5f * target.right; DebugVisualiser.DrawLine(val2, val, Color.white); DebugVisualiser.DrawLine(val3, val4, Color.white); DebugVisualiser.DrawLine(val2, val2 + target.forward * rayLength + target.forward * rayNearCutoff, Color.green); DebugVisualiser.DrawLine(val, val + target.forward * rayLength + target.forward * rayNearCutoff, Color.green); DebugVisualiser.DrawLine(val3, val3 + target.forward * rayLength + target.forward * rayNearCutoff, Color.green); DebugVisualiser.DrawLine(val4, val4 + target.forward * rayLength + target.forward * rayNearCutoff, Color.green); DebugVisualiser.DrawBox(target.position + target.forward * rayLength / 2f, Vector3.one, target.rotation, Color.green); DebugVisualiser.DrawLine(val2, val2 + target.forward * rayNearCutoff, Color.red); DebugVisualiser.DrawLine(val3, val3 + target.forward * rayNearCutoff, Color.red); DebugVisualiser.DrawLine(val, val + target.forward * rayNearCutoff, Color.red); DebugVisualiser.DrawLine(val4, val4 + target.forward * rayNearCutoff, Color.red); } public static List<Renderer> GetRenderersFromObject(GameObject target) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown List<Renderer> list = new List<Renderer>(); LODGroup[] componentsInChildren = target.GetComponentsInChildren<LODGroup>(true); if (componentsInChildren != null && componentsInChildren.Length != 0) { LODGroup[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { LOD[] lODs = array[i].GetLODs(); for (int j = 0; j < lODs.Length; j++) { Renderer[] renderers = lODs[j].renderers; foreach (Renderer val in renderers) { if (!((Object)val == (Object)null)) { list.Add(val); } } } } return list; } return target.GetComponentsInChildren<Renderer>(true).ToList(); } public static List<RendererMaterialCache> ApplyOverlayToRenderers(List<Renderer> renderers) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown List<RendererMaterialCache> list = new List<RendererMaterialCache>(); foreach (Renderer renderer in renderers) { Material[] sharedMaterials = renderer.sharedMaterials; Material val = new Material(SelectionOverlayShader); list.Add(new RendererMaterialCache { Renderer = renderer, OriginalMaterials = sharedMaterials, OverlayMaterial = val }); Material[] array = (Material[])(object)new Material[sharedMaterials.Length + 1]; Array.Copy(sharedMaterials, array, sharedMaterials.Length); array[^1] = val; renderer.sharedMaterials = array; } return list; } public static List<RendererMaterialCache> ApplyOverlayToRenderers(Renderer[] renderers) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown List<RendererMaterialCache> list = new List<RendererMaterialCache>(); foreach (Renderer val in renderers) { Material[] sharedMaterials = val.sharedMaterials; Material val2 = new Material(SelectionOverlayShader); list.Add(new RendererMaterialCache { Renderer = val, OriginalMaterials = sharedMaterials, OverlayMaterial = val2 }); Material[] array = (Material[])(object)new Material[sharedMaterials.Length + 1]; Array.Copy(sharedMaterials, array, sharedMaterials.Length); array[^1] = val2; val.sharedMaterials = array; } return list; } public static void RestoreRendererMaterials(List<RendererMaterialCache> rendererCache) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown foreach (RendererMaterialCache item in rendererCache) { if (!((Object)item.Renderer == (Object)null)) { item.Renderer.sharedMaterials = item.OriginalMaterials; if ((Object)item.OverlayMaterial != (Object)null) { Object.Destroy((Object)item.OverlayMaterial); } } } rendererCache.Clear(); } } public static class NetworkUtils { public static byte[] CompressBrotli(byte[] data) { using MemoryStream memoryStream = new MemoryStream(); using (BrotliStream brotliStream = new BrotliStream(memoryStream, CompressionLevel.Optimal)) { brotliStream.Write(data, 0, data.Length); } return memoryStream.ToArray(); } public static byte[] DecompressBrotli(byte[] compressed) { using MemoryStream stream = new MemoryStream(compressed); using BrotliStream brotliStream = new BrotliStream(stream, CompressionMode.Decompress); using MemoryStream memoryStream = new MemoryStream(); brotliStream.CopyTo(memoryStream); return memoryStream.ToArray(); } public static byte[] SerializeMapSyncData(MapSerializer.MapSyncData data) { string s = JsonConvert.SerializeObject((object)data); return Encoding.UTF8.GetBytes(s); } public static MapSerializer.MapSyncData DeserializeMapSyncData(byte[] bytes) { return JsonConvert.DeserializeObject<MapSerializer.MapSyncData>(Encoding.UTF8.GetString(bytes)); } public static byte[] CompressMapSyncData(MapSerializer.MapSyncData data) { return CompressBrotli(SerializeMapSyncData(data)); } public static MapSerializer.MapSyncData DecompressMapSyncData(byte[] compressed) { return DeserializeMapSyncData(DecompressBrotli(compressed)); } public static void SetMapDataRoomProperty(MapSerializer.MapSyncData mapSyncData) { byte[] array = CompressMapSyncData(mapSyncData); double num = (double)array.Length / 1048576.0; Debug.Log((object)$"Compressed MapSyncData Size: {num:F2} MB"); NetworkManager.SetRoomProperty("TC_propViews", null); NetworkManager.SetRoomProperty("TC_sv", null); NetworkManager.SetRoomProperty("TC_mapData", array); TrCompat.HostDisableTrInRoom(); } } } namespace TerrainCustomiser.UI { public static class ContextMenu { private static int selectedItemIndex = -1; private static Type[] types; public static void GetTypes(Type type) { types = GetConcreteDerivedTypes(type); } public static void CreateMenu(IList list, Type type) { if (!ImGui.BeginPopupContextItem("WidgetContextMenu")) { return; } for (int i = 0; i < types.Length; i++) { if (ImGui.Selectable(types[i].Name)) { object value = Activator.CreateInstance(types[i]); list.Add(value); types = null; break; } } ImGui.EndPopup(); } private static Type[] GetConcreteDerivedTypes(Type baseType) { return (from t in AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()) where baseType.IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface select t).ToArray(); } } public static class EditorGizmos { public static bool IsEnabled = false; private static List<GizmoUtils.RendererMaterialCache> rendererMaterialCache = new List<GizmoUtils.RendererMaterialCache>(); private static Transform Target; public static void ToggleGizmos() { IsEnabled = !IsEnabled; if (!IsEnabled) { GizmoUtils.RestoreRendererMaterials(rendererMaterialCache); } else { RefreshGizmos(); } } public static void OnSelectionChanged(Transform selected) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown Target = selected; if (IsEnabled) { GizmoUtils.RestoreRendererMaterials(rendererMaterialCache); LevelGenStep component = ((Component)Target).gameObject.GetComponent<LevelGenStep>(); GizmoUtils.TryDrawGizmos(Target, (Component)component); if ((Object)component != (Object)null) { rendererMaterialCache = GizmoUtils.ApplyOverlayToRenderers(((Component)Target).gameObject.GetComponentsInChildren<Renderer>(true)); } } } public static void RefreshGizmos() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (!IsEnabled) { return; } GizmoUtils.RestoreRendererMaterials(rendererMaterialCache); if (!((Object)Target == (Object)null)) { LevelGenStep component = ((Component)Target).gameObject.GetComponent<LevelGenStep>(); GizmoUtils.TryDrawGizmos(Target, (Component)component); if ((Object)component != (Object)null) { rendererMaterialCache = GizmoUtils.ApplyOverlayToRenderers(((Component)Target).gameObject.GetComponentsInChildren<Renderer>(true)); } } } } public class HierarchyView { public class ContextNode { public string Name; public List<ContextNode> Children = new List<ContextNode>(); public Action<Transform> Action; public Func<Transform, bool> CanUseNode; public void AddContextItem(string label, Action<Transform> action, Func<Transform, bool> canUseNode) { Children.Add(new ContextNode { Name = label, Action = action, CanUseNode = canUseNode }); } } public Action<Transform> OnSelectionChanged; public Func<Transform, bool> ShouldDrawNode; public List<ContextNode> ContextNodes = new List<ContextNode>(); public Transform Selected { get; private set; } public void DrawNode(Transform t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002a: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0041: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if ((Object)t == (Object)null || (ShouldDrawNode != null && !ShouldDrawNode(t))) { return; } ImGuiTreeNodeFlags val = (ImGuiTreeNodeFlags)4288; if ((Object)Selected == (Object)t) { val = (ImGuiTreeNodeFlags)(val | 1); } ImGui.PushID(((Object)t).GetInstanceID()); if (t.childCount == 0) { val = (ImGuiTreeNodeFlags)(val | 0x100); } bool num = ImGui.TreeNodeEx("", val, ((Object)t).name); if (ImGui.IsItemClicked() || ImGui.IsItemClicked((ImGuiMouseButton)1)) { SetSelected(t); } if (ImGui.IsItemClicked((ImGuiMouseButton)1)) { ImGui.OpenPopup("HierarchyItemContextMenuPopup"); } if (ImGui.BeginPopup("HierarchyItemContextMenuPopup")) { DrawContextNodes(t); ImGui.EndPopup(); } if (num) { for (int i = 0; i < t.childCount; i++) { DrawNode(t.GetChild(i)); } ImGui.TreePop(); } ImGui.PopID(); } public void SetSelected(Transform t) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Expected O, but got Unknown if (!((Object)Selected == (Object)t)) { Selected = t; OnSelectionChanged?.Invoke(t); } } public ContextNode AddContextMenu(string label, Func<Transform, bool> canUseNode) { ContextNode contextNode = new ContextNode { Name = label, CanUseNode = canUseNode }; ContextNodes.Add(contextNode); return contextNode; } public void AddContextItem(string label, Action<Transform> action, Func<Transform, bool> canUseNode) { ContextNodes.Add(new ContextNode { Name = label, Action = action, CanUseNode = canUseNode }); } public void DrawContextNodes(Transform t) { foreach (ContextNode contextNode in ContextNodes) { bool flag = true; if (contextNode.CanUseNode != null) { flag = contextNode.CanUseNode(t); } if (!flag) { ImGui.BeginDisabled(); } DrawContextNode(contextNode, t); if (!flag) { ImGui.EndDisabled(); } } } private void DrawContextNode(ContextNode node, Transform t) { if (node.Children.Count > 0) { DrawMenuNode(node, t); } else { DrawMenuItemNode(node, t); } } private void DrawMenuItemNode(ContextNode node, Transform t) { if (ImGui.MenuItem(node.Name)) { node.Action?.Invoke(t); } } private void DrawMenuNode(ContextNode node, Transform t) { if (!ImGui.BeginMenu(node.Name)) { return; } foreach (ContextNode child in node.Children) { DrawContextNode(child, t); } ImGui.EndMenu(); } } public static class ImGuiHelpers { public static void DrawPropertiesTable(string tableName, WidgetFactory.FieldWidgetData[] fieldWidgets) { if (!ImGui.BeginTable("Table_" + tableName, 2)) { return; } ImGui.TableSetupColumn("Name", (ImGuiTableColumnFlags)16, 100f); ImGui.TableSetupColumn("Value", (ImGuiTableColumnFlags)8); foreach (WidgetFactory.FieldWidgetData fieldWidgetData in fieldWidgets) { if (!fieldWidgetData.IsHidden) { if (fieldWidgetData.IsDisabled) { ImGui.BeginDisabled(); } ImGui.TableNextColumn(); ImGui.TextUnformatted(fieldWidgetData.Name); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(-1f); fieldWidgetData.Draw(); ImGui.TableNextRow(); if (fieldWidgetData.IsDisabled) { ImGui.EndDisabled(); } } } ImGui.EndTable(); } public static void DrawFullLayoutField(WidgetFactory.FieldWidgetData fieldWidget) { if (!fieldWidget.IsHidden) { ImGui.SetNextItemWidth(-1f); if (fieldWidget.IsDisabled) { ImGui.BeginDisabled(); } WidgetFactory.DrawField(fieldWidget); if (fieldWidget.IsDisabled) { ImGui.EndDisabled(); } } } public static void DrawButton(string label, Action onClick, bool enabled = true) { if (!enabled) { ImGui.BeginDisabled(); } if (ImGui.Button(label)) { onClick(); } if (!enabled) { ImGui.EndDisabled(); } } public static void DrawSmallButton(string label, Action onClick, bool enabled = true) { if (!enabled) { ImGui.BeginDisabled(); } if (ImGui.SmallButton(label)) { onClick(); } if (!enabled) { ImGui.EndDisabled(); } } } public static class WidgetFactory { public class FieldWidgetData { public string Name; public Type Type; public Func<object> Get; public Action<object> Set; public RangeAttribute RangeAttribute; public bool IsHidden; public bool IsDisabled; public FieldWidgetData(Type type, Func<object> get, Action<object> set, string name, RangeAttribute rangeAttribute = null, bool isHidden = false, bool isDisabled = false) { Type = type; Get = get; Set = set; Name = name; RangeAttribute = rangeAttribute; IsHidden = isHidden; IsDisabled = isDisabled; } public FieldWidgetData() { } public FieldWidgetData(FieldData fieldData, object ownerObject) { Type = fieldData.fieldInfo.FieldType; Get = () => fieldData.fieldInfo.GetValue(ownerObject); Set = delegate(object v) { fieldData.fieldInfo.SetValue(ownerObject, v); }; Name = fieldData.name; RangeAttribute = fieldData.rangeAttribute; IsHidden = fieldData.widgetMode == WidgetMode.Hidden; IsDisabled = fieldData.widgetMode == WidgetMode.Disabled; } public virtual void Draw() { DrawField(Type, Get, Set, Name, RangeAttribute); } } public class ComboWidgetData : FieldWidgetData { public Func<int> GetIndex; public Action<int> SetIndex; public Func<string[]> GetOptions; public ComboWidgetData(string name, Func<int> getIndex, Action<int> setIndex, Func<string[]> getOptions) { Name = name; GetIndex = getIndex; SetIndex = setIndex; GetOptions = getOptions; } public override void Draw() { int num = GetIndex(); string[] array = GetOptions(); if (array != null && array.Length != 0) { if (num < 0 || num >= array.Length) { num = 0; } ImGui.PushID(Name); if (ImGui.Combo("##v", ref num, array, array.Length)) { SetIndex(num); } ImGui.PopID(); } } } public class FieldData { public string name; public FieldInfo fieldInfo; public RangeAttribute rangeAttribute; public FieldLayout layout; public WidgetMode widgetMode; } public enum WidgetMode { Default, Disabled, Hidden } public enum FieldLayout { Inline, Full } private static List<string> spawnerHideFieldData = new List<string> { "_deferredSteps", "validationConstraints", "_propSpawnData", "_madeDummyData", "<ValidationState>k__BackingField", "<spawnedProps>k__BackingField" }; public static Dictionary<Type, FieldData[]> TypeFieldDataDictionary = new Dictionary<Type, FieldData[]>(); public static void DrawField(object obj, FieldData fieldData) { FieldInfo f = fieldData.fieldInfo; DrawField(f.FieldType, () => f.GetValue(obj), delegate(object v) { f.SetValue(obj, v); }, f.Name, fieldData.rangeAttribute); } public static void DrawField(FieldWidgetData fieldWidgetData) { DrawField(fieldWidgetData.Type, fieldWidgetData.Get, fieldWidgetData.Set, fieldWidgetData.Name, fieldWidgetData.RangeAttribute); } public static void DrawField(Type t, Func<object> get, Action<object> set, string id, RangeAttribute rangeAttribute = null) { ImGui.PushID(id); if (t == typeof(int)) { DrawInt(() => (int)get(), delegate(int v) { set(v); }); } else if (t == typeof(float)) { if (rangeAttribute != null) { DrawSliderFloat(() => (float)get(), delegate(float v) { set(v); }, rangeAttribute.min, rangeAttribute.max); } else { DrawFloat(() => (float)get(), delegate(float v) { set(v); }); } } else if (t == typeof(string)) { DrawString(() => (string)get(), delegate(string v) { set(v); }); } else if (t == typeof(Vector2)) { DrawVector2(() => (Vector2)get(), delegate(Vector2 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(Vector2Int)) { DrawVector2Int(() => (Vector2Int)get(), delegate(Vector2Int v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(Vector3)) { DrawVector3(() => (Vector3)get(), delegate(Vector3 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(Vector3Int)) { DrawVector3Int(() => (Vector3Int)get(), delegate(Vector3Int v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(Vector4)) { DrawVector4(() => (Vector4)get(), delegate(Vector4 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(Bounds)) { DrawBounds(() => (Bounds)get(), delegate(Bounds v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(bool)) { DrawBool(() => (bool)get(), delegate(bool v) { set(v); }); } else if (t.IsEnum) { DrawEnum(() => (Enum)get(), delegate(Enum v) { set(v); }); } else if (t == typeof(Color)) { DrawColor(() => (Color)get(), delegate(Color v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) set(v); }); } else if (t == typeof(GameObject)) { DrawGameObject(() => (GameObject)get(), delegate(GameObject v) { set(v); }); } else if (t == typeof(Material)) { DrawMaterial(() => (Material)get(), delegate(Material v) { set(v); }); } else if (t == typeof(Transform)) { DrawTransform(() => (Transform)get(), delegate(Transform v) { set(v); }); } else if (t.IsArray) { DrawArray(t.GetElementType(), () => (Array)get(), delegate(Array a) { set(a); }, id); } else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(List<>)) { DrawList(t.GetGenericArguments()[0], () => (IList)get(), id); } else if (t.IsClass && !typeof(Object).IsAssignableFrom(t)) { DrawClass(get, set, t); } else { ImGui.TextDisabled(t.ToString() + " NYI"); } ImGui.PopID(); } private static void DrawClass(Func<object> get, Action<object> set, Type classType) { object obj = get(); if (obj == null) { if (ImGui.SmallButton("Create")) { obj = Activator.CreateInstance(classType); set(obj); } return; } Type type = obj.GetType(); if (ImGui.TreeNode(obj.GetType().Name)) { List<FieldWidgetData> list = new List<FieldWidgetData>(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { FieldWidgetData item = new FieldWidgetData(GetFieldData(fields[i]), obj); list.Add(item); } ImGuiHelpers.DrawPropertiesTable(obj.GetType().Name, list.ToArray()); ImGui.TreePop(); } } private static void DrawInt(Func<int> get, Action<int> set) { int obj = get(); if (ImGui.InputInt("##v", ref obj)) { set(obj); } } private static void DrawFloat(Func<float> get, Action<float> set) { float obj = get(); if (ImGui.InputFloat("##v", ref obj)) { set(obj); } } private static void DrawString(Func<string> get, Action<string> set) { string text = get(); if (text == null) { text = ""; } if (ImGui.InputText("##v", ref text, 32u)) { set(text); } } private static void DrawSliderFloat(Func<float> get, Action<float> set, float min, float max) { float obj = get(); if (ImGui.SliderFloat("##v", ref obj, min, max)) { set(obj); } } private static void DrawVector2(Func<Vector2> get, Action<Vector2> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector2 obj = get(); if (ImGui.InputFloat2("##v", ref obj)) { set(obj); } } private static void DrawVector2Int(Func<Vector2Int> get, Action<Vector2Int> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector2Int val = get(); int[] array = new int[2] { ((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y }; if (ImGui.InputInt2("##v", ref array[0])) { set(new Vector2Int(array[0], array[1])); } } public static void DrawVector3(Func<Vector3> get, Action<Vector3> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 obj = get(); if (ImGui.InputFloat3("##v", ref obj)) { set(obj); } } private static void DrawVector3Int(Func<Vector3Int> get, Action<Vector3Int> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Vector3Int val = get(); int[] array = new int[3] { ((Vector3Int)(ref val)).x, ((Vector3Int)(ref val)).y, ((Vector3Int)(ref val)).z }; if (ImGui.InputInt3("##v", ref array[0])) { set(new Vector3Int(array[0], array[1], array[2])); } } public static void DrawVector4(Func<Vector4> get, Action<Vector4> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector4 obj = get(); if (ImGui.InputFloat4("##v", ref obj)) { set(obj); } } public static void DrawBounds(Func<Bounds> get, Action<Bounds> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Bounds obj = get(); Vector3 center = ((Bounds)(ref obj)).center; Vector3 extents = ((Bounds)(ref obj)).extents; ImGui.TextUnformatted("Center"); ImGui.SameLine(); ImGui.SetNextItemWidth(-1f); if (ImGui.InputFloat3("##vc", ref center)) { ((Bounds)(ref obj)).center = center; set(obj); } ImGui.TextUnformatted("Extent"); ImGui.SameLine(); ImGui.SetNextItemWidth(-1f); if (ImGui.InputFloat3("##ve", ref extents)) { ((Bounds)(ref obj)).extents = extents; set(obj); } } private static void DrawBool(Func<bool> get, Action<bool> set) { bool obj = get(); if (ImGui.Checkbox("##v", ref obj)) { set(obj); } } private static void DrawEnum(Func<Enum> get, Action<Enum> set) { Enum obj = get(); int value = Convert.ToInt32(obj); Type type = obj.GetType(); Enum.GetValues(type); string[] names = Enum.GetNames(type); if (ImGui.Combo("##v", ref value, names, names.Length)) { set((Enum)Enum.ToObject(type, value)); } } public static void DrawCombo(int selectedIndex, Func<string[]> get, Action<int> set) { string[] array = get(); if (ImGui.Combo("##v", ref selectedIndex, array, array.Length)) { set(selectedIndex); } } private static void DrawColor(Func<Color> get, Action<Color> set) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector4 val = Color.op_Implicit(get()); if (ImGui.ColorEdit4("##v", ref val)) { set(Color.op_Implicit(val)); } } private static void DrawGameObject(Func<GameObject> get, Action<GameObject> set) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown GameObject val = get(); ImGui.TextUnformatted(((Object)val != (Object)null) ? ((Object)val).name : "None"); ImGui.SameLine(); if (ImGui.SmallButton("Change")) { ResourceWindow.Show<GameObject>(get, set); WindowsManager.Get<ResourceWindow>().Open(); } } public static void DrawMaterial(Func<Material> get, Action<Material> set) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Material val = get(); ImGui.TextUnformatted(((Object)val != (Object)null) ? ((Object)val).name : "None"); ImGui.SameLine(); if (ImGui.SmallButton("Change")) { ResourceWindow.Show<Material>(get, set); WindowsManager.Get<ResourceWindow>().Open(); } } private static void DrawTransform(Func<Transform> get, Action<Transform> set) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Transform val = get(); string obj = (((Object)val != (Object)null) ? ((Object)val).name : "None"); ImGui.SetNextItemAllowOverlap(); ImGui.Selectable(obj); ImGui.SameLine(); if (ImGui.SmallButton("Change")) { ResourceWindow.Show<Transform>(get, set); WindowsManager.Get<ResourceWindow>().Open(); } } private static void DrawArray(Type elementType, Func<Array> get, Action<Array> set, string name) { Array array = get(); if (array == null) { ImGui.TextUnformatted(name); ImGui.SameLine(); if (ImGui.SmallButton("Create")) { array = Array.CreateInstance(elementType, 0); set(array); } return; } int num = -1; if (ImGui.TreeNode("Array", $"{name} [{array.Length}]")) { for (int i = 0; i < array.Length; i++) { ImGui.PushID(i); int index = i; DrawField(elementType, () => array.GetValue(index), delegate(object v) { array.SetValue(v, index); }, index.ToString()); ImGui.SameLine(); ImGui.PushID("Remove"); if (ImGui.SmallButton("Remove")) { num = index; } ImGui.PopID(); ImGui.PopID(); } if (ImGui.SmallButton("Add")) { AddElement(array, set); } ImGui.TreePop(); } if (num >= 0) { RemoveAt(array, set, num); num = -1; } } private static void DrawList(Type elementType, Func<IList> get, string name) { IList list = get(); if (list == null) { ImGui.TextUnformatted(name); ImGui.SameLine(); if (ImGui.SmallButton("Create")) { Type type = typeof(List<>).MakeGenericType(elementType); list = (IList)Activator.CreateInstance(type); } return; } int num = -1; if (ImGui.TreeNode("List", $"{name} [{list.Count}]")) { for (int i = 0; i < list.Count; i++) { ImGui.PushID(i); int index = i; DrawField(elementType, () => list[index], delegate(object v) { list[index] = v; }, index.ToString()); ImGui.SameLine(); ImGui.PushID("Remove"); if (ImGui.SmallButton("Remove")) { num = index; } ImGui.PopID(); ImGui.PopID(); } ContextMenu.CreateMenu(list, elementType); if (ImGui.SmallButton("Add")) { if (elementType.IsAbstract) { ContextMenu.GetTypes(elementType); ImGui.OpenPopup("WidgetContextMenu"); } else if (elementType == typeof(string)) { list.Add(string.Empty); } else { object value = Activator.CreateInstance(elementType); list.Add(value); } } ImGui.TreePop(); } if (num >= 0) { list.RemoveAt(num); num = -1; } } private static void RemoveAt(Array array, Action<Array> set, int index) { int length = array.Length; Array array2 = Array.CreateInstance(array.GetType().GetElementType(), length - 1); if (index > 0) { Array.Copy(array, 0, array2, 0, index); } if (index < length - 1) { Array.Copy(array, index + 1, array2, index, length - index - 1); } set(array2); } private static void AddElement(Array array, Action<Array> set) { int length = array.Length; Array array2 = Array.CreateInstance(array.GetType().GetElementType(), length + 1); Array.Copy(array, array2, length); set(array2); } public static FieldData[] GetSpecialFieldData(Type t) { FieldData[] fieldDataFromType = GetFieldDataFromType(t); if (t == typeof(PropSpawner) || t == typeof(PropSpawner_Sphere)) { FieldData fieldData = fieldDataFromType.Where((FieldData d) => d.name == "currentSpawns").FirstOrDefault(); if (fieldData != null) { fieldData.widgetMode = WidgetMode.Disabled; } FieldData[] array = fieldDataFromType; foreach (FieldData fieldData2 in array) { if (spawnerHideFieldData.Contains(fieldData2.name)) { fieldData2.widgetMode = WidgetMode.Hidden; } } } return fieldDataFromType; } public static FieldData[] GetFieldDataFromType(Type t) { FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldData[] array = new FieldData[fields.Length]; for (int i = 0; i < fields.Length; i++) { FieldInfo fieldInfo = fields[i]; RangeAttribute customAttribute = ((MemberInfo)fieldInfo).GetCustomAttribute<RangeAttribute>(); array[i] = new FieldData { name = fieldInfo.Name, fieldInfo = fieldInfo, rangeAttribute = customAttribute, widgetMode = WidgetMode.Default, layout = ((fieldInfo.FieldType.IsArray || (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>)) || (fieldInfo.FieldType.IsClass && !typeof(Object).IsAssignableFrom(fieldInfo.FieldType))) ? FieldLayout.Full : FieldLayout.Inline) }; } return array; } public static FieldData GetFieldData(FieldInfo fieldInfo) { RangeAttribute customAttribute = ((MemberInfo)fieldInfo).GetCustomAttribute<RangeAttribute>(); return new FieldData { name = fieldInfo.Name, fieldInfo = fieldInfo, rangeAttribute = customAttribute, widgetMode = WidgetMode.Default, layout = ((fieldInfo.FieldType.IsArray || (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>)) || (fieldInfo.FieldType.IsClass && !typeof(Object).IsAssignableFrom(fieldInfo.FieldType))) ? FieldLayout.Full : FieldLayout.Inline) }; } private static FieldInfo[] GetTypeFields(Type t) { return t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } } namespace TerrainCustomiser.UI.Windows { public class AirportWindow : ImGuiWindowBase { private int selectedSaveIndex; private bool useRandomSeed; private int seedValue; private bool bakeLightMap; public override string WindowName => "TC Menu"; public override ImGuiWindowFlags WindowFlags => (ImGuiWindowFlags)64; public override void OnCreate() { base.OnCreate(); bakeLightMap = PlayerInfoManager.LobbyCanBake && ConfigManager.EnableLightMapBaking.Value && ConfigManager.BakeLightMap.Value; useRandomSeed = ConfigManager.UseRandomSeed.Value; seedValue = ConfigManager.SeedToUse.Value; } protected override void DrawContent() { if (SessionState.Is(SessionState.State.InAirport) || SessionState.Is(SessionState.State.SelectingSave)) { DrawOptionSelectionMenu(); } else if (SessionState.Is(SessionState.State.ConfiguringCustomMap) || SessionState.Is(SessionState.State.WaitingToStartCustomMap)) { DrawPlayConfigMenu(); } } private void DrawOptionSelectionMenu() { if (ImGui.Button("Play")) { SaveSelectionModal.Open(OnSaveSelected); SessionState.Set(SessionState.State.SelectingSave); } SaveSelectionModal.Draw(); ImGui.SameLine(); ImGuiHelpers.DrawButton("Editor", OnEditorButtonClicked, PhotonNetwork.OfflineMode); } private void DrawPlayConfigMenu() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) WidgetFactory.FieldWidgetData[] fieldWidgets = new WidgetFactory.FieldWidgetData[3] { new WidgetFactory.FieldWidgetData(typeof(bool), () => useRandomSeed, delegate(object v) { SetUseRandomSeedValue((bool)v); }, "Random Seed"), new WidgetFactory.FieldWidgetData(typeof(int), () => seedValue, delegate { SetSeedValue(seedValue); }, "Seed", null, isHidden: false, useRandomSeed), new WidgetFactory.FieldWidgetData(typeof(bool), () => bakeLightMap && PlayerInfoManager.LobbyCanBake, delegate(object v) { SetBakeLightMapValue((bool)v); }, "Bake LightMap", null, isHidden: false, !PlayerInfoManager.LobbyCanBake) }; ImGuiHelpers.DrawPropertiesTable("PlayConfigTable", fieldWidgets); if (!PlayerInfoManager.LobbyCanBake) { ImGui.TextColored(new Vector4(1f, 0.82f, 0.28f, 1f), Loc.Zh ? "有玩家不可烘焙 → 本局全员禁用光照贴图,将自动启用挡风射线兜底。" : "A player can't bake -> lightmaps disabled for everyone this run; storm-shelter raycast auto-enabled."); } if (ImGui.BeginListBox("##players")) { Player[] array = ((CachedPlayerList)(ref PlayerHandler.Instance._playerList)).Get(); foreach (Player val in array) { ImGui.TextUnformatted(val.NickName); if (PlayerInfoManager.PlayersInfo.TryGetValue(val, out var value)) { ImGui.SameLine(); ImGui.TextUnformatted(value.canBake ? "CanBake" : "CantBake"); if (SessionState.Is(SessionState.State.LoadingCustomMap)) { ImGui.SameLine(); ImGui.TextUnformatted(value.hasMapData ? "Ready" : "Not Ready"); } } } ImGui.EndListBox(); } ImGuiHelpers.DrawButton("Play", OnPlayClicked, SessionState.Is(SessionState.State.ConfiguringCustomMap)); ImGui.SameLine(); if (ImGui.Button("Cancel")) { OnCancelLoadClicked(); } } private void SetUseRandomSeedValue(bool newValue) { useRandomSeed = newValue; ConfigManager.UseRandomSeed.Value = newValue; } private void SetSeedValue(int newValue) { seedValue = newValue; ConfigManager.SeedToUse.Value = newValue; } private void SetBakeLightMapValue(bool newValue) { bakeLightMap = newValue; ConfigManager.BakeLightMap.Value = newValue; } private void OnSaveSelected(int saveIndex) { selectedSaveIndex = saveIndex; SessionState.Set(SessionState.State.ConfiguringCustomMap); } private void OnEditorButtonClicked() { SessionState.Set(SessionState.State.LoadingEditor); Plugin.Instance.LoadWilIsland(); } private void OnPlayClicked() { SessionState.Set(SessionState.State.WaitingToStartCustomMap); Plugin.IslandLoadSent = false; byte[] save = MapSerializer.GetSave(selectedSaveIndex); if (useRandomSeed) { seedValue = Random.Range(0, 999999999); } NetworkUtils.SetMapDataRoomProperty(new MapSerializer.MapSyncData { bakeLightMap = bakeLightMap, seed = seedValue, mapSaveData = save }); } private void OnCancelLoadClicked() { NetworkManager.SetRoomProperty("TC_mapData", null); SessionState.Set(SessionState.State.InAirport); } } public class EditorWindow : ImGuiWindowBase { public HierarchyView hierarchy = new HierarchyView(); private int selectedSegmentNodeInstanceId; private MapData.BiomeSegment hierarchyTargetSegment; public override string WindowName => "Editor"; public override ImGuiWindowFlags WindowFlags => (ImGuiWindowFlags)64; public override void OnCreate() { base.OnCreate(); IsOpen = true; Singleton<EditorManager>.Instance.SetCurrentSegment(MapData.biomeSections[0].activeBiome.segments[0]); SetupHierarchy(); } private void SetupHierarchy() { HierarchyView hierarchyView = hierarchy; hierarchyView.OnSelectionChanged = (Action<Transform>)Delegate.Combine(hierarchyView.OnSelectionChanged, (Action<Transform>)delegate(Transform t) { WindowsManager.Get<InspectorWindow>().SetTarget(t); }); hierarchy.ShouldDrawNode = (Transform t) => (Object)((Component)t).GetComponent<LevelGenStep>() != (Object)null || (Object)((Component)t).GetComponent<PropGrouper>() != (Object)null || (((Component)t).GetComponents<Component>().Length == 1 && (Object)((Component)t.parent).GetComponent<PropGrouper>() != (Object)null); HierarchyView.ContextNode contextNode = hierarchy.AddContextMenu("Create Spawner", (Transform t) => (Object)t == (Object)null || (Object)((Component)t).GetComponent<LevelGenStep>() == (Object)null); foreach (Type item in Singleton<EditorManager>.Instance.levelGenStepTypes) { contextNode.AddContextItem(item.Name, delegate(Transform t) { //IL_0021: 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) Singleton<EditorManager>.Instance.CreateObjectWithComponent(item.Name, t, item, ((Component)Camera.main).transform.position, ((Component)Camera.main).transform.rotation); }, null); } hierarchy.AddContextItem("Create Grouper", delegate(Transform t) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Singleton<EditorManager>.Instance.CreateObjectWithComponent("PropGrouper", t, typeof(PropGrouper), ((Component)Camera.main).transform.position, ((Component)Camera.main).transform.rotation); }, (Transform t) => (Object)t == (Object)null || (Object)((Component)t).GetComponent<LevelGenStep>() == (Object)null); hierarchy.AddContextItem("Duplicate", delegate(Transform t) { Singleton<EditorManager>.Instance.DuplicateObject(t); }, (Transform t) => (Object)t != (Object)null); hierarchy.AddContextItem("Rename", delegate(Transform t) { RenameModal.RequestOpen(t); }, (Transform t) => (Object)t != (Object)null); hierarchy.AddContextItem("Delete", delegate(Transform t) { Singleton<EditorManager>.Instance.DestroyObject(((Component)t).gameObject); }, (Transform t) => (Object)t != (Object)null); } protected override void DrawContent() { DrawControlsList(); DrawBiomeTable(); ImGui.Separator(); DrawHierarchy(); } private void DrawControlsList() { ImGuiHelpers.DrawSmallButton("Generate", Singleton<EditorManager>.Instance.GenerateCurrentSegment); ImGui.SameLine(); ImGuiHelpers.DrawSmallButton("Save", SaveModal.Open); ImGui.SameLine(); ImGuiHelpers.DrawSmallButton("Load", LoadModal.Open); ImGui.SameLine();