Decompiled source of UltraEditor v0.0.8
UltraEditor.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using ScriptableObjects; using TMPro; using UltraEditor; using UltraEditor.Classes; using UltraEditor.Classes.Canvas; using UltraEditor.Classes.IO.SaveObjects; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using plog; using plog.Models; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("UltraEditor")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("WIP in-game level editor for ultrakill")] [assembly: AssemblyFileVersion("0.0.8.0")] [assembly: AssemblyInformationalVersion("0.0.8+091891a5990bfc51c0b30b380856a43d744a8b04")] [assembly: AssemblyProduct("UltraEditor")] [assembly: AssemblyTitle("UltraEditor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class NonDefaultScriptChecker : MonoBehaviour { public static void CheckScripts() { MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(true); MonoBehaviour[] array2 = array; foreach (MonoBehaviour val in array2) { Type type = ((object)val).GetType(); string name = type.Assembly.GetName().Name; if (name != "Assembly-CSharp" && !name.StartsWith("UnityEngine") && !name.StartsWith("Unity") && !name.StartsWith("UnityEditor")) { Plugin.LogError("Non-default script detected: " + type.FullName + " in assembly " + name + " on GameObject '" + ((Object)((Component)val).gameObject).name + "'"); } } Plugin.LogInfo("Script scan complete"); } } namespace UltrakillStupid.Patches { [HarmonyPatch(typeof(GameProgressSaver))] [HarmonyPatch("SecretFound")] internal class GmameProggressSaverPatch { public static bool Prefix(int secretNum) { return true; } } [HarmonyPatch(typeof(LeaderboardController))] [HarmonyPatch("SubmitLevelScore")] internal class LeaderboardControllerPatch { public static bool Prefix(string levelName, int difficulty, float seconds, int kills, int style, int restartCount, bool pRank = false) { return (Object)(object)EditorManager.Instance == (Object)null; } } [HarmonyPatch(typeof(Revolver))] [HarmonyPatch("Shoot")] internal class LookThisPatchIsNeeded { public static void Postfix(int shotType = 1) { ((Component)MonoSingleton<CameraController>.Instance).GetComponent<Camera>().fieldOfView = MonoSingleton<CameraController>.Instance.defaultFov; } } [HarmonyPatch(typeof(GetMissionName))] [HarmonyPatch("GetMissionNameOnly")] internal class GetMissionNamePatch { public static bool Prefix(int missionNum, ref string __result) { if (SceneHelper.CurrentScene == "UltraEditor") { __result = MapInfoBase.Instance.levelName; return false; } return true; } } [HarmonyPatch(typeof(GetMissionName))] [HarmonyPatch("GetMissionNumberOnly")] internal class GetMissionNamePatch2 { public static bool Prefix(int missionNum, ref string __result) { if (SceneHelper.CurrentScene == "UltraEditor") { __result = "C"; return false; } return true; } } [HarmonyPatch(typeof(GetMissionName))] [HarmonyPatch("GetMission")] internal class GetMissionNamePatch3 { public static bool Prefix(int missionNum, ref string __result) { if (SceneHelper.CurrentScene == "UltraEditor") { __result = MapInfoBase.Instance.levelName; return false; } return true; } } [HarmonyPatch(typeof(StatsManager))] [HarmonyPatch("SecretFound")] internal class SecretFoundPatch2 { public static bool Prefix(int i) { return i != 100000; } } } namespace UltraEditor { [BepInPlugin("duviz.ultrakill.ultraeditor", "UltraEditor", "0.0.8")] public class Plugin : BaseUnityPlugin { public const string GUID = "duviz.ultrakill.ultraeditor"; public const string Name = "UltraEditor"; public const string Version = "0.0.8"; public static Plugin instance; public Logger Log; public static KeyCode editorOpenKey = (KeyCode)282; public static KeyCode selectCursorKey = (KeyCode)283; public static KeyCode selectMoveKey = (KeyCode)284; public static KeyCode selectScaleKey = (KeyCode)285; public static KeyCode selectRotationKey = (KeyCode)286; public static KeyCode toggleEditorCanvasKey = (KeyCode)290; public static KeyCode deleteObjectKey = (KeyCode)127; public static KeyCode createCubeKey = (KeyCode)270; public static KeyCode ctrlKey = (KeyCode)306; public static KeyCode shiftKey = (KeyCode)304; public static KeyCode altKey = (KeyCode)308; private static bool seenWelcomeMessage = false; public static bool isToggleEnabledKeyPressed() { //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) if (Input.GetKey(altKey) && Input.GetKey(shiftKey) && Input.GetKeyDown((KeyCode)97)) { return true; } return false; } public static bool isDuplicateKeyPressed() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey(ctrlKey) && Input.GetKeyDown((KeyCode)100)) { return true; } return false; } public static bool isSelectPressed() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey(altKey) && Input.GetKeyDown((KeyCode)115)) { return true; } return false; } public static bool canMove() { //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) return !Input.GetKey(ctrlKey) && !Input.GetKey(altKey); } public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown instance = this; LogInfo("Hello, the Instagram community!"); Harmony val = new Harmony("duviz.ultrakill.ultraeditor"); val.PatchAll(); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)4; SceneManager.sceneLoaded += delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new GameObject("load pls uwu :3").AddComponent<EmptySceneLoader>(); }; } public void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("BundlesManager"); val.AddComponent<BundlesManager>(); val.AddComponent<ChapterSelectChanger>(); } public void Update() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(editorOpenKey) && (SceneHelper.CurrentScene != EditorManager.EditorSceneName || EditorManager.canOpenEditor || EmptySceneLoader.forceLevelCanOpenEditor || ((Object)(object)EditorManager.Instance != (Object)null && EditorManager.Instance.editorCanvas.activeInHierarchy)) && SceneHelper.PendingScene == null) { EditorManager.Create(); } if (SceneHelper.CurrentScene == "Main Menu" && SceneHelper.PendingScene == null && !seenWelcomeMessage) { if (PlayerPrefs.GetString("UltraEditor_LastPlayedVersion") != GetVersion().ToString()) { Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("WelcomeCanvas")); PlayerPrefs.SetString("UltraEditor_LastPlayedVersion", GetVersion().ToString()); } seenWelcomeMessage = true; } } public void LateUpdate() { } public static T Ass<T>(string path) { //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) return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion(); } public static T Ast<T>(string path) where T : Object { T val = Resources.Load<T>(path); if ((Object)(object)val == (Object)null) { LogError("Resources.Load failed for '" + path + "'"); } return val; } public static void LogInfo(object data, string stackTrace = null) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004b: Expected O, but got Unknown ManualLogSource logger = ((BaseUnityPlugin)instance).Logger; if (logger != null) { logger.LogInfo((stackTrace != null) ? $"{data}\n{stackTrace}" : data); } Plugin plugin = instance; Logger obj = plugin.Log; if (obj == null) { Logger val = new Logger("ULTRAEDITOR"); Logger val2 = val; plugin.Log = val; obj = val2; } if (obj != null) { obj.Info(data.ToString(), (IEnumerable<Tag>)null, stackTrace, (object)null); } } public static void LogError(object data, string stackTrace = null) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004b: Expected O, but got Unknown ManualLogSource logger = ((BaseUnityPlugin)instance).Logger; if (logger != null) { logger.LogError((stackTrace != null) ? $"{data}\n{stackTrace}" : data); } Plugin plugin = instance; Logger obj = plugin.Log; if (obj == null) { Logger val = new Logger("ULTRAEDITOR"); Logger val2 = val; plugin.Log = val; obj = val2; } if (obj != null) { obj.Error(data.ToString(), (IEnumerable<Tag>)null, stackTrace, (object)null); } } public static Version GetVersion() { return ((BaseUnityPlugin)instance).Info.Metadata.Version; } } } namespace UltraEditor.Classes { public class AssetItem : MonoBehaviour { public string assetPath; public string assetName; public TMP_Text assetNameText; public GameObject assetItemObject; public void Start() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (assetPath == "") { assetPath = ((Object)assetItemObject).name; } else { assetNameText.text = assetName; } ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { EditorManager.Instance.SpawnAsset(assetPath); }); } } public class Billboard : MonoBehaviour { public static List<Billboard> billboards = new List<Billboard>(); public static Sprite entitySprite = null; public static Sprite activateArena = null; public static Sprite activateNextWave = null; public static Sprite activateObject = null; public static Sprite deathzone = null; public static Sprite hudMessageObject = null; public static Sprite levelInfoObject = null; public static Sprite light = null; public static Sprite musicObject = null; public static Sprite teleportObject = null; public static Sprite checkpoint = null; public static Sprite cubeTilingAnimator = null; public static Sprite animator = null; public static Sprite sfxObject = null; public static Sprite skullTrigger = null; public static List<(Sprite, Material, Vector3)> materials = new List<(Sprite, Material, Vector3)>(); public GameObject target; public SphereCollider col; public static void DeleteAll() { foreach (Billboard item in billboards.ToList()) { if ((Object)(object)item != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)item).gameObject); } } billboards.Clear(); } public static void UpdateBillboards() { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)entitySprite == (Object)null) { entitySprite = BundlesManager.editorBundle.LoadAsset<Sprite>("entity"); activateArena = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateArena"); activateNextWave = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateNextWave"); Billboard.activateObject = BundlesManager.editorBundle.LoadAsset<Sprite>("ActivateObject"); deathzone = BundlesManager.editorBundle.LoadAsset<Sprite>("deathzone"); hudMessageObject = BundlesManager.editorBundle.LoadAsset<Sprite>("hudMessageObject"); Billboard.levelInfoObject = BundlesManager.editorBundle.LoadAsset<Sprite>("info"); light = BundlesManager.editorBundle.LoadAsset<Sprite>("light"); Billboard.musicObject = BundlesManager.editorBundle.LoadAsset<Sprite>("music"); checkpoint = BundlesManager.editorBundle.LoadAsset<Sprite>("checkpoint"); Billboard.cubeTilingAnimator = BundlesManager.editorBundle.LoadAsset<Sprite>("cubeTilingAnimator"); animator = BundlesManager.editorBundle.LoadAsset<Sprite>("animator"); sfxObject = BundlesManager.editorBundle.LoadAsset<Sprite>("sfxObject"); skullTrigger = BundlesManager.editorBundle.LoadAsset<Sprite>("skullTrigger"); } DeleteAll(); Component[] array = Object.FindObjectsOfType<Component>(true); Component[] array2 = array; foreach (Component val in array2) { Vector3 position = val.transform.position; Component val2 = val; Component val3 = val2; if (!(val3 is PrefabObject prefabObject)) { ActivateArena val4 = (ActivateArena)(object)((val3 is ActivateArena) ? val3 : null); if (val4 == null) { ActivateNextWave val5 = (ActivateNextWave)(object)((val3 is ActivateNextWave) ? val3 : null); if (val5 == null) { if (!(val3 is ActivateObject)) { DeathZone val6 = (DeathZone)(object)((val3 is DeathZone) ? val3 : null); if (val6 == null) { if (!(val3 is HUDMessageObject)) { if (!(val3 is LevelInfoObject)) { Light val7 = (Light)(object)((val3 is Light) ? val3 : null); if (val7 == null) { if (!(val3 is MusicObject)) { TeleportObject val8 = (TeleportObject)(object)((val3 is TeleportObject) ? val3 : null); if (val8 == null) { if (!(val3 is CheckpointObject)) { if (!(val3 is CubeTilingAnimator)) { if (!(val3 is MovingPlatformAnimator)) { if (!(val3 is SFXObject)) { if (val3 is SkullActivatorObject) { NewBillboard(skullTrigger, position, val.gameObject); } } else { NewBillboard(sfxObject, position, val.gameObject); } } else { NewBillboard(animator, position, val.gameObject); } } else { NewBillboard(Billboard.cubeTilingAnimator, position, val.gameObject); } } else { NewBillboard(checkpoint, position, val.gameObject); } } else { NewBillboard(teleportObject, position, val.gameObject); } } else { NewBillboard(Billboard.musicObject, position, val.gameObject); } } else if ((Object)(object)((Component)val7).GetComponent<SavableObject>() != (Object)null && (Object)(object)((Component)val7).GetComponent<PrefabObject>() == (Object)null) { NewBillboard(light, position, val.gameObject); } } else { NewBillboard(Billboard.levelInfoObject, position, val.gameObject); } } else { NewBillboard(hudMessageObject, position, val.gameObject); } } else if ((Object)(object)((Component)val6).GetComponent<SavableObject>() != (Object)null) { NewBillboard(deathzone, position, val.gameObject); } } else { NewBillboard(Billboard.activateObject, position, val.gameObject); } } else { NewBillboard(activateNextWave, position, val.gameObject); } } else { NewBillboard(activateArena, position, val.gameObject); } } else if (prefabObject.PrefabAsset.StartsWith("Assets/Prefabs/Enemies/")) { NewBillboard(entitySprite, position, val.gameObject); } } } public static void NewBillboard(Sprite spr, Vector3 pos, GameObject target) { //IL_01a2: 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_0091: Expected O, but got Unknown //IL_00aa: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_01b4: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); val.AddComponent<Billboard>(); Object.Destroy((Object)(object)val.GetComponent<Collider>()); Renderer component = val.GetComponent<Renderer>(); Shader val2 = Shader.Find("Sprites/Default"); if (!Object.op_Implicit((Object)(object)val2)) { Debug.LogError((object)"Sprites/Default shader not found"); return; } (Sprite, Material, Vector3) tuple = materials.FirstOrDefault(((Sprite, Material, Vector3) x) => (Object)(object)x.Item1 == (Object)(object)spr); if ((Object)(object)tuple.Item2 == (Object)null) { Material val3 = new Material(val2); val3.mainTexture = (Texture)(object)spr.texture; Rect rect = spr.rect; Texture texture = (Texture)(object)spr.texture; val3.mainTextureScale = new Vector2(((Rect)(ref rect)).width / (float)texture.width, ((Rect)(ref rect)).height / (float)texture.height); val3.mainTextureOffset = new Vector2(((Rect)(ref rect)).x / (float)texture.width, ((Rect)(ref rect)).y / (float)texture.height); component.material = val3; float num = ((Rect)(ref rect)).width / spr.pixelsPerUnit; float num2 = ((Rect)(ref rect)).height / spr.pixelsPerUnit; val.transform.localScale = new Vector3(num, num2, 1f); materials.Add((spr, val3, val.transform.localScale)); } else { component.material = tuple.Item2; val.transform.localScale = tuple.Item3; } val.transform.position = pos; val.GetComponent<Billboard>().target = target; val.GetComponent<Billboard>().Update(); } public void Awake() { col = ((Component)this).gameObject.AddComponent<SphereCollider>(); col.radius = 1f; billboards.Add(this); } public void Update() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)EditorManager.Instance == (Object)null) { DeleteAll(); } if (!EditorManager.Instance.editorCanvas.activeInHierarchy) { DeleteAll(); } Camera editorCamera = EditorManager.Instance.editorCamera; ((Component)this).transform.LookAt(((Component)editorCamera).transform); Renderer component = ((Component)this).GetComponent<Renderer>(); Color color = component.material.color; float num = Math.Clamp(Vector3.Distance(((Component)editorCamera).transform.position, ((Component)this).transform.position) - 1f, 0f, 5f) / (target.activeInHierarchy ? 5f : 20f); component.material.color = new Color(color.r, color.g, color.b, num); if (Input.GetMouseButtonDown(0) && ((Behaviour)EditorManager.Instance.cameraSelector).enabled && EditorManager.Instance.cameraSelector.selectionMode == CameraSelector.SelectionMode.Cursor) { Ray val = editorCamera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2) && (Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)this).transform) { EditorManager.Instance.cameraSelector.SelectObject(target); EditorManager.Instance.lastHierarchy = Array.Empty<GameObject>(); } } } } public class BundlesManager : MonoBehaviour { public static AssetBundle editorBundle; public void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = "UltraEditor.Assets.editorcanvas.bundle"; using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { Plugin.LogError("Embedded resource '" + text + "' not found!"); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); editorBundle = AssetBundle.LoadFromMemory(array); if ((Object)(object)editorBundle != (Object)null) { Plugin.LogInfo("Loaded embedded AssetBundle!"); } else { Plugin.LogError("Failed to load AssetBundle from memory!"); } } public void OnDestroy() { AssetBundle obj = editorBundle; if (obj != null) { obj.Unload(false); } } } public class CameraMovement : MonoBehaviour { public float movementSpeed = 30f; public float mouseSensitivity = 3f; public float shiftMultiplier = 3f; private (int x, int y) savedMousePos = (0, 0); public Light unlitLight = null; public bool moving() { return Input.GetMouseButton(1) && Plugin.canMove() && !EditorManager.Instance.blocker.activeSelf; } public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CameraLight"); val.transform.parent = ((Component)this).transform; val.transform.localPosition = Vector3.zero; val.transform.localEulerAngles = Vector3.zero; unlitLight = val.AddComponent<Light>(); unlitLight.range = 500f; unlitLight.renderMode = (LightRenderMode)1; unlitLight.type = (LightType)2; ((Behaviour)unlitLight).enabled = false; } public void Update() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) if (Plugin.canMove() && !EditorManager.Instance.blocker.activeSelf) { float num = movementSpeed * (Input.GetKey((KeyCode)304) ? shiftMultiplier : 1f) * Mathf.Min(Time.unscaledDeltaTime, 0.1f); float num2 = Input.GetAxisRaw("Horizontal") * num; float num3 = Input.GetAxisRaw("Vertical") * num; float num4 = (float)(Input.GetKey((KeyCode)101) ? 1 : (-(Input.GetKey((KeyCode)113) ? 1 : 0))) * num; ((Component)this).transform.Translate(new Vector3(num2, num4, num3)); if (Input.GetMouseButtonDown(1)) { savedMousePos = MouseController.GetMousePos(); Cursor.visible = false; } if (Input.GetMouseButton(1)) { float num5 = Input.GetAxisRaw("Mouse X") * mouseSensitivity; float num6 = Input.GetAxisRaw("Mouse Y") * mouseSensitivity; ((Component)this).transform.Rotate(Vector3.up, num5, (Space)0); ((Component)this).transform.Rotate(Vector3.right, 0f - num6, (Space)1); MouseController.SetCursorPos(savedMousePos.x, savedMousePos.y); } } } public void setUnlit(bool unlit) { ((Behaviour)unlitLight).enabled = unlit; } } public class CameraSelector : MonoBehaviour { public enum SelectionMode { Cursor, Move, Scale, Rotate } private struct MeshEntry { public Mesh mesh; public Matrix4x4 localToRoot; public Material mat; } public Camera camera; public GameObject selectedObject; public Material highlightMaterial; private SelectionMode _selectionMode = SelectionMode.Cursor; private List<MeshEntry> meshes = new List<MeshEntry>(); public Material ghostMaterial; public Material ghostMaterial2; private bool objectActive = false; private GameObject hoveredObject; private Dictionary<GameObject, Material> originalMaterials = new Dictionary<GameObject, Material>(); private Transform[] moveArrows; public bool dragging = false; private int draggingAxis = -1; private Vector3 dragStartPos; private Vector3 objectStartPos; private Vector3 objectStartScale; private Vector3 objectStartEuler; private (int x, int y) savedMousePos = (0, 0); private Vector2 realMousePos = Vector2.zero; private float timeToUpdate = 0.1f; private float scaleMultiplier = 1f; public SelectionMode selectionMode { get { return _selectionMode; } set { if (value == SelectionMode.Cursor) { DeleteArrows(); } if (value != 0) { ClearHover(); } _selectionMode = value; ModeButton.UpdateButtons(); } } private void CacheMeshes() { meshes.Clear(); if (!((Object)(object)selectedObject == (Object)null)) { CacheRecursive(selectedObject.transform, selectedObject.transform); } } private void CacheRecursive(Transform t, Transform root) { //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) MeshFilter component = ((Component)t).GetComponent<MeshFilter>(); MeshRenderer component2 = ((Component)t).GetComponent<MeshRenderer>(); Material mat = ghostMaterial; if (((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible")) { mat = ghostMaterial; } if (!((Component)t).gameObject.activeInHierarchy) { mat = ghostMaterial2; } if ((Object)(object)((Component)t).GetComponent<PrefabObject>() != (Object)null && ((Component)t).GetComponent<PrefabObject>().PrefabAsset.StartsWith("Assets/Prefabs/Enemies/")) { return; } if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component.sharedMesh) && (!((Component)t).gameObject.activeInHierarchy || ((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible"))) { float num = 1f; Bounds bounds = component.sharedMesh.bounds; Vector3 lossyScale = t.lossyScale; Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, lossyScale); if (Mathf.Max(new float[3] { val.x, val.y, val.z }) > 100f && new Func<SavableObject>(((Component)t).GetComponent<SavableObject>) == null) { num = 0.01f; } meshes.Add(new MeshEntry { mesh = component.sharedMesh, localToRoot = root.worldToLocalMatrix * t.localToWorldMatrix * Matrix4x4.Scale(Vector3.one * num), mat = mat }); } SkinnedMeshRenderer component3 = ((Component)t).GetComponent<SkinnedMeshRenderer>(); if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component3.sharedMesh) && (!((Component)t).gameObject.activeInHierarchy || ((Component)t).gameObject.layer == LayerMask.NameToLayer("Invisible"))) { Mesh val2 = new Mesh(); component3.BakeMesh(val2); float num2 = 1f; Bounds bounds2 = val2.bounds; Vector3 lossyScale2 = t.lossyScale; Vector3 val3 = Vector3.Scale(((Bounds)(ref bounds2)).size, lossyScale2); if (Mathf.Max(new float[3] { val3.x, val3.y, val3.z }) > 100f && new Func<SavableObject>(((Component)t).GetComponent<SavableObject>) == null) { num2 = 0.01f; } meshes.Add(new MeshEntry { mesh = val2, localToRoot = root.worldToLocalMatrix * t.localToWorldMatrix * Matrix4x4.Scale(Vector3.one * num2), mat = mat }); } for (int i = 0; i < t.childCount; i++) { CacheRecursive(t.GetChild(i), root); } } private static Bounds TransformBounds(Bounds b, Matrix4x4 m) { //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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0064: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00df: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //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_0106: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Matrix4x4)(ref m)).MultiplyPoint3x4(((Bounds)(ref b)).center); Vector3 extents = ((Bounds)(ref b)).extents; Vector3 val2 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(extents.x, 0f, 0f)); Vector3 val3 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(0f, extents.y, 0f)); Vector3 val4 = ((Matrix4x4)(ref m)).MultiplyVector(new Vector3(0f, 0f, extents.z)); extents.x = Mathf.Abs(val2.x) + Mathf.Abs(val3.x) + Mathf.Abs(val4.x); extents.y = Mathf.Abs(val2.y) + Mathf.Abs(val3.y) + Mathf.Abs(val4.y); extents.z = Mathf.Abs(val2.z) + Mathf.Abs(val3.z) + Mathf.Abs(val4.z); return new Bounds(val, extents * 2f); } public void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)camera)) { camera = ((Component)this).GetComponent<Camera>(); } highlightMaterial = new Material(MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial); highlightMaterial.color = new Color(0.5f, 0.5f, 1f); ghostMaterial = CreateGhostMaterial(new Color(0.25f, 0.25f, 1f)); ghostMaterial2 = CreateGhostMaterial(new Color(0.25f, 0.25f, 0.25f)); ModeButton.UpdateButtons(); } private Material CreateGhostMaterial(Color color, float thickness = 30f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) Shader val = BundlesManager.editorBundle.LoadAsset<Shader>("GhostDottedOutline"); Material val2 = new Material(val); val2.SetColor("_Color", color); val2.SetFloat("_Thickness", 0.02f); val2.SetFloat("_DotScale", thickness); val2.SetFloat("_DotCutoff", 0f); val2.SetFloat("_Offset", 0f); return val2; } public void Update() { //IL_0001: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(Plugin.selectCursorKey)) { selectionMode = SelectionMode.Cursor; } if (Input.GetKeyDown(Plugin.selectMoveKey)) { selectionMode = SelectionMode.Move; } if (Input.GetKeyDown(Plugin.selectScaleKey)) { selectionMode = SelectionMode.Scale; } if (Input.GetKeyDown(Plugin.selectRotationKey)) { selectionMode = SelectionMode.Rotate; } if (selectionMode == SelectionMode.Cursor) { HandleCursorMode(); } if (selectionMode != 0 && Object.op_Implicit((Object)(object)selectedObject)) { HandleMoveMode(); } if ((Object)(object)selectedObject == (Object)null || !EditorManager.Instance.IsObjectEditable()) { if (selectionMode != 0) { DeleteArrows(); } selectionMode = SelectionMode.Cursor; } if ((Object)(object)selectedObject != (Object)null && objectActive != selectedObject.activeInHierarchy) { objectActive = selectedObject.activeInHierarchy; CacheMeshes(); } } public void LateUpdate() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011f: 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_0135: 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) highlightMaterial.SetFloat("_Offset", highlightMaterial.GetFloat("_Offset") + Time.unscaledDeltaTime); if ((Object)(object)selectedObject == (Object)null) { return; } Matrix4x4 localToWorldMatrix = selectedObject.transform.localToWorldMatrix; ghostMaterial.SetFloat("_Offset", ghostMaterial.GetFloat("_Offset") + Time.unscaledDeltaTime); ghostMaterial2.SetFloat("_Offset", ghostMaterial2.GetFloat("_Offset") + Time.unscaledDeltaTime); timeToUpdate -= Time.unscaledDeltaTime; if (timeToUpdate <= 0f) { timeToUpdate = 0.1f; CacheMeshes(); } foreach (MeshEntry mesh in meshes) { if (!((Object)(object)mesh.mesh == (Object)null)) { Matrix4x4 val = localToWorldMatrix * mesh.localToRoot; Bounds val2 = TransformBounds(mesh.mesh.bounds, val); if (!((Bounds)(ref val2)).Contains(((Component)camera).transform.position)) { Graphics.DrawMesh(mesh.mesh, val, mesh.mat, 0); } } } } private void OnDisable() { ClearHover(); } private void HandleCursorMode() { //IL_0043: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) if ((Object)(object)hoveredObject != (Object)null && (Object)(object)hoveredObject != (Object)(object)selectedObject) { RestoreMaterial(hoveredObject); hoveredObject = null; } Ray val = camera.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 1000f, camera.cullingMask) || !(((RaycastHit)(ref val2)).distance > 0.1f)) { return; } GameObject gameObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; if ((Object)(object)gameObject != (Object)(object)selectedObject) { hoveredObject = gameObject; Renderer component = gameObject.GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component) && (EditorManager.Instance.IsObjectEditable(gameObject) || EditorManager.Instance.advancedInspector)) { if (!originalMaterials.ContainsKey(gameObject)) { originalMaterials[gameObject] = component.material; } component.material = highlightMaterial; } } if (Input.GetMouseButtonDown(0)) { if (Input.GetKey(Plugin.altKey)) { EditorManager.Instance.SelectObject(gameObject); } else if (EditorManager.Instance.IsObjectEditable(gameObject) || EditorManager.Instance.advancedInspector) { SelectObject(gameObject); } } } public void ClearHover() { if (Object.op_Implicit((Object)(object)hoveredObject)) { RestoreMaterial(hoveredObject); } hoveredObject = null; } private void RestoreMaterial(GameObject obj) { Material value; if ((Object)(object)obj.GetComponent<CubeObject>() != (Object)null && (Object)(object)obj.GetComponent<MaterialChoser>() != (Object)null) { obj.GetComponent<MaterialChoser>().ProcessMaterial(obj.GetComponent<CubeObject>().matType); } else if (Object.op_Implicit((Object)(object)obj) && originalMaterials.TryGetValue(obj, out value)) { Renderer component = obj.GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component)) { component.material = value; } } } public void ClearSelectedMaterial() { if (Object.op_Implicit((Object)(object)selectedObject)) { RestoreMaterial(selectedObject); } } public void UnselectObject() { if (Object.op_Implicit((Object)(object)selectedObject)) { RestoreMaterial(selectedObject); } selectedObject = null; EditorManager.PlayAudio(EditorManager.unselectObject); ClearHover(); if (moveArrows != null) { Transform[] array = moveArrows; foreach (Transform val in array) { Object.Destroy((Object)(object)((Component)val).gameObject); } moveArrows = null; } } private void HandleMoveMode() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0390: 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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_014f: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) if (moveArrows == null) { CreateMoveArrows(); } if (selectedObject.isStatic) { selectionMode = SelectionMode.Cursor; EditorManager.Log("Can't move an static object"); } UpdateMoveArrows(); Vector3 mousePosition = Input.mousePosition; if (!dragging) { int num = -1; float num2 = 999f; for (int i = 0; i < moveArrows.Length; i++) { Vector3 val = camera.WorldToScreenPoint(moveArrows[i].position); float num3 = Vector2.Distance(Vector2.op_Implicit(mousePosition), Vector2.op_Implicit(val)); if (num3 < 40f && num3 < num2) { num = i; num2 = num3; } } if (num != -1) { Color val2 = default(Color); for (int j = 0; j < moveArrows.Length; j++) { Renderer component = ((Component)moveArrows[j]).GetComponent<Renderer>(); Material material = component.material; Color color; if (j != num) { Material material2 = component.material; ((Color)(ref val2))..ctor(component.material.color.r, component.material.color.g, component.material.color.b, 0.5f); material2.color = val2; color = val2; } else { Material material3 = component.material; ((Color)(ref val2))..ctor(component.material.color.r, component.material.color.g, component.material.color.b, 1f); material3.color = val2; color = val2; } material.color = color; } if (Input.GetMouseButtonDown(0)) { dragging = true; draggingAxis = num; objectStartPos = selectedObject.transform.position; objectStartScale = selectedObject.transform.localScale; objectStartEuler = selectedObject.transform.eulerAngles; dragStartPos = mousePosition; scaleMultiplier = moveArrows[0].localScale.y; savedMousePos = MouseController.GetMousePos(); realMousePos = Vector2.op_Implicit(mousePosition); Cursor.visible = false; Billboard.DeleteAll(); } } else { for (int k = 0; k < moveArrows.Length; k++) { Renderer component2 = ((Component)moveArrows[k]).GetComponent<Renderer>(); Color color2 = (Color)(k switch { 1 => Color.green, 0 => Color.red, _ => Color.blue, }); component2.material.color = color2; } } return; } if (Input.GetMouseButton(0)) { realMousePos += new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); Vector3 val3 = new Vector3(realMousePos.x, realMousePos.y, 0f) - dragStartPos; MouseController.SetCursorPos(savedMousePos.x, savedMousePos.y); float num4 = scaleMultiplier * 0.1f; Vector3 val4 = Vector3.zero; float num5 = 0f; if (draggingAxis == 0) { val4 = Vector3.right; num5 = val3.x; } if (draggingAxis == 1) { val4 = Vector3.up; num5 = val3.y; } if (draggingAxis == 2) { val4 = Vector3.forward; num5 = val3.x; } if (selectionMode == SelectionMode.Move) { Vector3 val5 = objectStartPos + val4 * num5 * num4 * 3f; float s = 0.25f; if (Input.GetKey(Plugin.shiftKey)) { s = 1f; } if (Input.GetKey(Plugin.ctrlKey)) { val5 = Snap(val5, s); } selectedObject.transform.position = val5; } if (selectionMode == SelectionMode.Scale) { Vector3 val6 = objectStartScale + val4 * num5 * num4 * 3f; float s2 = 0.25f; if (Input.GetKey(Plugin.shiftKey)) { s2 = 1f; } if (Input.GetKey(Plugin.ctrlKey)) { val6 = Snap(val6, s2); } selectedObject.transform.localScale = val6; } if (selectionMode == SelectionMode.Rotate) { Vector3 val7 = objectStartEuler + val4 * num5 * 5f; float s3 = 15f; if (Input.GetKey(Plugin.shiftKey)) { s3 = 45f; } if (Input.GetKey(Plugin.ctrlKey)) { val7 = Snap(val7, s3); } selectedObject.transform.eulerAngles = val7; } } if (Input.GetMouseButtonUp(0)) { dragging = false; draggingAxis = -1; EditorManager.Instance.UpdateInspector(); Cursor.visible = true; Billboard.UpdateBillboards(); } } public void SelectObject(GameObject obj) { EditorManager.PlayAudio(EditorManager.selectObject); if ((Object)(object)selectedObject != (Object)null) { RestoreMaterial(selectedObject); } selectedObject = obj; Debug.Log((object)("[CameraSelector] Selected object: " + ((Object)obj).name)); selectionMode = SelectionMode.Move; if (moveArrows == null) { CreateMoveArrows(); } UpdateMoveArrows(); CacheMeshes(); } private void CreateMoveArrows() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (moveArrows != null) { DeleteArrows(); } moveArrows = (Transform[])(object)new Transform[3]; for (int i = 0; i < 3; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)2); val.GetComponent<Renderer>().material = new Material(MonoSingleton<DefaultReferenceManager>.Instance.masterShader); val.transform.localScale = new Vector3(0.5f, 1f, 0.5f); val.GetComponent<Collider>().isTrigger = true; GameObjectExtensions.GetOrAddComponent<NavMeshModifier>(val).ignoreFromBuild = true; ((Object)val).name = "MoveArrow_" + i; Material val2 = new Material(Shader.Find("Hidden/Internal-Colored")); val2.SetInt("_ZTest", 8); val2.SetInt("_ZWrite", 0); val2.SetColor("_Color", (Color)(i switch { 1 => Color.green, 0 => Color.red, _ => Color.blue, })); val.GetComponent<Renderer>().material = val2; moveArrows[i] = val.transform; } } public void DeleteArrows() { if (moveArrows != null) { Transform[] array = moveArrows; foreach (Transform val in array) { Object.Destroy((Object)(object)((Component)val).gameObject); } moveArrows = null; } } public void FocusOnSelected() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)selectedObject)) { Vector3 val = ((Component)camera).transform.position - selectedObject.transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((Component)camera).transform.position = selectedObject.transform.position + normalized * 5f; } } private void UpdateMoveArrows() { //IL_0031: 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_003f: 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_004d: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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) //IL_010a: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_01a7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)selectedObject == (Object)null) && moveArrows != null) { Vector3 position = selectedObject.transform.position; moveArrows[0].position = position + Vector3.right * moveArrows[0].localScale.y * 2f; moveArrows[0].rotation = Quaternion.Euler(0f, 0f, 90f); moveArrows[1].position = position + Vector3.up * moveArrows[0].localScale.y * 2f; moveArrows[1].rotation = Quaternion.identity; moveArrows[2].position = position + Vector3.forward * moveArrows[0].localScale.y * 2f; moveArrows[2].rotation = Quaternion.Euler(90f, 0f, 0f); float num = Vector3.Distance(((Component)camera).transform.position, position); float num2 = 2f * num * Mathf.Tan(camera.fieldOfView * 0.5f * (MathF.PI / 180f)); float num3 = num2 * 0.1f; float num4 = num3 * 0.1f; Transform[] array = moveArrows; foreach (Transform val in array) { val.localScale = Vector3.one * num4; } } } private Vector3 GetMouseWorldPos() { //IL_0003: 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) //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_0025: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); ((Plane)(ref val))..ctor(Vector3.up, Vector3.zero); Ray val2 = camera.ScreenPointToRay(Input.mousePosition); float num = default(float); ((Plane)(ref val)).Raycast(val2, ref num); return ((Ray)(ref val2)).GetPoint(num); } private Vector3 Snap(Vector3 v, float s = 0.25f) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) v.x = Mathf.Round(v.x / s) * s; v.y = Mathf.Round(v.y / s) * s; v.z = Mathf.Round(v.z / s) * s; return v; } } public class ChapterSelectChanger : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__5_0; public static UnityAction <>9__5_1; public static UnityAction <>9__5_2; internal void <ChangeLayout>b__5_0() { EmptySceneLoader.forceEditor = true; EmptySceneLoader.Instance.LoadLevel(); } internal void <ChangeLayout>b__5_1() { GameObject canvas = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("OpenLevelCanvas")); EditorManager.StaticLoadPopup(canvas); } internal void <ChangeLayout>b__5_2() { GameObject val = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("ExploreLevelsCanvas")); } } public GameObject topLeftCS; public GameObject topRightCS; public GameObject bottomMiddleCS; private int frameCount = 0; public void Update() { if (!(SceneHelper.CurrentScene == "Main Menu") || !Object.CurrentThreadIsMainThread()) { return; } if ((Object)(object)topLeftCS != (Object)null || (Object)(object)topRightCS != (Object)null || (Object)(object)bottomMiddleCS != (Object)null) { frameCount = 0; return; } frameCount++; if (frameCount >= 60) { ChangeLayout(); } } public void ChangeLayout() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Expected O, but got Unknown //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Expected O, but got Unknown //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Expected O, but got Unknown //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Expected O, but got Unknown //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Expected O, but got Unknown if ((Object)(object)topLeftCS != (Object)null || (Object)(object)topRightCS != (Object)null || (Object)(object)bottomMiddleCS != (Object)null) { return; } Object.Destroy((Object)(object)topLeftCS); Object.Destroy((Object)(object)topRightCS); Object.Destroy((Object)(object)bottomMiddleCS); VerticalLayoutGroup[] array = Object.FindObjectsOfType<VerticalLayoutGroup>(true); foreach (VerticalLayoutGroup val in array) { if (!(((Object)val).name == "Chapters")) { continue; } ((Component)val).gameObject.SetActive(true); GameObject val2 = new GameObject("TopLeftChapterSelect", new Type[3] { typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ObjectActivateInSequence) }); val2.transform.SetParent(((Component)val).transform.parent); topLeftCS = val2; GameObject val3 = new GameObject("TopRightChapterSelect", new Type[2] { typeof(RectTransform), typeof(VerticalLayoutGroup) }); val3.transform.SetParent(((Component)val).transform.parent); topRightCS = val3; GameObject val4 = new GameObject("BottomMiddleChapterSelect", new Type[2] { typeof(RectTransform), typeof(VerticalLayoutGroup) }); val4.transform.SetParent(((Component)val).transform.parent); bottomMiddleCS = val4; ObjectActivateInSequence component = topLeftCS.GetComponent<ObjectActivateInSequence>(); component.delay = 0.025f; component.objectsToActivate = (GameObject[])(object)new GameObject[0]; ((Transform)topLeftCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(-200f, 200f)); ((Transform)topRightCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(200f, 212f)); ((Transform)bottomMiddleCS.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(-200f, -50f)); ((Transform)topLeftCS.GetComponent<RectTransform>()).localScale = Vector3.one; ((Transform)topRightCS.GetComponent<RectTransform>()).localScale = Vector3.one; ((Transform)bottomMiddleCS.GetComponent<RectTransform>()).localScale = Vector3.one; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f; ((LayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false; ((HorizontalOrVerticalLayoutGroup)topLeftCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f; ((LayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false; ((HorizontalOrVerticalLayoutGroup)topRightCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).spacing = 4f; ((LayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childScaleHeight = false; ((HorizontalOrVerticalLayoutGroup)bottomMiddleCS.GetComponent<VerticalLayoutGroup>()).childScaleWidth = false; int num = 0; GameObject val5 = null; GameObject val6 = null; for (int j = 0; j < ((Component)val).transform.childCount; j++) { GameObject gameObject = ((Component)((Component)val).transform.GetChild(j)).gameObject; if (((Object)gameObject).name == "Secondary") { val6 = gameObject; num = 1; } switch (num) { case 0: { GameObject val8 = Object.Instantiate<GameObject>(gameObject.gameObject, topLeftCS.transform); val8.transform.SetParent(topLeftCS.transform); val5 = val8; List<GameObject> list2 = component.objectsToActivate.ToList(); list2.Add(val8); component.objectsToActivate = list2.ToArray(); break; } case 1: { GameObject val7 = null; val7 = ((!((Object)gameObject).name.Contains("(Clone)")) ? Object.Instantiate<GameObject>(gameObject.gameObject, topRightCS.transform) : gameObject); val7.transform.SetParent(topRightCS.transform); val5 = val7; List<GameObject> list = component.objectsToActivate.ToList(); list.Add(val7); component.objectsToActivate = list.ToArray(); break; } } } GameObject val9 = Object.Instantiate<GameObject>(val6.gameObject, bottomMiddleCS.transform); ((Transform)val9.GetComponent<RectTransform>()).localScale = Vector3.one; val9.transform.SetParent(bottomMiddleCS.transform); val9.GetComponentInChildren<TMP_Text>().text = "LEVEL EDITOR"; List<GameObject> list3 = component.objectsToActivate.ToList(); list3.Add(val9); component.objectsToActivate = list3.ToArray(); val9 = Object.Instantiate<GameObject>(val5.gameObject, bottomMiddleCS.transform); ((Transform)val9.GetComponent<RectTransform>()).localScale = Vector3.one; val9.transform.SetParent(bottomMiddleCS.transform); val9.GetComponentInChildren<TMP_Text>().text = "CREATE LEVEL"; val9.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEventBase)val9.GetComponent<Button>().onClick).RemoveAllListeners(); ButtonClickedEvent onClick = val9.GetComponent<Button>().onClick; object obj = <>c.<>9__5_0; if (obj == null) { UnityAction val10 = delegate { EmptySceneLoader.forceEditor = true; EmptySceneLoader.Instance.LoadLevel(); }; <>c.<>9__5_0 = val10; obj = (object)val10; } ((UnityEvent)onClick).AddListener((UnityAction)obj); list3 = component.objectsToActivate.ToList(); list3.Add(val9); component.objectsToActivate = list3.ToArray(); val9 = Object.Instantiate<GameObject>(val5.gameObject, bottomMiddleCS.transform); ((Transform)val9.GetComponent<RectTransform>()).localScale = Vector3.one; val9.transform.SetParent(bottomMiddleCS.transform); val9.GetComponentInChildren<TMP_Text>().text = "OPEN LEVEL"; val9.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick2 = val9.GetComponent<Button>().onClick; object obj2 = <>c.<>9__5_1; if (obj2 == null) { UnityAction val11 = delegate { GameObject canvas = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("OpenLevelCanvas")); EditorManager.StaticLoadPopup(canvas); }; <>c.<>9__5_1 = val11; obj2 = (object)val11; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); list3 = component.objectsToActivate.ToList(); list3.Add(val9); component.objectsToActivate = list3.ToArray(); val9 = Object.Instantiate<GameObject>(val5.gameObject, bottomMiddleCS.transform); ((Transform)val9.GetComponent<RectTransform>()).localScale = Vector3.one; val9.transform.SetParent(bottomMiddleCS.transform); val9.GetComponentInChildren<TMP_Text>().text = "EXPLORE LEVELS"; val9.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick3 = val9.GetComponent<Button>().onClick; object obj3 = <>c.<>9__5_2; if (obj3 == null) { UnityAction val12 = delegate { GameObject val13 = Object.Instantiate<GameObject>(BundlesManager.editorBundle.LoadAsset<GameObject>("ExploreLevelsCanvas")); }; <>c.<>9__5_2 = val12; obj3 = (object)val12; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); list3 = component.objectsToActivate.ToList(); list3.Add(val9); component.objectsToActivate = list3.ToArray(); ((Component)val).gameObject.SetActive(false); break; } } } public class EditorManager : MonoBehaviour { private class InspectorVariable { public string varName; public Type parentComponent; } private enum inspectorItemType { None, InputField, RemoveButton, Button, ArrayItem, Dropdown } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__26_2; public static Func<Type, bool> <>9__46_3; public static Func<Assembly, IEnumerable<Type>> <>9__46_0; public static Func<Type, bool> <>9__46_1; public static Func<FieldInfo, bool> <>9__47_0; public static Func<(string, Type, float), float> <>9__57_6; public static Func<(string, float), float> <>9__85_2; public static UnityAction<string> <>9__87_0; public static Func<(string, float), float> <>9__88_2; internal void <SetupButtons>b__26_2() { string text = Application.persistentDataPath + "/ULTRAEDITOR"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } Application.OpenURL("file://" + text); } internal IEnumerable<Type> <GetAllMonoBehaviourTypes>b__46_0(Assembly a) { try { return a.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } internal bool <GetAllMonoBehaviourTypes>b__46_3(Type t) { return t != null; } internal bool <GetAllMonoBehaviourTypes>b__46_1(Type t) { return (t.IsSubclassOf(typeof(MonoBehaviour)) || typeof(Component).IsAssignableFrom(t)) && !t.IsAbstract; } internal bool <InitializeDefaultFields>b__47_0(FieldInfo f) { return f.IsPublic || ((MemberInfo)f).GetCustomAttribute<SerializeField>() != null; } internal float <UpdateInspector>b__57_6((string, Type, float) t) { return t.Item3; } internal float <StaticLoadPopup>b__85_2((string, float) t) { return t.Item2; } internal void <TryToGroupName>b__87_0(string val) { } internal float <TryToLoadShit>b__88_2((string, float) t) { return t.Item2; } } [CompilerGenerated] private sealed class <GoToBackupScene>d__92 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EditorManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GoToBackupScene>d__92(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; DeleteScene(force: true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.LoadSceneJson(tempScene); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.SetAlert("Loaded scene backup", "Info!", (Color?)new Color(1f, 0.5f, 0.25f)); Billboard.UpdateBillboards(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadScene>d__89 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string sceneName; public EditorManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadScene>d__89(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; DeleteScene(force: true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.LoadShit(sceneName); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.SetAlert("Scene loaded!", "Info!", (Color?)new Color(1f, 0.5f, 0.25f)); Billboard.UpdateBillboards(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static EditorManager Instance; public GameObject editorCanvas; public Camera editorCamera; public CameraSelector cameraSelector; public GameObject blocker; private bool mouseLocked = true; private bool destroyedLastFrame = false; public bool advancedInspector = false; public static bool friendlyAdvancedInspector = false; public static bool logShit = false; public static bool canOpenEditor = false; private static string tempScene = "\r\n? CubeObject ?\r\nWall(-10.00, 98.75, 20.00)(0.00, 0.00, 90.00)(20.00, 0.25, 40.00)\r\nWall\r\n24\r\nWall\r\n(-10.00, 98.75, 20.00)\r\n(0.00, 0.00, 90.00)\r\n(20.00, 0.25, 40.00)\r\n1\r\n\r\n0\r\n\r\n? END ?\r\n? CubeObject ?\r\nFloor(0.00, 89.25, 20.00)(0.00, 0.00, 0.00)(20.00, 1.00, 40.00)\r\nFloor\r\n24\r\nFloor\r\n(0.00, 89.25, 20.00)\r\n(0.00, 0.00, 0.00)\r\n(20.00, 1.00, 40.00)\r\n1\r\n\r\n0\r\n"; private List<InspectorVariable> inspectorVariables = new List<InspectorVariable>(); public static TMP_Text MissionNameText = null; public static string EditorSceneName = "UltraEditor"; private static NavMeshSurface navMeshSurface; private int defaultCullingMask = 0; private bool legacyUnlit = false; private Component[] lastComponents = (Component[])(object)new Component[0]; public GameObject[] lastHierarchy = (GameObject[])(object)new GameObject[0]; private GameObject lastSelected = null; private GameObject holdingObject = null; private GameObject holdingTarget = null; private string lastFieldText = ""; private Enum lastEnum = null; private Type lastEnumType = null; private object coppiedValue = null; private Type lastCoppiedType = null; private List<(string, Type, float)> searchResults = new List<(string, Type, float)>(); private static List<(string, float)> sceneResults = new List<(string, float)>(); private Type arrayType = null; private Type[] supportedTypes = new Type[9] { typeof(string), typeof(int), typeof(float), typeof(double), typeof(bool), typeof(Vector3), typeof(Vector2), typeof(Vector4), typeof(Color) }; private Type choosing_type = null; private object choosing_field = null; private Component choosing_comp = null; private int choosing_index = 0; private bool choosing = false; private string choosing_special = ""; private string choosing_field_name = ""; private GameObject choosing_object = null; private string lastLoaded = ""; public static AudioClip activateObject = BundlesManager.editorBundle.LoadAsset<AudioClip>("Speech On"); public static AudioClip inactivateObject = BundlesManager.editorBundle.LoadAsset<AudioClip>("Speech Sleep"); public static AudioClip selectObject = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Balloon"); public static AudioClip unselectObject = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Default"); public static AudioClip destroyObject = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Error"); public static AudioClip spawnAsset = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Exclamation"); public static AudioClip removeComponent = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Logoff Sound"); public static AudioClip addComponent = BundlesManager.editorBundle.LoadAsset<AudioClip>("Windows Logon Sound"); public static AudioClip chord = BundlesManager.editorBundle.LoadAsset<AudioClip>("chord"); private static AudioSource source = null; public void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void Update() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) if (editorCanvas.activeSelf) { UpdateHierarchy(); } if (destroyedLastFrame) { destroyedLastFrame = false; Billboard.UpdateBillboards(); } if (!mouseLocked) { Cursor.lockState = (CursorLockMode)0; if (!cameraSelector.dragging && !((Component)editorCamera).GetComponent<CameraMovement>().moving()) { Cursor.visible = true; } } if (Input.GetKeyDown(Plugin.toggleEditorCanvasKey)) { editorCanvas.SetActive(!editorCanvas.activeSelf); cameraSelector.ClearHover(); } if (Input.GetKeyDown(Plugin.deleteObjectKey) && editorCanvas.activeSelf) { if (Input.GetKey(Plugin.ctrlKey) && Input.GetKey(Plugin.shiftKey) && friendlyAdvancedInspector) { DeleteScene(force: true); } else if (IsObjectEditable()) { deleteObject(); } } if (Plugin.isToggleEnabledKeyPressed() && IsObjectEditable() && editorCanvas.activeSelf) { toggleObject(); } if (Plugin.isDuplicateKeyPressed() && IsObjectEditable() && editorCanvas.activeSelf) { duplicateObject(); } if (Input.GetKey(Plugin.createCubeKey) && editorCanvas.activeSelf) { createCube(createRigidbody: true, useGravity: false); } ((Behaviour)cameraSelector).enabled = (!blocker.activeSelf || cameraSelector.dragging) && ((Component)editorCamera).gameObject.activeSelf; if (Input.GetMouseButtonUp(0)) { if (logShit) { Plugin.LogInfo("Released mouse button with " + (Object.op_Implicit((Object)(object)holdingObject) ? ((Object)holdingObject).name : "null") + " & " + (Object.op_Implicit((Object)(object)holdingTarget) ? ((Object)holdingTarget).name : "null")); } if ((Object)(object)holdingObject != (Object)null && (Object)(object)holdingTarget != (Object)null && (Object)(object)holdingObject != (Object)(object)holdingTarget) { if (IsObjectEditable(holdingTarget) || advancedInspector) { if (logShit) { Plugin.LogInfo("Dropped object: " + ((Object)holdingObject).name + " into target: " + ((Object)holdingTarget).name); } holdingObject.transform.SetParent(holdingTarget.transform); cameraSelector.selectedObject = holdingTarget; lastSelected = null; UpdateHierarchy(); holdingObject = null; holdingTarget = null; } } else if ((Object)(object)holdingObject != (Object)(object)holdingTarget && (Object)(object)holdingObject != (Object)null) { if (logShit) { Plugin.LogInfo("Released object: " + ((Object)holdingObject).name + " from target"); } holdingObject.transform.SetParent((Transform)null); cameraSelector.selectedObject = holdingTarget; lastSelected = null; UpdateHierarchy(); holdingObject = null; holdingTarget = null; } } if (Plugin.isSelectPressed() && (Object)(object)cameraSelector.selectedObject != (Object)null && editorCanvas.activeSelf) { SelectObject(cameraSelector.selectedObject); } if ((Object)(object)MonoSingleton<FinalRank>.Instance != (Object)null) { MonoSingleton<FinalRank>.Instance.targetLevelName = "Main Menu"; } } public void LateUpdate() { } public static void DeleteScene(bool force = false) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!force && (!(SceneHelper.CurrentScene == EditorSceneName) || MonoSingleton<StatsManager>.Instance.timer)) { return; } Scene activeScene = SceneManager.GetActiveScene(); foreach (GameObject item in ((Scene)(ref activeScene)).GetRootGameObjects().ToList()) { if ((Object)(object)item == (Object)null) { continue; } if (logShit) { Plugin.LogInfo("Trying to detroy " + ((Object)item).name); } if ((Object)(object)item.GetComponent<SavableObject>() != (Object)null || ((Object)item).name == "Automated Gore Zone") { if (logShit) { Plugin.LogInfo("Destroyed " + ((Object)item).name); } Object.Destroy((Object)(object)item); } } Billboard.DeleteAll(); } public static void Create() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { DeleteScene(); GameObject val = new GameObject("EditorManager"); Instance = val.AddComponent<EditorManager>(); Instance.CreateUI(); } else { Instance.CreateUI(); } } public void CreateUI() { //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_036c: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) if ((Object)(object)editorCanvas != (Object)null) { mouseLocked = !mouseLocked; ((Component)editorCamera).gameObject.SetActive(!mouseLocked); if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null) { ((Component)MonoSingleton<NewMovement>.Instance).gameObject.SetActive(mouseLocked); } editorCanvas.SetActive(!mouseLocked); blocker.SetActive(true); cameraSelector.ClearHover(); cameraSelector.UnselectObject(); cameraSelector.selectionMode = CameraSelector.SelectionMode.Cursor; Billboard.DeleteAll(); if (mouseLocked) { if (SceneHelper.CurrentScene != "Main Menu") { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } if (Input.GetKey(Plugin.shiftKey)) { ((Component)MonoSingleton<NewMovement>.Instance).transform.position = ((Component)editorCamera).transform.position; ((Component)MonoSingleton<NewMovement>.Instance).transform.rotation = ((Component)editorCamera).transform.rotation; } Door[] array = Object.FindObjectsOfType<Door>(); foreach (Door val in array) { MethodInfo method = ((object)val).GetType().GetMethod("GetPos", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(val, null); } RebuildNavmesh(forceFindNavmesh: false); } else { ((Component)editorCamera).transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position; ((Component)editorCamera).transform.rotation = ((Component)MonoSingleton<NewMovement>.Instance).transform.rotation; } if (!mouseLocked && !string.IsNullOrEmpty(tempScene) && !advancedInspector && SceneHelper.CurrentScene == EditorSceneName && canOpenEditor) { ((MonoBehaviour)this).StartCoroutine(GoToBackupScene()); } if (mouseLocked && !advancedInspector && SceneHelper.CurrentScene == EditorSceneName && canOpenEditor) { tempScene = GetSceneJson(); string text = Application.persistentDataPath + "/ULTRAEDITOR/backups"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } File.WriteAllText(text + "/" + DateTime.Now.ToString("dd.MM.yyyy-HH.mm.ss") + ".uterus", tempScene); } Time.timeScale = (mouseLocked ? 1f : 0f); DisableAlert(); return; } GameObject val2 = BundlesManager.editorBundle.LoadAsset<GameObject>("EditorCanvas"); if ((Object)(object)val2 == (Object)null) { Plugin.LogError("Prefab 'EditorCanvas' not found in AssetBundle"); return; } mouseLocked = false; editorCanvas = Object.Instantiate<GameObject>(val2); ((Object)editorCanvas).name = "EditorCanvas_Instance"; Plugin.LogInfo("EditorCanvas instantiated successfully!"); GameObject val3 = new GameObject("EditorCamera"); editorCamera = val3.AddComponent<Camera>(); val3.AddComponent<AudioListener>(); val3.AddComponent<CameraMovement>(); val3.AddComponent<CameraSelector>(); ((Component)editorCamera).transform.position = ((Component)Camera.main).transform.position; editorCamera.depth = 100f; editorCamera.fieldOfView = 105f; cameraSelector = val3.GetComponent<CameraSelector>(); blocker = ((Component)editorCanvas.transform.GetChild(0).GetChild(0).GetChild(0)).gameObject; SetupVariables(); if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null) { ((Component)MonoSingleton<NewMovement>.Instance).gameObject.SetActive(mouseLocked); defaultCullingMask = MonoSingleton<CameraController>.Instance.cam.cullingMask; ChangeCameraCullingLayers(defaultCullingMask); MonoSingleton<NewMovement>.Instance.endlessMode = false; } Time.timeScale = (mouseLocked ? 1f : 0f); SetupButtons(); if ((Object)(object)Object.FindObjectOfType<NavMeshSurface>() != (Object)null) { EditorVisualizers.RebuildNavMeshVis(Object.FindObjectOfType<NavMeshSurface>()); } if (!string.IsNullOrEmpty(tempScene) && !advancedInspector && SceneHelper.CurrentScene == EditorSceneName && canOpenEditor) { ((MonoBehaviour)this).StartCoroutine(GoToBackupScene()); } } private void SetupButtons() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to