using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BaboonAPI.Hooks.Initializer; using BaboonAPI.Hooks.Tracks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using TootTallyAccounts; using TootTallyCore; using TootTallyCore.APIServices; using TootTallyCore.Graphics; using TootTallyCore.Graphics.Animations; using TootTallyCore.Utils.Assets; using TootTallyCore.Utils.Helpers; using TootTallyCore.Utils.TootTallyGlobals; using TootTallyCore.Utils.TootTallyModules; using TootTallyCore.Utils.TootTallyNotifs; using TootTallyDiffCalcLibs; using TootTallyGameModifiers; using TootTallyLeaderboard.Compatibility; using TootTallyLeaderboard.Replays; using TootTallySettings; using TrombLoader; using TrombLoader.CustomTracks; using TrombLoader.Data; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Localization.Components; using UnityEngine.Networking; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("TootTallyLeaderboard")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("TootTally Leaderboard and Replay module")] [assembly: AssemblyFileVersion("1.2.7.0")] [assembly: AssemblyInformationalVersion("1.2.7+dbd8726f4b5bd22d694c3749e69a0e244185a1e6")] [assembly: AssemblyProduct("TootTallyLeaderboard")] [assembly: AssemblyTitle("TootTallyLeaderboard")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.7.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TootTallyLeaderboard { public static class BetterScrollSpeedSliderPatcher { private const string CONFIG_NAME = "BetterScrollSpeed.cfg"; private const string CONFIG_FIELD = "SliderValues"; private const uint DEFAULT_MAX = 250u; private const uint DEFAULT_MIN = 5u; private const float DEFAULT_VALUE = 100f; public static Options options; public static void PatchScrollSpeedSlider() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_0178: Unknown result type (might be due to invalid IL or missing references) SetSliderOption(); Text component = GameObject.Find("MainCanvas/FullScreenPanel/scroll_speed/ScrollSpeed-lbl").GetComponent(); Slider component2 = GameObject.Find("MainCanvas/FullScreenPanel/scroll_speed/Slider").GetComponent(); Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component2).navigation = navigation; ((Graphic)((Component)component2.fillRect).gameObject.GetComponent()).color = Theme.colors.scrollSpeedSlider.fill; ((Graphic)((Component)((Component)component2).transform.Find("Background")).GetComponent()).color = Theme.colors.scrollSpeedSlider.background; ((Graphic)((Component)component2.handleRect).gameObject.GetComponent()).color = Theme.colors.scrollSpeedSlider.handle; component2.minValue = (float)options.Min.Value / 100f; component2.maxValue = (float)options.Max.Value / 100f; component2.value = options.LastValue.Value / 100f; Text scrollSpeedSliderText = Object.Instantiate(component, (Transform)(object)component2.handleRect); ((Component)scrollSpeedSliderText).GetComponent().anchoredPosition = Vector2.zero; scrollSpeedSliderText.alignment = (TextAnchor)4; scrollSpeedSliderText.fontSize = 12; scrollSpeedSliderText.text = ((int)(GlobalVariables.gamescrollspeed * 100f)).ToString(); ((Graphic)scrollSpeedSliderText).color = Theme.colors.scrollSpeedSlider.text; scrollSpeedSliderText.text = SliderValueToText(component2.value); ((UnityEvent)(object)component2.onValueChanged).AddListener((UnityAction)delegate(float _value) { options.LastValue.Value = _value * 100f; scrollSpeedSliderText.text = SliderValueToText(_value); }); GameObject.Find("MainCanvas/FullScreenPanel/scroll_speed/ScrollSpeed-lbl").gameObject.SetActive(false); } public static void SetSliderOption() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (options == null) { string text = Path.Combine(Paths.BepInExRootPath, "config/"); ConfigFile val = new ConfigFile(text + "BetterScrollSpeed.cfg", true); options = new Options { Max = val.Bind("SliderValues", "Max", 250u, (ConfigDescription)null), Min = val.Bind("SliderValues", "Min", 5u, (ConfigDescription)null), LastValue = val.Bind("SliderValues", "LastValue", 100f, (ConfigDescription)null) }; if (options.Min.Value >= options.Max.Value) { Plugin.LogError("Slider MAX has to be greater than Slider MIN"); } else if (options.Min.Value <= 4) { Plugin.LogError("Slider MIN has to be greater or equal to 5"); } else if (options.Max.Value >= 1000) { Plugin.LogError("Buddy. What are you trying to do?? You're never gonna play with 1k+ scrollspeed..."); } if (options.Max.Value >= options.Min.Value || options.Min.Value <= 4 || options.Max.Value >= 1000) { options.Min.Value = 5u; options.Max.Value = 250u; } if (options.LastValue.Value < (float)options.Min.Value || options.LastValue.Value > (float)options.Max.Value) { options.LastValue.Value = 100f; } GlobalVariables.gamescrollspeed = options.LastValue.Value / 100f; } } public static string SliderValueToText(float value) { if (value >= 1f) { return Mathf.FloorToInt(value * 100f).ToString(); } return Mathf.CeilToInt(value * 100f).ToString(); } } public class Options { public ConfigEntry Max { get; set; } public ConfigEntry Min { get; set; } public ConfigEntry LastValue { get; set; } } public class GlobalLeaderboard { public enum LeaderboardState { None, ErrorNoSongHashFound, ErrorNoLeaderboardFound, ErrorUnexpected, ReadyToRefresh, SongDataLoaded, SongDataMissing } private const string ERROR_NO_LEADERBOARD_FOUND_TEXT = "Could not find a leaderboard for this track.\n Be the first one to set a score on the track!"; private const string ERROR_NO_SONGHASH_FOUND_TEXT = "This chart is not uploaded to TootTally...\n Please upload the chart to TootTally.com\n or use TootBender on discord to create the leaderboard."; private static Dictionary gradeToColorDict = new Dictionary { { "SSS", Color.yellow }, { "SS", Color.yellow }, { "S", Color.yellow }, { "A", Color.green }, { "B", new Color(0f, 0.4f, 1f) }, { "C", Color.magenta }, { "D", Color.red }, { "F", Color.grey } }; private static string[] tabsImageNames = new string[3] { "profile64.png", "global64.png", "local64.png" }; private static float[] _starSizeDeltaPositions = new float[11] { 0f, 19f, 39f, 59f, 79f, 99f, 119f, 139f, 159f, 179f, 199f }; private static GameObject _fullScreenPanelCanvas; private List> _currentLeaderboardCoroutines; private IEnumerator _profilePictureRequest; private LevelSelectController _levelSelectControllerInstance; private List _scoreDataList; private GameObject _leaderboard; private GameObject _globalLeaderboard; private GameObject _scoreboard; private GameObject _errorsHolder; private GameObject _tabs; private GameObject _profilePopup; private GameObject _ratedIcon; private LoadingIcon _loadingSwirly; private LoadingIcon _profilePopupLoadingSwirly; private Text _errorText; private TMP_Text _diffRating; private Vector2 _starRatingMaskSizeTarget; private RectTransform _diffRatingMaskRectangle; private List _scoreGameObjectList; private List _tempAllReplayData; private SongDataFromDB _songData; private Slider _slider; private Slider _gameSpeedSlider; private ScrollableSliderHandler _scrollableSliderHandler; private GameObject _sliderHandle; private Dictionary _speedToDiffDict; private int _currentSelectedSongHash; private int _localScoreId; private string _songHash; public bool IsMouseOver; private SecondDegreeDynamicsAnimation _starMaskAnimation; private static string _savedTrackref; public bool HasLeaderboard => (Object)(object)_leaderboard != (Object)null; public void Initialize(LevelSelectController __instance) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Expected O, but got Unknown //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) _fullScreenPanelCanvas = GameObject.Find("MainCanvas/FullScreenPanel"); _levelSelectControllerInstance = __instance; _currentLeaderboardCoroutines = new List>(); _scoreGameObjectList = new List(); _tempAllReplayData = new List(); _speedToDiffDict = new Dictionary(); ClearBaseLeaderboard(); CustomizeGameMenuUI(__instance); _leaderboard.transform.SetAsLastSibling(); _globalLeaderboard = LeaderboardFactory.CreateSteamLeaderboardFromPrefab(_leaderboard.transform, "GlobalLeaderboard"); _globalLeaderboard.SetActive(true); EventTrigger val = _globalLeaderboard.AddComponent(); Entry val2 = new Entry(); val2.eventID = (EventTriggerType)0; ((UnityEvent)(object)val2.callback).AddListener((UnityAction)delegate { OnPointerEnter(); }); val.triggers.Add(val2); Entry val3 = new Entry(); val3.eventID = (EventTriggerType)1; ((UnityEvent)(object)val3.callback).AddListener((UnityAction)delegate { OnPointerExit(); }); val.triggers.Add(val3); GameObject gameObject = ((Component)_globalLeaderboard.transform.Find("PanelBody")).gameObject; gameObject.SetActive(true); _scoreboard = ((Component)gameObject.transform.Find("scoreboard")).gameObject; _scoreboard.SetActive(true); _errorsHolder = ((Component)gameObject.transform.Find("errors")).gameObject; _errorText = ((Component)_errorsHolder.transform.Find("error_noleaderboard")).GetComponent(); ((Component)_errorText).gameObject.SetActive(true); _tabs = ((Component)gameObject.transform.Find("tabs")).gameObject; SetTabsImages(); _loadingSwirly = GameObjectFactory.CreateLoadingIcon(gameObject.transform, new Vector2(-20f, 0f), new Vector2(128f, 128f), AssetManager.GetSprite("icon.png"), true, "LeaderboardLoadingSwirly"); _loadingSwirly.StartRecursiveAnimation(); _loadingSwirly.Show(); _slider = ((Component)gameObject.transform.Find("LeaderboardVerticalSlider")).gameObject.GetComponent(); ((Graphic)((Component)((Component)_slider).transform.Find("Fill Area/Fill")).GetComponent()).color = Theme.colors.leaderboard.slider.fill; ((Graphic)((Component)((Component)_slider).transform.Find("Background")).GetComponent()).color = Theme.colors.leaderboard.slider.background; _scrollableSliderHandler = ((Component)_slider).gameObject.AddComponent(); _sliderHandle = ((Component)((Component)_slider).transform.Find("Handle")).gameObject; ((Graphic)_sliderHandle.GetComponent()).color = Theme.colors.leaderboard.slider.handle; SetOnSliderValueChangeEvent(); GameObject gameObject2 = ((Component)_fullScreenPanelCanvas.transform.Find("bar_difficulty")).gameObject; Object.DestroyImmediate((Object)(object)((Component)_fullScreenPanelCanvas.transform.Find("difficulty text")).gameObject); TMP_Text val4 = GameObjectFactory.CreateSingleText(gameObject2.transform, "Difficulty Text", "Difficulty:", (TextFont)1); val4.alignment = (TextAlignmentOptions)513; val4.margin = Vector4.op_Implicit(new Vector2(20f, 4f)); val4.fontSize = 16f; GameObject gameObject3 = ((Component)_fullScreenPanelCanvas.transform.Find("difficulty stars")).gameObject; _diffRatingMaskRectangle = gameObject3.GetComponent(); _diffRatingMaskRectangle.anchoredPosition = new Vector2(120f, -48f); _diffRatingMaskRectangle.sizeDelta = new Vector2(0f, 30f); _diffRatingMaskRectangle.pivot = new Vector2(0f, 0.5f); Mask val5 = gameObject3.AddComponent(); val5.showMaskGraphic = false; gameObject3.AddComponent(); RectTransform component = gameObject2.GetComponent(); component.sizeDelta += new Vector2(41.5f, 0f); _diffRating = GameObjectFactory.CreateSingleText(gameObject2.transform, "diffRating", "", (TextFont)1); _diffRating.outlineColor = Color32.op_Implicit(Theme.colors.leaderboard.textOutline); _diffRating.outlineWidth = 0.2f; _diffRating.fontSize = 20f; _diffRating.alignment = (TextAlignmentOptions)4100; _diffRating.rectTransform.sizeDelta = new Vector2(355f, 30f); RectTransform rectTransform = _diffRating.rectTransform; RectTransform rectTransform2 = _diffRating.rectTransform; Vector2 val6 = default(Vector2); ((Vector2)(ref val6))..ctor(0f, 0.5f); rectTransform2.anchorMax = val6; rectTransform.anchorMin = val6; _diffRating.rectTransform.offsetMin = Vector2.zero; _starMaskAnimation = new SecondDegreeDynamicsAnimation(1.23f, 1f, 1.2f); _ratedIcon = GameObjectFactory.CreateImageHolder(_globalLeaderboard.transform, new Vector2(350f, 180f), Vector2.one * 42f, AssetManager.GetSprite("rated64.png"), "RatedChartIcon"); BubblePopupHandler val7 = _ratedIcon.AddComponent(); val7.Initialize(GameObjectFactory.CreateBubble(new Vector2(300f, 40f), "RatedIconBubble", "This chart is rated.", 6, true, 12), true); _levelSelectControllerInstance.sortdrop.transform.SetAsLastSibling(); } public void OnPointerEnter() { ((Behaviour)_scrollableSliderHandler).enabled = (IsMouseOver = true); } public void OnPointerExit() { ((Behaviour)_scrollableSliderHandler).enabled = (IsMouseOver = false); } public void ClearBaseLeaderboard() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown _leaderboard = ((Component)_fullScreenPanelCanvas.transform.Find("Leaderboard")).gameObject; foreach (Transform item in _leaderboard.transform) { Transform val = item; ((Component)val).gameObject.SetActive(false); } DestroyFromParent(_leaderboard, "......."); DestroyFromParent(_leaderboard, "\"HIGH SCORES\""); for (int i = 1; i <= 5; i++) { ((Component)_leaderboard.transform.Find(i.ToString())).gameObject.SetActive(false); } } public void CustomizeGameMenuUI(LevelSelectController __instance) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_013c: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Expected O, but got Unknown //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Expected O, but got Unknown //IL_0580: 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_0594: Unknown result type (might be due to invalid IL or missing references) try { ((Component)_fullScreenPanelCanvas.transform.Find("Dial")).gameObject.SetActive(false); ((Component)_fullScreenPanelCanvas.transform.Find("capsules")).GetComponent().anchoredPosition = new Vector2(-275f, 32f); ((Component)_fullScreenPanelCanvas.transform.Find("btn_RANDOM")).GetComponent().anchoredPosition = new Vector2(-123f, -7f); ((Component)_fullScreenPanelCanvas.transform.Find("btn_TURBO")).GetComponent().anchoredPosition = new Vector2(-110f, 65f); BetterScrollSpeedSliderPatcher.PatchScrollSpeedSlider(); ((Component)_fullScreenPanelCanvas.transform.Find("scroll_speed")).GetComponent().anchoredPosition = new Vector2(4.5f, 5f); ((Component)_fullScreenPanelCanvas.transform.Find("scroll_speed/Slider")).GetComponent().anchoredPosition = new Vector2(-115f, 22f); ((Component)_fullScreenPanelCanvas.transform.Find("scroll_speed/txt_scrollspeed")).GetComponent().anchoredPosition = new Vector2(-112f, 36f); ((Component)_fullScreenPanelCanvas.transform.Find("btn_TURBO")).gameObject.SetActive(false); ((Component)_fullScreenPanelCanvas.transform.Find("btn_PRACTICE")).gameObject.SetActive(false); _gameSpeedSlider = Object.Instantiate(((Component)_fullScreenPanelCanvas.transform.Find("scroll_speed/Slider")).GetComponent(), _fullScreenPanelCanvas.transform); ((Component)_gameSpeedSlider).gameObject.GetComponent().anchoredPosition = new Vector2(-110f, 65f); _gameSpeedSlider.wholeNumbers = true; _gameSpeedSlider.minValue = 0f; _gameSpeedSlider.maxValue = 30f; _gameSpeedSlider.value = (ReplaySystemManager.gameSpeedMultiplier - 0.5f) / 0.05f; GameObject val = Object.Instantiate(((Component)_fullScreenPanelCanvas.transform.Find("scroll_speed/txt_scrollspeed")).gameObject, _fullScreenPanelCanvas.transform); ((Object)val).name = "GameSpeedShad"; val.GetComponent().text = "Game Speed"; val.GetComponent().anchoredPosition = new Vector2(-108f, 78f); GameObject gameObject = ((Component)val.transform.Find("txt_scrollspeed-top")).gameObject; ((Object)gameObject).name = "GameSpeed"; gameObject.GetComponent().text = "Game Speed"; Text scrollSpeedSliderText = ((Component)((Component)_gameSpeedSlider).transform.Find("Handle Slide Area/Handle/ScrollSpeed-lbl(Clone)")).GetComponent(); scrollSpeedSliderText.text = (_gameSpeedSlider.value * 0.05f + 0.5f).ToString("0.00"); _gameSpeedSlider.onValueChanged = new SliderEvent(); ((UnityEvent)(object)_gameSpeedSlider.onValueChanged).AddListener((UnityAction)delegate(float _value) { _gameSpeedSlider.value = Mathf.Round(_value * 20f) / 20f; TootTallyGlobalVariables.gameSpeedMultiplier = _gameSpeedSlider.value * 0.05f + 0.5f; scrollSpeedSliderText.text = ReplaySystemManager.gameSpeedMultiplier.ToString("0.00"); UpdateStarRating(__instance); }); GameObject val2 = Object.Instantiate(_levelSelectControllerInstance.songtitlebar); ((Object)val2).name = "titlebarPrefab"; ((Transform)val2.GetComponent()).eulerAngles = Vector3.zero; ((Transform)val2.GetComponent()).localScale = Vector3.one; ((Graphic)val2.GetComponent()).color = new Color(0f, 0f, 0f, 0.001f); GameObject val3 = LeaderboardFactory.CreateDefaultPanel(_fullScreenPanelCanvas.transform, new Vector2(381f, -207f), new Vector2(72f, 72f), "ProfilePopupHitbox"); GameObjectFactory.CreateSingleText(val3.transform, "ProfilePopupHitboxText", "P", (TextFont)1); if (TootTallyUser.userInfo.id == 0) { return; } _profilePopup = LeaderboardFactory.CreateDefaultPanel(_fullScreenPanelCanvas.transform, new Vector2(525f, -300f), new Vector2(450f, 270f), "TootTallyScorePanel"); _profilePopupLoadingSwirly = GameObjectFactory.CreateLoadingIcon(_profilePopup.transform, Vector2.zero, new Vector2(96f, 96f), AssetManager.GetSprite("icon.png"), true, "ProfilePopupLoadingSwirly"); _profilePopupLoadingSwirly.Show(); _profilePopupLoadingSwirly.StartRecursiveAnimation(); GameObject scoresbody = ((Component)_profilePopup.transform.Find("scoresbody")).gameObject; HorizontalLayoutGroup val4 = scoresbody.AddComponent(); ((LayoutGroup)val4).padding = new RectOffset(2, 2, 2, 2); ((LayoutGroup)val4).childAlignment = (TextAnchor)4; bool childForceExpandHeight = (((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true); ((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = childForceExpandHeight; GameObject mainPanel = Object.Instantiate(val2, scoresbody.transform); ((Behaviour)mainPanel.GetComponent()).enabled = false; VerticalLayoutGroup val5 = mainPanel.AddComponent(); ((LayoutGroup)val5).padding = new RectOffset(2, 2, 2, 2); ((LayoutGroup)val5).childAlignment = (TextAnchor)4; childForceExpandHeight = (((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true); ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = childForceExpandHeight; _profilePictureRequest = TootTallyAPIService.GetUserFromID(TootTallyUser.userInfo.id, (Action)delegate(User user) { AssetManager.GetProfilePictureByID(user.id, (Action)delegate(Sprite sprite) { //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Transform transform = scoresbody.transform; Vector2 zero = Vector2.zero; Rect rect = sprite.rect; float width = ((Rect)(ref rect)).width; rect = sprite.rect; CustomButton val8 = GameObjectFactory.CreateCustomButton(transform, zero, new Vector2(width, ((Rect)(ref rect)).height), sprite, false, "Pfp", (Action)delegate { OpenUserProfile(TootTallyUser.userInfo.id); }); ((Component)val8).transform.SetSiblingIndex(0); }); if (Plugin.Instance.option.SessionStartTT.Value == 0f || Plugin.Instance.ShouldUpdateSession) { Plugin.Instance.ShouldUpdateSession = false; Plugin.Instance.option.SessionDate.Value = DateTime.Now.AddDays(1.0).ToString(CultureInfo.InvariantCulture); Plugin.Instance.option.SessionStartTT.Value = user.tt; } float num = user.tt - Plugin.Instance.option.SessionStartTT.Value; TMP_Text val6 = GameObjectFactory.CreateSingleText(mainPanel.transform, "NameLabel", $"{user.username} #{user.rank}", (TextFont)0); TMP_Text val7 = GameObjectFactory.CreateSingleText(mainPanel.transform, "TTLabel", string.Format("{0}tt ({1}{2:0.00}tt)", user.tt, (num > 0f) ? "+" : "", num), (TextFont)0); _profilePopupLoadingSwirly.Dispose(); _profilePictureRequest = null; }); ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)_profilePictureRequest); new SlideTooltip(val3, _profilePopup, new Vector2(525f, -300f), new Vector2(282f, -155f)); } catch (Exception ex) { Plugin.LogError(ex.Message); } } private void UpdateStarRating(LevelSelectController __instance) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_00f3: 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_0116: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); for (int i = 0; i < 10 && (Plugin.Instance.option.ShowLeaderboard.Value || i < __instance.alltrackslist[__instance.songindex].difficulty); i++) { if (!Theme.isDefault) { ((Graphic)__instance.diffstars[i]).color = Color.Lerp(Theme.colors.diffStar.gradientStart, Theme.colors.diffStar.gradientEnd, (float)i / 9f); } else { ((Graphic)__instance.diffstars[i]).color = Color.white; } if (Plugin.Instance.option.ShowLeaderboard.Value) { RectTransform component = ((Component)__instance.diffstars[i]).gameObject.GetComponent(); RectTransform component2 = ((Component)((Component)__instance.diffstars[i]).transform.parent).gameObject.GetComponent(); ((Vector2)(ref val))..ctor(0.5f, 0.5f); component.anchorMax = val; component.anchorMin = val; ((Vector2)(ref val))..ctor(0f, 0.5f); component2.anchorMax = val; component2.anchorMin = val; ((MaskableGraphic)__instance.diffstars[i]).maskable = true; } } float num; if (_songData != null) { num = _speedToDiffDict[(int)_gameSpeedSlider.value]; _diffRating.text = num.ToString("0.0"); } else { num = ((Chart)(ref DiffCalcGlobals.selectedChart)).GetDiffRating(TootTallyGlobalVariables.gameSpeedMultiplier); _diffRating.text = $"~{num:0.0}"; } int num2 = (int)Mathf.Clamp(num + 1f, 1f, 10f); int num3 = (int)Mathf.Clamp(num, 0f, 9f); _starMaskAnimation.SetStartVector(Vector2.op_Implicit(_diffRatingMaskRectangle.sizeDelta)); _starRatingMaskSizeTarget = new Vector2(EasingHelper.Lerp(_starSizeDeltaPositions[num2], _starSizeDeltaPositions[num3], (float)num2 - num), 30f); } public void UpdateLeaderboard(LevelSelectController __instance, List ___alltrackslist, Action callback) { _globalLeaderboard.SetActive(true); _ratedIcon.SetActive(false); _scrollableSliderHandler.ResetAcceleration(); _savedTrackref = ___alltrackslist[_levelSelectControllerInstance.songindex].trackref; TromboneTrack val = TrackLookup.lookup(_savedTrackref); _songHash = SongDataHelper.GetSongHash(val); if (_currentLeaderboardCoroutines.Count != 0) { CancelAndClearAllCoroutineInList(); } _songData = null; _scoreDataList = null; _currentLeaderboardCoroutines.Add(TootTallyAPIService.GetHashInDB(_songHash, val is CustomTrack, (Action)delegate(int songHashInDB) { if (songHashInDB == 0) { _errorText.text = "This chart is not uploaded to TootTally...\n Please upload the chart to TootTally.com\n or use TootBender on discord to create the leaderboard."; Plugin.LogInfo(" - " + DiffCalcGlobals.selectedChart.trackRef); if (DiffCalcGlobals.selectedChart.trackRef != "") { _diffRating.text = $"~{((Chart)(ref DiffCalcGlobals.selectedChart)).GetDiffRating(TootTallyGlobalVariables.gameSpeedMultiplier):0.0}"; } else { _diffRating.text = "NA"; } UpdateStarRating(__instance); callback(LeaderboardState.ErrorNoSongHashFound); } else { _currentSelectedSongHash = songHashInDB; _currentLeaderboardCoroutines.Add(TootTallyAPIService.GetSongDataFromDB(songHashInDB, (Action)delegate(SongDataFromDB songData) { if (songData != null) { OnSongInfoReceived(songData); } UpdateStarRating(__instance); if (_scoreDataList != null) { CancelAndClearAllCoroutineInList(); } })); ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)_currentLeaderboardCoroutines.Last()); _currentLeaderboardCoroutines.Add(TootTallyAPIService.GetLeaderboardScoresFromDB(songHashInDB, (Action>)delegate(List scoreDataList) { if (scoreDataList != null) { _scoreDataList = scoreDataList; _scrollableSliderHandler.accelerationMult = 8f / (float)_scoreDataList.Count; callback(LeaderboardState.ReadyToRefresh); } else { _errorText.text = "Could not find a leaderboard for this track.\n Be the first one to set a score on the track!"; callback(LeaderboardState.ErrorNoLeaderboardFound); } if (_songData != null) { CancelAndClearAllCoroutineInList(); } })); ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)_currentLeaderboardCoroutines.Last()); } })); ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)_currentLeaderboardCoroutines.Last()); } public void OnSongInfoReceived(SongDataFromDB songData) { _songData = songData; _speedToDiffDict.Clear(); _ratedIcon.SetActive(songData.is_rated); for (int i = 0; i <= 29; i++) { float num = (int)((float)i / 5f); float num2 = num * 0.25f + 0.5f; float num3 = (num + 1f) * 0.25f + 0.5f; float num4 = (float)i * 0.05f + 0.5f; float num5 = (num4 - num2) / (num3 - num2); float value = EasingHelper.Lerp(_songData.speed_diffs[(int)num], _songData.speed_diffs[(int)num + 1], num5); _speedToDiffDict.Add(i, value); } _speedToDiffDict.Add(30, _songData.speed_diffs.Last()); } public void ShowLoadingSwirly() { _loadingSwirly.Show(); } public void HideLoadingSwirly() { _loadingSwirly.Hide(); } public void RefreshLeaderboard() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) int num = 1; _localScoreId = -1; foreach (ScoreDataFromDB scoreData in _scoreDataList) { LeaderboardRowEntry leaderboardRowEntry = LeaderboardFactory.CreateLeaderboardRowEntryFromScore(_scoreboard.transform, "RowEntry" + scoreData.player, scoreData, num, gradeToColorDict[scoreData.grade], _levelSelectControllerInstance); _scoreGameObjectList.Add(leaderboardRowEntry); if (scoreData.player == TootTallyUser.userInfo.username) { ((Graphic)leaderboardRowEntry.imageStrip).color = Theme.colors.leaderboard.yourRowEntry; ((Component)leaderboardRowEntry.imageStrip).gameObject.SetActive(true); _localScoreId = num - 1; } num++; } if (_scoreGameObjectList.Count > 8) { _slider.value = 0f; _sliderHandle.GetComponent().anchoredPosition = new Vector2(-12f, 522f); ShowSlider(); } else { HideSlider(); } } public void StartLocalLeaderboardRoutine() { _currentLeaderboardCoroutines.Add(RefreshLeaderboardLocal()); ((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)_currentLeaderboardCoroutines.Last()); } public IEnumerator RefreshLeaderboardLocal() { ShowLoadingSwirly(); int count = 1; _localScoreId = -1; _tempAllReplayData.Clear(); List replayPathsFromSongHash = CachedReplays.GetReplayPathsFromSongHash(_songHash); string savedSongHash = _songHash; foreach (CachedReplays.CachedReplayData item2 in replayPathsFromSongHash) { if (_songHash != savedSongHash) { yield break; } if (!File.Exists(item2.filePath)) { Plugin.LogError("File " + item2.filePath + " didn't exist. Deleting from cache."); CachedReplays.DeleteReplayFromSongHash(item2); continue; } try { NewReplaySystem.ReplayData replayData = JsonConvert.DeserializeObject(FileHelper.ReadJsonFromFile("", item2.filePath)); float num = (float)replayData.finalscore / (float)DiffCalcGlobals.selectedChart.maxScore; float gamePercent = (float)replayData.finalscore / (float)DiffCalcGlobals.selectedChart.gameMaxScore; ScoreDataFromDB val = new ScoreDataFromDB(); val.grade = GetGradeFromLocalReplay(replayData.finalnotetallies, gamePercent); val.is_rated = _songData.is_rated; val.max_combo = replayData.maxcombo; val.modifiers = ((replayData.gamemodifiers.Length == 0 || replayData.gamemodifiers.ToUpper().Contains("NONE")) ? null : replayData.gamemodifiers.Split(new char[1] { ',' })); val.percentage = num * 100f; val.tt = GetTTFromLocalReplay(replayData, num); val.score = replayData.finalscore; val.replay_speed = replayData.gamespeedmultiplier; val.perfect = replayData.finalnotetallies[0]; val.nice = replayData.finalnotetallies[1]; val.okay = replayData.finalnotetallies[2]; val.meh = replayData.finalnotetallies[3]; val.nasty = replayData.finalnotetallies[4]; val.missed_gaps = replayData.notedata.Count((dynamic[] x) => x[1] == 0); val.game_version = replayData.gameversion; val.replay_id = replayData.uuid; val.player = replayData.username; val.played_on = ""; val.player_id = 1; ScoreDataFromDB item = val; _tempAllReplayData.Add(item); } catch (Exception) { Plugin.LogError("Couldn't parse replay " + item2.filePath + "."); CachedReplays.DeleteReplayFromSongHash(item2); } yield return null; } HideLoadingSwirly(); foreach (ScoreDataFromDB item3 in _tempAllReplayData.OrderByDescending((ScoreDataFromDB r) => r.tt)) { if (!(_songHash != savedSongHash)) { LeaderboardRowEntry leaderboardRowEntry = LeaderboardFactory.CreateLeaderboardRowEntryFromScore(_scoreboard.transform, "RowEntry" + item3.player, item3, count, gradeToColorDict[item3.grade], _levelSelectControllerInstance); _scoreGameObjectList.Add(leaderboardRowEntry); if (item3.player == TootTallyUser.userInfo.username) { ((Graphic)leaderboardRowEntry.imageStrip).color = Theme.colors.leaderboard.yourRowEntry; ((Component)leaderboardRowEntry.imageStrip).gameObject.SetActive(true); _localScoreId = count - 1; } count++; yield return null; continue; } yield break; } if (_scoreGameObjectList.Count > 8) { _slider.value = 0f; _sliderHandle.GetComponent().anchoredPosition = new Vector2(-12f, 522f); ShowSlider(); } else { HideSlider(); } } public float GetTTFromLocalReplay(NewReplaySystem.ReplayData data, float percent) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Utils.CalculateScoreTT(DiffCalcGlobals.selectedChart, data.gamespeedmultiplier, data.finalnotetallies[0] + data.finalnotetallies[1], data.finalnotetallies.Sum(), percent, data.gamemodifiers.Split(new char[1] { ',' })); } public string GetGradeFromLocalReplay(int[] tally, float gamePercent) { int noteCount = ((Chart)(ref DiffCalcGlobals.selectedChart)).GetNoteCount(); if (tally[0] >= noteCount) { return "SSS"; } if (tally[4] + tally[3] + tally[2] == 0) { return "SS"; } if (gamePercent >= 1f) { return "S"; } if (gamePercent >= 0.8f) { return "A"; } if (gamePercent >= 0.6f) { return "B"; } if (gamePercent >= 0.4f) { return "C"; } if (gamePercent >= 0.2f) { return "D"; } return "F"; } public void SetOnSliderValueChangeEvent() { ((UnityEvent)(object)_slider.onValueChanged).AddListener((UnityAction)delegate(float _value) { //IL_004a: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) _slider.value = Mathf.Clamp(_value, 0f, 1f); foreach (LeaderboardRowEntry scoreGameObject in _scoreGameObjectList) { RectTransform component = _sliderHandle.GetComponent(); float num = (0f - ((Component)_slider).GetComponent().sizeDelta.x) / 2f; float num2 = ((Component)_slider).GetComponent().sizeDelta.y / 1.38f; Rect rect = _slider.fillRect.rect; component.anchoredPosition = new Vector2(num, num2 - ((Rect)(ref rect)).height); RectTransform component2 = scoreGameObject.singleScore.GetComponent(); component2.anchoredPosition = new Vector2(component2.anchoredPosition.x, (float)((scoreGameObject.rowId - 1) * -35) + _slider.value * 35f * (float)(_scoreGameObjectList.Count - 8) - 17f); if (component2.anchoredPosition.y >= -15f) { ((Component)scoreGameObject).GetComponent().alpha = Math.Max(1f - (component2.anchoredPosition.y + 15f) / 35f, 0f); } else if (component2.anchoredPosition.y - 35f <= 295f) { ((Component)scoreGameObject).GetComponent().alpha = Math.Max((component2.anchoredPosition.y + 280f + 15f) / 35f, 0f); } else { ((Component)scoreGameObject).GetComponent().alpha = 1f; } } }); } public void UpdateStarRatingAnimation() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) _diffRatingMaskRectangle.sizeDelta = Vector2.op_Implicit(_starMaskAnimation.GetNewVector(Vector2.op_Implicit(_starRatingMaskSizeTarget), Time.deltaTime)); } public bool IsScrollingEnabled() { return ((Behaviour)_scrollableSliderHandler).enabled; } public void ClearLeaderboard() { _scoreGameObjectList.ForEach(delegate(LeaderboardRowEntry score) { Object.DestroyImmediate((Object)(object)score.singleScore); }); _scoreGameObjectList.Clear(); } public void CancelProfilePictureRequest() { if (_profilePictureRequest != null) { ((MonoBehaviour)Plugin.Instance).StopCoroutine((IEnumerator)_profilePictureRequest); } } public void CancelAndClearAllCoroutineInList() { if (_currentLeaderboardCoroutines.Count > 0) { Plugin.LogInfo($"Stopping {_currentLeaderboardCoroutines.Count} leaderboard coroutines."); _currentLeaderboardCoroutines.ForEach((Action>)((MonoBehaviour)Plugin.Instance).StopCoroutine); _currentLeaderboardCoroutines.Clear(); } } public void CancelCoroutineInList(IEnumerator c) { if (_currentLeaderboardCoroutines.Contains(c)) { ((MonoBehaviour)Plugin.Instance).StopCoroutine((IEnumerator)c); _currentLeaderboardCoroutines.Remove(c); } } public void ShowSlider() { ((Component)_slider).gameObject.SetActive(true); } public void HideSlider() { ((Component)_slider).gameObject.SetActive(false); } public void ShowErrorText() { _errorsHolder.SetActive(true); } public void HideErrorText() { _errorsHolder.SetActive(false); } public static void OpenUserProfile(int id) { Application.OpenURL($"https://toottally.com/profile/{id}"); } public static void OpenLoginPage() { Application.OpenURL("https://toottally.com/login"); } public void OpenSongLeaderboard() { Application.OpenURL("https://toottally.com/song/" + _currentSelectedSongHash); } public void OpenSongFolder() { string text = ((_savedTrackref != null) ? _savedTrackref : DiffCalcGlobals.selectedChart.trackRef); TromboneTrack val = TrackLookup.lookup(text); if (val != null) { CustomTrack val2 = (CustomTrack)(object)((val is CustomTrack) ? val : null); string text2 = ((val2 == null) ? (Application.streamingAssetsPath + "/trackassets/" + val.trackref) : val2.folderPath); if (Directory.Exists(text2)) { Process.Start(text2); } else { TootTallyNotifManager.DisplayNotif("Folder couldn't be found.", 6f); } } } public void ScrollToLocalScore() { if (_localScoreId == -1) { TootTallyNotifManager.DisplayNotif("You don't have a score on that leaderboard yet", 6f); } else if (_scoreGameObjectList.Count > 8) { _slider.value = (float)_localScoreId / ((float)_scoreGameObjectList.Count - 8f); ((UnityEvent)(object)_slider.onValueChanged).Invoke(_slider.value); } } private void SetTabsImages() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 3; i++) { GameObject val = _globalLeaderboard.GetComponent().tabs[i]; Button componentInChildren = val.GetComponentInChildren