using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; 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 System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using IL.RoR2; using LeTai.Asset.TranslucentImage; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using On.RoR2; using On.RoR2.UI; using ProperSave; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.Stats; using RoR2.UI; using StatsMod.CustomStats; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("StatsMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+07d5a8f83bef9a0cad0e86fb584eb1a02f3d90db")] [assembly: AssemblyProduct("StatsMod")] [assembly: AssemblyTitle("StatsMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 StatsMod { public static class Assets { public static AssetBundle assetBundle = null; internal static string assetBundleName = "statsmodassets"; internal static string assemblyDir => Path.GetDirectoryName(StatsMod.pluginInfo.Location); public static void Init() { assetBundle = AssetBundle.LoadFromFile(Path.Combine(assemblyDir, assetBundleName)); } } public class GraphHandler : MonoBehaviour { public enum MouseActionType { Move, SelectAreaToZoom, SelectPoints } public enum RectangleType { Free, PreserveAspectRatio, OriginalAspectRatio } public enum RectangleSelectionType { SelectAll, SelectUnselect } public enum RectangleSelectionPhase { Moving, Release } public enum PointSelectionType { Select, FixZoomPoint } [Flags] public enum UpdateMethod { UpdatePositionAndScale = 1, UpdateOutlines = 2, UpdatePointVisuals = 4, UpdateContent = 8, MouseZoom = 0x10, MouseAction = 0x20, UpdateGridLines = 0x40, All = 0x80 } public bool updateGraph = true; private GraphSettings GS; [SerializeField] private Canvas canvas; private RectTransform graph; private RectTransform graphContent; private Vector2 contentScale = Vector2.zero; private List values; private List trueYvalues; private List sortedIndices; private Vector2Int xAxisRange = new Vector2Int(-1, -1); private Vector2Int prevXAxisRange = new Vector2Int(-1, -1); public int activePointIndex = -1; private Vector2 activePointValue = Vector2.zero; private bool pointIsActive = false; private List points; private List pointImages; private List pointRects; private List pointOutlines; private List pointOutlineRects; private List pointOutlineImages; private List lines; private List lineRects; private List lineImages; private List xGridRects; private List xGridImages; private List xAxisTexts; private List xAxisTextRects; private List yGridRects; private List yGridImages; private List yAxisTexts; private List yAxisTextRects; private RectTransform zoomSelectionRectTransform; private Image zoomSelectionImage; private List zoomSelectionOutlines; private List zoomSelectionOutlineImages; private RectTransform pointSelectionRectTransform; private Image pointSelectionImage; private List pointSelectionOutlines; private List pointSelectionOutlineImages; private RectTransform maskObj; private Image backgroundImage; private RectTransform backgroundRect; private GameObject pointParent; private GameObject lineParent; private GameObject gridParent; private GameObject outlineParent; private List outlines; private List outlineImages; private List lockedHoveredPoints; private List lockedPoints; private List fixedHoveredPoints; public int fixedPointIndex = -1; private Vector2 contentOffset = Vector2.zero; private Vector2 bottomLeft; private Vector2 topRight; private Vector2 center; public MouseActionType mouseActionType; public RectangleType rectangleType; public RectangleSelectionType rectangleSelectionType; public RectangleSelectionPhase rectangleSelectionPhase; public PointSelectionType pointSelectionType; private List initialLockedPoints; private List recentlyLockedPoints; private bool mouseInsideBounds = false; private Vector2 mousePos; private Vector2 previousMousePos; private Vector2 initialMousePos = Vector2.zero; private bool initialMouseInsideBounds = false; private Vector2 _zoomPoint = Vector2.zero; private Vector2 _absoluteZoomPoint = Vector2.zero; private Vector2 _targetZoom = new Vector2(1f, 1f); private Vector2 zoom = new Vector2(1f, 1f); private Vector2 moveOffset; public Vector2 _targetMoveOffset; private Vector2 initialMoveOffset = Vector2.zero; private float timeToUpdateMouse = 0f; private float timeToUpdateTouch = 0f; private float timeToUpdateScroll = 0f; private bool error; private bool currentPlotIsLog = false; public readonly int logBase = 2; private float c = 1f; private bool rightBorderReached; private bool topBorderReached; private bool bottomBorderReached; private bool leftBorderReached; public List Values => values; public Vector2Int XAxisRange => xAxisRange; public Vector2 ActivePointValue => activePointValue; public Vector2 BottomLeft => bottomLeft; public Vector2 TopRight => topRight; public Vector2 Center => center; private Vector2 zoomPoint { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return _zoomPoint; } set { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (IsWithinBounds(zoom, absoluteZoomPoint, value, moveOffset)) { _zoomPoint = value; } } } private Vector2 absoluteZoomPoint { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return _absoluteZoomPoint; } set { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (IsWithinBounds(zoom, value, zoomPoint, moveOffset)) { _absoluteZoomPoint = value; } } } public Vector2 targetZoom { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return _targetZoom; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (IsWithinBounds(value, absoluteZoomPoint, zoomPoint, moveOffset)) { _targetZoom = value; } } } public Vector2 targetMoveOffset { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return _targetMoveOffset; } set { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (IsWithinBounds(zoom, absoluteZoomPoint, zoomPoint, value)) { _targetMoveOffset = value; } } } public void CreatePoint(Vector2 newValue, bool shouldCreateLine = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreatePointInternal(newValue, shouldCreateLine); } public void ChangePoint(int indexToChange, Vector2 newValue) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ChangePointInternal(indexToChange, newValue); } public void SetCornerValues(Vector2 newBottomLeft, Vector2 newTopRight) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetCornerValuesInternal(newBottomLeft, newTopRight); } public void UpdateGraph() { UpdateGraphInternal(UpdateMethod.All); } public void PlotStat(string statName, int index, bool isLog = false) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) ResetGraph(); UpdateGraph(); UpdateContent(); float num = -5f; float num2 = 5f; currentPlotIsLog = isLog; StatsScreen.ChangePlotTitle(statName); List statSeries = RecordHandler.independentDatabase[0].GetStatSeries("timestamps"); if (index >= 0) { Color lineColor = GraphSettings.Rainbow((float)index / (float)RecordHandler.independentDatabase.Count); GS.LineColor = lineColor; List statSeries2 = RecordHandler.independentDatabase[index].GetStatSeries(statName); float[] array = new float[statSeries2.Count]; if (currentPlotIsLog) { for (int i = 0; i < statSeries.Count; i++) { array[i] = Convert.ToSingle(PlayerStatsDatabase.Numberise(statSeries2[i])); } c = median(array); if (c == 0f) { currentPlotIsLog = false; Log.Info("median of dataset is 0, aborting log transform"); } } for (int j = 0; j < statSeries.Count; j++) { float num3 = Convert.ToSingle(statSeries[j]); float num4 = Convert.ToSingle(PlayerStatsDatabase.Numberise(statSeries2[j])); trueYvalues.Add(num4); if (num4.ToString() == "Infinity") { num4 = -1f; } if (currentPlotIsLog && num4 > 0f - c) { num4 = (float)Math.Log(1f + num4 / c, logBase); } CreatePoint(new Vector2(num3, num4)); if (num4 < num) { num = num4; } else if (num4 > num2) { num2 = num4; } } } else if (index == -1) { int num5 = 0; foreach (IndependentEntry item in RecordHandler.independentDatabase) { Color lineColor2 = GraphSettings.Rainbow((float)num5 / (float)RecordHandler.independentDatabase.Count); GS.LineColor = lineColor2; List statSeries3 = item.GetStatSeries(statName); if (num5 == 0 && currentPlotIsLog) { float[] array2 = new float[statSeries3.Count]; for (int k = 0; k < statSeries.Count; k++) { array2[k] = Convert.ToSingle(PlayerStatsDatabase.Numberise(statSeries3[k])); } c = median(array2); if (c == 0f) { currentPlotIsLog = false; Log.Info("median of dataset is 0, aborting log transform"); } } for (int l = 0; l < statSeries.Count; l++) { float num6 = Convert.ToSingle(statSeries[l]); float num7 = Convert.ToSingle(PlayerStatsDatabase.Numberise(statSeries3[l])); trueYvalues.Add(num7); if (num7.ToString() == "Infinity") { num7 = -1f; } if (currentPlotIsLog && num7 > 0f - c) { num7 = (float)Math.Log(1f + num7 / c, logBase); } if (l == 0) { GS.LineColor = Color.clear; } CreatePoint(new Vector2(num6, num7)); GS.LineColor = lineColor2; if (num7 < num) { num = num7; } else if (num7 > num2) { num2 = num7; } } num5++; } } float num8 = Convert.ToSingle(statSeries[statSeries.Count - 1]) * 0.05f; float num9 = math.max(math.abs(num), math.abs(num2)) * 0.05f; SetCornerValues(new Vector2(0f - num8, num - num9), new Vector2(Convert.ToSingle(statSeries[statSeries.Count - 1]) + num8, num2 + num9)); absoluteZoomPoint = Vector2.zero; UpdateGraph(); SetCornerValues(new Vector2(0f - num8, num - num9), new Vector2(Convert.ToSingle(statSeries[statSeries.Count - 1]) + num8, num2 + num9)); UpdateGraph(); } public static float median(float[] data) { if (data == null || data.Length == 0) { throw new ArgumentException("I'm coming for you"); } float[] array = (float[])data.Clone(); Array.Sort(array); int num = array.Length; if (num % 2 == 1) { return array[num / 2]; } return 0.5f * (array[num / 2 - 1] + array[num / 2]); } private void ResetGraph() { Object.Destroy((Object)(object)((Component)maskObj).gameObject); Object.Destroy((Object)(object)outlineParent.gameObject); AwakeWOHook(); Start(); } private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ResolutionConVar.SetString += new hook_SetString(ResizeGraph); AwakeWOHook(); } private void AwakeWOHook() { values = new List(); trueYvalues = new List(); sortedIndices = new List(); points = new List(); pointRects = new List(); pointImages = new List(); pointOutlines = new List(); pointOutlineRects = new List(); pointOutlineImages = new List(); lines = new List(); lineRects = new List(); lineImages = new List(); xGridRects = new List(); xGridImages = new List(); yGridRects = new List(); yGridImages = new List(); xAxisTexts = new List(); yAxisTexts = new List(); xAxisTextRects = new List(); yAxisTextRects = new List(); zoomSelectionOutlines = new List(); zoomSelectionOutlineImages = new List(); pointSelectionOutlines = new List(); pointSelectionOutlineImages = new List(); outlines = new List(); outlineImages = new List(); lockedHoveredPoints = new List(); lockedPoints = new List(); initialLockedPoints = new List(); recentlyLockedPoints = new List(); fixedHoveredPoints = new List(); } private void ResizeGraph(orig_SetString orig, ResolutionConVar self, string newValue) { //IL_004d: 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_0073: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, newValue); if ((Object)(object)graph != (Object)null) { string[] array = newValue.Split('x'); int num = int.Parse(array[0]); int num2 = int.Parse(array[1]); GS.GraphSize = new Vector2(0.5208f * (float)num, 0.7037f * (float)num2); ((Transform)graph).localPosition = Vector2.op_Implicit(new Vector2(0.1302f * (float)num, 0.0212f * (float)num2)); UpdateOutlines(); } } private bool IsWithinBounds(Vector2 zoom, Vector2 absoluteZoomPoint, Vector2 zoomPoint, Vector2 moveOffset) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) Vector2 val = GS.GraphScale * zoom; Vector2 val2 = absoluteZoomPoint - zoomPoint * val - moveOffset; Vector2 val3 = -val2 / val; Vector2 val4 = val3 + GS.GraphSize / val; rightBorderReached = val4.x > float.MaxValue || float.IsNaN(val4.x); topBorderReached = val4.y > float.MaxValue || float.IsNaN(val4.y); bottomBorderReached = val3.x < float.MinValue || float.IsNaN(val3.x); leftBorderReached = val3.y < float.MinValue || float.IsNaN(val3.y); if (rightBorderReached || topBorderReached || bottomBorderReached || leftBorderReached) { return false; } return true; } private bool IsSizeableDif() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Vector2 val = GS.GraphScale * targetZoom; Vector2 val2 = absoluteZoomPoint - zoomPoint * val - targetMoveOffset; Vector2 val3 = -val2 / val; Vector2 val4 = val3 + GS.GraphSize / val; Vector2 val5 = TopRight - val4; if (!(((Vector2)(ref val5)).magnitude > 1E+11f)) { val5 = BottomLeft - val3; if (!(((Vector2)(ref val5)).magnitude > 1E+11f)) { return false; } } return true; } private void OnDestroy() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ResolutionConVar.SetString -= new hook_SetString(ResizeGraph); } private void Start() { if (!CheckForErrors()) { GS = ((Component)this).GetComponent(); PrepareGraph(); } } private void Update() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey((KeyCode)304)) { mouseActionType = MouseActionType.SelectAreaToZoom; } else if (Input.GetKey((KeyCode)306)) { mouseActionType = MouseActionType.SelectPoints; } else { mouseActionType = MouseActionType.Move; } if (!error) { CheckIfUpdateGraph(); if (updateGraph) { UpdateGraphInternal(UpdateMethod.All); } if (lockedHoveredPoints.Count > 0) { UpdatePoints(); } if (fixedHoveredPoints.Count > 0) { UpdatePointOutlines(); } zoom = Vector2.Lerp(zoom, targetZoom, GS.SmoothZoomSpeed * Time.deltaTime); moveOffset = Vector2.Lerp(moveOffset, targetMoveOffset, GS.SmoothMoveSpeed * Time.deltaTime); if (IsSizeableDif()) { zoom = targetZoom; moveOffset = targetMoveOffset; } } } private void PrepareGraph() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00f2: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)canvas == (Object)null) { canvas = new GameObject("GraphCanvas").AddComponent(); ((Component)canvas).gameObject.SetActive(false); canvas.renderMode = (RenderMode)0; ((Component)canvas).gameObject.AddComponent(); } if ((Object)(object)((Component)this).GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } graph = ((Component)this).gameObject.GetComponent(); ((Transform)graph).SetParent(((Component)canvas).transform); graph.anchoredPosition = Vector2.zero; graph.sizeDelta = GS.GraphSize; RectTransform obj = graph; Vector3 localPosition = (((Transform)graph).localPosition = Vector2.op_Implicit(new Vector2(0.1302f * (float)Screen.width, 0.0212f * (float)Screen.height))); ((Transform)obj).localPosition = localPosition; maskObj = new GameObject("MaskObj").AddComponent(); ((Transform)maskObj).SetParent((Transform)(object)graph); maskObj.anchoredPosition = Vector2.zero; ((Component)maskObj).gameObject.AddComponent(); Mask val2 = ((Component)maskObj).gameObject.AddComponent(); val2.showMaskGraphic = false; backgroundRect = new GameObject("Background").AddComponent(); ((Transform)backgroundRect).SetParent((Transform)(object)maskObj); backgroundRect.anchoredPosition = Vector2.zero; backgroundImage = ((Component)backgroundRect).gameObject.AddComponent(); graphContent = new GameObject("GraphContent").AddComponent(); ((Transform)graphContent).SetParent(((Component)backgroundRect).transform); graphContent.sizeDelta = Vector2.zero; gridParent = CreateParent("GridParent"); lineParent = CreateParent("LineParent"); pointParent = CreateParent("PointParent"); outlineParent = CreateParent("OutlineParent"); CreateOutlines(); outlineParent.transform.SetParent((Transform)(object)graph); fixedPointIndex = -1; CreateselectionTypes(); UpdateGraphInternal(UpdateMethod.All); } private GameObject CreateParent(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent((Transform)(object)((name == "OutlineParent") ? graph : graphContent)); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0f); ((Graphic)val2).raycastTarget = false; val.GetComponent().anchoredPosition = Vector2.zero; return val; } private void CreateOutlines() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 4; i++) { Image val = new GameObject("Outline").AddComponent(); RectTransform component = ((Component)val).GetComponent(); ((Transform)component).SetParent(outlineParent.transform); ((Graphic)val).color = GS.OutlineColor; ((Graphic)val).raycastTarget = false; outlines.Add(component); outlineImages.Add(val); } } private void CreatePointInternal(Vector2 value, bool shouldCreateLine = true) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_005a: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) int i = points.Count; GameObject val = CreatePointOutline(i); GameObject val2 = new GameObject("Point" + i); points.Add(val2); values.Add(value); val2.transform.SetParent(val.transform); Image val3 = val2.AddComponent(); ((Graphic)val3).color = GS.PointColor; pointImages.Add(val3); RectTransform component = val2.GetComponent(); component.sizeDelta = Vector2.one * GS.PointRadius; pointRects.Add(component); val3.sprite = GS.PointSprite; EventTrigger val4 = val2.AddComponent(); var array = new[] { new { Type = (EventTriggerType)0, Callback = (Action)delegate { MouseTrigger(i, enter: true); } }, new { Type = (EventTriggerType)1, Callback = (Action)delegate { MouseTrigger(i, enter: false); } }, new { Type = (EventTriggerType)4, Callback = (Action)delegate { PointClicked(i); } } }; var array2 = array; foreach (var eventType in array2) { Entry val5 = new Entry { eventID = eventType.Type }; ((UnityEvent)(object)val5.callback).AddListener((UnityAction)delegate { eventType.Callback(); }); val4.triggers.Add(val5); } if (points.Count > 1 && shouldCreateLine) { GameObject val6 = new GameObject("Line"); val6.transform.SetParent(lineParent.transform); lineImages.Add(val6.AddComponent()); ((Graphic)val6.GetComponent()).color = GS.LineColor; lineRects.Add(val6.GetComponent()); lines.Add(val6); if (value.x < bottomLeft.x || value.x > topRight.x) { val6.SetActive(false); } } lockedHoveredPoints.Add(i); SortIndices(); if (value.x < bottomLeft.x || value.x > topRight.x) { val.SetActive(false); } } private void ChangePointInternal(int index, Vector2 newValue) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) values[index] = newValue; SortIndices(); } private void SortIndices() { sortedIndices = (from item in values.Select((Vector2 vector, int index) => new { vector, index }) orderby item.vector.x, item.vector.y select item.index).ToList(); } private GameObject CreatePointOutline(int i) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_005e: 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) GameObject val = new GameObject("PointOutline" + i); pointOutlines.Add(val); if ((Object)(object)pointParent != (Object)null) { val.transform.SetParent(pointParent.transform); } Image val2 = val.AddComponent(); ((Graphic)val2).color = GS.PointColor; pointOutlineImages.Add(val2); RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(GS.PointRadius, GS.PointRadius); pointOutlineRects.Add(component); Sprite pointSprite = GS.PointSprite; val2.sprite = pointSprite; return val; } private void CreateGridLines(bool createX) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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) if (createX) { GameObject val = new GameObject("xGrid" + xGridRects.Count); val.transform.SetParent(gridParent.transform); Image val2 = val.AddComponent(); ((Graphic)val2).raycastTarget = false; xGridRects.Add(val.GetComponent()); xGridImages.Add(val2); if (xGridRects.Count > 1) { TextMeshProUGUI val3 = new GameObject("xText" + xGridRects.Count).AddComponent(); RectTransform component = ((Component)val3).gameObject.GetComponent(); ((Transform)component).SetParent((Transform)(object)val.GetComponent()); ((TMP_Text)val3).font = GS.GridTextFont; ((TMP_Text)val3).fontStyle = (FontStyles)1; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((TMP_Text)val3).verticalAlignment = (VerticalAlignmentOptions)512; ((Graphic)val3).color = GS.XAxisTextColor; ((TMP_Text)val3).enableAutoSizing = true; component.sizeDelta = Vector2.one * GS.XAxisTextSize; ((Graphic)val3).raycastTarget = false; xAxisTexts.Add(val3); xAxisTextRects.Add(component); } } else { GameObject val4 = new GameObject("yGrid" + yGridRects.Count); val4.transform.SetParent(gridParent.transform); Image val5 = val4.AddComponent(); ((Graphic)val5).raycastTarget = false; yGridRects.Add(val4.GetComponent()); yGridImages.Add(val5); if (yGridRects.Count > 1) { TextMeshProUGUI val6 = new GameObject("yText" + yGridRects.Count).AddComponent(); RectTransform component2 = ((Component)val6).gameObject.GetComponent(); ((Transform)component2).SetParent((Transform)(object)val4.GetComponent()); ((TMP_Text)val6).font = GS.GridTextFont; ((TMP_Text)val6).fontStyle = (FontStyles)1; ((TMP_Text)val6).alignment = (TextAlignmentOptions)514; ((TMP_Text)val6).verticalAlignment = (VerticalAlignmentOptions)512; ((Graphic)val6).color = GS.YAxisTextColor; ((TMP_Text)val6).enableAutoSizing = true; component2.sizeDelta = Vector2.one * GS.YAxisTextSize; ((Graphic)val6).raycastTarget = false; yAxisTexts.Add(val6); yAxisTextRects.Add(component2); } } } private void CreateselectionTypes() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0118: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SelectionParent"); val.transform.SetParent((Transform)(object)graphContent); val.AddComponent().anchoredPosition = new Vector2(0f, 0f); zoomSelectionImage = new GameObject("ZoomSelection").AddComponent(); zoomSelectionRectTransform = ((Component)zoomSelectionImage).GetComponent(); ((Transform)zoomSelectionRectTransform).SetParent(val.transform); for (int i = 0; i < 4; i++) { Image val2 = new GameObject("Outline").AddComponent(); RectTransform component = ((Component)val2).GetComponent(); ((Transform)component).SetParent((Transform)(object)zoomSelectionRectTransform); zoomSelectionOutlineImages.Add(val2); zoomSelectionOutlines.Add(component); } ((Component)zoomSelectionRectTransform).gameObject.SetActive(false); pointSelectionImage = new GameObject("PointSelection").AddComponent(); pointSelectionRectTransform = ((Component)pointSelectionImage).GetComponent(); ((Transform)pointSelectionRectTransform).SetParent(val.transform); for (int j = 0; j < 4; j++) { Image val3 = new GameObject("Outline").AddComponent(); RectTransform component2 = ((Component)val3).GetComponent(); ((Transform)component2).SetParent((Transform)(object)pointSelectionRectTransform); pointSelectionOutlineImages.Add(val3); pointSelectionOutlines.Add(component2); } ((Component)pointSelectionRectTransform).gameObject.SetActive(false); } private void CheckIfUpdateGraph() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) CalculateMousePosition(); if (mouseInsideBounds) { if (Input.GetMouseButtonDown(0) || Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) { timeToUpdateMouse = GS.updatePeriod; } if (Input.touchCount > 0) { timeToUpdateTouch = GS.updatePeriod; } if (Input.mouseScrollDelta.y != 0f) { timeToUpdateScroll = GS.updatePeriod; } } if (timeToUpdateMouse > 0f) { UpdateGraphInternal(UpdateMethod.UpdatePositionAndScale | UpdateMethod.UpdatePointVisuals | UpdateMethod.UpdateContent | UpdateMethod.MouseAction | UpdateMethod.UpdateGridLines); } if (timeToUpdateTouch > 0f) { UpdateGraphInternal(UpdateMethod.UpdatePositionAndScale | UpdateMethod.UpdatePointVisuals | UpdateMethod.UpdateContent | UpdateMethod.MouseZoom | UpdateMethod.MouseAction | UpdateMethod.UpdateGridLines); } if (timeToUpdateScroll > 0f) { UpdateGraphInternal(UpdateMethod.UpdatePositionAndScale | UpdateMethod.UpdatePointVisuals | UpdateMethod.UpdateContent | UpdateMethod.MouseZoom | UpdateMethod.UpdateGridLines); } timeToUpdateMouse -= Time.deltaTime; timeToUpdateTouch -= Time.deltaTime; timeToUpdateScroll -= Time.deltaTime; } public void UpdateGraphInternal(UpdateMethod methodsToUpdate) { if (methodsToUpdate.HasFlag(UpdateMethod.UpdatePositionAndScale) || methodsToUpdate.HasFlag(UpdateMethod.All)) { UpdatePositionAndScale(); } CalculateCornerValues(); if (methodsToUpdate.HasFlag(UpdateMethod.UpdateOutlines) || methodsToUpdate.HasFlag(UpdateMethod.All)) { UpdateOutlines(); } if (methodsToUpdate.HasFlag(UpdateMethod.UpdateContent) || methodsToUpdate.HasFlag(UpdateMethod.All)) { HandleActiveObjects(); } if (methodsToUpdate.HasFlag(UpdateMethod.UpdatePointVisuals) || methodsToUpdate.HasFlag(UpdateMethod.All)) { UpdatePointVisuals(); } if (methodsToUpdate.HasFlag(UpdateMethod.UpdateContent) || methodsToUpdate.HasFlag(UpdateMethod.All)) { UpdateContent(); } CalculateMousePosition(); if (methodsToUpdate.HasFlag(UpdateMethod.MouseZoom) || methodsToUpdate.HasFlag(UpdateMethod.All)) { MouseZoom(); } if (methodsToUpdate.HasFlag(UpdateMethod.MouseAction) || methodsToUpdate.HasFlag(UpdateMethod.All)) { MouseAction(); } if (methodsToUpdate.HasFlag(UpdateMethod.UpdateGridLines) || methodsToUpdate.HasFlag(UpdateMethod.All)) { UpdateGridLines(); } } private void UpdatePositionAndScale() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) contentScale = GS.GraphScale * zoom; maskObj.sizeDelta = GS.GraphSize; contentOffset = absoluteZoomPoint - zoomPoint * contentScale - moveOffset; graphContent.anchoredPosition = -GS.GraphSize / 2f + contentOffset; graph.sizeDelta = GS.GraphSize; backgroundRect.sizeDelta = GS.GraphSize; ((Graphic)backgroundImage).color = GS.BackgroundColor; } private void UpdateOutlines() { //IL_00bb: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < outlines.Count; i++) { if (i % 2 == 0) { outlines[i].sizeDelta = new Vector2(GS.OutlineWidth, GS.GraphSize.y + GS.OutlineWidth * 2f); outlines[i].anchoredPosition = new Vector2((float)((i != 0) ? 1 : (-1)) * (GS.GraphSize.x + GS.OutlineWidth) / 2f, 0f); } else { outlines[i].sizeDelta = new Vector2(GS.GraphSize.x + GS.OutlineWidth * 2f, GS.OutlineWidth); outlines[i].anchoredPosition = new Vector2(0f, (float)((i != 1) ? 1 : (-1)) * (GS.GraphSize.y + GS.OutlineWidth) / 2f); } } } private void CalculateCornerValues() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) topRight = new Vector2(Mathf.Clamp(topRight.x, bottomLeft.x, float.PositiveInfinity), Mathf.Clamp(topRight.y, bottomLeft.y, float.PositiveInfinity)); bottomLeft = -contentOffset / contentScale; topRight = bottomLeft + GS.GraphSize / contentScale; center = (topRight - bottomLeft) / 2f + bottomLeft; } private void UpdateContent() { //IL_0090: 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_00e0: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0120: 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) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) if (((Vector2Int)(ref xAxisRange)).x == -1 || ((Vector2Int)(ref xAxisRange)).y == -1) { return; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(bottomLeft.y, topRight.y); for (int i = ((Vector2Int)(ref xAxisRange)).x - 1; i <= ((Vector2Int)(ref xAxisRange)).y + 1; i++) { if (i < 0 || i > sortedIndices.Count - 1) { continue; } int num = sortedIndices[i]; float y = values[num].y; float y2 = values[Mathf.Clamp(num - 1, 0, values.Count - 1)].y; float y3 = values[Mathf.Clamp(num + 1, 0, values.Count - 1)].y; if ((!(y < val.x) || !(y2 < val.x) || !(y3 < val.x)) && (!(y > val.y) || !(y2 > val.y) || !(y3 > val.y))) { UpdateAnchoredPosition(pointOutlineRects[i], CalculatePosition(i)); if (lines.Count > 0 && num < lines.Count) { Vector2 val2 = CalculatePosition(num); Vector2 val3 = CalculatePosition(num + 1); float num2 = Vector2.Distance(val2, val3); UpdateAnchoredPosition(lineRects[num], (val3 + val2) / 2f); UpdateSizeDelta(lineRects[num], new Vector2(num2, GS.LineWidth)); Vector2 val4 = val3 - val2; float num3 = Mathf.Atan2(val4.y, val4.x) * 57.29578f; ((Transform)lineRects[num]).rotation = Quaternion.AngleAxis(num3, Vector3.forward); } } } } private void HandleActiveObjects() { //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) try { if (((Vector2Int)(ref prevXAxisRange)).x < ((Vector2Int)(ref xAxisRange)).x) { for (int i = ((Vector2Int)(ref prevXAxisRange)).x - 1; i < ((Vector2Int)(ref xAxisRange)).x - 1; i++) { if (i >= 0) { pointOutlines[sortedIndices[i]].SetActive(false); if (i < lines.Count) { lines[sortedIndices[i]].SetActive(false); } } } } else if (((Vector2Int)(ref prevXAxisRange)).x > ((Vector2Int)(ref xAxisRange)).x && ((Vector2Int)(ref xAxisRange)).x >= 0) { for (int j = ((Vector2Int)(ref xAxisRange)).x - 1; j < ((Vector2Int)(ref prevXAxisRange)).x; j++) { if (j >= 0) { pointOutlines[sortedIndices[j]].SetActive(true); if (j < lines.Count) { lines[sortedIndices[j]].SetActive(true); } } } } if (((Vector2Int)(ref prevXAxisRange)).y > ((Vector2Int)(ref xAxisRange)).y) { for (int k = ((Vector2Int)(ref xAxisRange)).y + 2; k <= ((Vector2Int)(ref prevXAxisRange)).y + 2; k++) { if (k <= pointOutlines.Count - 1 && k >= 0) { pointOutlines[sortedIndices[k]].SetActive(false); if (k < lines.Count) { lines[sortedIndices[k]].SetActive(false); } } } } else if (((Vector2Int)(ref xAxisRange)).y > ((Vector2Int)(ref prevXAxisRange)).y) { for (int l = ((Vector2Int)(ref prevXAxisRange)).y + 2; l <= ((Vector2Int)(ref xAxisRange)).y + 1; l++) { if (l <= pointOutlines.Count - 1 && l >= 0) { pointOutlines[sortedIndices[l]].SetActive(true); if (l < lines.Count) { lines[sortedIndices[l]].SetActive(true); } } } } } catch (ArgumentOutOfRangeException) { } prevXAxisRange = xAxisRange; xAxisRange = new Vector2Int(MinMaxBinarySearch(findLeft: true), MinMaxBinarySearch(findLeft: false)); } private Vector2 CalculatePosition(int i) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return values[i] * contentScale; } private void MouseTrigger(int pointIndex, bool enter) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_0226: 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_025b: Unknown result type (might be due to invalid IL or missing references) fixedHoveredPoints.Add(pointIndex); fixedHoveredPoints = fixedHoveredPoints.Distinct().ToList(); if (enter) { activePointIndex = pointIndex; activePointValue = values[pointIndex]; pointIsActive = enter; if (pointSelectionType == PointSelectionType.Select) { lockedHoveredPoints.Add(pointIndex); lockedHoveredPoints = lockedHoveredPoints.Distinct().ToList(); } } else { if ((lockedPoints.Contains(activePointIndex) && pointSelectionType == PointSelectionType.Select) || (fixedPointIndex == activePointIndex && pointSelectionType == PointSelectionType.FixZoomPoint)) { return; } activePointIndex = pointIndex; activePointValue = values[pointIndex]; pointIsActive = enter; } if (points[pointIndex].transform.childCount > 0) { Object.Destroy((Object)(object)((Component)points[pointIndex].transform.GetChild(0)).gameObject); return; } GameObject val = new GameObject("coordinateDisplay"); val.transform.SetParent(points[pointIndex].transform, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; ((Transform)val2).localPosition = ((Transform)val2).localPosition + new Vector3(0f, 25f, 0f); TextMeshProUGUI val3 = val.gameObject.AddComponent(); if (currentPlotIsLog) { ((TMP_Text)val3).text = $"{Math.Round(values[pointIndex].x, 0)}, {trueYvalues[pointIndex]}"; } else { ((TMP_Text)val3).text = $"{Math.Round(values[pointIndex].x, 0)}, {trueYvalues[pointIndex]}"; } ((Graphic)val3).color = Color.white; ((TMP_Text)val3).fontSize = 30f; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((TMP_Text)val3).enableWordWrapping = false; ((Graphic)val3).raycastTarget = false; } private void PointClicked(int pointIndex) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (pointSelectionType == PointSelectionType.FixZoomPoint) { if (fixedPointIndex != -1) { ChangeZoomPoint(values[pointIndex]); fixedHoveredPoints.Add(fixedPointIndex); } fixedHoveredPoints = fixedHoveredPoints.Distinct().ToList(); fixedPointIndex = ((fixedPointIndex == pointIndex) ? (-1) : pointIndex); ChangeZoomPoint((fixedPointIndex == -1) ? center : values[pointIndex]); } else if (lockedPoints.Contains(pointIndex)) { lockedPoints.Remove(pointIndex); } else { lockedPoints.Add(pointIndex); } } private void UpdatePointVisuals() { if (((Vector2Int)(ref xAxisRange)).x == -1 || ((Vector2Int)(ref xAxisRange)).y == -1) { return; } for (int i = ((Vector2Int)(ref xAxisRange)).x; i <= ((Vector2Int)(ref xAxisRange)).y; i++) { if (activePointIndex != sortedIndices[i]) { lockedHoveredPoints.Add(sortedIndices[i]); fixedHoveredPoints.Add(sortedIndices[i]); } } } private void UpdatePoints() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < lockedHoveredPoints.Count; i++) { int num = lockedHoveredPoints[i]; bool flag = activePointIndex == num && pointIsActive; Vector2 val; Color val2; float num2; if (lockedPoints.Contains(num)) { val = Vector2.one * GS.PointLockedRadius; val2 = GS.PointLockedColor; num2 = GS.PointLockedSpeed; } else if (flag && pointSelectionType == PointSelectionType.Select) { val = Vector2.one * GS.PointHoverRadius; val2 = GS.PointHoverColor; num2 = GS.PointHoverSpeed; } else { val = Vector2.one * GS.PointRadius; val2 = GS.PointColor; num2 = GS.PointHoverSpeed; } pointRects[num].sizeDelta = Vector2.Lerp(pointRects[num].sizeDelta, val, Time.deltaTime * num2); if (!flag && Vector2.Distance(pointRects[num].sizeDelta, val) < 0.5f && Vector4.Distance(Color.op_Implicit(((Graphic)pointImages[num]).color), Color.op_Implicit(val2)) < 0.5f) { ((Graphic)pointImages[num]).color = val2; pointRects[num].sizeDelta = val; lockedHoveredPoints.RemoveAt(i); } else if (!fixedHoveredPoints.Contains(num) && num != fixedPointIndex) { pointOutlineRects[num].sizeDelta = pointRects[num].sizeDelta + Vector2.one * GS.UnfixedPointOutlineWidth; } } UpdatePointOutlines(); } private void UpdatePointOutlines() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); for (int i = 0; i < fixedHoveredPoints.Count; i++) { int num = fixedHoveredPoints[i]; bool flag = activePointIndex == num && pointIsActive; float num2; Color val2; if (fixedPointIndex == num) { ((Vector2)(ref val))..ctor(GS.FixedPointOutlineWidth, GS.FixedPointOutlineWidth); val2 = GS.FixedPointOutlineColor; num2 = GS.FixedPointOutlineSpeed; } else if (flag && pointSelectionType == PointSelectionType.FixZoomPoint) { ((Vector2)(ref val))..ctor(GS.UnfixedPointOutlineHoverWidth, GS.UnfixedPointOutlineHoverWidth); val2 = GS.UnfixedPointOutlineHoverColor; num2 = GS.UnfixedPointOutlineHoverSpeed; } else { ((Vector2)(ref val))..ctor(GS.UnfixedPointOutlineWidth, GS.UnfixedPointOutlineWidth); val2 = GS.UnfixedPointOutlineColor; num2 = GS.UnfixedPointOutlineHoverSpeed; } val += pointRects[num].sizeDelta; RectTransform val3 = pointOutlineRects[num]; if (pointSelectionType == PointSelectionType.FixZoomPoint) { val3.sizeDelta = Vector2.Lerp(val3.sizeDelta, val, Time.deltaTime * num2); } else { val3.sizeDelta = val; } Image val4 = pointOutlineImages[num]; val2 = Color.Lerp(((Graphic)val4).color, val2, Time.deltaTime * num2); ((Graphic)val4).color = val2; if (!flag && Vector2.Distance(val3.sizeDelta, val) < 0.5f) { fixedHoveredPoints.RemoveAt(i); } } } private void UpdateGridLines() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0278: 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_02c3: 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_0325: 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_038b: 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_03a7: 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_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0373: 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_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) Vector2 val = CalculateGridSpacing(); Vector2 val2 = new Vector2(Mathf.Ceil(bottomLeft.x * val.x) / val.x, Mathf.Ceil(bottomLeft.y * val.y) / val.y) * contentScale; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(-1f, -1f); int num = Mathf.CeilToInt((topRight.y - bottomLeft.y) * val.y) + 1; int num2 = Mathf.CeilToInt((topRight.x - bottomLeft.x) * val.x) + 1; if (num2 < 0) { num2 = 7; } if (num < 0) { num = 7; } while (xGridRects.Count <= num2) { CreateGridLines(createX: true); } while (yGridRects.Count <= num) { CreateGridLines(createX: false); } for (int i = 0; i < num2; i++) { RectTransform val4 = xGridRects[i]; Image val5 = xGridImages[i]; if (!((Component)val4).gameObject.activeSelf) { ((Component)val4).gameObject.SetActive(true); } if (i == 0) { UpdateSizeDelta(val4, new Vector2(GS.XAxisWidth, GS.GraphSize.y * 2f)); ((Graphic)val5).color = GS.XAxisColor; UpdateAnchoredPosition(val4, new Vector2(0f, center.y * contentScale.y)); continue; } UpdateSizeDelta(val4, new Vector2(GS.XGridWidth, GS.GraphSize.y * 2f)); ((Graphic)val5).color = GS.XGridColor; if (Mathf.Round(val2.x + ((float)i + val3.x) / val.x * contentScale.x) == 0f) { val3.x = 0f; } UpdateAnchoredPosition(val4, new Vector2(val2.x + ((float)i + val3.x) / val.x * contentScale.x, center.y * contentScale.y)); UpdateSizeDelta(xAxisTextRects[i - 1], new Vector2(1f / val.x * contentScale.x, GS.XAxisTextSize)); UpdateAnchoredPosition(xAxisTextRects[i - 1], new Vector2(0f, (0f - center.y) * contentScale.y + GS.XAxisTextOffset)); ((TMP_Text)xAxisTexts[i - 1]).text = ((Mathf.Floor(1f / val.x) > 0f) ? Mathf.Round(val2.x / contentScale.x + ((float)i + val3.x) / val.x).ToString() : (val2.x / contentScale.x + ((float)i + val3.x) / val.x).ToString("R")); if (((TMP_Text)xAxisTexts[i - 1]).text[0] == '-') { ((TMP_Text)xAxisTexts[i - 1]).text = ""; } } if (xAxisTexts.Count >= 2) { for (int j = 1; j < xAxisTexts.Count; j++) { if (((TMP_Text)xAxisTexts[j - 1]).text == "" && ((TMP_Text)xAxisTexts[j]).text != "") { ((TMP_Text)xAxisTexts[j - 1]).text = "seconds"; break; } } } for (int k = 0; k < num; k++) { RectTransform val6 = yGridRects[k]; Image val7 = yGridImages[k]; if (!((Component)val6).gameObject.activeSelf) { ((Component)val6).gameObject.SetActive(true); } if (k == 0) { UpdateSizeDelta(val6, new Vector2(GS.GraphSize.x * 2f, GS.YAxisWidth)); ((Graphic)val7).color = GS.YAxisColor; UpdateAnchoredPosition(val6, new Vector2(center.x * contentScale.x, 0f)); continue; } UpdateSizeDelta(val6, new Vector2(GS.GraphSize.x * 2f, GS.YGridWidth)); ((Graphic)val7).color = GS.YGridColor; if (Mathf.Round(val2.y + ((float)k + val3.y) / val.y * contentScale.y) == 0f) { val3.y = 0f; } UpdateAnchoredPosition(val6, new Vector2(center.x * contentScale.x, val2.y + ((float)k + val3.y) / val.y * contentScale.y)); UpdateSizeDelta(yAxisTextRects[k - 1], new Vector2(1f / val.x * contentScale.x, GS.XAxisTextSize)); UpdateAnchoredPosition(yAxisTextRects[k - 1], new Vector2((0f - center.x) * contentScale.x + GS.YAxisTextOffset, 0f)); ((TMP_Text)yAxisTexts[k - 1]).text = ((Mathf.Floor(1f / val.y) > 0f) ? Mathf.Round(val2.y / contentScale.y + ((float)k + val3.y) / val.y).ToString() : (val2.y / contentScale.y + ((float)k + val3.y) / val.y).ToString("R")); if (currentPlotIsLog) { if (long.TryParse(((TMP_Text)yAxisTexts[k - 1]).text, out var result) && (float)result > 0f - c) { ((TMP_Text)yAxisTexts[k - 1]).text = $"{(long)((double)c * (Math.Pow(logBase, double.Parse(((TMP_Text)yAxisTexts[k - 1]).text)) - 1.0))}"; } else { ((TMP_Text)yAxisTexts[k - 1]).text = ""; } } } for (int l = num2; l < xGridRects.Count; l++) { if (((Component)xGridRects[l]).gameObject.activeSelf) { ((Component)xGridRects[l]).gameObject.SetActive(false); } } for (int m = num; m < yGridRects.Count; m++) { if (((Component)yGridRects[m]).gameObject.activeSelf) { ((Component)yGridRects[m]).gameObject.SetActive(false); } } } private Vector2 CalculateGridSpacing() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.FloorToInt(Mathf.Log(zoom.x, 2f)); int num2 = Mathf.FloorToInt(Mathf.Log(zoom.y, 2f)); float num3 = Mathf.Pow(2f, (float)num); float num4 = Mathf.Pow(2f, (float)num2); return new Vector2(num3, num4) * GS.GridSpacing; } private void SetCornerValuesInternal(Vector2 newBottomLeft, Vector2 newTopRight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dd: 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_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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (newBottomLeft.x < -2.5E+38f || float.IsNaN(newBottomLeft.x)) { newBottomLeft.x = -2.5E+38f; } if (newBottomLeft.y < -2.5E+38f || float.IsNaN(newBottomLeft.y)) { newBottomLeft.y = -2.5E+38f; } if (newTopRight.x > 2.5E+38f || float.IsNaN(newTopRight.x)) { newTopRight.x = 2.5E+38f; } if (newTopRight.y > 2.5E+38f || float.IsNaN(newTopRight.y)) { newTopRight.y = 2.5E+38f; } Vector2 val = (newTopRight - newBottomLeft) / 2f + newBottomLeft; targetMoveOffset = (val - center) * contentScale + moveOffset; ChangeZoomPoint(val); targetZoom = GS.GraphSize / GS.GraphScale / (newTopRight - newBottomLeft); } private void CalculateMousePosition() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) mousePos = (new Vector2(Input.mousePosition.x, Input.mousePosition.y) - new Vector2(((Component)graphContent).transform.position.x, ((Component)graphContent).transform.position.y)) / contentScale; mouseInsideBounds = mousePos.x > bottomLeft.x && mousePos.y > bottomLeft.y && mousePos.x < topRight.x && mousePos.y < topRight.y; mousePos = new Vector2(Mathf.Clamp(mousePos.x, bottomLeft.x, topRight.x), Mathf.Clamp(mousePos.y, bottomLeft.y, topRight.y)); } private void MouseZoom() { //IL_0010: 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_0048: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (mouseInsideBounds && Input.mouseScrollDelta.y != 0f) { if (fixedPointIndex == -1) { ChangeZoomPoint(mousePos); } targetZoom = zoom + Input.mouseScrollDelta.y * zoom * GS.ZoomSpeed / 100f; } } private void ChangeZoomPoint(Vector2 newZoomPoint) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (IsWithinBounds(zoom, (newZoomPoint - zoomPoint) * contentScale + absoluteZoomPoint, newZoomPoint, moveOffset)) { absoluteZoomPoint = (newZoomPoint - zoomPoint) * contentScale + absoluteZoomPoint; zoomPoint = newZoomPoint; } } private void MouseAction() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0144: 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_014f: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Invalid comparison between Unknown and I4 //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Invalid comparison between Unknown and I4 //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Invalid comparison between Unknown and I4 //IL_0365: 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_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0412: 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) if (Input.GetMouseButtonDown(0)) { initialMouseInsideBounds = mouseInsideBounds; if (!mouseInsideBounds) { return; } initialMousePos = Vector2.op_Implicit(Input.mousePosition); if (mouseActionType == MouseActionType.Move) { initialMoveOffset = moveOffset; } else if (mouseActionType == MouseActionType.SelectPoints) { initialLockedPoints.Clear(); for (int i = 0; i < lockedPoints.Count; i++) { initialLockedPoints.Add(lockedPoints[i]); } } return; } if (Input.GetMouseButton(0) && initialMouseInsideBounds) { if (Input.GetMouseButtonDown(1)) { initialMouseInsideBounds = false; ((Component)zoomSelectionRectTransform).gameObject.SetActive(false); ((Component)pointSelectionRectTransform).gameObject.SetActive(false); } if (previousMousePos != mousePos) { Vector2 val = Vector2.op_Implicit(Input.mousePosition); if (mouseActionType == MouseActionType.Move) { targetMoveOffset = initialMousePos - val + initialMoveOffset; } else if (mouseActionType == MouseActionType.SelectAreaToZoom) { if (!((Component)zoomSelectionRectTransform).gameObject.activeSelf) { ((Component)zoomSelectionRectTransform).gameObject.SetActive(true); } SelectAreaToZoom(release: false); } else if (mouseActionType == MouseActionType.SelectPoints) { if (!((Component)pointSelectionRectTransform).gameObject.activeSelf) { ((Component)pointSelectionRectTransform).gameObject.SetActive(true); } SelectPoints(release: false); } } previousMousePos = mousePos; } else if (Input.GetMouseButtonUp(0) && initialMouseInsideBounds) { if (mouseActionType == MouseActionType.SelectAreaToZoom) { SelectAreaToZoom(release: true); } else if (mouseActionType == MouseActionType.SelectPoints) { SelectPoints(release: true); } recentlyLockedPoints.Clear(); } if (Input.touchCount != 1) { return; } Touch touch = Input.GetTouch(0); if ((int)((Touch)(ref touch)).phase == 0) { initialMousePos = ((Touch)(ref touch)).position; mousePos = (new Vector2(((Touch)(ref touch)).position.x, ((Touch)(ref touch)).position.y) - new Vector2(((Component)graphContent).transform.position.x, ((Component)graphContent).transform.position.y)) / contentScale; initialMouseInsideBounds = mousePos.x > bottomLeft.x && mousePos.y > bottomLeft.y && mousePos.x < topRight.x && mousePos.y < topRight.y; if (mouseActionType == MouseActionType.Move) { initialMoveOffset = moveOffset; } else if (mouseActionType == MouseActionType.SelectPoints) { initialLockedPoints.Clear(); for (int j = 0; j < lockedPoints.Count; j++) { initialLockedPoints.Add(lockedPoints[j]); } } } else if ((int)((Touch)(ref touch)).phase == 1 && initialMouseInsideBounds) { if (mouseActionType == MouseActionType.Move) { Vector2 position = ((Touch)(ref touch)).position; targetMoveOffset = initialMousePos - position + initialMoveOffset; } else if (mouseActionType == MouseActionType.SelectAreaToZoom) { if (!((Component)zoomSelectionRectTransform).gameObject.activeSelf) { ((Component)zoomSelectionRectTransform).gameObject.SetActive(true); } SelectAreaToZoom(release: false); } else if (mouseActionType == MouseActionType.SelectPoints) { if (!((Component)pointSelectionRectTransform).gameObject.activeSelf) { ((Component)pointSelectionRectTransform).gameObject.SetActive(true); } SelectPoints(release: false); } } else if ((int)((Touch)(ref touch)).phase == 3 && initialMouseInsideBounds) { if (mouseActionType == MouseActionType.SelectAreaToZoom) { SelectAreaToZoom(release: true); } else if (mouseActionType == MouseActionType.SelectPoints) { SelectPoints(release: true); } recentlyLockedPoints.Clear(); } } private void SelectAreaToZoom(bool release) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034b: 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_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0365: 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_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037a: 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_0384: 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_011f: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_039e: 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_026c: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (new Vector2(initialMousePos.x, initialMousePos.y) - new Vector2(((Component)graphContent).transform.position.x, ((Component)graphContent).transform.position.y)) / contentScale; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(mousePos.x, val.y + (mousePos.x - val.x) / GS.GraphSize.x * GS.GraphSize.y * contentScale.x / contentScale.y); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(mousePos.x, val.y + (mousePos.x - val.x)); Vector2 val4 = ((rectangleType == RectangleType.Free) ? mousePos : ((rectangleType == RectangleType.PreserveAspectRatio) ? val2 : val3)); if (!release) { zoomSelectionRectTransform.anchoredPosition = (val + (val4 - val) / 2f) * contentScale; Vector2 val5 = new Vector2(Mathf.Abs(val4.x - val.x), Mathf.Abs(val4.y - val.y)) * contentScale; zoomSelectionRectTransform.sizeDelta = val5; ((Graphic)zoomSelectionImage).color = GS.ZoomSelectionColor; for (int i = 0; i < zoomSelectionOutlines.Count; i++) { if (i % 2 == 0) { zoomSelectionOutlines[i].sizeDelta = new Vector2(GS.ZoomSelectionOutlineWidth, val5.y + GS.ZoomSelectionOutlineWidth * 2f); zoomSelectionOutlines[i].anchoredPosition = new Vector2((float)((i != 0) ? 1 : (-1)) * (val5.x + GS.ZoomSelectionOutlineWidth) / 2f, 0f); } else { zoomSelectionOutlines[i].sizeDelta = new Vector2(val5.x + GS.ZoomSelectionOutlineWidth * 2f, GS.ZoomSelectionOutlineWidth); zoomSelectionOutlines[i].anchoredPosition = new Vector2(0f, (float)((i != 1) ? 1 : (-1)) * (val5.y + GS.ZoomSelectionOutlineWidth) / 2f); } ((Graphic)zoomSelectionOutlineImages[i]).color = GS.ZoomSelectionOutlineColor; } } else { ((Component)zoomSelectionRectTransform).gameObject.SetActive(false); Vector2 val6 = default(Vector2); ((Vector2)(ref val6))..ctor(Mathf.Min(val.x, val4.x), Mathf.Min(val.y, val4.y)); Vector2 val7 = default(Vector2); ((Vector2)(ref val7))..ctor(Mathf.Max(val.x, val4.x), Mathf.Max(val.y, val4.y)); Vector2 val8 = val7 - val6; float magnitude = ((Vector2)(ref val8)).magnitude; val8 = topRight - bottomLeft; if (magnitude > ((Vector2)(ref val8)).magnitude / 16f) { SetCornerValues(val6, val7); } } } private void SelectPoints(bool release) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cc: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (new Vector2(initialMousePos.x, initialMousePos.y) - new Vector2(((Component)graphContent).transform.position.x, ((Component)graphContent).transform.position.y)) / contentScale; if (!release) { Vector2 val2 = mousePos; pointSelectionRectTransform.anchoredPosition = (val + (val2 - val) / 2f) * contentScale; Vector2 val3 = new Vector2(Mathf.Abs(val2.x - val.x), Mathf.Abs(val2.y - val.y)) * contentScale; pointSelectionRectTransform.sizeDelta = val3; ((Graphic)pointSelectionImage).color = GS.PointSelectionColor; for (int i = 0; i < pointSelectionOutlines.Count; i++) { if (i % 2 == 0) { pointSelectionOutlines[i].sizeDelta = new Vector2(GS.PointSelectionOutlineWidth, val3.y + GS.PointSelectionOutlineWidth * 2f); pointSelectionOutlines[i].anchoredPosition = new Vector2((float)((i != 0) ? 1 : (-1)) * (val3.x + GS.PointSelectionOutlineWidth) / 2f, 0f); } else { pointSelectionOutlines[i].sizeDelta = new Vector2(val3.x + GS.PointSelectionOutlineWidth * 2f, GS.PointSelectionOutlineWidth); pointSelectionOutlines[i].anchoredPosition = new Vector2(0f, (float)((i != 1) ? 1 : (-1)) * (val3.y + GS.PointSelectionOutlineWidth) / 2f); } ((Graphic)pointSelectionOutlineImages[i]).color = GS.PointSelectionOutlineColor; } if (rectangleSelectionPhase == RectangleSelectionPhase.Moving) { Vector2 newBottomLeft = default(Vector2); ((Vector2)(ref newBottomLeft))..ctor(Mathf.Min(val.x, mousePos.x), Mathf.Min(val.y, mousePos.y)); Vector2 newTopRight = default(Vector2); ((Vector2)(ref newTopRight))..ctor(Mathf.Max(val.x, mousePos.x), Mathf.Max(val.y, mousePos.y)); PointSelect(moving: true, newBottomLeft, newTopRight); } } else { ((Component)pointSelectionRectTransform).gameObject.SetActive(false); Vector2 newBottomLeft2 = default(Vector2); ((Vector2)(ref newBottomLeft2))..ctor(Mathf.Min(val.x, mousePos.x), Mathf.Min(val.y, mousePos.y)); Vector2 newTopRight2 = default(Vector2); ((Vector2)(ref newTopRight2))..ctor(Mathf.Max(val.x, mousePos.x), Mathf.Max(val.y, mousePos.y)); if (rectangleSelectionPhase == RectangleSelectionPhase.Release) { PointSelect(moving: false, newBottomLeft2, newTopRight2); } } } private void PointSelect(bool moving, Vector2 newBottomLeft, Vector2 newTopRight) { //IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) for (int i = ((Vector2Int)(ref xAxisRange)).x; i <= ((Vector2Int)(ref xAxisRange)).y; i++) { Vector2 val = values[i]; if (!(val.x >= newBottomLeft.x) || !(val.x <= newTopRight.x) || !(val.y >= newBottomLeft.y) || !(val.y <= newTopRight.y)) { continue; } if (rectangleSelectionType == RectangleSelectionType.SelectUnselect) { if (moving) { if (initialLockedPoints.Contains(i) && lockedPoints.Contains(i)) { lockedPoints.Remove(i); recentlyLockedPoints.Add(i); } else if (!initialLockedPoints.Contains(i) && !lockedPoints.Contains(i)) { lockedPoints.Add(i); recentlyLockedPoints.Add(i); } } else if (lockedPoints.Contains(i)) { lockedPoints.Remove(i); } else { lockedPoints.Add(i); } } else if (moving) { if (!initialLockedPoints.Contains(i) && !lockedPoints.Contains(i)) { lockedPoints.Add(i); recentlyLockedPoints.Add(i); } } else if (!lockedPoints.Contains(i)) { lockedPoints.Add(i); } lockedHoveredPoints.Add(i); lockedHoveredPoints = lockedHoveredPoints.Distinct().ToList(); lockedPoints = lockedPoints.Distinct().ToList(); } for (int j = 0; j < recentlyLockedPoints.Count; j++) { int num = recentlyLockedPoints[j]; Vector2 val2 = values[num]; if (!(val2.x >= newBottomLeft.x) || !(val2.x <= newTopRight.x) || !(val2.y >= newBottomLeft.y) || !(val2.y <= newTopRight.y)) { if (initialLockedPoints.Contains(num)) { if (!lockedPoints.Contains(num)) { lockedPoints.Add(num); } } else if (lockedPoints.Contains(num)) { lockedPoints.Remove(num); } } lockedHoveredPoints.Add(num); lockedHoveredPoints = lockedHoveredPoints.Distinct().ToList(); lockedPoints = lockedPoints.Distinct().ToList(); } } private int MinMaxBinarySearch(bool findLeft) { //IL_004f: 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) float num = (findLeft ? bottomLeft.x : topRight.x); int num2 = 0; int num3 = sortedIndices.Count - 1; while (num2 <= num3) { int num4 = num2 + (num3 - num2) / 2; float x = values[sortedIndices[num4]].x; if (findLeft ? (x >= num) : (x <= num)) { if ((findLeft && (num4 == 0 || values[sortedIndices[num4 - 1]].x < num)) || (!findLeft && (num4 == sortedIndices.Count - 1 || values[sortedIndices[num4 + 1]].x > num))) { return num4; } if (findLeft) { num3 = num4 - 1; } else { num2 = num4 + 1; } } else if (findLeft) { num2 = num4 + 1; } else { num3 = num4 - 1; } } return -1; } private void UpdateSizeDelta(RectTransform rect, Vector2 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(rect.sizeDelta.x - size.x) > 0.1f || Mathf.Abs(rect.sizeDelta.y - size.y) > 0.1f) { rect.sizeDelta = size; } } private void UpdateAnchoredPosition(RectTransform rect, Vector2 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(rect.sizeDelta.x - position.x) > 0.1f || Mathf.Abs(rect.sizeDelta.y - position.y) > 0.1f) { rect.anchoredPosition = position; } } private bool CheckForErrors() { if ((Object)(object)((Component)this).GetComponent() == (Object)null) { Debug.LogError((object)"This GameObject has no GraphSettings script attached. Attach GraphSettings and restart"); error = true; return true; } if ((Object)(object)((Component)this).GetComponent().GridTextFont == (Object)null) { Debug.LogError((object)"No font was found. Assign a font for GraphSettings.GridTextFont and restart"); error = true; } if ((Object)(object)((Component)this).GetComponent().PointSprite == (Object)null) { Debug.LogError((object)"No point sprite was found. Assign a sprite for GraphSettings.PointSprite and restart"); error = true; } if (error) { return true; } return false; } } public class GraphSettings : MonoBehaviour { [Header("Graph Settings")] [Space] public int updatePeriod = 5; [SerializeField] private Vector2 graphSize = new Vector2(0.5208f * (float)Screen.width, 0.7037f * (float)Screen.height); [SerializeField] private Vector2 graphScale = new Vector2(100f, 100f); [Space] [Header("Graph Visuals")] [Space] [SerializeField] private Color backgroundColor = new Color(0f, 0f, 0f, 1f); [SerializeField] private float outlineWidth = 5f; [SerializeField] private Color outlineColor = new Color(1f, 1f, 1f, 1f); [Space] [SerializeField] private float lineWidth = 4f; [SerializeField] private Color lineColor = new Color(1f, 0.35f, 0f, 1f); [Space] public Sprite PointSprite = Assets.assetBundle.LoadAsset("cross.png"); [SerializeField] private float pointRadius = 5f; [SerializeField] private Color pointColor = Color.white; [Space] [SerializeField] private float pointHoverRadius = 15f; public float PointHoverSpeed = 5f; [SerializeField] private Color pointHoverColor = Color.white; [Space] [SerializeField] private float pointLockedRadius = 17f; public float PointLockedSpeed = 5f; [SerializeField] private Color pointLockedColor = Color.white; [Space] [SerializeField] private float unfixedPointOutlineWidth = 10f; [SerializeField] private Color unfixedPointOutlineColor = Color.white; [Space] [SerializeField] private float unfixedPointOutlineHoverWidth = 15f; public float UnfixedPointOutlineHoverSpeed = 5f; [Space] [SerializeField] private Color unfixedPointOutlineHoverColor = Color.white; [Space] [SerializeField] private float fixedPointOutlineWidth = 17f; public float FixedPointOutlineSpeed = 5f; [SerializeField] private Color fixedPointOutlineColor = Color.white; [Space] [Header("Grid Settings")] [Space] public TMP_FontAsset GridTextFont = Assets.assetBundle.LoadAsset("LiberationSans SDF.asset"); [SerializeField] private Vector2 gridSpacing = new Vector2(1f, 1f); [Space] [SerializeField] private float xAxisWidth = 3f; [SerializeField] private Color xAxisColor = new Color(1f, 1f, 1f, 1f); [Space] [SerializeField] private Color xAxisTextColor = new Color(1f, 1f, 1f, 1f); [SerializeField] private float xAxisTextSize = 10f; [SerializeField] private float xAxisTextOffset = 10f; [Space] [SerializeField] private float yAxisWidth = 3f; [SerializeField] private Color yAxisColor = new Color(1f, 1f, 1f, 1f); [Space] [SerializeField] private Color yAxisTextColor = new Color(1f, 1f, 1f, 1f); [SerializeField] private float yAxisTextSize = 10f; [SerializeField] private float yAxisTextOffset = 10f; [Space] [SerializeField] private float xGridWidth = 2f; [SerializeField] private Color xGridColor = new Color(1f, 1f, 1f, 0.6f); [Space] [SerializeField] private float yGridWidth = 2f; [SerializeField] private Color yGridColor = new Color(1f, 1f, 1f, 0.6f); [Space] [SerializeField] private Color zoomSelectionColor = new Color(0f, 0.8f, 1f, 0.2f); [SerializeField] private float zoomSelectionOutlineWidth = 5f; [SerializeField] private Color zoomSelectionOutlineColor = new Color(0f, 0.8f, 1f, 0.6f); [Space] [SerializeField] private Color pointSelectionColor = new Color(1f, 0.35f, 0f, 0.2f); [SerializeField] private float pointSelectionOutlineWidth = 5f; [SerializeField] private Color pointSelectionOutlineColor = new Color(1f, 0.35f, 0f, 0.4f); [Space] public float ZoomSpeed = 5f; public float SmoothZoomSpeed = 20f; public float SmoothMoveSpeed = 20f; private GraphHandler GH; public Vector2 GraphSize { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return graphSize; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) graphSize = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePositionAndScale | GraphHandler.UpdateMethod.UpdateContent | GraphHandler.UpdateMethod.UpdateGridLines); } } public Vector2 GraphScale { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return graphScale; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) graphScale = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePositionAndScale | GraphHandler.UpdateMethod.UpdateContent | GraphHandler.UpdateMethod.UpdateGridLines); } } public Color BackgroundColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return backgroundColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) backgroundColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateOutlines); } } public float OutlineWidth { get { return outlineWidth; } set { outlineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateOutlines); } } public Color OutlineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return outlineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) outlineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateOutlines); } } public float LineWidth { get { return lineWidth; } set { lineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateContent); } } public Color LineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return lineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) lineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateContent); } } public float PointRadius { get { return pointRadius; } set { pointRadius = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color PointColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return pointColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) pointColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public float PointHoverRadius { get { return pointHoverRadius; } set { pointHoverRadius = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color PointHoverColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return pointHoverColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) pointHoverColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public float PointLockedRadius { get { return pointLockedRadius; } set { pointLockedRadius = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color PointLockedColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return pointLockedColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) pointLockedColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public float UnfixedPointOutlineWidth { get { return unfixedPointOutlineWidth; } set { unfixedPointOutlineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color UnfixedPointOutlineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return unfixedPointOutlineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) unfixedPointOutlineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public float UnfixedPointOutlineHoverWidth { get { return unfixedPointOutlineHoverWidth; } set { unfixedPointOutlineHoverWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color UnfixedPointOutlineHoverColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return unfixedPointOutlineHoverColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) unfixedPointOutlineHoverColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public float FixedPointOutlineWidth { get { return fixedPointOutlineWidth; } set { fixedPointOutlineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Color FixedPointOutlineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return fixedPointOutlineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) fixedPointOutlineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdatePointVisuals); } } public Vector2 GridSpacing { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return gridSpacing; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) gridSpacing = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float XAxisWidth { get { return xAxisWidth; } set { xAxisWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color XAxisColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return xAxisColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) xAxisColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color XAxisTextColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return xAxisTextColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) xAxisTextColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float XAxisTextSize { get { return xAxisTextSize; } set { xAxisTextSize = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float XAxisTextOffset { get { return xAxisTextOffset; } set { xAxisTextOffset = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float YAxisWidth { get { return yAxisWidth; } set { yAxisWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color YAxisColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return yAxisColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) yAxisColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color YAxisTextColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return yAxisTextColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) yAxisTextColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float YAxisTextSize { get { return yAxisTextSize; } set { yAxisTextSize = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float YAxisTextOffset { get { return yAxisTextOffset; } set { yAxisTextOffset = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float XGridWidth { get { return xGridWidth; } set { xGridWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color XGridColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return xGridColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) xGridColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public float YGridWidth { get { return yGridWidth; } set { yGridWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color YGridColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return yGridColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) yGridColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.UpdateGridLines); } } public Color ZoomSelectionColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return zoomSelectionColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) zoomSelectionColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } public float ZoomSelectionOutlineWidth { get { return zoomSelectionOutlineWidth; } set { zoomSelectionOutlineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } public Color ZoomSelectionOutlineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return zoomSelectionOutlineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) zoomSelectionOutlineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } public Color PointSelectionColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return pointSelectionColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) pointSelectionColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } public float PointSelectionOutlineWidth { get { return pointSelectionOutlineWidth; } set { pointSelectionOutlineWidth = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } public Color PointSelectionOutlineColor { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return pointSelectionOutlineColor; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) pointSelectionOutlineColor = value; GH.UpdateGraphInternal(GraphHandler.UpdateMethod.MouseAction); } } private void Awake() { GH = ((Component)this).GetComponent(); } public static Color Rainbow(float progress) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) float num = Math.Abs(progress % 1f) * 6f; int num2 = (int)(num % 1f * 255f); int num3 = 255 - num2; Color color = (int)num switch { 0 => Color.FromArgb(255, 255, num2, 0), 1 => Color.FromArgb(255, num3, 255, 0), 2 => Color.FromArgb(255, 0, 255, num2), 3 => Color.FromArgb(255, 0, num3, 255), 4 => Color.FromArgb(255, num2, 0, 255), _ => Color.FromArgb(255, 255, 0, num3), }; return new Color((float)(int)color.R / 255f, (float)(int)color.G / 255f, (float)(int)color.B / 255f, (float)(int)color.A / 255f); } } public class StatsButtonController : MonoBehaviour { [CompilerGenerated] private static class <>O { public static UnityAction <0>__CreateStatsWindow; } private Transform _statsButtonInstance; public bool ButtonIsVisible { get { return Object.op_Implicit((Object)(object)_statsButtonInstance) && ((Component)_statsButtonInstance).gameObject.activeSelf; } set { //IL_00a4: 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_00af: Expected O, but got Unknown if (ButtonIsVisible == value) { return; } if (!Object.op_Implicit((Object)(object)_statsButtonInstance) && value) { if (Object.op_Implicit((Object)(object)StatsScreen.continueButton)) { GameObject val = Object.Instantiate(((Component)StatsScreen.continueButton).gameObject, ((Component)StatsScreen.continueButton).transform.parent); ((Component)StatsScreen.continueButton).transform.SetAsLastSibling(); ((Object)val).name = "StatsButton"; HGButton component = val.GetComponent(); ((UnityEventBase)((Button)component).onClick).RemoveAllListeners(); ButtonClickedEvent onClick = ((Button)component).onClick; object obj = <>O.<0>__CreateStatsWindow; if (obj == null) { UnityAction val2 = StatsScreen.CreateStatsWindow; <>O.<0>__CreateStatsWindow = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); LanguageTextMeshController componentInChildren = val.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.token = "Stats Plus"; } Transform val3 = val.transform.Find("GenericGlyph"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(false); } _statsButtonInstance = val.transform; } } else { ((Component)_statsButtonInstance).gameObject.SetActive(value); } } } private static bool ShouldShowOnReportScreen(RunReport runReport) { if (runReport == null) { return false; } if (!Object.op_Implicit((Object)(object)runReport.gameEnding)) { return false; } return true; } public void OnSetDisplayData(DisplayData newDisplayData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ButtonIsVisible = ShouldShowOnReportScreen(newDisplayData.runReport); } private void Awake() { StatsScreen.gameEndReportPanelController = ((Component)this).GetComponent(); StatsScreen.continueButton = StatsScreen.gameEndReportPanelController.continueButton; if ((Object)(object)StatsScreen.graph == (Object)null) { StatsScreen.CreateGraph(); } } } public static class StatsScreen { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__GameEndReportPanelController_Awake; public static hook_SetDisplayData <1>__GameEndReportPanelController_SetDisplayData; public static hook_GenerateReportScreen <2>__GetHud; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__13_0; internal void b__13_0() { GUIUtility.systemCopyBuffer = RecordHandler.GetRScript(); } } public static HUD CurrentHud; public static GameEndReportPanelController gameEndReportPanelController; public static MPButton continueButton; public static GameObject graph; private static GameObject plotTitle; public static GameObject gameEndPrefab => Addressables.LoadAssetAsync((object)"RoR2/Base/UI/GameEndReportPanel.prefab").WaitForCompletion(); public static GameObject panelPrefab => Assets.assetBundle.LoadAsset("StatsPanel.prefab"); public static void CreateStatsWindow() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_0284: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Expected O, but got Unknown //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentHud != (Object)null) { if ((Object)(object)gameEndReportPanelController != (Object)null) { ((Component)((Component)gameEndReportPanelController).transform.Find("BlurPP")).GetComponent().maxDuration = 0f; } LocalUser localUserViewer = CurrentHud.localUserViewer; GameObject val = Object.Instantiate(gameEndPrefab, ((Component)CurrentHud).transform); val.transform.SetParent(((Component)CurrentHud).transform); val.GetComponent().eventSystem = localUserViewer.eventSystem; Object.Destroy((Object)(object)val.GetComponent()); Object.Destroy((Object)(object)val.GetComponent()); Object.Destroy((Object)(object)val.GetComponent()); Object.Destroy((Object)(object)val.GetComponent()); Object.Destroy((Object)(object)((Component)val.transform.Find("BlurPP")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("Flash")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("UnlockStripTemplate")).gameObject); Object.Destroy((Object)(object)((Component)val.transform.Find("SafeArea (JUICED)")).gameObject); val.GetComponent().anchorMin = Vector2.zero; val.GetComponent().anchorMax = Vector2.one; val.GetComponent().sizeDelta = Vector2.zero; val.GetComponent().anchoredPosition = Vector2.zero; val.AddComponent(); GameObject val2 = new GameObject(); ((Object)val2).name = "Background"; val2.transform.SetParent(val.transform, false); ((Graphic)val2.AddComponent()).color = new Color(0f, 0f, 0f, 1f); ((Graphic)val2.GetComponent()).raycastTarget = true; ((Graphic)val2.GetComponent()).material = ((Graphic)Resources.Load("Prefabs/UI/Tooltip").GetComponentInChildren(true)).material; val2.GetComponent().anchorMin = Vector2.zero; val2.GetComponent().anchorMax = Vector2.one; val2.GetComponent().sizeDelta = Vector2.zero; val2.GetComponent().anchoredPosition = Vector2.zero; GameObject val3 = Object.Instantiate(panelPrefab, val2.transform); val3.GetComponent().anchorMin = Vector2.zero; val3.GetComponent().anchorMax = Vector2.one; val3.GetComponent().sizeDelta = Vector2.zero; val3.GetComponent().anchoredPosition = Vector2.zero; Transform val4 = val3.transform.Find("SafeArea (JUICED)/BodyArea/StatsAndChatArea/StatsContainer/Stats Body/ScrollView/Viewport/Content"); GameObject gameObject = ((Component)val4.Find("StatContainer")).gameObject; foreach (string allStat in PlayerStatsDatabase.allStats) { GameObject val5 = Object.Instantiate(gameObject, val4); GameObject val6 = Object.Instantiate(((Component)gameEndPrefab.transform.Find("SafeArea (JUICED)/BodyArea/StatsAndChatArea/StatsContainer/Stats And Player Nav/Stats Header")).gameObject, val5.transform.Find("TitleContainer")); LanguageTextMeshController componentInChildren = val6.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.token = "STATSMOD_STAT_TITLE_" + allStat; } TooltipProvider val7 = val6.AddComponent(); val7.titleToken = "STATSMOD_STAT_TITLE_" + allStat; val7.bodyToken = "STATSMOD_STAT_BODY_" + allStat; val7.titleColor = Color.gray; val7.bodyColor = Color.white; CreatePlayerPlotButtons(val5, componentInChildren, allStat); } Object.Destroy((Object)(object)gameObject); if ((Object)(object)graph != (Object)null) { ((Component)graph.transform.parent).gameObject.SetActive(true); } else { Log.Error("Graph window must be created first!"); } Transform parent = val3.transform.Find("PlotTitleContainer"); plotTitle = new GameObject("plotTitle"); plotTitle.transform.SetParent(parent); RectTransform val8 = plotTitle.AddComponent(); val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; val8.offsetMin = Vector2.zero; val8.offsetMax = Vector2.zero; HGTextMeshProUGUI val9 = plotTitle.AddComponent(); ((Graphic)val9).color = Color.white; ((TMP_Text)val9).fontSize = 8f; ((TMP_Text)val9).alignment = (TextAlignmentOptions)514; ((TMP_Text)val9).transform.localPosition = new Vector3(0f, 450f, 0f); ((TMP_Text)val9).transform.localScale = new Vector3(10f, 10f, 10f); ((Graphic)val9).raycastTarget = false; plotTitle.SetActive(false); LanguageTextMeshController val10 = plotTitle.AddComponent(); val10.token = ""; plotTitle.SetActive(true); CreateRScriptButton(val3); CreateCloseButton(val3, val); } else { Log.Warning("CurrentHud is null!"); } } private static void PlotStartingStat() { graph.GetComponent().PlotStat("maxHealth", -1); } public static void ChangePlotTitle(string statName) { plotTitle.GetComponentInChildren().token = "STATSMOD_STAT_TITLE_" + statName; } public static void CreatePlayerPlotButtons(GameObject statContainer, LanguageTextMeshController labelText, string stat) { Transform val = statContainer.transform.Find("ButtonHolder"); int num = 0; foreach (IndependentEntry item in RecordHandler.independentDatabase) { CreateStatPlotButton(statContainer, labelText, stat, num, item.playerName); num++; } CreateStatPlotButton(statContainer, labelText, stat, -1, "all players"); Object.Destroy((Object)(object)((Component)val).gameObject); } private static void CreateRScriptButton(GameObject panel) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown GameObject val = Object.Instantiate(((Component)continueButton).gameObject, ((Component)panel.transform.Find("SafeArea (JUICED)/BodyArea/RightArea/AcceptButtonArea")).transform); ((Object)val).name = "ScriptButton"; HGButton component = val.GetComponent(); ((UnityEventBase)((Button)component).onClick).RemoveAllListeners(); ButtonClickedEvent onClick = ((Button)component).onClick; object obj = <>c.<>9__13_0; if (obj == null) { UnityAction val2 = delegate { GUIUtility.systemCopyBuffer = RecordHandler.GetRScript(); }; <>c.<>9__13_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); LanguageTextMeshController componentInChildren = val.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.token = "Copy R code"; } Transform val3 = val.transform.Find("GenericGlyph"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(false); } } private static void CreateCloseButton(GameObject panel, GameObject hud) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown GameObject val = Object.Instantiate(((Component)continueButton).gameObject, ((Component)panel.transform.Find("SafeArea (JUICED)/BodyArea/RightArea/AcceptButtonArea")).transform); ((Object)val).name = "CloseButton"; HGButton component = val.GetComponent(); ((UnityEventBase)((Button)component).onClick).RemoveAllListeners(); ((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate { Object.Destroy((Object)(object)hud); ((Component)graph.transform.parent).gameObject.SetActive(false); }); LanguageTextMeshController componentInChildren = val.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.token = "Close"; } Transform val2 = val.transform.Find("GenericGlyph"); if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(false); } } private static void CreateStatPlotButton(GameObject statContainer, LanguageTextMeshController labelText, string stat, int statIndex, string plotForName) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00e0: 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_01d2: Expected O, but got Unknown GameObject val = Object.Instantiate(((Component)statContainer.transform.Find("ButtonHolder")).gameObject, statContainer.transform); GameObject val2 = Object.Instantiate(((Component)continueButton).gameObject, val.transform); ((Object)val2).name = "StatButton"; LayoutElement component = val2.GetComponent(); component.minWidth = -1f; component.preferredWidth = 230f; HGButton component2 = val2.GetComponent(); ((UnityEventBase)((Button)component2).onClick).RemoveAllListeners(); ((UnityEvent)((Button)component2).onClick).AddListener((UnityAction)delegate { graph.GetComponent().PlotStat(stat, statIndex); }); labelText = val2.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)labelText)) { string text = ((statIndex == -1) ? "FFFFFF" : ColorUtility.ToHtmlStringRGB(GraphSettings.Rainbow((float)statIndex / (float)RecordHandler.independentDatabase.Count))); labelText.token = "Plot for " + plotForName + ""; } Transform val3 = val2.transform.Find("GenericGlyph"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(false); } GameObject val4 = Object.Instantiate(val2.gameObject, val.transform); val4.GetComponent().preferredWidth = 20f; labelText = val4.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)labelText)) { labelText.token = "log"; } HGButton component3 = val4.GetComponent(); ((UnityEventBase)((Button)component3).onClick).RemoveAllListeners(); ((UnityEvent)((Button)component3).onClick).AddListener((UnityAction)delegate { graph.GetComponent().PlotStat(stat, statIndex, isLog: true); }); } public static void CreateGraph() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown graph = new GameObject(); graph.AddComponent(); graph.AddComponent(); } private static void GameEndReportPanelController_Awake(orig_Awake orig, GameEndReportPanelController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent(); } private static void GameEndReportPanelController_SetDisplayData(orig_SetDisplayData orig, GameEndReportPanelController self, DisplayData newDisplayData) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, newDisplayData); StatsButtonController statsButtonController = default(StatsButtonController); if (((Component)self).TryGetComponent(ref statsButtonController)) { statsButtonController.OnSetDisplayData(newDisplayData); } } private static GameEndReportPanelController GetHud(orig_GenerateReportScreen orig, GameOverController self, HUD hud) { CurrentHud = hud; return orig.Invoke(self, hud); } public static void Init() { //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_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //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_005e: Expected O, but got Unknown object obj = <>O.<0>__GameEndReportPanelController_Awake; if (obj == null) { hook_Awake val = GameEndReportPanelController_Awake; <>O.<0>__GameEndReportPanelController_Awake = val; obj = (object)val; } GameEndReportPanelController.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__GameEndReportPanelController_SetDisplayData; if (obj2 == null) { hook_SetDisplayData val2 = GameEndReportPanelController_SetDisplayData; <>O.<1>__GameEndReportPanelController_SetDisplayData = val2; obj2 = (object)val2; } GameEndReportPanelController.SetDisplayData += (hook_SetDisplayData)obj2; object obj3 = <>O.<2>__GetHud; if (obj3 == null) { hook_GenerateReportScreen val3 = GetHud; <>O.<2>__GetHud = val3; obj3 = (object)val3; } GameOverController.GenerateReportScreen += (hook_GenerateReportScreen)obj3; } } internal static class Language { public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)StatsMod.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)StatsMod.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [Serializable] public class IndependentEntry { public readonly string playerName; public readonly Dictionary> Database = new Dictionary>(); public IndependentEntry(Dictionary> Database, string playerName) { this.Database = Database; this.playerName = playerName; } public List GetStatSeries(string name) { return Database[name]; } public string GetStatSeriesAsString(string name, bool rVector = false) { List statSeries = GetStatSeries(name); StringBuilder stringBuilder = new StringBuilder(); foreach (object item in statSeries) { if (!rVector) { stringBuilder.Append($"{item}, "); } else { stringBuilder.Append($"{PlayerStatsDatabase.Numberise(item)}, "); } } string text = stringBuilder.ToString().Substring(0, Math.Max(0, stringBuilder.Length - 2)); if (!rVector) { return name + ": " + text; } return name + " <- c(" + text + ")"; } public Dictionary GetRecord(int index) { if (index < 0) { index = Database["maxHealth"].Count + index; } Dictionary dictionary = new Dictionary(); foreach (string allStat in PlayerStatsDatabase.allStats) { dictionary.Add(allStat, Database[allStat][index]); } return dictionary; } public Dictionary GetRecord(float time) { List list = Database["timestamps"]; int index; try { index = list.IndexOf(time); } catch { index = list.IndexOf(list.OrderBy((object x) => Math.Abs(float.Parse(x.ToString()) - time)).First()); } return GetRecord(index); } } public class DatabaseSender : MonoBehaviour { private int index = 0; private List substrings; private void Awake() { string text = JsonConvert.SerializeObject((object)RecordHandler.independentDatabase); int num = 256; substrings = new List(); for (int i = 0; i < text.Length; i += num) { int length = Math.Min(num, text.Length - i); substrings.Add(text.Substring(i, length)); } } private void Update() { if (index >= substrings.Count) { Log.Info("Finished sending database"); Object.Destroy((Object)(object)this); } else { Log.Info($"Sending database substring {index}"); NetMessageExtensions.Send((INetMessage)(object)new SyncDatabase(substrings[index], index == substrings.Count - 1), (NetworkDestination)1); index++; } } } public class SyncDatabase : INetMessage, ISerializableObject { private static string serializedDB = ""; private string chunk; private bool end; public SyncDatabase() { } public SyncDatabase(string chunk, bool end) { this.chunk = chunk; this.end = end; } public void Serialize(NetworkWriter writer) { writer.Write(chunk); writer.Write(end); } public void Deserialize(NetworkReader reader) { chunk = reader.ReadString(); end = reader.ReadBoolean(); } public void OnReceived() { if (!NetworkServer.active) { serializedDB += chunk; Log.Info("Received a database chunk..."); if (end) { Log.Info("Finished receiving database!"); RecordHandler.independentDatabase = JsonConvert.DeserializeObject>(serializedDB); serializedDB = ""; } } } } public class PlayerStatsDatabase { private readonly PlayerCharacterMasterController player; private readonly int playerIndex; private readonly string playerName; public bool goner = false; public readonly Dictionary> Database = new Dictionary>(); public static readonly string[] charBodyStats = new string[9] { "maxHealth", "regen", "maxShield", "moveSpeed", "maxJumpCount", "damage", "attackSpeed", "crit", "armor" }; public static readonly string[] statSheetStats = new string[23] { "totalTimeAlive", "totalKills", "totalMinionKills", "totalDeaths", "totalDamageDealt", "totalMinionDamageDealt", "totalDamageTaken", "totalHealthHealed", "highestDamageDealt", "goldCollected", "totalDistanceTraveled", "totalItemsCollected", "totalPurchases", "totalGoldPurchases", "totalBloodPurchases", "totalLunarPurchases", "totalTier1Purchases", "totalTier2Purchases", "totalTier3Purchases", "totalDronesPurchased", "totalTurretsPurchased", "totalGreenSoupsPurchased", "totalRedSoupsPurchased" }; public static readonly string[] customStats = CustomStatTracker.statsTable.Keys.OfType().ToArray(); public static IEnumerable allStats = charBodyStats.Union(statSheetStats).Union(customStats); public PlayerStatsDatabase(PlayerCharacterMasterController instance) { player = instance; playerIndex = PlayerCharacterMasterController.instances.IndexOf(player); playerName = player.networkUser.userName; if (playerName.Length == 0) { Log.Warning($"No name found for player with index {playerIndex}, will use index to reference instead. Can by caused by singleplayer server testing."); playerName = $"Player {playerIndex}"; } RecordHandler.masterControllerToName[instance] = playerName; Database.Add("timestamps", new List()); foreach (string allStat in allStats) { Database.Add(allStat, new List()); } } public float TakeRecord() { //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown float runStopwatch = Run.instance.GetRunStopwatch(); Database["timestamps"].Add(runStopwatch); if (goner) { foreach (string allStat in allStats) { Database[allStat].Add(Database[allStat].Last()); } return runStopwatch; } CharacterBody body = player.master.GetBody(); if ((Object)(object)body == (Object)null) { Log.Warning($"No body found for {playerName} at {runStopwatch}. Duplicate entries added to database"); string[] array = charBodyStats; foreach (string key in array) { Database[key].Add(Database[key].Last()); } } else { string[] array2 = charBodyStats; foreach (string text in array2) { object value = typeof(CharacterBody).GetProperty(text).GetValue(body); Database[text].Add(value); } } RunReport val = RunReport.Generate(Run.instance, GameEndingCatalog.GetGameEndingDef((GameEndingIndex)2)); PlayerInfo playerInfo = val.GetPlayerInfo(playerIndex); if (playerInfo == null) { Log.Warning($"No stat sheet found for {playerName} at {runStopwatch}. Duplicate entries added to database"); string[] array3 = statSheetStats; foreach (string key2 in array3) { Database[key2].Add(Database[key2].Last()); } } else { string[] array4 = statSheetStats; foreach (string text2 in array4) { StatDef val2 = (StatDef)typeof(StatDef).GetField(text2).GetValue(null); object statDisplayValue = playerInfo.statSheet.GetStatDisplayValue(val2); Database[text2].Add(statDisplayValue); } } string[] array5 = customStats; foreach (string text3 in array5) { try { object stat = CustomStatTracker.GetStat(player, text3); Database[text3].Add(stat); } catch (Exception ex) { Database[text3].Add(Database[text3].Last()); Log.Warning($"Failed customStat {text3} for {playerName} at {runStopwatch}, duplicate entry added. \n {ex.Message}"); } } return runStopwatch; } public void RestoreFrom(Dictionary> restoredDatabase) { Database.Clear(); foreach (KeyValuePair> item in restoredDatabase) { Database[item.Key] = item.Value; } } public List GetStatSeries(string name) { return Database[name]; } public string GetStatSeriesAsString(string name, bool rVector = false) { List statSeries = GetStatSeries(name); StringBuilder stringBuilder = new StringBuilder(); foreach (object item in statSeries) { if (!rVector) { stringBuilder.Append($"{item}, "); } else { stringBuilder.Append($"{Numberise(item)}, "); } } string text = stringBuilder.ToString().Substring(0, Math.Max(0, stringBuilder.Length - 2)); if (!rVector) { return name + ": " + text; } return name + " <- c(" + text + ")"; } public Dictionary GetRecord(int index) { if (index < 0) { index = Database["maxHealth"].Count + index; } Dictionary dictionary = new Dictionary(); foreach (string allStat in allStats) { dictionary.Add(allStat, Database[allStat][index]); } return dictionary; } public Dictionary GetRecord(float time) { List list = Database["timestamps"]; int index; try { index = list.IndexOf(time); } catch { index = list.IndexOf(list.OrderBy((object x) => Math.Abs(float.Parse(x.ToString()) - time)).First()); } return GetRecord(index); } public static object Numberise(object value) { if (value.GetType() == typeof(bool)) { return ((bool)value) ? 1 : 0; } string text = value.ToString(); if (text.Contains(',')) { try { return long.Parse(text, NumberStyles.AllowThousands); } catch (OverflowException) { return -1; } } if (text.Contains(':')) { string[] array = text.Split(':'); return int.Parse(array[0]) * 60 + int.Parse(array[1]); } if (text.Contains("marathons")) { return float.Parse(text.Substring(0, text.Length - 10)); } return value; } public bool BelongsTo(PlayerCharacterMasterController instance) { return (Object)(object)player == (Object)(object)instance; } public PlayerCharacterMasterController GetPlayer() { return player; } public string GetPlayerName() { return playerName; } public int GetPlayerIndex() { return playerIndex; } } public static class ProperSaveCompat { private class StatsPlusProperSaveObj { public Dictionary>> databases; public string customStatsTable; public StatsPlusProperSaveObj(Dictionary>> databases, string customStatsTable) { this.databases = databases; this.customStatsTable = customStatsTable; } } private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave"); } return _enabled.Value; } } public static void Init() { SaveFile.OnGatherSaveData += SaveStats; Loading.OnLoadingEnded += LoadStats; } private static void SaveStats(Dictionary dict) { if (RecordHandler.statsDatabase == null) { return; } Dictionary>> dictionary = new Dictionary>>(); foreach (PlayerStatsDatabase item in RecordHandler.statsDatabase) { dictionary[item.GetPlayerName()] = item.Database; } StatsPlusProperSaveObj value = new StatsPlusProperSaveObj(dictionary, JsonConvert.SerializeObject((object)CustomStatTracker.statsTable)); dict["StatsPlus_Save"] = value; } private static void LoadStats(SaveFile saveFile) { try { if (!saveFile.ModdedData.ContainsKey("StatsPlus_Save")) { return; } StatsPlusProperSaveObj moddedData = saveFile.GetModdedData("StatsPlus_Save"); foreach (PlayerStatsDatabase item in RecordHandler.statsDatabase) { if (moddedData.databases.TryGetValue(item.GetPlayerName(), out var value)) { item.RestoreFrom(value); } } CustomStatTracker.statsTable.Clear(); foreach (BaseCustomStat registeredStat in CustomStatTracker.registeredStats) { registeredStat.TryDeserialize(JsonConvert.DeserializeObject>(moddedData.customStatsTable)); registeredStat.ConfigureStatsTable(); } Log.Info("Loaded database from ProperSave"); } catch (Exception ex) { Log.Error("Error during ProperSave load: " + ex.Message + " \n " + ex.StackTrace); } } } public static class RecordHandler { [CompilerGenerated] private static class <>O { public static Action <0>__ResetDatabase; public static Action <1>__NextStageBodyReset; public static Action <2>__GameOverReport; public static NetworkUserGenericDelegate <3>__DeleteUserRecord; public static Action <4>__CheckTakeRecord; } private static List _statsDatabase; public static List independentDatabase; public static Dictionary masterControllerToName = new Dictionary(); private static int bodiesCounter = 0; private static bool awaitingStageRecord = true; public static List statsDatabase => _statsDatabase; public static void Init() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown Run.onRunStartGlobal += ResetDatabase; SceneExitController.onBeginExit += NextStageBodyReset; Run.onServerGameOver += GameOverReport; object obj = <>O.<3>__DeleteUserRecord; if (obj == null) { NetworkUserGenericDelegate val = DeleteUserRecord; <>O.<3>__DeleteUserRecord = val; obj = (object)val; } NetworkUser.onNetworkUserLost += (NetworkUserGenericDelegate)obj; if (ProperSaveCompat.enabled) { ProperSaveCompat.Init(); } } private static void DeleteUserRecord(NetworkUser networkUser) { if (!NetworkServer.active || networkUser.masterController == null || statsDatabase == null) { return; } foreach (PlayerStatsDatabase item in statsDatabase) { if (item.BelongsTo(networkUser.masterController)) { item.goner = true; Log.Info(item.GetPlayerName() + " marked as disconnected"); } } InnerCheckTakeRecord(); } private static void ResetDatabase(Run run) { if (NetworkServer.active) { CustomStatTracker.ResetData(); SetupDatabase(); ResetBodyCounter(); Log.Info("New run, resetting data dicts and database"); } } private static void CheckTakeRecord(CharacterBody self) { if (NetworkServer.active && self.isPlayerControlled) { bodiesCounter++; InnerCheckTakeRecord(); } } private static void InnerCheckTakeRecord() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (awaitingStageRecord && bodiesCounter >= statsDatabase.Count((PlayerStatsDatabase x) => !x.goner)) { awaitingStageRecord = false; CharacterBody.onBodyStartGlobal -= CheckTakeRecord; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "bazaar") { TakeRecord(); } } } private static void NextStageBodyReset(SceneExitController sceneExitController) { if (NetworkServer.active) { ResetBodyCounter(); } } private static void CreateIndependentDatabase() { if (!NetworkServer.active) { return; } independentDatabase = new List(); foreach (PlayerStatsDatabase item in statsDatabase) { independentDatabase.Add(new IndependentEntry(item.Database, item.GetPlayerName())); } } private static void GameOverReport(Run run, GameEndingDef gameEndingDef) { if (NetworkServer.active) { TakeRecord(); CreateIndependentDatabase(); ((Component)StatsMod.instance).gameObject.AddComponent(); } } private static void SetupDatabase() { if (!NetworkServer.active) { return; } _statsDatabase = new List(); masterControllerToName.Clear(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { statsDatabase.Add(new PlayerStatsDatabase(instance)); } Log.Info($"Successfully setup stats database for {statsDatabase.Count} players"); } private static void TakeRecord() { if (!NetworkServer.active) { return; } foreach (PlayerStatsDatabase item in statsDatabase) { float num = item.TakeRecord(); Log.Info($"Successfully made record at {num} for {item.GetPlayerName()}"); } } private static void ReportToLog() { if (!NetworkServer.active) { return; } StringBuilder stringBuilder = new StringBuilder(); foreach (PlayerStatsDatabase item in statsDatabase) { stringBuilder.AppendLine(item.GetPlayerName() ?? ""); stringBuilder.AppendLine(item.GetStatSeriesAsString("timestamps")); foreach (string allStat in PlayerStatsDatabase.allStats) { stringBuilder.AppendLine(item.GetStatSeriesAsString(allStat)); } stringBuilder.AppendLine(""); } Log.Info(stringBuilder.ToString()); } public static string GetRScript() { CreateIndependentDatabase(); StringBuilder stringBuilder = new StringBuilder(independentDatabase[0].GetStatSeriesAsString("timestamps", rVector: true)); stringBuilder.AppendLine(); List list = new List(); string text = ""; string text2 = ""; for (int i = 0; i < independentDatabase.Count; i++) { IndependentEntry independentEntry = independentDatabase[i]; list.Add(independentEntry.playerName); text = text + "\"" + independentEntry.playerName + "\", "; text2 += $"rainbow({independentDatabase.Count})[{i + 1}], "; foreach (string allStat in PlayerStatsDatabase.allStats) { stringBuilder.AppendLine($"player{i}.{independentEntry.GetStatSeriesAsString(allStat, rVector: true)}"); } stringBuilder.AppendLine(); } text = text.Substring(0, Math.Max(0, text.Length - 2)); text2 = text2.Substring(0, Math.Max(0, text2.Length - 2)); string value = "legend(\"topright\", inset=c(-0.25,0), legend=c(" + text + "), col = c(" + text2 + "), lty=1, pch=1, bty=\"n\")"; stringBuilder.AppendLine("par(xpd = TRUE, mar = c(5, 4, 4, 6))"); stringBuilder.AppendLine(); foreach (string allStat2 in PlayerStatsDatabase.allStats) { string text3 = ""; for (int j = 0; j < list.Count; j++) { text3 += $"player{j}.{allStat2}, "; } text3 = text3.Substring(0, Math.Max(0, text3.Length - 2)); stringBuilder.AppendLine("yLimit <- c(min(" + text3 + "), max(" + text3 + "))"); stringBuilder.AppendLine(string.Format("plot(timestamps, player0.{0}, type = \"b\", col = rainbow({1})[1], ylab = \"{2}\", xlab = \"timestamp\", main = \"{3}\", ylim = yLimit)", allStat2, list.Count, Language.english.GetLocalizedStringByToken("STATSMOD_STAT_TITLE_" + allStat2), Language.english.GetLocalizedStringByToken("STATSMOD_STAT_TITLE_" + allStat2))); for (int k = 1; k < list.Count; k++) { stringBuilder.AppendLine($"points(timestamps, player{k}.{allStat2}, type = \"b\", col=rainbow({list.Count})[{k + 1}])"); } stringBuilder.AppendLine(value); stringBuilder.AppendLine(); } return stringBuilder.ToString(); } private static void ResetBodyCounter() { bodiesCounter = 0; awaitingStageRecord = true; CharacterBody.onBodyStartGlobal += CheckTakeRecord; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("pond.StatsPlus", "StatsPlus", "2.1.0")] public class StatsMod : BaseUnityPlugin { public const string PluginGUID = "pond.StatsPlus"; public const string PluginAuthor = "pond"; public const string PluginName = "StatsPlus"; public const string PluginVersion = "2.1.0"; public static PluginInfo pluginInfo; public static StatsMod instance; public void Awake() { instance = this; pluginInfo = ((BaseUnityPlugin)this).Info; Log.Init(((BaseUnityPlugin)this).Logger); StatTokens.Init(); NetworkingAPI.RegisterMessageType(); Assets.Init(); CustomStatTracker.Init(); RecordHandler.Init(); StatsScreen.Init(); } private void Update() { } } public static class StatTokens { public const string titlePrefix = "STATSMOD_STAT_TITLE_"; public const string bodyPrefix = "STATSMOD_STAT_BODY_"; public static void Init() { AddStatsModTokens(); } public static void AddStatsModTokens() { Language.Add("STATSMOD_STAT_TITLE_maxHealth", "Max Health"); Language.Add("STATSMOD_STAT_BODY_maxHealth", "The size of each player's maximum health (the green portion of the health bar)."); Language.Add("STATSMOD_STAT_TITLE_regen", "Regen"); Language.Add("STATSMOD_STAT_BODY_regen", "Each player's health regeneration (in hp/s)."); Language.Add("STATSMOD_STAT_TITLE_maxShield", "Max Shield"); Language.Add("STATSMOD_STAT_BODY_maxShield", "The size of each player's maximum shield (the blue portion of the health bar)."); Language.Add("STATSMOD_STAT_TITLE_moveSpeed", "Move Speed"); Language.Add("STATSMOD_STAT_BODY_moveSpeed", "Each player's base movement speed."); Language.Add("STATSMOD_STAT_TITLE_maxJumpCount", "Max Jump Count"); Language.Add("STATSMOD_STAT_BODY_maxJumpCount", "Each player's maximum jump count"); Language.Add("STATSMOD_STAT_TITLE_damage", "Damage"); Language.Add("STATSMOD_STAT_BODY_damage", "Each player's base damage stat."); Language.Add("STATSMOD_STAT_TITLE_attackSpeed", "Attack Speed"); Language.Add("STATSMOD_STAT_BODY_attackSpeed", "Each player's attack speed multiplier."); Language.Add("STATSMOD_STAT_TITLE_crit", "Crit Chance"); Language.Add("STATSMOD_STAT_BODY_crit", "Each player's critical hit chance."); Language.Add("STATSMOD_STAT_TITLE_armor", "Armor"); Language.Add("STATSMOD_STAT_BODY_armor", "Each player's armor stat. Damage reduction multiplier = armor / (100 + armor)."); Language.Add("STATSMOD_STAT_TITLE_totalTimeAlive", "Total Time Alive"); Language.Add("STATSMOD_STAT_BODY_totalTimeAlive", "The total time in seconds that each player was alive for while the run stopwatch was active."); Language.Add("STATSMOD_STAT_TITLE_totalKills", "Total Kills"); Language.Add("STATSMOD_STAT_BODY_totalKills", "The total enemy kills of each player."); Language.Add("STATSMOD_STAT_TITLE_totalMinionKills", "Total Minion Kills"); Language.Add("STATSMOD_STAT_BODY_totalMinionKills", "The total kills of all minions belonging to an individual player."); Language.Add("STATSMOD_STAT_TITLE_totalDeaths", "Total Deaths"); Language.Add("STATSMOD_STAT_BODY_totalDeaths", "Each player's total amount of deaths."); Language.Add("STATSMOD_STAT_TITLE_totalDamageDealt", "Total Damage Dealt"); Language.Add("STATSMOD_STAT_BODY_totalDamageDealt", "The total amount of damage dealt by each individual player."); Language.Add("STATSMOD_STAT_TITLE_totalMinionDamageDealt", "Total Minion Damage Dealt"); Language.Add("STATSMOD_STAT_BODY_totalMinionDamageDealt", "The total damage dealt by all minions belonging to an individual player."); Language.Add("STATSMOD_STAT_TITLE_totalDamageTaken", "Total Damage Taken"); Language.Add("STATSMOD_STAT_BODY_totalDamageTaken", "The total damage that each individual player took."); Language.Add("STATSMOD_STAT_TITLE_totalHealthHealed", "Total Health Healed"); Language.Add("STATSMOD_STAT_BODY_totalHealthHealed", "The total amount of health that each individual player restored."); Language.Add("STATSMOD_STAT_TITLE_highestDamageDealt", "Highest Damage Dealt"); Language.Add("STATSMOD_STAT_BODY_highestDamageDealt", "The highest damage attack landed by each player."); Language.Add("STATSMOD_STAT_TITLE_goldCollected", "Gold Collected"); Language.Add("STATSMOD_STAT_BODY_goldCollected", "The total gold collected by each individual player"); Language.Add("STATSMOD_STAT_TITLE_totalItemsCollected", "Total Items Collected"); Language.Add("STATSMOD_STAT_BODY_totalItemsCollected", "Each player's total amount of items."); Language.Add("STATSMOD_STAT_TITLE_totalDistanceTraveled", "Total Distance Traveled"); Language.Add("STATSMOD_STAT_BODY_totalDistanceTraveled", "The distance that each individual player covered, in marathons."); Language.Add("STATSMOD_STAT_TITLE_totalPurchases", "Total Purchases"); Language.Add("STATSMOD_STAT_BODY_totalPurchases", "The total amount of interactable purchases made by each player"); Language.Add("STATSMOD_STAT_TITLE_totalGoldPurchases", "Total Gold Purchases"); Language.Add("STATSMOD_STAT_BODY_totalGoldPurchases", "The total amount of interactable purchases costing gold made by each player."); Language.Add("STATSMOD_STAT_TITLE_totalBloodPurchases", "Total Blood Purchases"); Language.Add("STATSMOD_STAT_BODY_totalBloodPurchases", "The total amount of interactable purchases costing health made by each player."); Language.Add("STATSMOD_STAT_TITLE_totalLunarPurchases", "Total Lunar Purchases"); Language.Add("STATSMOD_STAT_BODY_totalLunarPurchases", "The total amount of interactable purchases costing lunar coins made by each player."); Language.Add("STATSMOD_STAT_TITLE_totalTier1Purchases", "Total Tier 1 Purchases"); Language.Add("STATSMOD_STAT_BODY_totalTier1Purchases", "The total amount of interactable purchases costing common (white) items made by each player"); Language.Add("STATSMOD_STAT_TITLE_totalTier2Purchases", "Total Tier 2 Purchases"); Language.Add("STATSMOD_STAT_BODY_totalTier2Purchases", "The total amount of interactable purchases costing uncommon (green) items made by each player"); Language.Add("STATSMOD_STAT_TITLE_totalTier3Purchases", "Total Tier 3 Purchases"); Language.Add("STATSMOD_STAT_BODY_totalTier3Purchases", "The total amount of interactable purchases costing legendary (red) items made by each player"); Language.Add("STATSMOD_STAT_TITLE_totalDronesPurchased", "Total Drones Purchased"); Language.Add("STATSMOD_STAT_BODY_totalDronesPurchased", "The total amount of drone interactables purchased by each individual player"); Language.Add("STATSMOD_STAT_TITLE_totalTurretsPurchased", "Total Turrets Purchased"); Language.Add("STATSMOD_STAT_BODY_totalTurretsPurchased", "The total amount of turret interactables purchased by each individual player"); Language.Add("STATSMOD_STAT_TITLE_totalGreenSoupsPurchased", "Total Green Soups Purchased"); Language.Add("STATSMOD_STAT_BODY_totalGreenSoupsPurchased", "The total amount of common-to-uncommon item cauldrons interacted with by each individual player"); Language.Add("STATSMOD_STAT_TITLE_totalRedSoupsPurchased", "Total Red Soups Purchased"); Language.Add("STATSMOD_STAT_BODY_totalRedSoupsPurchased", "The total amount of uncommon-to-legendary item cauldrons interacted with by each individual player"); Language.Add("STATSMOD_STAT_TITLE_shrinePurchases", "Shrine of Chance Purchases"); Language.Add("STATSMOD_STAT_BODY_shrinePurchases", "The total amount of times a Shrine of Chance was interacted with by an individual player."); Language.Add("STATSMOD_STAT_TITLE_shrineWins", "Shrine of Chance Wins"); Language.Add("STATSMOD_STAT_BODY_shrineWins", "The total amount of times a Shrine of Chance was successfully interacted with by an individual player."); Language.Add("STATSMOD_STAT_TITLE_orderHits", "Shrine of Order Hits"); Language.Add("STATSMOD_STAT_BODY_orderHits", "The total amount of times a Shrine of Order was interacted with by an individual player."); Language.Add("STATSMOD_STAT_TITLE_timeStill", "Time Still"); Language.Add("STATSMOD_STAT_BODY_timeStill", "The total amount of time in seconds each player spent standing still while the stopwatch was active."); Language.Add("STATSMOD_STAT_TITLE_timeStillUnsafe", "Time Still While Unsafe"); Language.Add("STATSMOD_STAT_BODY_timeStillUnsafe", "The total amount of time in seconds each player spent standing still while the stopwatch was active, and the environment is considered\"unsafe\": teleporter is not charged, or void fields / void locus is not completed"); Language.Add("STATSMOD_STAT_TITLE_timeLowHealth", "Time At Low Health"); Language.Add("STATSMOD_STAT_BODY_timeLowHealth", "The total amount of time in seconds each player spent with their healh below 25%."); Language.Add("STATSMOD_STAT_TITLE_fallDamage", "Fall Damage"); Language.Add("STATSMOD_STAT_BODY_fallDamage", "The total amount of fall damage received by each player."); Language.Add("STATSMOD_STAT_TITLE_coinsSpent", "Lunar Coins Spent"); Language.Add("STATSMOD_STAT_BODY_coinsSpent", "The total amount of lunar coins spent by each player."); Language.Add("STATSMOD_STAT_TITLE_avenges", "Avenges"); Language.Add("STATSMOD_STAT_BODY_avenges", "How many times each player killed an enemy that had harmed another player."); Language.Add("STATSMOD_STAT_TITLE_timesLastStanding", "Times Last Standing"); Language.Add("STATSMOD_STAT_BODY_timesLastStanding", "The amount of times a player was the last player standing."); Language.Add("STATSMOD_STAT_TITLE_itemLead", "Item Lead"); Language.Add("STATSMOD_STAT_BODY_itemLead", "The item lead of the player with the most items to the player with the second most items."); Language.Add("STATSMOD_STAT_TITLE_nonScrapPrinted", "Non-Scrap Printed"); Language.Add("STATSMOD_STAT_BODY_nonScrapPrinted", "The amount of non-scrap items spent by each individual player."); Language.Add("STATSMOD_STAT_TITLE_likelyDonations", "Likely Donations"); Language.Add("STATSMOD_STAT_BODY_likelyDonations", "The total amount of items that each player is estimated to have donated to other players."); Language.Add("STATSMOD_STAT_TITLE_allies", "Allies"); Language.Add("STATSMOD_STAT_BODY_allies", "The total permanent allies that each player possessed. Counting is finicky - may not support certain modded allies."); } } } namespace StatsMod.CustomStats { public static class CustomStatTracker { public static List registeredStats = new List(); public static Dictionary statsTable = new Dictionary(); private static bool loaded = false; public static object GetStat(PlayerCharacterMasterController player, string statName) { if (statsTable.ContainsKey(statName)) { IDictionary dictionary = statsTable[statName]; if (dictionary != null) { IDictionary dictionary2 = dictionary; if (true) { string key = RecordHandler.masterControllerToName[player]; if (!dictionary2.Contains(key)) { return 0; } return dictionary2[key]; } } return 0; } Log.Error("Stat not found, returning 0"); return 0; } public static void Init() { if (!loaded) { InitCustomStats(); } loaded = true; } public static void ResetData() { foreach (IDictionary value in statsTable.Values) { if (value != null) { IDictionary dictionary = value; if (true) { dictionary.Clear(); } } } } private static void InitCustomStats() { new Allies().Init(); new Avenges().Init(); new CoinsSpent().Init(); new FallDamage().Init(); new ItemLead().Init(); new NonScrapPrinted().Init(); new OrderHits().Init(); new ShrinePurchases().Init(); new TimeLowHealth().Init(); new TimesLastStanding().Init(); new TimeStill().Init(); } } public static class CustomStatUtils { public static bool IsSafe() { VoidStageMissionController instance = VoidStageMissionController.instance; int? num = ((instance != null) ? new int?(instance.numBatteriesActivated) : ((int?)null)); VoidStageMissionController instance2 = VoidStageMissionController.instance; int num2; if (num >= ((instance2 != null) ? new int?(instance2.numBatteriesSpawned) : ((int?)null))) { VoidStageMissionController instance3 = VoidStageMissionController.instance; num2 = ((instance3 != null && instance3.numBatteriesSpawned > 0) ? 1 : 0); } else { num2 = 0; } bool flag = (byte)num2 != 0; TeleporterInteraction instance4 = TeleporterInteraction.instance; int result; if (instance4 == null) { ArenaMissionController instance5 = ArenaMissionController.instance; result = (((instance5 != null) ? instance5.clearedEffect.activeSelf : flag) ? 1 : 0); } else { result = (instance4.isCharged ? 1 : 0); } return (byte)result != 0; } public static bool CanDeserialize(this Dictionary dict, T1 key) { if (dict.ContainsKey(key) && dict[key] != null) { return true; } Log.Error($"Error deserializing custom stat - could not find key '{key}'"); return false; } } internal class Allies : BaseCustomStat { private static Dictionary alliesDict = new Dictionary(); public override void Init() { base.Init(); SceneExitController.onBeginExit += AllyCountTrackLeaveStage; Run.onServerGameOver += AllyCountTrackRunOver; } private static void AllyCountTrackRunOver(Run run, GameEndingDef gameEndingDef) { CountAllies(); } private static void AllyCountTrackLeaveStage(SceneExitController sceneExitController) { CountAllies(); } private static void CountAllies() { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { Inventory inventory = instance.master.inventory; CharacterMaster master = instance.master; int num = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster u) => (((Object)u).name.Contains("Drone") || ((Object)u).name.Contains("Turret")) && (Object)(object)u.minionOwnership.ownerMaster == (Object)(object)master).Count(); int value = master.GetDeployableSameSlotLimit((DeployableSlot)2) + master.GetDeployableSameSlotLimit((DeployableSlot)8) + master.GetDeployableSameSlotLimit((DeployableSlot)18) + ((inventory.GetItemCountPermanent(Items.RoboBallBuddy) > 0) ? 2 : 0) + num; string key = RecordHandler.masterControllerToName[instance]; if (alliesDict.ContainsKey(key)) { alliesDict[key] = (uint)value; } else { alliesDict.Add(key, (uint)value); } } } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("allies", alliesDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("allies")) { alliesDict = restored["allies"].ToObject>(); } } } internal class Avenges : BaseCustomStat { [CompilerGenerated] private static class <>O { public static Action <0>__AvengesTrack; public static hook_ctor <1>__RecordHitList; public static hook_BeginStage <2>__ClearDicts; } private static Dictionary avengesDict = new Dictionary(); private static Dictionary> avengeHitList = new Dictionary>(); public override void Init() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005a: 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_0065: Expected O, but got Unknown base.Init(); GlobalEventManager.onCharacterDeathGlobal += AvengesTrack; object obj = <>O.<1>__RecordHitList; if (obj == null) { hook_ctor val = RecordHitList; <>O.<1>__RecordHitList = val; obj = (object)val; } DamageReport.ctor += (hook_ctor)obj; object obj2 = <>O.<2>__ClearDicts; if (obj2 == null) { hook_BeginStage val2 = ClearDicts; <>O.<2>__ClearDicts = val2; obj2 = (object)val2; } Run.BeginStage += (hook_BeginStage)obj2; } private static void RecordHitList(orig_ctor orig, DamageReport self, DamageInfo damageInfo, HealthComponent victim, float damageDealt, float combinedHealthBeforeDamage) { orig.Invoke(self, damageInfo, victim, damageDealt, combinedHealthBeforeDamage); CharacterBody val = (Object.op_Implicit((Object)(object)victim) ? victim.body : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); CharacterMaster key = ((val2 != null) ? val2.master : null); try { if (val == null || !val.isPlayerControlled || val2 == null || val2.isChampion) { return; } PlayerCharacterMasterController component = ((Component)val.master).GetComponent(); if (avengeHitList.ContainsKey(key)) { if (!avengeHitList[key].Contains(component)) { avengeHitList[key].Add(component); } } else { avengeHitList.Add(key, new List(1) { component }); } } catch (ArgumentNullException) { } } private static void AvengesTrack(DamageReport damageReport) { CharacterMaster victimMaster = damageReport.victimMaster; if ((Object)(object)victimMaster == (Object)null || !avengeHitList.ContainsKey(victimMaster)) { return; } CharacterBody attackerBody = damageReport.attackerBody; if (attackerBody == null || !attackerBody.isPlayerControlled) { return; } PlayerCharacterMasterController component = ((Component)damageReport.attackerMaster).GetComponent(); if (avengeHitList[victimMaster].Count > 1 || (Object)(object)avengeHitList[victimMaster][0] != (Object)(object)component) { string key = RecordHandler.masterControllerToName[component]; if (avengesDict.ContainsKey(key)) { avengesDict[key]++; } else { avengesDict.Add(key, 1u); } } avengeHitList.Remove(victimMaster); } private static void ClearDicts(orig_BeginStage orig, Run self) { avengeHitList = new Dictionary>(); orig.Invoke(self); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("avenges", avengesDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("avenges")) { avengesDict = restored["avenges"].ToObject>(); } } } public abstract class BaseCustomStat { public virtual void Init() { CustomStatTracker.registeredStats.Add(this); ConfigureStatsTable(); } public abstract void ConfigureStatsTable(); public void TryDeserialize(Dictionary restored) { try { Deserialize(restored); } catch (Exception arg) { Log.Error($"Failed to deserialize custom stat!\n{arg}"); } } public abstract void Deserialize(Dictionary restored); } internal class CoinsSpent : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_DeductLunarCoins <0>__CoinsTrack; } private static Dictionary coinsSpentDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__CoinsTrack; if (obj == null) { hook_DeductLunarCoins val = CoinsTrack; <>O.<0>__CoinsTrack = val; obj = (object)val; } NetworkUser.DeductLunarCoins += (hook_DeductLunarCoins)obj; } private static void CoinsTrack(orig_DeductLunarCoins orig, NetworkUser self, uint count) { PlayerCharacterMasterController masterController = self.masterController; if (masterController != null) { string key = RecordHandler.masterControllerToName[masterController]; if (coinsSpentDict.ContainsKey(key)) { coinsSpentDict[key] += count; } else { coinsSpentDict.Add(key, count); } } orig.Invoke(self, count); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("coinsSpent", coinsSpentDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("coinsSpent")) { coinsSpentDict = restored["coinsSpent"].ToObject>(); } } } internal class FallDamage : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_OnTakeDamageServer <0>__FallDamageTrack; } private static Dictionary fallDamageDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__FallDamageTrack; if (obj == null) { hook_OnTakeDamageServer val = FallDamageTrack; <>O.<0>__FallDamageTrack = val; obj = (object)val; } CharacterBody.OnTakeDamageServer += (hook_OnTakeDamageServer)obj; } private static void FallDamageTrack(orig_OnTakeDamageServer orig, CharacterBody self, DamageReport damageReport) { bool flag; try { flag = damageReport.victimBody.isPlayerControlled && damageReport.isFallDamage; } catch (NullReferenceException) { return; } if (flag) { PlayerCharacterMasterController component = ((Component)damageReport.victimMaster).GetComponent(); string key = RecordHandler.masterControllerToName[component]; if (fallDamageDict.ContainsKey(key)) { fallDamageDict[key] += damageReport.damageDealt; } else { fallDamageDict.Add(key, damageReport.damageDealt); } } orig.Invoke(self, damageReport); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("fallDamage", fallDamageDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("fallDamage")) { fallDamageDict = restored["fallDamage"].ToObject>(); } } } internal class ItemLead : BaseCustomStat { private static Dictionary itemLeadDict = new Dictionary(); public override void Init() { base.Init(); SceneExitController.onBeginExit += ItemLeadTrack; } private static void ItemLeadTrack(SceneExitController sceneExitController) { if (PlayerCharacterMasterController.instances.Count < 2) { return; } uint num = 0u; uint num2 = 0u; string key = null; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { string text = RecordHandler.masterControllerToName[instance]; itemLeadDict[text] = 0u; uint totalItemStacks = (uint)((ItemCollection)(ref instance.master.inventory.permanentItemStacks)).GetTotalItemStacks(); if (totalItemStacks >= num2) { num = totalItemStacks - num2; num2 = totalItemStacks; key = text; } else if (num2 - totalItemStacks < num) { num = num2 - totalItemStacks; } } if (itemLeadDict.ContainsKey(key)) { itemLeadDict[key] = num; } else { itemLeadDict.Add(key, num); } } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("itemLead", itemLeadDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("itemLead")) { itemLeadDict = restored["itemLead"].ToObject>(); } } } internal class NonScrapPrinted : BaseCustomStat { [CompilerGenerated] private static class <>O { public static Manipulator <0>__NonScrapTrack; } private static Dictionary nonScrapPrintedDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__NonScrapTrack; if (obj == null) { Manipulator val = NonScrapTrack; <>O.<0>__NonScrapTrack = val; obj = (object)val; } PurchaseInteraction.OnInteractionBegin += (Manipulator)obj; } private static void NonScrapTrack(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_009d: 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) ILCursor val = new ILCursor(il); int itemIndexLoc = 20; int num = default(int); ILLabel val2 = default(ILLabel); if (val.TryGotoNext(new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref itemIndexLoc), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "itemIndex"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchBeq(x, ref val2) })) { val.Emit(OpCodes.Ldloc_0); val.Emit(OpCodes.Ldloc, itemIndexLoc); val.EmitDelegate>((Action)delegate(CharacterBody interactorBody, ItemAndStackValues item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(item.itemIndex); ItemDef[] source = (ItemDef[])(object)new ItemDef[5] { Items.ScrapWhite, Items.ScrapGreen, Items.ScrapRed, Items.ScrapYellow, Items.RegeneratingScrap }; if (!source.Contains(itemDef)) { PlayerCharacterMasterController playerCharacterMasterController = interactorBody.master.playerCharacterMasterController; string key = RecordHandler.masterControllerToName[playerCharacterMasterController]; if (nonScrapPrintedDict.ContainsKey(key)) { nonScrapPrintedDict[key]++; } else { nonScrapPrintedDict.Add(key, 1u); } } }); } else { Log.Error("NonScrapTrack IL hook borked."); } } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("nonScrapPrinted", nonScrapPrintedDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("nonScrapPrinted")) { nonScrapPrintedDict = restored["nonScrapPrinted"].ToObject>(); } } } internal class OrderHits : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_AddShrineStack <0>__OrderTrack; } private static Dictionary orderHitsDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__OrderTrack; if (obj == null) { hook_AddShrineStack val = OrderTrack; <>O.<0>__OrderTrack = val; obj = (object)val; } ShrineRestackBehavior.AddShrineStack += (hook_AddShrineStack)obj; } private static void OrderTrack(orig_AddShrineStack orig, ShrineRestackBehavior self, Interactor interactor) { PlayerCharacterMasterController playerCharacterMasterController = ((Component)interactor).GetComponent().master.playerCharacterMasterController; string key = RecordHandler.masterControllerToName[playerCharacterMasterController]; if (orderHitsDict.ContainsKey(key)) { orderHitsDict[key]++; } else { orderHitsDict.Add(key, 1u); } orig.Invoke(self, interactor); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("orderHits", orderHitsDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("orderHits")) { orderHitsDict = restored["orderHits"].ToObject>(); } } } internal class ShrinePurchases : BaseCustomStat { private static Dictionary shrinePurchasesDict = new Dictionary(); private static Dictionary shrineWinsDict = new Dictionary(); public override void Init() { base.Init(); ShrineChanceBehavior.onShrineChancePurchaseGlobal += ShrineTrack; } private static void ShrineTrack(bool failed, Interactor activator) { PlayerCharacterMasterController playerCharacterMasterController = ((Component)activator).GetComponent().master.playerCharacterMasterController; string key = RecordHandler.masterControllerToName[playerCharacterMasterController]; if (shrinePurchasesDict.ContainsKey(key)) { shrinePurchasesDict[key]++; if (!failed) { shrineWinsDict[key]++; } } else { shrinePurchasesDict.Add(key, 1u); if (!failed) { shrineWinsDict.Add(key, 1u); } else { shrineWinsDict.Add(key, 0u); } } } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("shrinePurchases", shrinePurchasesDict); CustomStatTracker.statsTable.Add("shrineWins", shrineWinsDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("shrinePurchases")) { shrinePurchasesDict = restored["shrinePurchases"].ToObject>(); } if (restored.CanDeserialize("shrineWins")) { shrineWinsDict = restored["shrineWins"].ToObject>(); } } } internal class TimeLowHealth : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_OnFixedUpdate <0>__LowHealthTrack; } private static Dictionary timeLowHealthDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__LowHealthTrack; if (obj == null) { hook_OnFixedUpdate val = LowHealthTrack; <>O.<0>__LowHealthTrack = val; obj = (object)val; } Run.OnFixedUpdate += (hook_OnFixedUpdate)obj; } private static void LowHealthTrack(orig_OnFixedUpdate orig, Run self) { if (NetworkServer.active && PlayerCharacterMasterController.instances.Count > 0) { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { try { if (instance.master.GetBody().healthComponent.isHealthLow) { string key = RecordHandler.masterControllerToName[instance]; try { timeLowHealthDict[key] += Time.fixedDeltaTime; } catch (KeyNotFoundException) { timeLowHealthDict.Add(key, Time.fixedDeltaTime); } } } catch (NullReferenceException) { } } } orig.Invoke(self); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("timeLowHealth", timeLowHealthDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("timeLowHealth")) { timeLowHealthDict = restored["timeLowHealth"].ToObject>(); } } } internal class TimesLastStanding : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_OnPlayerCharacterDeath <0>__LastStandingTrack; } private static Dictionary timesLastStandingDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__LastStandingTrack; if (obj == null) { hook_OnPlayerCharacterDeath val = LastStandingTrack; <>O.<0>__LastStandingTrack = val; obj = (object)val; } GlobalEventManager.OnPlayerCharacterDeath += (hook_OnPlayerCharacterDeath)obj; } private static void LastStandingTrack(orig_OnPlayerCharacterDeath orig, GlobalEventManager self, DamageReport damageReport, NetworkUser victimNetworkUser) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (CustomStatUtils.IsSafe()) { return; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "bazaar") { return; } int num = 0; PlayerCharacterMasterController key = null; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (!instance.master.IsDeadAndOutOfLivesServer()) { num++; key = instance; } } if (num == 1) { string key2 = RecordHandler.masterControllerToName[key]; if (timesLastStandingDict.ContainsKey(key2)) { timesLastStandingDict[key2]++; } else { timesLastStandingDict.Add(key2, 1u); } } orig.Invoke(self, damageReport, victimNetworkUser); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("timesLastStanding", timesLastStandingDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("timesLastStanding")) { timesLastStandingDict = restored["timesLastStanding"].ToObject>(); } } } internal class TimeStill : BaseCustomStat { [CompilerGenerated] private static class <>O { public static hook_OnFixedUpdate <0>__StillTrack; } private static Dictionary timeStillDict = new Dictionary(); private static Dictionary timeStillUnsafeDict = new Dictionary(); public override void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown base.Init(); object obj = <>O.<0>__StillTrack; if (obj == null) { hook_OnFixedUpdate val = StillTrack; <>O.<0>__StillTrack = val; obj = (object)val; } Run.OnFixedUpdate += (hook_OnFixedUpdate)obj; } private static void StillTrack(orig_OnFixedUpdate orig, Run self) { if (NetworkServer.active && PlayerCharacterMasterController.instances.Count > 0) { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Run.instance.isRunStopwatchPaused) { continue; } bool flag = false; try { flag = instance.master.GetBody().GetNotMoving(); } catch (NullReferenceException) { continue; } bool flag2 = CustomStatUtils.IsSafe(); if (!flag) { continue; } string key = RecordHandler.masterControllerToName[instance]; if (timeStillDict.ContainsKey(key)) { timeStillDict[key] += Time.fixedDeltaTime; if (!flag2) { timeStillUnsafeDict[key] += Time.fixedDeltaTime; } } else { timeStillDict.Add(key, Time.fixedDeltaTime); if (!flag2) { timeStillUnsafeDict.Add(key, Time.fixedDeltaTime); } else { timeStillUnsafeDict.Add(key, 0f); } } } } orig.Invoke(self); } public override void ConfigureStatsTable() { CustomStatTracker.statsTable.Add("timeStill", timeStillDict); CustomStatTracker.statsTable.Add("timeStillUnsafe", timeStillUnsafeDict); } public override void Deserialize(Dictionary restored) { if (restored.CanDeserialize("timeStill")) { timeStillDict = restored["timeStill"].ToObject>(); } if (restored.CanDeserialize("timeStillUnsafe")) { timeStillUnsafeDict = restored["timeStillUnsafe"].ToObject>(); } } } }