Decompiled source of TootTallySongDownloader v2.1.1
plugins/TootTallySongDownloader.dll
Decompiled 3 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BaboonAPI.Hooks.Initializer; using BaboonAPI.Hooks.Tracks; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using Microsoft.FSharp.Core; using TMPro; using TootTallyCore; using TootTallyCore.APIServices; using TootTallyCore.Graphics; using TootTallyCore.Graphics.Animations; using TootTallyCore.Graphics.ProgressCounters; using TootTallyCore.Utils.Assets; using TootTallyCore.Utils.Helpers; using TootTallyCore.Utils.TootTallyModules; using TootTallyCore.Utils.TootTallyNotifs; using TootTallySettings; using TootTallySongDownloader.SongDownloader; using TootTallySongDownloader.Ui; using TrombLoader.CustomTracks; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("TootTallySongDownloader")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("In-game custom songs downloader")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] [assembly: AssemblyProduct("TootTallySongDownloader")] [assembly: AssemblyTitle("TootTallySongDownloader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 TootTallySongDownloader { [BepInPlugin("TootTallySongDownloader", "TootTallySongDownloader", "2.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin, ITootTallyModule { public static Plugin Instance; private const string CONFIG_NAME = "ModuleTemplate.cfg"; private Harmony _harmony; public static TootTallySettingPage settingPage; public ConfigEntry<bool> ModuleConfigEnabled { get; set; } public bool IsConfigInitialized { get; set; } public string Name { get { return "TootTallySongDownloader"; } set { Name = value; } } public static void LogInfo(string msg) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg); } public static void LogWarning(string msg) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)msg); } public static void LogError(string msg) { ((BaseUnityPlugin)Instance).Logger.LogError((object)msg); } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { Instance = this; _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize); } } private void TryInitialize() { ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Modules", "SongDownloader", true, "In-game custom songs downloader."); TootTallyModuleManager.AddModule((ITootTallyModule)(object)this); } public void LoadModule() { AssetManager.LoadAssets(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "Assets")); settingPage = TootTallySettingsManager.AddNewPage((TootTallySettingPage)(object)new SongDownloadPage()); Plugin.TryAddThunderstoreIconToPageButton(((BaseUnityPlugin)Instance).Info.Location, Name, settingPage); LogInfo("Module loaded!"); } public void UnloadModule() { _harmony.UnpatchSelf(); settingPage.Remove(); LogInfo("Module unloaded!"); } } internal abstract record DownloadState { internal sealed record Waiting : DownloadState; internal sealed record DownloadAvailable : DownloadState; internal sealed record DownloadUnavailable : DownloadState; internal sealed record Downloading : DownloadState { internal ProgressCounter Progress; [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { return base.PrintMembers(builder); } } internal sealed record Owned : DownloadState; } internal class SongDownloadObject : BaseTootTallySettingObject { private abstract record FileDataState { internal sealed record Unknown : FileDataState; internal sealed record WaitingOnRequest : FileDataState { internal readonly Coroutine Coroutine; public WaitingOnRequest(Coroutine coroutine) { Coroutine = coroutine; } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { return base.PrintMembers(builder); } } internal sealed record HasData : FileDataState { internal readonly FileData FileData; public HasData(FileData fileData) { FileData = fileData; } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { return base.PrintMembers(builder); } } internal sealed record ErrorFetchingData : FileDataState; } private readonly SongRow _songRow; private readonly SongDataFromDB _song; public bool IsOwned; private FileDataState _fileData = new FileDataState.Unknown(); public bool IsDownloadAvailable => !IsOwned && _fileData is FileDataState.HasData; public SongDownloadObject(Transform canvasTransform, SongDataFromDB song, TootTallySettingPage page) : base("Song" + song.track_ref, page) { _song = song; _songRow = SongRow.Create().WithParent(canvasTransform).WithSongId(song.id) .WithSongName(song.name) .WithArtist(song.author) .WithDurationSeconds(song.song_length) .WithDifficulty(song.difficulty) .WithCharter(song.charter) .WithIsRated(song.is_rated) .WithIsDeletable(IsTrackDeletable(song.track_ref)) .OnDownload(delegate { DownloadChart(DownloadSource.Auto); }) .OnDownloadFromTootTally(delegate { DownloadChart(DownloadSource.TootTallyMirror); }) .OnDownloadFromAlternative(delegate { DownloadChart(DownloadSource.Alternate); }) .OnDelete(DeleteChart); if (!HasTrackDownloaded(song.track_ref)) { TryRequestFileData(); } else { _songRow.WithDownloadState(new DownloadState.Owned()); } } public void SetActive(bool active) { _songRow.GameObject.SetActive(active); } public override void Dispose() { _songRow.Dispose(); if (_fileData is FileDataState.WaitingOnRequest waitingOnRequest) { ((MonoBehaviour)Plugin.Instance).StopCoroutine(waitingOnRequest.Coroutine); } } public void DownloadChart(DownloadSource dlSource) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ProgressCounter val = new ProgressCounter(Array.Empty<IProgressCountable>()); _songRow.WithDownloadState(new DownloadState.Downloading { Progress = val }); if (1 == 0) { } string text = dlSource switch { DownloadSource.TootTallyMirror => _song.mirror, DownloadSource.Alternate => _song.download, DownloadSource.Auto => _song.mirror ?? _song.download, _ => throw new ArgumentOutOfRangeException("dlSource", dlSource, null), }; if (1 == 0) { } string text2 = text; if (string.IsNullOrEmpty(text2)) { TootTallyNotifManager.DisplayError("Missing download link", 6f); return; } ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.DownloadZipFromServer(text2, val, (Action<byte[]>)delegate(byte[] data) { if (data != null) { string text3 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location), "Downloads/"); string text4 = $"{_song.id}.zip"; try { if (!Directory.Exists(text3)) { Directory.CreateDirectory(text3); } } catch (IOException ex) { Plugin.LogError(ex.ToString()); TootTallyNotifManager.DisplayNotif("IO error creating download directory", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (UnauthorizedAccessException ex2) { Plugin.LogError(ex2.ToString()); TootTallyNotifManager.DisplayNotif("Insufficient permissions while creating download directory", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (Exception ex3) { Plugin.LogError(ex3.ToString()); TootTallyNotifManager.DisplayNotif("Unknown error creating download directory (check logs!)", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } try { FileHelper.WriteBytesToFile(text3, text4, data); } catch (IOException ex4) { Plugin.LogError(ex4.ToString()); TootTallyNotifManager.DisplayNotif("IO error writing ZIP archive", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (UnauthorizedAccessException ex5) { Plugin.LogError(ex5.ToString()); TootTallyNotifManager.DisplayNotif("Insufficient permissions while writing ZIP archive", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (Exception ex6) { Plugin.LogError(ex6.ToString()); TootTallyNotifManager.DisplayNotif("Unknown error writing ZIP archive (check logs!)", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } string text5 = Path.Combine(text3, text4); string text6 = Path.Combine(Paths.BepInExRootPath, "CustomSongs/"); try { FileHelper.ExtractZipToDirectory(text5, text6); } catch (InvalidDataException ex7) { Plugin.LogError(ex7.ToString()); TootTallyNotifManager.DisplayNotif("Downloaded file was not a ZIP archive", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (IOException ex8) { Plugin.LogError(ex8.ToString()); TootTallyNotifManager.DisplayNotif("IO error extracting ZIP archive", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (UnauthorizedAccessException ex9) { Plugin.LogError(ex9.ToString()); TootTallyNotifManager.DisplayNotif("Insufficient permissions while extracting ZIP archive", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } catch (Exception ex10) { Plugin.LogError(ex10.ToString()); TootTallyNotifManager.DisplayNotif("Unknown error extracting ZIP archive (check logs!)", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); return; } finally { FileHelper.DeleteFile(text3, text4); } IsOwned = true; _songRow.WithDownloadState(new DownloadState.Owned()); SongDownloadPage songDownloadPage = (SongDownloadPage)(object)base._page; songDownloadPage.AddTrackRefToDownloadedSong(_song.track_ref); SetActive(!songDownloadPage.ShowNotOwnedOnly); } else { TootTallyNotifManager.DisplayNotif("Download failed.", 6f); _songRow.WithDownloadState(new DownloadState.DownloadAvailable()); } })); } private string? GetLocalChartDirectory() { FSharpOption<TromboneTrack> val = TrackLookup.tryLookup(_song.track_ref); if (FSharpOption<TromboneTrack>[val]) { return null; } TromboneTrack value = val.Value; TromboneTrack obj = ((value is CustomTrack) ? value : null); return (obj != null) ? ((CustomTrack)obj).folderPath : null; } private static bool IsSubDirectoryOf(string candidate, string other) { DirectoryInfo directoryInfo = new DirectoryInfo(candidate); DirectoryInfo directoryInfo2 = new DirectoryInfo(other); while (directoryInfo.Parent != null) { if (directoryInfo.Parent.FullName == directoryInfo2.FullName) { return true; } directoryInfo = directoryInfo.Parent; } return false; } private void DeleteChart() { string localChartDirectory = GetLocalChartDirectory(); if (localChartDirectory == null) { TootTallyNotifManager.DisplayNotif("Can only delete charts loaded by TrombLoader", 6f); return; } try { string other = Path.Combine(Paths.BepInExRootPath, "CustomSongs"); if (!IsSubDirectoryOf(localChartDirectory, other)) { TootTallyNotifManager.DisplayNotif("Refusing to delete chart outside of the CustomSongs folder", 6f); return; } try { Directory.Delete(localChartDirectory, recursive: true); } catch (IOException ex) { Plugin.LogError(ex.ToString()); TootTallyNotifManager.DisplayNotif("IO error deleting chart", 6f); return; } catch (UnauthorizedAccessException ex2) { Plugin.LogError(ex2.ToString()); TootTallyNotifManager.DisplayNotif("Insufficient permissions while deleting chart", 6f); return; } IsOwned = false; _songRow.WithIsDeletable(isDeletable: false); ((SongDownloadPage)(object)base._page).MarkTrackDeleted(_song.track_ref); UpdateUiDownloadState(); TryRequestFileData(); TootTallyNotifManager.DisplayNotif("Chart deleted", 6f); } catch (Exception ex3) { Plugin.LogError(ex3.ToString()); TootTallyNotifManager.DisplayNotif("Failed to delete chart (check logs!)", 6f); } } private bool IsTrackDeletable(string trackRef) { SongDownloadPage songDownloadPage = (SongDownloadPage)(object)base._page; FSharpOption<TromboneTrack> val = TrackLookup.tryLookup(trackRef); return FSharpOption<TromboneTrack>[val] && val.Value is CustomTrack && !songDownloadPage.WasTrackDeleted(trackRef); } private bool HasTrackDownloaded(string trackRef) { SongDownloadPage songDownloadPage = (SongDownloadPage)(object)base._page; return (FSharpOption<TromboneTrack>[TrackLookup.tryLookup(trackRef)] && !songDownloadPage.WasTrackDeleted(trackRef)) || songDownloadPage.IsAlreadyDownloaded(trackRef); } private void SetFileData(FileDataState newState) { _fileData = newState; UpdateUiDownloadState(); } private void UpdateUiDownloadState() { if (HasTrackDownloaded(_song.track_ref)) { _songRow.WithDownloadState(new DownloadState.Owned()); } else { FileDataState fileData = _fileData; FileDataState fileDataState = fileData; if (!(fileDataState is FileDataState.ErrorFetchingData)) { if (!(fileDataState is FileDataState.HasData hasData)) { if (!(fileDataState is FileDataState.Unknown) && !(fileDataState is FileDataState.WaitingOnRequest)) { throw new ArgumentOutOfRangeException("_fileData"); } _songRow.WithDownloadState(new DownloadState.Waiting()); } else { switch (hasData.FileData.extension) { case "zip": case "x-zip": case "zip-compressed": case "x-zip-compressed": _songRow.WithFileSize(hasData.FileData.size).WithDownloadState(new DownloadState.DownloadAvailable()); break; default: _songRow.WithDownloadState(new DownloadState.DownloadUnavailable()); break; } } } else { _songRow.WithDownloadState(new DownloadState.DownloadUnavailable()); } } SongDownloadPage songDownloadPage = (SongDownloadPage)(object)base._page; songDownloadPage.UpdateDownloadAllButton(); } private void TryRequestFileData() { if (_fileData is FileDataState.Unknown) { string downloadLinkFromSongData = FileHelper.GetDownloadLinkFromSongData(_song); if (downloadLinkFromSongData != null) { _songRow.WithDownloadState(new DownloadState.Waiting()); SetFileData(new FileDataState.WaitingOnRequest(((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.GetFileSize(downloadLinkFromSongData, (Action<FileData>)OnFileDataFetched)))); } else { Plugin.LogWarning(_song.track_ref + " cannot be downloaded: no download link found"); SetFileData(new FileDataState.ErrorFetchingData()); } } } private void OnFileDataFetched(FileData? fileData) { if (fileData != null) { if (!fileData.extension.Contains("zip")) { Plugin.LogWarning(_song.track_ref + " cannot be downloaded: File is not zip: " + fileData.extension); SetFileData(new FileDataState.ErrorFetchingData()); } else { SetFileData(new FileDataState.HasData(fileData)); } } else { Plugin.LogWarning(_song.track_ref + " cannot be downloaded: got null FileData"); } } } internal class SongDownloadPage : TootTallySettingPage { private const string DEFAULT_INPUT_TEXT = "SearchHere"; private TMP_InputField _inputField; private GameObject _searchButton; private GameObject _nextButton; private GameObject _prevButton; private GameObject _downloadAllButton; private Toggle _toggleRated; private Toggle _toggleUnrated; private Toggle _toggleNotOwned; private LoadingIcon _loadingIcon; private readonly List<string> _trackRefList; private readonly List<string> _newDownloadedTrackRefs; private readonly List<string> _deletedTrackRefs; private readonly List<SongDownloadObject> _downloadObjectList; public bool ShowNotOwnedOnly => _toggleNotOwned.isOn; private static ColorBlock GetButtonColors { get { //IL_0002: 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_0035: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ColorBlock result = default(ColorBlock); ((ColorBlock)(ref result)).normalColor = new Color(0.2f, 0.2f, 1f); ((ColorBlock)(ref result)).highlightedColor = new Color(0.15f, 0.15f, 0.65f); ((ColorBlock)(ref result)).pressedColor = new Color(0.5f, 0.5f, 0.75f); ((ColorBlock)(ref result)).selectedColor = new Color(0.2f, 0.2f, 1f); ((ColorBlock)(ref result)).fadeDuration = 0.08f; ((ColorBlock)(ref result)).colorMultiplier = 1f; return result; } } public SongDownloadPage() : base("MoreSongs", "More Songs", 20f, new Color(0f, 0f, 0f, 0.1f), GetButtonColors) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) _trackRefList = new List<string>(); _newDownloadedTrackRefs = new List<string>(); _deletedTrackRefs = new List<string>(); _downloadObjectList = new List<SongDownloadObject>(); } public override void Initialize() { //IL_0024: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01d7: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: 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_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown ((TootTallySettingPage)this).Initialize(); _inputField = TootTallySettingObjectFactory.CreateInputField(base._fullPanel.transform, base.name + "InputField", TootTallySettingPage.DEFAULT_OBJECT_SIZE, TootTallySettingPage.DEFAULT_FONTSIZE, "SearchHere", false); ((UnityEvent<string>)(object)_inputField.onSubmit).AddListener((UnityAction<string>)delegate { Search(_inputField.text); }); RectTransform component = ((Component)_inputField).GetComponent<RectTransform>(); RectTransform component2 = ((Component)_inputField).GetComponent<RectTransform>(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.72f, 0.7f); component2.anchorMax = val; component.anchorMin = val; _loadingIcon = GameObjectFactory.CreateLoadingIcon(base._fullPanel.transform, new Vector2(-300f, -75f), new Vector2(128f, 128f), AssetManager.GetSprite("icon.png"), false, "SongSearchLoadingSwirly"); _searchButton = ((Component)GameObjectFactory.CreateCustomButton(base._fullPanel.transform, new Vector2(-375f, -175f), TootTallySettingPage.DEFAULT_OBJECT_SIZE, "Search", base.name + "SearchButton", (Action)delegate { Search(_inputField.text); })).gameObject; _toggleRated = TootTallySettingObjectFactory.CreateToggle(base._fullPanel.transform, base.name + "ToggleRated", new Vector2(200f, 60f), "Rated", (ConfigEntry<bool>)null); RectTransform component3 = ((Component)_toggleRated).GetComponent<RectTransform>(); RectTransform component4 = ((Component)_toggleRated).GetComponent<RectTransform>(); ((Vector2)(ref val))..ctor(0.63f, 0.58f); component4.anchorMax = val; component3.anchorMin = val; ((UnityEvent<bool>)(object)_toggleRated.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value) { if (value) { _toggleUnrated.SetIsOnWithoutNotify(!value); } }); _toggleUnrated = TootTallySettingObjectFactory.CreateToggle(base._fullPanel.transform, base.name + "ToggleUnrated", new Vector2(200f, 60f), "Unrated", (ConfigEntry<bool>)null); RectTransform component5 = ((Component)_toggleUnrated).GetComponent<RectTransform>(); RectTransform component6 = ((Component)_toggleUnrated).GetComponent<RectTransform>(); ((Vector2)(ref val))..ctor(0.63f, 0.5f); component6.anchorMax = val; component5.anchorMin = val; ((UnityEvent<bool>)(object)_toggleUnrated.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value) { if (value) { _toggleRated.SetIsOnWithoutNotify(!value); } }); _toggleNotOwned = TootTallySettingObjectFactory.CreateToggle(base._fullPanel.transform, base.name + "ToggleNotOwned", new Vector2(200f, 60f), "Not Owned", (ConfigEntry<bool>)null); RectTransform component7 = ((Component)_toggleNotOwned).GetComponent<RectTransform>(); RectTransform component8 = ((Component)_toggleNotOwned).GetComponent<RectTransform>(); ((Vector2)(ref val))..ctor(0.63f, 0.42f); component8.anchorMax = val; component7.anchorMin = val; ((UnityEvent<bool>)(object)_toggleNotOwned.onValueChanged).AddListener((UnityAction<bool>)OnNotOwnedToggle); _downloadAllButton = ((Component)GameObjectFactory.CreateCustomButton(base._fullPanel.transform, new Vector2(-1330f, -87f), new Vector2(200f, 60f), "Download All", "DownloadAllButton", (Action)DownloadAll)).gameObject; _downloadAllButton.SetActive(false); ((UnityEvent)base._backButton.button.onClick).AddListener((UnityAction)delegate { if (_newDownloadedTrackRefs.Count > 0 || _deletedTrackRefs.Count > 0) { TootTallyNotifManager.DisplayNotif("Reloading songs...", 6f); _newDownloadedTrackRefs.Clear(); _deletedTrackRefs.Clear(); ((MonoBehaviour)Plugin.Instance).Invoke("ReloadTracks", 0.35f); } }); base._scrollableSliderHandler.accelerationMult = 0.09f; ((HorizontalOrVerticalLayoutGroup)base.gridPanel.GetComponent<VerticalLayoutGroup>()).spacing = 8f; } public override void OnShow() { _loadingIcon.StartRecursiveAnimation(); } public override void OnHide() { _loadingIcon.StopRecursiveAnimation(true); } private void Search(string input, bool searchWithFilter = true) { if (input == "SearchHere") { input = ""; } _downloadObjectList.Clear(); _downloadAllButton.SetActive(false); ((TootTallySettingPage)this).RemoveAllObjects(); _searchButton.SetActive(false); _loadingIcon.Show(); if ((Object)(object)_nextButton != (Object)null) { Object.DestroyImmediate((Object)(object)_nextButton); _nextButton = null; } if ((Object)(object)_prevButton != (Object)null) { Object.DestroyImmediate((Object)(object)_prevButton); _prevButton = null; } _trackRefList.Clear(); if (searchWithFilter) { ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.SearchSongWithFilters(input, _toggleRated.isOn, _toggleUnrated.isOn, (Action<SongInfoFromDB>)OnSearchInfoRecieved)); } else { ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.SearchSongByURL(input, (Action<SongInfoFromDB>)OnSearchInfoRecieved)); } } private void OnSearchInfoRecieved(SongInfoFromDB? searchInfo) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) SongInfoFromDB searchInfo2 = searchInfo; _searchButton.SetActive(true); _loadingIcon.Hide(); base._verticalSlider.value = 0f; if (searchInfo2 == null) { return; } searchInfo2.results.OrderByDescending((SongDataFromDB x) => x.id).ToList()?.ForEach(AddSongToPage); ((Component)base._verticalSlider).gameObject.SetActive(searchInfo2.results.Length > 5); ((Behaviour)base._scrollableSliderHandler).enabled = searchInfo2.results.Length > 5; if (searchInfo2.next != null) { _nextButton = ((Component)GameObjectFactory.CreateCustomButton(base._fullPanel.transform, new Vector2(-350f, -175f), new Vector2(50f, 50f), ">>", base.name + "NextButton", (Action)delegate { Search(searchInfo2.next, searchWithFilter: false); })).gameObject; } if (searchInfo2.previous != null) { _prevButton = ((Component)GameObjectFactory.CreateCustomButton(base._fullPanel.transform, new Vector2(-700f, -175f), new Vector2(50f, 50f), "<<", base.name + "PrevButton", (Action)delegate { Search(searchInfo2.previous, searchWithFilter: false); })).gameObject; } } public void UpdateDownloadAllButton() { if (!_downloadAllButton.activeSelf) { _downloadAllButton.SetActive(_downloadObjectList.Any((SongDownloadObject o) => o.IsDownloadAvailable)); } } private void DownloadAll() { _downloadAllButton.SetActive(false); CollectionExtensions.Do<SongDownloadObject>(_downloadObjectList.Where((SongDownloadObject o) => o.IsDownloadAvailable), (Action<SongDownloadObject>)delegate(SongDownloadObject o) { o.DownloadChart(DownloadSource.Auto); }); } private void AddSongToPage(SongDataFromDB song) { if (!_trackRefList.Contains(song.track_ref)) { _trackRefList.Add(song.track_ref); SongDownloadObject songDownloadObject = new SongDownloadObject(base.gridPanel.transform, song, (TootTallySettingPage)(object)this); songDownloadObject.SetActive(!_toggleNotOwned.isOn || !songDownloadObject.IsOwned); _downloadObjectList.Add(songDownloadObject); ((TootTallySettingPage)this).AddSettingObjectToList((BaseTootTallySettingObject)(object)songDownloadObject); } } private void OnNotOwnedToggle(bool value) { _downloadObjectList.ForEach(delegate(SongDownloadObject x) { x.SetActive(!value || !x.IsOwned); }); } internal void AddTrackRefToDownloadedSong(string trackref) { _newDownloadedTrackRefs.Add(trackref); _deletedTrackRefs.Remove(trackref); } internal void MarkTrackDeleted(string trackref) { _deletedTrackRefs.Add(trackref); _newDownloadedTrackRefs.Remove(trackref); } public bool IsAlreadyDownloaded(string trackref) { return _newDownloadedTrackRefs.Contains(trackref); } public bool WasTrackDeleted(string trackref) { return _deletedTrackRefs.Contains(trackref); } } public static class PluginInfo { public const string PLUGIN_GUID = "TootTallySongDownloader"; public const string PLUGIN_NAME = "TootTallySongDownloader"; public const string PLUGIN_VERSION = "2.1.0"; } } namespace TootTallySongDownloader.Ui { public class DownloadButton { private readonly GameObject _gameObject; private readonly Button _button; private readonly Image _fillImage; private readonly Image _downloadIconImage; private readonly TMP_Text _filesizeText; private readonly Image _altIconImage; private readonly LoadingIcon _loadingIcon; private readonly ProgressPieGraphic _progressPie; private DownloadState _downloadState = new DownloadState.Waiting(); private RectTransform Transform => (RectTransform)_gameObject.transform; private DownloadButton(GameObject gameObject, Button button, Image fillImage, Image downloadIconImage, TMP_Text filesizeText, Image altIconImage, LoadingIcon loadingIcon, ProgressPieGraphic progressPie) { _gameObject = gameObject; _button = button; _fillImage = fillImage; _downloadIconImage = downloadIconImage; _filesizeText = filesizeText; _altIconImage = altIconImage; _loadingIcon = loadingIcon; _progressPie = progressPie; } internal static DownloadButton Create() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0337: 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_0353: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: 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_0449: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0481: 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_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0494: 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_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Expected O, but got Unknown //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Expected O, but got Unknown //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Expected O, but got Unknown //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DownloadButton", new Type[5] { typeof(RectTransform), typeof(Canvas), typeof(GraphicRaycaster), typeof(LayoutElement), typeof(Button) }); Transform transform = val.transform; LayoutElement component = val.GetComponent<LayoutElement>(); component.preferredWidth = 64f; Button component2 = val.GetComponent<Button>(); GameObject val2 = new GameObject("PanelFill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(transform, false); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; Image component3 = val2.GetComponent<Image>(); Texture2D texture = AssetManager.GetTexture("RoundedBoxRightFill.png"); component3.sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, new Vector4(4f, 4f, 4f, 4f), false); component3.type = (Type)1; ((Graphic)component3).color = new Color(0.91f, 0.212f, 0.333f); ((Selectable)component2).targetGraphic = (Graphic)(object)component3; GameObject val4 = new GameObject("PanelBorder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val5 = (RectTransform)val4.transform; ((Transform)val5).SetParent(transform, false); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = Vector2.zero; val5.offsetMax = Vector2.zero; Image component4 = val4.GetComponent<Image>(); Texture2D texture2 = AssetManager.GetTexture("RoundedBoxRightBorder.png"); component4.sprite = Sprite.Create(texture2, new Rect(0f, 0f, (float)((Texture)texture2).width, (float)((Texture)texture2).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, new Vector4(4f, 4f, 4f, 4f), false); component4.type = (Type)1; ((Graphic)component4).color = new Color(0.91f, 0.212f, 0.333f); GameObject val6 = new GameObject("DownloadIcon", new Type[2] { typeof(RectTransform), typeof(Image) }); val6.SetActive(false); Image component5 = val6.GetComponent<Image>(); component5.sprite = AssetManager.GetSprite("Download64.png"); Vector2 val7 = Vector2.one * 0.5f; RectTransform val8 = (RectTransform)val6.transform; ((Transform)val8).SetParent(transform, false); Vector2 anchorMin = (val8.anchorMax = val7); val8.anchorMin = anchorMin; val8.offsetMin = new Vector2(-18f, -10f); val8.offsetMax = new Vector2(18f, 26f); TMP_Text val10 = GameObjectFactory.CreateSingleText(transform, "FilesizeText", "12.3 MB", (TextFont)0); ((Component)val10).gameObject.SetActive(false); RectTransform rectTransform = val10.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = new Vector2(1f, 0f); rectTransform.offsetMin = Vector2.one * 4f; rectTransform.offsetMax = new Vector2(-4f, 24f); val10.fontSize = 14f; val10.alignment = (TextAlignmentOptions)1026; val10.overflowMode = (TextOverflowModes)2; val10.enableWordWrapping = false; GameObject val11 = new GameObject("AltIcon", new Type[2] { typeof(RectTransform), typeof(Image) }); val11.SetActive(false); Vector2 val12 = Vector2.one * 24f; RectTransform val13 = (RectTransform)val11.transform; ((Transform)val13).SetParent(transform, false); anchorMin = (val13.anchorMax = val7); val13.anchorMin = anchorMin; val13.offsetMin = -val12; val13.offsetMax = val12; LoadingIcon val15 = GameObjectFactory.CreateLoadingIcon(transform, Vector2.zero, Vector2.one * 48f, AssetManager.GetSprite("IconMono.png"), true, "LoadingIcon"); RectTransform val16 = (RectTransform)val15.iconHolder.transform; anchorMin = (val16.anchorMax = val7); val16.anchorMin = anchorMin; val16.offsetMin = -val12; val16.offsetMax = val12; GameObject val18 = new GameObject("ProgressPie", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(ProgressPieGraphic) }); val18.SetActive(false); RectTransform val19 = (RectTransform)val18.transform; ((Transform)val19).SetParent(transform, false); anchorMin = (val19.anchorMax = val7); val19.anchorMin = anchorMin; val19.offsetMin = -val12; val19.offsetMax = val12; return new DownloadButton(val, component2, component3, component5, val10, val11.GetComponent<Image>(), val15, val18.GetComponent<ProgressPieGraphic>()); } internal DownloadButton WithParent(Transform parent) { ((Transform)Transform).SetParent(parent, false); return this; } internal DownloadButton WithFilesize(long numBytes) { _filesizeText.text = FileHelper.SizeSuffix(numBytes, 1); return this; } internal DownloadButton WithDownloadState(DownloadState state) { //IL_00c3: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) _downloadState = state; if (!(state is DownloadState.DownloadAvailable)) { if (!(state is DownloadState.DownloadUnavailable)) { if (!(state is DownloadState.Downloading downloading)) { if (!(state is DownloadState.Owned)) { if (!(state is DownloadState.Waiting)) { throw new ArgumentOutOfRangeException("state"); } ((Component)_downloadIconImage).gameObject.SetActive(false); ((Component)_filesizeText).gameObject.SetActive(false); ((Component)_altIconImage).gameObject.SetActive(false); _loadingIcon.iconHolder.SetActive(true); _loadingIcon.StartRecursiveAnimation(); ((Component)_progressPie).gameObject.SetActive(false); ((Graphic)_fillImage).color = new Color(0.102f, 0.102f, 0.102f); } else { ((Component)_downloadIconImage).gameObject.SetActive(false); ((Component)_filesizeText).gameObject.SetActive(false); ((Component)_altIconImage).gameObject.SetActive(true); _loadingIcon.iconHolder.SetActive(false); _loadingIcon.StopRecursiveAnimation(true); ((Component)_progressPie).gameObject.SetActive(false); ((Graphic)_fillImage).color = new Color(0.102f, 0.102f, 0.102f); _altIconImage.sprite = AssetManager.GetSprite("PageTick64.png"); } } else { ((Component)_downloadIconImage).gameObject.SetActive(false); ((Component)_filesizeText).gameObject.SetActive(false); ((Component)_altIconImage).gameObject.SetActive(false); _loadingIcon.iconHolder.SetActive(false); _loadingIcon.StopRecursiveAnimation(true); ((Component)_progressPie).gameObject.SetActive(true); downloading.Progress.AddCounter((IProgressCountable)(object)_progressPie); ((Graphic)_fillImage).color = new Color(0.102f, 0.102f, 0.102f); } } else { ((Component)_downloadIconImage).gameObject.SetActive(false); ((Component)_filesizeText).gameObject.SetActive(false); ((Component)_altIconImage).gameObject.SetActive(true); _loadingIcon.iconHolder.SetActive(false); _loadingIcon.StopRecursiveAnimation(true); ((Component)_progressPie).gameObject.SetActive(false); ((Graphic)_fillImage).color = new Color(0.102f, 0.102f, 0.102f); _altIconImage.sprite = AssetManager.GetSprite("PageBroken64.png"); } } else { ((Component)_downloadIconImage).gameObject.SetActive(true); ((Component)_filesizeText).gameObject.SetActive(true); ((Component)_altIconImage).gameObject.SetActive(false); _loadingIcon.iconHolder.SetActive(false); _loadingIcon.StopRecursiveAnimation(true); ((Component)_progressPie).gameObject.SetActive(false); ((Graphic)_fillImage).color = new Color(0.91f, 0.212f, 0.333f); } return this; } internal void OnDownload(Action callback) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown Action callback2 = callback; ((UnityEvent)_button.onClick).AddListener((UnityAction)delegate { if (_downloadState is DownloadState.DownloadAvailable) { callback2(); } }); } } public class MainBody { private readonly GameObject _gameObject; private readonly TMP_Text _songNameText; private readonly TMP_Text _artistText; private readonly StatDisplay _durationStatDisplay; private readonly StatDisplay _difficultyStatDisplay; private readonly StatDisplay _charterStatDisplay; private readonly GameObject _ratedIconGo; private RectTransform Transform => (RectTransform)_gameObject.transform; private MainBody(GameObject gameObject, TMP_Text songNameText, TMP_Text artistText, StatDisplay durationStatDisplay, StatDisplay difficultyStatDisplay, StatDisplay charterStatDisplay, GameObject ratedIconGo) { _gameObject = gameObject; _songNameText = songNameText; _artistText = artistText; _durationStatDisplay = durationStatDisplay; _difficultyStatDisplay = difficultyStatDisplay; _charterStatDisplay = charterStatDisplay; _ratedIconGo = ratedIconGo; } internal static MainBody Create() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b6: 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_00d0: 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) //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_0129: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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_0248: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: 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) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0385: 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_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Expected O, but got Unknown //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Expected O, but got Unknown //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Expected O, but got Unknown //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Expected O, but got Unknown //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MainBody", new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(GraphicRaycaster), typeof(LayoutElement) }); RectTransform val2 = (RectTransform)val.transform; LayoutElement component = val.GetComponent<LayoutElement>(); component.flexibleWidth = 1f; GameObject val3 = new GameObject("PanelFill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val4 = (RectTransform)val3.transform; ((Transform)val4).SetParent((Transform)(object)val2, false); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; Image component2 = val3.GetComponent<Image>(); Texture2D texture = AssetManager.GetTexture("RoundedBoxLeftFill.png"); component2.sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component2.type = (Type)1; ((Graphic)component2).color = new Color(0.102f, 0.102f, 0.102f); GameObject val5 = new GameObject("PanelBorder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val6 = (RectTransform)val5.transform; ((Transform)val6).SetParent((Transform)(object)val2, false); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.offsetMin = Vector2.zero; val6.offsetMax = Vector2.zero; Image component3 = val5.GetComponent<Image>(); Texture2D texture2 = AssetManager.GetTexture("RoundedBoxLeftBorder.png"); component3.sprite = Sprite.Create(texture2, new Rect(0f, 0f, (float)((Texture)texture2).width, (float)((Texture)texture2).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component3.type = (Type)1; ((Graphic)component3).color = new Color(0.91f, 0.212f, 0.333f); TMP_Text val7 = GameObjectFactory.CreateSingleText((Transform)(object)val2, "SongName", "", (TextFont)0); RectTransform rectTransform = val7.rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(8f, -36f); rectTransform.offsetMax = new Vector2(-208f, 0f); val7.fontSize = 24f; val7.alignment = (TextAlignmentOptions)1025; val7.overflowMode = (TextOverflowModes)1; val7.enableWordWrapping = false; TMP_Text val8 = GameObjectFactory.CreateSingleText((Transform)(object)val2, "Artist", "", (TextFont)0); RectTransform rectTransform2 = val8.rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = new Vector2(1f, 0f); rectTransform2.offsetMin = Vector2.one * 8f; rectTransform2.offsetMax = new Vector2(-208f, 58f); val8.fontSize = 18f; val8.alignment = (TextAlignmentOptions)1025; val8.overflowMode = (TextOverflowModes)1; val8.enableWordWrapping = false; ((Graphic)val8).color = new Color(1f, 1f, 1f, 0.5f); GameObject val9 = new GameObject("RightTopBox", new Type[2] { typeof(RectTransform), typeof(HorizontalLayoutGroup) }); RectTransform val10 = (RectTransform)val9.transform; ((Transform)val10).SetParent((Transform)(object)val2, false); val10.anchorMin = new Vector2(1f, 0f); val10.anchorMax = Vector2.one; val10.offsetMin = new Vector2(-208f, 8f); val10.offsetMax = Vector2.one * -8f; HorizontalLayoutGroup component4 = val9.GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component4).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component4).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandHeight = false; ((LayoutGroup)component4).childAlignment = (TextAnchor)2; ((HorizontalOrVerticalLayoutGroup)component4).spacing = 8f; GameObject val11 = new GameObject("RatedIcon", new Type[2] { typeof(RectTransform), typeof(Image) }); RectTransform val12 = (RectTransform)val11.transform; ((Transform)val12).SetParent((Transform)(object)val10, false); Image component5 = val11.GetComponent<Image>(); component5.sprite = AssetManager.GetSprite("rated64.png"); ((RectTransform)((Component)component5).transform).sizeDelta = Vector2.one * 20f; StatDisplay durationStatDisplay = StatDisplay.Create().WithParent((Transform)(object)val10).WithIcon("time64.png"); StatDisplay difficultyStatDisplay = StatDisplay.Create().WithParent((Transform)(object)val10).WithIcon("stardiff64.png"); GameObject val13 = new GameObject("RightBottomBox", new Type[2] { typeof(RectTransform), typeof(HorizontalLayoutGroup) }); RectTransform val14 = (RectTransform)val13.transform; ((Transform)val14).SetParent((Transform)(object)val2, false); val14.anchorMin = new Vector2(1f, 0f); val14.anchorMax = Vector2.one; val14.offsetMin = new Vector2(-208f, 8f); val14.offsetMax = Vector2.one * -8f; HorizontalLayoutGroup component6 = val13.GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component6).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component6).childForceExpandHeight = false; ((LayoutGroup)component6).childAlignment = (TextAnchor)8; ((HorizontalOrVerticalLayoutGroup)component6).spacing = 8f; StatDisplay charterStatDisplay = StatDisplay.Create().WithParent((Transform)(object)val14).WithIcon("Pencil64.png"); return new MainBody(val, val7, val8, durationStatDisplay, difficultyStatDisplay, charterStatDisplay, val11); } internal MainBody WithParent(Transform parent) { ((Transform)Transform).SetParent(parent, false); return this; } internal MainBody WithSongName(string text) { _songNameText.text = text; return this; } internal MainBody WithArtist(string text) { _artistText.text = text; return this; } internal MainBody WithDurationSeconds(float seconds) { uint num = (uint)seconds; uint num2 = num % 60; uint num3 = num / 60; uint num4 = num3 % 60; uint num5 = num3 / 60; string text = ((num5 == 0) ? $"{num4}:{num2:D2}" : $"{num5}:{num4:D2}:{num2:D2}"); _durationStatDisplay.WithText(text); return this; } internal MainBody WithDifficulty(float difficulty) { _difficultyStatDisplay.WithText(difficulty.ToString("n2")); return this; } internal MainBody WithCharter(string charterDisplayName) { _charterStatDisplay.WithText(charterDisplayName); return this; } internal MainBody WithIsRated(bool rated) { _ratedIconGo.SetActive(rated); return this; } } internal class MenuOverlay { private readonly GameObject _canvasGameObject; private readonly GameObject _bodyGameObject; private bool _isHiding = false; private MenuOverlay(GameObject canvasGameObject, GameObject bodyGameObject) { _canvasGameObject = canvasGameObject; _bodyGameObject = bodyGameObject; } internal static MenuOverlay Create() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_008b: 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) //IL_00e4: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00fe: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0223: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_0297: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Expected O, but got Unknown GameObject val = new GameObject("MenuOverlayCanvas", new Type[5] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster), typeof(CanvasGroup) }); Transform transform = val.transform; Canvas component = val.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.overrideSorting = true; component.sortingOrder = 2; CanvasScaler component2 = val.GetComponent<CanvasScaler>(); component2.referenceResolution = new Vector2(1920f, 1080f); component2.uiScaleMode = (ScaleMode)1; GameObject val2 = new GameObject("CloseButton", new Type[4] { typeof(RectTransform), typeof(GraphicRaycaster), typeof(Button), typeof(Image) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(transform, false); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; Button component3 = val2.GetComponent<Button>(); Image component4 = val2.GetComponent<Image>(); ((Graphic)component4).color = new Color(0f, 0f, 0f, 0f); GameObject val4 = new GameObject("MenuBody", new Type[3] { typeof(RectTransform), typeof(OverlayLayoutGroup), typeof(ContentSizeFitter) }); RectTransform val5 = (RectTransform)val4.transform; ((Transform)val5).SetParent(transform, false); ContentSizeFitter component5 = val4.GetComponent<ContentSizeFitter>(); component5.horizontalFit = (FitMode)2; component5.verticalFit = (FitMode)2; GameObject val6 = new GameObject("PanelFill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val7 = (RectTransform)val6.transform; ((Transform)val7).SetParent((Transform)(object)val5, false); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.offsetMin = Vector2.zero; val7.offsetMax = Vector2.zero; Image component6 = val6.GetComponent<Image>(); Texture2D texture = AssetManager.GetTexture("RoundedBoxLeftFill.png"); component6.sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component6.type = (Type)1; ((Graphic)component6).color = new Color(0.102f, 0.102f, 0.102f); GameObject val8 = new GameObject("PanelBorder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val9 = (RectTransform)val8.transform; ((Transform)val9).SetParent((Transform)(object)val5, false); val9.anchorMin = Vector2.zero; val9.anchorMax = Vector2.one; val9.offsetMin = Vector2.zero; val9.offsetMax = Vector2.zero; Image component7 = val8.GetComponent<Image>(); Texture2D texture2 = AssetManager.GetTexture("RoundedBoxLeftBorder.png"); component7.sprite = Sprite.Create(texture2, new Rect(0f, 0f, (float)((Texture)texture2).width, (float)((Texture)texture2).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component7.type = (Type)1; ((Graphic)component7).color = new Color(0.91f, 0.212f, 0.333f); GameObject val10 = new GameObject("ItemList", new Type[2] { typeof(RectTransform), typeof(VerticalLayoutGroup) }); Transform transform2 = val10.transform; transform2.SetParent((Transform)(object)val5, false); VerticalLayoutGroup component8 = val10.GetComponent<VerticalLayoutGroup>(); ((LayoutGroup)component8).padding = new RectOffset(1, 1, 1, 1); MenuOverlay menuOverlay = new MenuOverlay(val, val4); ((UnityEvent)component3.onClick).AddListener(new UnityAction(menuOverlay.Hide)); return menuOverlay; } internal MenuOverlay WithItem(string text, UnityAction onClick) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown Transform val = _bodyGameObject.transform.Find("ItemList"); GameObject val2 = new GameObject("Item", new Type[5] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Button), typeof(Image), typeof(OverlayLayoutGroup) }); Transform transform = val2.transform; transform.SetParent(val, false); Image component = val2.GetComponent<Image>(); Button component2 = val2.GetComponent<Button>(); ((Selectable)component2).transition = (Transition)1; ((Selectable)component2).targetGraphic = (Graphic)(object)component; ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = new Color(0f, 0f, 0f, 0f); ((ColorBlock)(ref colors)).highlightedColor = new Color(0.91f, 0.212f, 0.333f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.557f, 0.129f, 0.204f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)component2).colors = colors; ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { onClick.Invoke(); Hide(); }); OverlayLayoutGroup component3 = val2.GetComponent<OverlayLayoutGroup>(); component3.padding = new RectOffset(4, 4, 4, 4); TMP_Text val3 = GameObjectFactory.CreateSingleText(transform, "Text", text, (TextFont)0); val3.enableWordWrapping = false; val3.fontSize = 18f; val3.horizontalAlignment = (HorizontalAlignmentOptions)1; return this; } internal void ShowAtCursor() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0050: 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_0056: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)_canvasGameObject.transform, Vector2.op_Implicit(Input.mousePosition), _canvasGameObject.GetComponent<Canvas>().worldCamera, ref val); RectTransform val2 = (RectTransform)_bodyGameObject.transform; ((Transform)val2).position = _canvasGameObject.transform.TransformPoint(Vector2.op_Implicit(val)); LayoutRebuilder.ForceRebuildLayoutImmediate(val2); float preferredHeight = LayoutUtility.GetPreferredHeight(val2); if (((Transform)val2).position.y - preferredHeight < 0f) { val2.pivot = new Vector2(0f, 0f); } else { val2.pivot = new Vector2(0f, 1f); } ((Transform)val2).localScale = new Vector3(0f, 0f, 1f); TootTallyAnimationManager.AddNewScaleAnimation(_bodyGameObject, Vector2.one, 0.35f, new SecondDegreeDynamicsAnimation(3.5f, 1f, 1.2f), (Action<GameObject>)null); } private void Hide() { //IL_001b: 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_003f: Expected O, but got Unknown if (!_isHiding) { _isHiding = true; TootTallyAnimationManager.AddNewScaleAnimation(_bodyGameObject, Vector2.zero, 0.35f, new SecondDegreeDynamicsAnimation(3.5f, 1f, 1.2f), (Action<GameObject>)null); _canvasGameObject.GetComponent<CanvasGroup>().interactable = false; _canvasGameObject.GetComponent<CanvasGroup>().blocksRaycasts = false; Object.Destroy((Object)(object)_canvasGameObject, 0.35f); } } } public class MoreInfoButton { private readonly GameObject _gameObject; private int _songId; private bool _isDeletable = false; private DownloadState _downloadState = new DownloadState.Waiting(); private readonly List<Action> _onDownloadFromTootTally; private readonly List<Action> _onDownloadFromAlternative; private readonly List<Action> _onDelete; private RectTransform Transform => (RectTransform)_gameObject.transform; private MoreInfoButton(GameObject gameObject) { _gameObject = gameObject; _onDownloadFromTootTally = new List<Action>(); _onDownloadFromAlternative = new List<Action>(); _onDelete = new List<Action>(); } internal static MoreInfoButton Create() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00ce: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_01eb: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Expected O, but got Unknown GameObject val = new GameObject("MoreInfoButton", new Type[5] { typeof(RectTransform), typeof(Canvas), typeof(GraphicRaycaster), typeof(LayoutElement), typeof(Button) }); Transform transform = val.transform; LayoutElement component = val.GetComponent<LayoutElement>(); component.preferredWidth = 24f; Button component2 = val.GetComponent<Button>(); GameObject val2 = new GameObject("PanelFill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(transform, false); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; Image component3 = val2.GetComponent<Image>(); Texture2D texture = AssetManager.GetTexture("HBoxMidFill.png"); component3.sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component3.type = (Type)1; ((Graphic)component3).color = new Color(0.557f, 0.129f, 0.204f); ((Selectable)component2).targetGraphic = (Graphic)(object)component3; GameObject val4 = new GameObject("PanelBorder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform val5 = (RectTransform)val4.transform; ((Transform)val5).SetParent(transform, false); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = Vector2.zero; val5.offsetMax = Vector2.zero; Image component4 = val4.GetComponent<Image>(); Texture2D texture2 = AssetManager.GetTexture("HBoxMidBorder.png"); component4.sprite = Sprite.Create(texture2, new Rect(0f, 0f, (float)((Texture)texture2).width, (float)((Texture)texture2).height), Vector2.one * 0.5f, 100f, 1u, (SpriteMeshType)0, Vector4.one * 4f, false); component4.type = (Type)1; ((Graphic)component4).color = new Color(0.91f, 0.212f, 0.333f); GameObject val6 = new GameObject("Icon", new Type[2] { typeof(RectTransform), typeof(Image) }); RectTransform val7 = (RectTransform)val6.transform; ((Transform)val7).SetParent(transform, false); val7.anchorMin = Vector2.one * 0.5f; val7.anchorMax = Vector2.one * 0.5f; val7.offsetMin = new Vector2(-3f, -11.5f); val7.offsetMax = new Vector2(3f, 11.5f); val6.GetComponent<Image>().sprite = AssetManager.GetSprite("MoreInfoIcon.png"); MoreInfoButton ret = new MoreInfoButton(val); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { ret.OpenMenu(); }); return ret; } internal MoreInfoButton WithParent(Transform parent) { ((Transform)Transform).SetParent(parent, false); return this; } internal MoreInfoButton WithSongId(int songId) { _songId = songId; return this; } internal MoreInfoButton WithDownloadState(DownloadState downloadState) { _downloadState = downloadState; return this; } internal MoreInfoButton WithIsDeletable(bool isDeletable) { _isDeletable = isDeletable; return this; } internal MoreInfoButton OnDownloadFromTootTally(Action callback) { _onDownloadFromTootTally.Add(callback); return this; } internal MoreInfoButton OnDownloadFromAlternative(Action callback) { _onDownloadFromAlternative.Add(callback); return this; } internal MoreInfoButton OnDelete(Action callback) { _onDelete.Add(callback); return this; } private void OpenMenu() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown MenuOverlay menuOverlay = MenuOverlay.Create().WithItem("View on TootTally.com", (UnityAction)delegate { Application.OpenURL($"https://toottally.com/song/{_songId}/"); }); DownloadState downloadState = _downloadState; DownloadState downloadState2 = downloadState; if (!(downloadState2 is DownloadState.DownloadAvailable)) { if (!(downloadState2 is DownloadState.DownloadUnavailable)) { if (!(downloadState2 is DownloadState.Owned)) { if (!(downloadState2 is DownloadState.Waiting) && downloadState2 is DownloadState.Downloading) { } } else { menuOverlay.WithItem("Redownload from TootTally", (UnityAction)delegate { _onDownloadFromTootTally.ForEach(delegate(Action action) { action(); }); }); menuOverlay.WithItem("Redownload from alternate source", (UnityAction)delegate { _onDownloadFromAlternative.ForEach(delegate(Action action) { action(); }); }); } } else { menuOverlay.WithItem("Try download anyway from TootTally", (UnityAction)delegate { _onDownloadFromTootTally.ForEach(delegate(Action action) { action(); }); }); menuOverlay.WithItem("Try download anyway from alternate source", (UnityAction)delegate { _onDownloadFromAlternative.ForEach(delegate(Action action) { action(); }); }); } } else { menuOverlay.WithItem("Download from TootTally", (UnityAction)delegate { _onDownloadFromTootTally.ForEach(delegate(Action action) { action(); }); }); menuOverlay.WithItem("Download from alternate source", (UnityAction)delegate { _onDownloadFromAlternative.ForEach(delegate(Action action) { action(); }); }); } if (_isDeletable) { menuOverlay.WithItem("Delete", (UnityAction)delegate { _onDelete.ForEach(delegate(Action action) { action(); }); }); } menuOverlay.ShowAtCursor(); } } public class OverlayLayoutGroup : UIBehaviour, ILayoutElement, ILayoutGroup, ILayoutController { public RectOffset padding = new RectOffset(); [NonSerialized] private RectTransform _rectTransform; public float minWidth { get; private set; } public float preferredWidth { get; private set; } public float flexibleWidth { get; private set; } public float minHeight { get; private set; } public float preferredHeight { get; private set; } public float flexibleHeight { get; private set; } public int layoutPriority => 0; private RectTransform RectTransform { get { if ((Object)(object)_rectTransform == (Object)null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } public void CalculateLayoutInputHorizontal() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown minWidth = 0f; preferredWidth = 0f; flexibleWidth = 0f; for (int i = 0; i < ((Transform)RectTransform).childCount; i++) { RectTransform val = (RectTransform)((Component)((Transform)RectTransform).GetChild(i)).transform; minWidth = Mathf.Max(minWidth, LayoutUtility.GetMinWidth(val)); preferredWidth = Mathf.Max(preferredWidth, LayoutUtility.GetPreferredWidth(val)); flexibleWidth = Mathf.Max(flexibleWidth, LayoutUtility.GetFlexibleWidth(val)); } int num = padding.left + padding.right; minWidth += num; preferredWidth += num; flexibleWidth += num; } public void CalculateLayoutInputVertical() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown minHeight = 0f; preferredHeight = 0f; flexibleHeight = 0f; for (int i = 0; i < ((Transform)RectTransform).childCount; i++) { RectTransform val = (RectTransform)((Component)((Transform)RectTransform).GetChild(i)).transform; minHeight = Mathf.Max(minHeight, LayoutUtility.GetMinHeight(val)); preferredHeight = Mathf.Max(preferredHeight, LayoutUtility.GetPreferredHeight(val)); flexibleHeight = Mathf.Max(flexibleHeight, LayoutUtility.GetFlexibleHeight(val)); } int num = padding.bottom + padding.top; minHeight += num; preferredHeight += num; flexibleHeight += num; } public void SetLayoutHorizontal() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0027: 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_0043: 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_0066: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ((Transform)RectTransform).childCount; i++) { RectTransform val = (RectTransform)((Component)((Transform)RectTransform).GetChild(i)).transform; val.anchorMin = new Vector2(0f, val.anchorMin.y); val.anchorMax = new Vector2(1f, val.anchorMax.y); val.offsetMin = new Vector2((float)padding.left, val.offsetMin.y); val.offsetMax = new Vector2((float)(-padding.right), val.offsetMax.y); } } public void SetLayoutVertical() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0070: 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_0094: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ((Transform)RectTransform).childCount; i++) { RectTransform val = (RectTransform)((Component)((Transform)RectTransform).GetChild(i)).transform; val.anchorMin = new Vector2(val.anchorMin.x, 0f); val.anchorMax = new Vector2(val.anchorMax.x, 1f); val.offsetMin = new Vector2(val.offsetMin.x, (float)padding.bottom); val.offsetMax = new Vector2(val.offsetMax.x, (float)(-padding.top)); } } } public class ProgressPieGraphic : MaskableGraphic, IProgressCountable { private float _fillPercent = 0f; internal float FillPercent { get { return _fillPercent; } set { _fillPercent = value; ((Graphic)this).SetVerticesDirty(); } } protected override void OnPopulateMesh(VertexHelper vh) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c7: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0114: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; Vector2 center = ((Rect)(ref rect)).center; float num = Mathf.Min(((Rect)(ref rect)).width, ((Rect)(ref rect)).height) / 2f; UIVertex val = default(UIVertex); val.position = Vector2.op_Implicit(center); val.color = Color32.op_Implicit(((Graphic)this).color); UIVertex val2 = val; vh.AddVert(val2); for (float num2 = 0f; num2 < (float)Math.PI * 2f * FillPercent; num2 += 0.025f) { int currentVertCount = vh.currentVertCount; int num3 = currentVertCount + 1; Vector2 val3 = new Vector2(Mathf.Sin(num2), Mathf.Cos(num2)) * num; Vector2 val4 = new Vector2(Mathf.Sin(num2 + 0.025f), Mathf.Cos(num2 + 0.025f)) * num; val = default(UIVertex); val.position = Vector2.op_Implicit(val3); val.color = Color32.op_Implicit(((Graphic)this).color); UIVertex val5 = val; val = default(UIVertex); val.position = Vector2.op_Implicit(val4); val.color = Color32.op_Implicit(((Graphic)this).color); UIVertex val6 = val; vh.AddVert(val5); vh.AddVert(val6); vh.AddTriangle(0, currentVertCount, num3); } } public void OnProgressCounterFinish(ProgressCounter sender, double elapsed) { FillPercent = 100f; sender.RemoveCounter((IProgressCountable)(object)this); } public void OnProgressCounterUpdate(ProgressCounter sender, float progress) { FillPercent = progress; } } public class SongRow : IDisposable { internal readonly GameObject GameObject; private readonly MainBody _mainBody; private readonly MoreInfoButton _moreInfoButton; private readonly DownloadButton _downloadButton; private RectTransform Transform => (RectTransform)GameObject.transform; private SongRow(GameObject gameObject, MainBody mainBody, MoreInfoButton moreInfoButton, DownloadButton downloadButton) { GameObject = gameObject; _mainBody = mainBody; _moreInfoButton = moreInfoButton; _downloadButton = downloadButton; } internal static SongRow Create() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SongRow", new Type[2] { typeof(RectTransform), typeof(HorizontalLayoutGroup) }); RectTransform val2 = (RectTransform)val.transform; val2.sizeDelta = new Vector2(1050f, 64f); HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = true; MainBody mainBody = MainBody.Create().WithParent((Transform)(object)val2); MoreInfoButton moreInfoButton = MoreInfoButton.Create().WithParent((Transform)(object)val2); DownloadButton downloadButton = DownloadButton.Create().WithParent((Transform)(object)val2); return new SongRow(val, mainBody, moreInfoButton, downloadButton); } internal SongRow WithParent(Transform parent) { ((Transform)Transform).SetParent(parent, false); return this; } internal SongRow WithSongName(string text) { _mainBody.WithSongName(text); return this; } internal SongRow WithArtist(string text) { _mainBody.WithArtist(text); return this; } internal SongRow WithDurationSeconds(float seconds) { _mainBody.WithDurationSeconds(seconds); return this; } internal SongRow WithDifficulty(float difficulty) { _mainBody.WithDifficulty(difficulty); return this; } internal SongRow WithCharter(string charterDisplayName) { _mainBody.WithCharter(charterDisplayName); return this; } internal SongRow WithIsRated(bool rated) { _mainBody.WithIsRated(rated); return this; } internal SongRow WithDownloadState(DownloadState state) { _downloadButton.WithDownloadState(state); _moreInfoButton.WithDownloadState(state); return this; } internal SongRow WithFileSize(long fileDataSize) { _downloadButton.WithFilesize(fileDataSize); return this; } internal SongRow WithSongId(int songId) { _moreInfoButton.WithSongId(songId); return this; } internal SongRow WithIsDeletable(bool isDeletable) { _moreInfoButton.WithIsDeletable(isDeletable); return this; } internal SongRow OnDownload(Action callback) { _downloadButton.OnDownload(callback); return this; } internal SongRow OnDownloadFromTootTally(Action callback) { _moreInfoButton.OnDownloadFromTootTally(callback); return this; } internal SongRow OnDownloadFromAlternative(Action callback) { _moreInfoButton.OnDownloadFromAlternative(callback); return this; } internal SongRow OnDelete(Action callback) { _moreInfoButton.OnDelete(callback); return this; } public void Dispose() { Object.DestroyImmediate((Object)(object)GameObject); } } public class StatDisplay { private readonly GameObject _gameObject; private readonly Image _image; private readonly TMP_Text _text; private RectTransform Transform => (RectTransform)_gameObject.transform; private StatDisplay(GameObject gameObject, Image image, TMP_Text text) { _gameObject = gameObject; _image = image; _text = text; } internal static StatDisplay Create() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown GameObject val = new GameObject("StatDisplay", new Type[2] { typeof(RectTransform), typeof(HorizontalLayoutGroup) }); Transform transform = val.transform; HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)component).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component).spacing = 4f; GameObject val2 = new GameObject("Icon", new Type[2] { typeof(RectTransform), typeof(Image) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(transform, false); TMP_Text val4 = GameObjectFactory.CreateSingleText(transform, "Text", "", (TextFont)0); val4.fontSize = 18f; val4.enableWordWrapping = false; val4.autoSizeTextContainer = true; return new StatDisplay(val, val2.GetComponent<Image>(), val4); } internal StatDisplay WithParent(Transform parent) { ((Transform)Transform).SetParent(parent, false); return this; } internal StatDisplay WithIcon(string assetKey) { //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) //IL_002d: Unknown result type (might be due to invalid IL or missing references) _image.sprite = AssetManager.GetSprite(assetKey); ((RectTransform)((Component)_image).transform).sizeDelta = Vector2.one * 20f; return this; } internal StatDisplay WithText(string text) { _text.text = text; return this; } } } namespace TootTallySongDownloader.SongDownloader { public class ChartPackDownloadPage : TootTallySettingPage { private const string DEFAULT_INPUT_TEXT = "SearchHere"; private TMP_InputField _inputField; private GameObject _searchButton; private GameObject _nextButton; private GameObject _prevButton; private LoadingIcon _loadingIcon; private readonly List<string> _newDownloadedTrackRefs; private static ColorBlock GetButtonColors { get { //IL_0002: 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_0035: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ColorBlock result = default(ColorBlock); ((ColorBlock)(ref result)).normalColor = new Color(0.2f, 0.2f, 1f); ((ColorBlock)(ref result)).highlightedColor = new Color(0.15f, 0.15f, 0.65f); ((ColorBlock)(ref result)).pressedColor = new Color(0.5f, 0.5f, 0.75f); ((ColorBlock)(ref result)).selectedColor = new Color(0.2f, 0.2f, 1f); ((ColorBlock)(ref result)).fadeDuration = 0.08f; ((ColorBlock)(ref result)).colorMultiplier = 1f; return result; } } public ChartPackDownloadPa