Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Empress The Grid Menu v1.0.1
EmpressGridMenu.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressGridMenu")] [assembly: AssemblyTitle("EmpressGridMenu")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.GridMenu { [BepInPlugin("com.empress.repo.gridmenu", "Empress Grid Menu", "1.0.0")] public sealed class EmpressGridMenuPlugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.gridmenu"; public const string PluginName = "Empress Grid Menu"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; private GridMenuRuntime _runtime; internal static EmpressGridMenuPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static GridMenuSettings Settings { get; private set; } private void Awake() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Settings = new GridMenuSettings(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); GridMenuAudio.InitializeMusic(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), ((BaseUnityPlugin)this).Logger); _harmony = new Harmony("com.empress.repo.gridmenu"); _harmony.PatchAll(typeof(EmpressGridMenuPlugin).Assembly); EnsureRuntime(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Grid Menu v1.0.0 loaded."); } internal GridMenuRuntime EnsureRuntime() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)_runtime != (Object)null) { return _runtime; } GameObject val = new GameObject("Empress Grid Menu Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); _runtime = val.AddComponent<GridMenuRuntime>(); return _runtime; } } internal sealed class GridMenuSettings { public readonly ConfigEntry<bool> Enabled; public readonly ConfigEntry<bool> PlayMusic; public readonly ConfigEntry<int> MusicVolume; public readonly ConfigEntry<bool> SuppressVanillaMenuMusic; public GridMenuSettings(ConfigFile config) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Enabled = config.Bind<bool>("General", "Enabled", true, "Draws the Empress TRON grid behind the REPO main menu."); PlayMusic = config.Bind<bool>("Audio", "PlayMusic", true, "Plays the Empress grid music bundle on the main menu."); MusicVolume = config.Bind<int>("Audio", "MusicVolume", 70, new ConfigDescription("Volume of the Empress grid menu music.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); SuppressVanillaMenuMusic = config.Bind<bool>("Audio", "SuppressVanillaMenuMusic", true, "Mutes the vanilla main-menu music while the Empress grid music is playing."); } } [HarmonyPatch(typeof(MainMenuOpen), "Start")] internal static class GridMenuPatchMainMenuOpenStart { private static void Postfix() { EmpressGridMenuPlugin.Instance?.EnsureRuntime().RequestRefresh(); } } [HarmonyPatch(typeof(MenuPageMain), "Start")] internal static class GridMenuPatchMenuPageMainStart { private static void Postfix() { EmpressGridMenuPlugin.Instance?.EnsureRuntime().RequestRefresh(); } } [HarmonyPatch(typeof(LevelMusic), "Update")] internal static class GridMenuPatchLevelMusicUpdate { private static bool Prefix(LevelMusic __instance) { return !GridMenuRuntime.ShouldSuppressLevelMusic(__instance); } } [HarmonyPatch(typeof(ConstantMusic), "Update")] internal static class GridMenuPatchConstantMusicUpdate { private static bool Prefix(ConstantMusic __instance) { return !GridMenuRuntime.ShouldSuppressConstantMusic(__instance); } } internal static class GridMenuAudio { private const string MusicBundleName = "empresstronaudio"; private static AssetBundle _musicBundle; private static AudioClip _musicClip; private static bool _musicInitialized; public static AudioClip MusicClip => _musicClip; public static void InitializeMusic(string pluginDirectory, ManualLogSource log) { if (_musicInitialized) { return; } _musicInitialized = true; string text = ResolveMusicPath(pluginDirectory); if (text == null || !File.Exists(text)) { log.LogWarning((object)"Empress Grid Menu music bundle (empresstronaudio) not found beside DLL. The menu will run without music."); return; } _musicBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_musicBundle == (Object)null) { log.LogWarning((object)("Empress Grid Menu could not load music bundle at " + text)); return; } string[] allAssetNames = _musicBundle.GetAllAssetNames(); foreach (string text2 in allAssetNames) { AudioClip val = _musicBundle.LoadAsset<AudioClip>(text2); if ((Object)(object)val != (Object)null) { _musicClip = val; break; } } if ((Object)(object)_musicClip != (Object)null) { log.LogInfo((object)("Empress Grid Menu loaded music clip \"" + ((Object)_musicClip).name + "\".")); } } private static string ResolveMusicPath(string pluginDirectory) { string[] array = new string[3] { Path.Combine(pluginDirectory ?? string.Empty, "empresstronaudio"), Path.Combine(pluginDirectory ?? string.Empty, "Audio", "empresstronaudio"), Path.Combine(Path.GetDirectoryName(pluginDirectory) ?? pluginDirectory ?? string.Empty, "empresstronaudio") }; for (int i = 0; i < array.Length; i++) { if (File.Exists(array[i])) { return array[i]; } } return array[0]; } } internal sealed class GridMenuRuntime : MonoBehaviour { private static readonly FieldRef<LevelMusic, AudioSource> LevelMusicAudioSourceRef = AccessTools.FieldRefAccess<LevelMusic, AudioSource>("audioSource"); private static readonly FieldRef<LevelMusic, bool> LevelMusicActiveRef = AccessTools.FieldRefAccess<LevelMusic, bool>("active"); private static readonly FieldRef<LevelMusic, bool> LevelMusicActivePlayedRef = AccessTools.FieldRefAccess<LevelMusic, bool>("activePlayed"); private static readonly FieldRef<LevelMusic, bool> LevelMusicInterruptRef = AccessTools.FieldRefAccess<LevelMusic, bool>("interrupt"); private static readonly FieldRef<LevelMusic, float> LevelMusicInterruptVolumeRef = AccessTools.FieldRefAccess<LevelMusic, float>("interruptVolume"); private static readonly FieldRef<LevelMusic, float> LevelMusicInterruptVolumeLerpRef = AccessTools.FieldRefAccess<LevelMusic, float>("interruptVolumeLerp"); private static readonly FieldRef<ConstantMusic, AudioSource> ConstantMusicAudioSourceRef = AccessTools.FieldRefAccess<ConstantMusic, AudioSource>("audioSource"); private static readonly FieldRef<ConstantMusic, bool> ConstantMusicSetupRef = AccessTools.FieldRefAccess<ConstantMusic, bool>("setup"); private static GridMenuRuntime _instance; private GridMenuVisual _visual; private AudioSource _music; private bool _menuActive; private bool _refreshRequested = true; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _instance = this; GameObject val = new GameObject("Empress Grid Menu Music"); val.transform.SetParent(((Component)this).transform, false); _music = val.AddComponent<AudioSource>(); _music.loop = true; _music.playOnAwake = false; _music.spatialBlend = 0f; _music.priority = 32; _music.volume = 0.7f; } public void RequestRefresh() { _refreshRequested = true; } private void Update() { bool flag = MenuContextActive(); if (flag != _menuActive) { _menuActive = flag; _refreshRequested = true; } if (_refreshRequested) { Refresh(); _refreshRequested = false; } if (_menuActive) { UpdateMusic(); } } private bool MenuContextActive() { if (EmpressGridMenuPlugin.Settings == null || !EmpressGridMenuPlugin.Settings.Enabled.Value) { return false; } if ((Object)(object)RunManager.instance == (Object)null || (Object)(object)RunManager.instance.levelCurrent == (Object)null || (Object)(object)RunManager.instance.levelMainMenu == (Object)null) { return false; } return RunManager.instance.levelCurrent == RunManager.instance.levelMainMenu; } private void Refresh() { if (_menuActive) { EnsureVisual(); _visual.Show(); return; } if ((Object)(object)_visual != (Object)null) { _visual.Hide(); } if ((Object)(object)_music != (Object)null && _music.isPlaying) { _music.Stop(); } } private void EnsureVisual() { if ((Object)(object)_visual == (Object)null) { _visual = GridMenuVisual.Create(); } } private void UpdateMusic() { if ((Object)(object)_music == (Object)null) { return; } if (!EmpressGridMenuPlugin.Settings.PlayMusic.Value || (Object)(object)GridMenuAudio.MusicClip == (Object)null) { if (_music.isPlaying) { _music.Stop(); } return; } _music.volume = Mathf.Clamp01((float)EmpressGridMenuPlugin.Settings.MusicVolume.Value / 100f); if ((Object)(object)_music.clip != (Object)(object)GridMenuAudio.MusicClip) { _music.clip = GridMenuAudio.MusicClip; } if (!_music.isPlaying) { _music.Play(); } } private bool MusicIsPlaying() { if ((Object)(object)_music != (Object)null) { return _music.isPlaying; } return false; } public static bool ShouldSuppressLevelMusic(LevelMusic levelMusic) { if ((Object)(object)levelMusic == (Object)null || (Object)(object)_instance == (Object)null || !_instance._menuActive) { return false; } if (EmpressGridMenuPlugin.Settings == null || !EmpressGridMenuPlugin.Settings.SuppressVanillaMenuMusic.Value) { return false; } if (!_instance.MusicIsPlaying()) { return false; } ResetLevelMusic(levelMusic); return true; } public static bool ShouldSuppressConstantMusic(ConstantMusic constantMusic) { if ((Object)(object)constantMusic == (Object)null || (Object)(object)_instance == (Object)null || !_instance._menuActive) { return false; } if (EmpressGridMenuPlugin.Settings == null || !EmpressGridMenuPlugin.Settings.SuppressVanillaMenuMusic.Value) { return false; } if (!_instance.MusicIsPlaying()) { return false; } ref AudioSource reference = ref ConstantMusicAudioSourceRef.Invoke(constantMusic); if ((Object)(object)reference == (Object)null) { reference = ((Component)constantMusic).GetComponent<AudioSource>(); } if ((Object)(object)reference != (Object)null && reference.isPlaying) { reference.Stop(); reference.clip = null; } ConstantMusicSetupRef.Invoke(constantMusic) = false; return true; } private static void ResetLevelMusic(LevelMusic levelMusic) { ref AudioSource reference = ref LevelMusicAudioSourceRef.Invoke(levelMusic); if ((Object)(object)reference == (Object)null) { reference = ((Component)levelMusic).GetComponent<AudioSource>(); } LevelMusicActiveRef.Invoke(levelMusic) = false; LevelMusicActivePlayedRef.Invoke(levelMusic) = false; LevelMusicInterruptRef.Invoke(levelMusic) = false; LevelMusicInterruptVolumeRef.Invoke(levelMusic) = 0f; LevelMusicInterruptVolumeLerpRef.Invoke(levelMusic) = 0f; if ((Object)(object)reference != (Object)null && reference.isPlaying) { reference.Stop(); reference.clip = null; } } private void OnDestroy() { if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } internal sealed class GridMenuVisual : MonoBehaviour { private const int VerticalLinesPerSide = 11; private const int HorizontalLines = 16; private const float HorizonFrac = 0.62f; private const float DepthScale = 0.5f; private const float ScrollSpeed = 0.28f; private const float IntroDuration = 1.6f; private const float BottomSpread = 1.5f; private static readonly Color BackdropColor = new Color(0.004f, 0.012f, 0.025f, 1f); private static readonly Color SkyColor = new Color(0.02f, 0.07f, 0.13f, 1f); private static readonly Color LineColor = new Color(0.16f, 0.68f, 1f, 1f); private static readonly Color HorizonColor = new Color(0.6f, 0.95f, 1f, 1f); private static readonly FieldRef<MenuManager, Canvas> MenuPageParentCanvasRef = CreateMenuCanvasRef("menuPageParentCanvas"); private static Sprite _sprite; private RectTransform _root; private Canvas _hostCanvas; private Image _backdrop; private Image _sky; private readonly List<Image> _verticals = new List<Image>(); private readonly List<Image> _horizontals = new List<Image>(); private Image _horizon; private Image _horizonGlow; private float _introTime; private float _phase; public static GridMenuVisual Create() { //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) GridMenuVisual gridMenuVisual = new GameObject("Empress Grid Menu", new Type[1] { typeof(RectTransform) }) { layer = LayerMask.NameToLayer("UI") }.AddComponent<GridMenuVisual>(); gridMenuVisual.Build(); return gridMenuVisual; } private void Build() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) _root = (RectTransform)((Component)this).transform; _backdrop = CreateStretchImage((Transform)(object)_root, "Backdrop", BackdropColor); _sky = CreateStretchImage((Transform)(object)_root, "Sky", SkyColor); _horizonGlow = CreateLine((Transform)(object)_root, "Horizon Glow"); for (int i = 0; i < 16; i++) { _horizontals.Add(CreateLine((Transform)(object)_root, "Grid Horizontal")); } for (int j = 0; j < 23; j++) { _verticals.Add(CreateLine((Transform)(object)_root, "Grid Vertical")); } _horizon = CreateLine((Transform)(object)_root, "Horizon"); } public void Show() { ((Component)this).gameObject.SetActive(true); _introTime = 0f; _phase = 0f; EnsureAttached(); } public void Hide() { ((Component)this).gameObject.SetActive(false); } private bool EnsureAttached() { //IL_0073: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_hostCanvas != (Object)null && (Object)(object)((Transform)_root).parent == (Object)(object)((Component)_hostCanvas).transform) { ((Transform)_root).SetAsFirstSibling(); return true; } Canvas val = ResolveMenuCanvas(); if ((Object)(object)val == (Object)null) { return false; } _hostCanvas = val; ((Transform)_root).SetParent(((Component)val).transform, false); ((Transform)_root).SetAsFirstSibling(); _root.anchorMin = Vector2.zero; _root.anchorMax = Vector2.one; _root.pivot = new Vector2(0.5f, 0.5f); _root.offsetMin = Vector2.zero; _root.offsetMax = Vector2.zero; ((Transform)_root).localScale = Vector3.one; ((Transform)_root).localRotation = Quaternion.identity; return true; } private static Canvas ResolveMenuCanvas() { if ((Object)(object)MenuManager.instance != (Object)null) { Canvas val = ((MenuPageParentCanvasRef != null) ? MenuPageParentCanvasRef.Invoke(MenuManager.instance) : null); if ((Object)(object)val != (Object)null) { return val; } } if ((Object)(object)MenuHolder.instance != (Object)null) { Canvas componentInParent = ((Component)MenuHolder.instance).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { if (!((Object)(object)componentInParent.rootCanvas != (Object)null)) { return componentInParent; } return componentInParent.rootCanvas; } } MenuPage val2 = Object.FindObjectOfType<MenuPage>(); if ((Object)(object)val2 != (Object)null) { Canvas componentInParent2 = ((Component)val2).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent2 != (Object)null) { if (!((Object)(object)componentInParent2.rootCanvas != (Object)null)) { return componentInParent2; } return componentInParent2.rootCanvas; } } return null; } private static FieldRef<MenuManager, Canvas> CreateMenuCanvasRef(string fieldName) { if (AccessTools.Field(typeof(MenuManager), fieldName) == null) { return null; } return AccessTools.FieldRefAccess<MenuManager, Canvas>(fieldName); } private void Update() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_root == (Object)null) && EnsureAttached()) { Rect rect = _root.rect; float width = ((Rect)(ref rect)).width; float height = ((Rect)(ref rect)).height; if (!(width < 1f) && !(height < 1f)) { _introTime += Time.unscaledDeltaTime; float num = Mathf.Clamp01(_introTime / 1.6f); float num2 = 1f - Mathf.Pow(1f - num, 3f); _phase = Mathf.Repeat(_phase + Time.unscaledDeltaTime * 0.28f, 1f); float scale = Mathf.Max(0.5f, height / 1080f); float yBottom = (0f - height) * 0.5f; float yHorizon = (0f - height) * 0.5f + 0.62f * height; float halfBottom = width * 0.5f * 1.5f; float spread = 0.3f + 0.7f * num2; UpdateSky(yHorizon, width, height); UpdateHorizon(yHorizon, width, scale, num2); UpdateVerticals(yHorizon, yBottom, halfBottom, spread, scale, num2); UpdateHorizontals(yHorizon, yBottom, halfBottom, scale, num2); } } } private void UpdateSky(float yHorizon, float width, float height) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_sky == (Object)null)) { float num = height * 0.5f - yHorizon; ((Graphic)_sky).rectTransform.sizeDelta = new Vector2(width, Mathf.Max(0f, num)); ((Graphic)_sky).rectTransform.anchoredPosition = new Vector2(0f, yHorizon + num * 0.5f); } } private void UpdateHorizon(float yHorizon, float width, float scale, float ease) { //IL_0015: 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_004b: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) float num = 0.25f * ease; Place(_horizonGlow, new Vector2(0f, yHorizon), new Vector2(width, 30f * scale), 0f, new Color(HorizonColor.r, HorizonColor.g, HorizonColor.b, num)); Place(_horizon, new Vector2(0f, yHorizon), new Vector2(width, 4f * scale), 0f, new Color(HorizonColor.r, HorizonColor.g, HorizonColor.b, ease)); } private void UpdateVerticals(float yHorizon, float yBottom, float halfBottom, float spread, float scale, float ease) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005f: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00cf: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, yHorizon); Vector2 val2 = default(Vector2); Color color = default(Color); for (int i = 0; i < _verticals.Count; i++) { float num = (float)(i - 11) / 11f; float num2 = num * halfBottom * spread; ((Vector2)(ref val2))..ctor(num2, yBottom); Vector2 val3 = val2 - val; float magnitude = ((Vector2)(ref val3)).magnitude; float angle = Mathf.Atan2(val3.y, val3.x) * 57.29578f; Vector2 position = (val + val2) * 0.5f; float num3 = 1f - 0.35f * Mathf.Abs(num); ((Color)(ref color))..ctor(LineColor.r, LineColor.g, LineColor.b, ease * num3); Place(_verticals[i], position, new Vector2(magnitude, 2.6f * scale), angle, color); } } private void UpdateHorizontals(float yHorizon, float yBottom, float halfBottom, float scale, float ease) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); for (int i = 0; i < _horizontals.Count; i++) { float num = (float)(i + 1) - _phase; float num2 = 1f / (1f + num * 0.5f); float num3 = Mathf.Lerp(yHorizon, yBottom, num2); float num4 = 2f * halfBottom * num2; float num5 = ease * Mathf.Clamp01(0.18f + 0.82f * num2); ((Color)(ref color))..ctor(LineColor.r, LineColor.g, LineColor.b, num5); Place(_horizontals[i], new Vector2(0f, num3), new Vector2(num4, (1.4f + 1.8f * num2) * scale), 0f, color); } } private static void Place(Image image, Vector2 position, Vector2 size, float angle, Color color) { //IL_0011: 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_0029: 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) if (!((Object)(object)image == (Object)null)) { RectTransform rectTransform = ((Graphic)image).rectTransform; rectTransform.anchoredPosition = position; rectTransform.sizeDelta = size; ((Transform)rectTransform).localRotation = Quaternion.Euler(0f, 0f, angle); ((Graphic)image).color = color; } } private static Image CreateStretchImage(Transform parent, string name, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_003d: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_009b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = LayerMask.NameToLayer("UI") }; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.pivot = new Vector2(0.5f, 0.5f); val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; Image obj = val.AddComponent<Image>(); obj.sprite = WhiteSprite(); obj.type = (Type)0; ((Graphic)obj).raycastTarget = false; ((Graphic)obj).color = color; return obj; } private static Image CreateLine(Transform parent, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = LayerMask.NameToLayer("UI") }; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); Image obj = val.AddComponent<Image>(); obj.sprite = WhiteSprite(); obj.type = (Type)0; ((Graphic)obj).raycastTarget = false; ((Graphic)obj).color = LineColor; return obj; } private static Sprite WhiteSprite() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown if ((Object)(object)_sprite != (Object)null) { return _sprite; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, Color.white); ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); _sprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); return _sprite; } } }