using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.codaaaaaa.pitchcrosshair")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.3.0")]
[assembly: AssemblyInformationalVersion("0.3.3")]
[assembly: AssemblyProduct("com.codaaaaaa.pitchcrosshair")]
[assembly: AssemblyTitle("PeakPitchCrosshair")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace PeakPitchCrosshair
{
[BepInPlugin("com.codaaaaaa.pitchcrosshair", "Peak Pitch Crosshair", "0.3.3")]
public class Plugin : BaseUnityPlugin
{
[Serializable]
private class NoteRange
{
public string noteName;
public float minAngle;
public float maxAngle;
public int degree;
public bool sharp;
public int octave;
public float Mid => 0.5f * (minAngle + maxAngle);
public string Jianpu
{
get
{
string text = (sharp ? "♯" : "");
string text2 = degree.ToString();
string text3 = ((octave < 0) ? "." : ((octave > 0) ? "′" : ""));
return text + text2 + text3;
}
}
}
private class RenderBand
{
public NoteRange src;
public float dispMin;
public float dispMax;
}
[Serializable]
private class PrecisePoint
{
public string noteName;
public float angleDeg;
public float hz;
public bool sharp;
public int degree;
public int octave;
public string Jianpu => string.Format("{0}{1}{2}", sharp ? "♯" : "", degree, (octave < 0) ? "." : ((octave > 0) ? "′" : ""));
}
public const string PluginGuid = "com.codaaaaaa.pitchcrosshair";
public const string PluginName = "Peak Pitch Crosshair";
public const string PluginVersion = "0.3.3";
private ConfigEntry<bool> _enabled;
private ConfigEntry<KeyCode> _toggleKey;
private ConfigEntry<bool> _invertPitch;
private ConfigEntry<bool> _showLabels;
private ConfigEntry<bool> _highlightActive;
private ConfigEntry<bool> _showSharps;
private ConfigEntry<KeyCode> _toggleSharpsKey;
private ConfigEntry<float> _rayMaxDist;
private ConfigEntry<int> _rayLayerMask;
private ConfigEntry<float> _edgeClampDeg;
private ConfigEntry<bool> _fallbackWhenNoHit;
private ConfigEntry<int> _tickHalfWidthPx;
private ConfigEntry<int> _tickThicknessPx;
private ConfigEntry<int> _bracketThicknessPx;
private ConfigEntry<int> _fontSize;
private ConfigEntry<bool> _fontBold;
private ConfigEntry<string> _preferredFontName;
private Font _activeFont;
private GUIStyle _labelStyle;
private GUIStyle _labelOutlineStyle;
private ConfigEntry<float> _alphaNatural;
private ConfigEntry<float> _alphaSharp;
private ConfigEntry<float> _alphaActiveBoost;
private ConfigEntry<bool> _showPrecisePoints;
private ConfigEntry<KeyCode> _togglePrecisePointsKey;
private ConfigEntry<int> _precisePointSizePx;
private ConfigEntry<int> _precisePointThicknessPx;
private ConfigEntry<bool> _precisePointShowLabel;
private ConfigEntry<float> _precisePointAlpha;
private Texture2D _tex1x1;
private static readonly NoteRange[] RawRanges = new NoteRange[25]
{
new NoteRange
{
noteName = "C4",
minAngle = 78.92f,
maxAngle = 84.31f,
degree = 1,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "C#4",
minAngle = 70.71f,
maxAngle = 79.22f,
degree = 1,
sharp = true,
octave = -1
},
new NoteRange
{
noteName = "D4",
minAngle = 63.98f,
maxAngle = 70.1f,
degree = 2,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "D#4",
minAngle = 58.57f,
maxAngle = 63.72f,
degree = 2,
sharp = true,
octave = -1
},
new NoteRange
{
noteName = "E4",
minAngle = 53.42f,
maxAngle = 58.33f,
degree = 3,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "F4",
minAngle = 48.78f,
maxAngle = 53.23f,
degree = 4,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "F#4",
minAngle = 44.28f,
maxAngle = 48.68f,
degree = 4,
sharp = true,
octave = -1
},
new NoteRange
{
noteName = "G4",
minAngle = 39.69f,
maxAngle = 43.63f,
degree = 5,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "G#4",
minAngle = 35.22f,
maxAngle = 39.53f,
degree = 5,
sharp = true,
octave = -1
},
new NoteRange
{
noteName = "A4",
minAngle = 30.91f,
maxAngle = 35.1f,
degree = 6,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "A#4",
minAngle = 26.27f,
maxAngle = 30.61f,
degree = 6,
sharp = true,
octave = -1
},
new NoteRange
{
noteName = "B4",
minAngle = 21.38f,
maxAngle = 25.84f,
degree = 7,
sharp = false,
octave = -1
},
new NoteRange
{
noteName = "C5",
minAngle = 16.76f,
maxAngle = 20.89f,
degree = 1,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "C#5",
minAngle = 11.55f,
maxAngle = 16.24f,
degree = 1,
sharp = true,
octave = 0
},
new NoteRange
{
noteName = "D5",
minAngle = 6.77f,
maxAngle = 11.43f,
degree = 2,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "D#5",
minAngle = 1.72f,
maxAngle = 6.85f,
degree = 2,
sharp = true,
octave = 0
},
new NoteRange
{
noteName = "E5",
minAngle = -4.13f,
maxAngle = 1f,
degree = 3,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "F5",
minAngle = -9.74f,
maxAngle = -4.54f,
degree = 4,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "F#5",
minAngle = -16.34f,
maxAngle = -9.88f,
degree = 4,
sharp = true,
octave = 0
},
new NoteRange
{
noteName = "G5",
minAngle = -22.77f,
maxAngle = -16.31f,
degree = 5,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "G#5",
minAngle = -30.49f,
maxAngle = -23.42f,
degree = 5,
sharp = true,
octave = 0
},
new NoteRange
{
noteName = "A5",
minAngle = -39.19f,
maxAngle = -30.68f,
degree = 6,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "A#5",
minAngle = -50.75f,
maxAngle = -39.7f,
degree = 6,
sharp = true,
octave = 0
},
new NoteRange
{
noteName = "B5",
minAngle = -67.12f,
maxAngle = -50.67f,
degree = 7,
sharp = false,
octave = 0
},
new NoteRange
{
noteName = "C6",
minAngle = -82.05f,
maxAngle = -66.18f,
degree = 1,
sharp = false,
octave = 1
}
};
private static readonly PrecisePoint[] PrecisePoints = new PrecisePoint[15]
{
new PrecisePoint
{
noteName = "C4",
angleDeg = 85f,
hz = 261.6f,
sharp = false,
degree = 1,
octave = -1
},
new PrecisePoint
{
noteName = "D4",
angleDeg = 66.7f,
hz = 293.7f,
sharp = false,
degree = 2,
octave = -1
},
new PrecisePoint
{
noteName = "E4",
angleDeg = 55.8f,
hz = 329.6f,
sharp = false,
degree = 3,
octave = -1
},
new PrecisePoint
{
noteName = "F4",
angleDeg = 50.9f,
hz = 349.2f,
sharp = false,
degree = 4,
octave = -1
},
new PrecisePoint
{
noteName = "G4",
angleDeg = 41.9f,
hz = 392f,
sharp = false,
degree = 5,
octave = -1
},
new PrecisePoint
{
noteName = "A4",
angleDeg = 33.1f,
hz = 440f,
sharp = false,
degree = 6,
octave = -1
},
new PrecisePoint
{
noteName = "B4",
angleDeg = 24.1f,
hz = 493.9f,
sharp = false,
degree = 7,
octave = -1
},
new PrecisePoint
{
noteName = "C5",
angleDeg = 18.74f,
hz = 523.3f,
sharp = false,
degree = 1,
octave = 0
},
new PrecisePoint
{
noteName = "D5",
angleDeg = 9.6f,
hz = 587.3f,
sharp = false,
degree = 2,
octave = 0
},
new PrecisePoint
{
noteName = "E5",
angleDeg = -0.8f,
hz = 659.3f,
sharp = false,
degree = 3,
octave = 0
},
new PrecisePoint
{
noteName = "F5",
angleDeg = -5.4f,
hz = 698.5f,
sharp = false,
degree = 4,
octave = 0
},
new PrecisePoint
{
noteName = "G5",
angleDeg = -19.4f,
hz = 784f,
sharp = false,
degree = 5,
octave = 0
},
new PrecisePoint
{
noteName = "A5",
angleDeg = -34.2f,
hz = 880f,
sharp = false,
degree = 6,
octave = 0
},
new PrecisePoint
{
noteName = "B5",
angleDeg = -58.2f,
hz = 987.8f,
sharp = false,
degree = 7,
octave = 0
},
new PrecisePoint
{
noteName = "C6",
angleDeg = -85f,
hz = 1046.5f,
sharp = false,
degree = 1,
octave = 1
}
};
private RenderBand[] _bands = Array.Empty<RenderBand>();
private void Awake()
{
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Expected O, but got Unknown
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
_enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", false, "Show overlay on start (default: hidden)");
_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)287, "Toggle overlay on/off");
_invertPitch = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "InvertPitch", false, "Invert pitch sign if needed");
_showLabels = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ShowLabels", true, "Show Jianpu labels");
_highlightActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "HighlightActive", true, "Highlight the active note range");
_showSharps = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ShowSharps", true, "Show sharp (#) ranges and sharp precise points");
_toggleSharpsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleSharpsKey", (KeyCode)288, "Toggle showing sharp ranges/points");
_rayMaxDist = ((BaseUnityPlugin)this).Config.Bind<float>("World", "RayMaxDistance", 1000f, "Max raycast distance for world-anchored markers");
_rayLayerMask = ((BaseUnityPlugin)this).Config.Bind<int>("World", "RayLayerMask", -1, "LayerMask bitmask for raycast (default Everything)");
_edgeClampDeg = ((BaseUnityPlugin)this).Config.Bind<float>("World", "EdgeClampDeg", 85f, "Extend topmost/bottommost bands to ±this degree");
_fallbackWhenNoHit = ((BaseUnityPlugin)this).Config.Bind<bool>("World", "FallbackWhenNoHit", true, "When raycast misses, still draw at far point");
_tickHalfWidthPx = ((BaseUnityPlugin)this).Config.Bind<int>("Style", "TickHalfWidthPx", 16, "Half width of boundary ticks (px)");
_tickThicknessPx = ((BaseUnityPlugin)this).Config.Bind<int>("Style", "TickThicknessPx", 5, "Thickness of boundary ticks (px)");
_bracketThicknessPx = ((BaseUnityPlugin)this).Config.Bind<int>("Style", "BracketThicknessPx", 4, "Thickness of vertical bracket (px)");
_fontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Text", "FontSize", 24, "Label font size");
_fontBold = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "FontBold", true, "Bold labels");
_preferredFontName = ((BaseUnityPlugin)this).Config.Bind<string>("Text", "PreferredFontName", "", "Preferred in-game Font name (contains, case-insensitive)");
_alphaNatural = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "AlphaNatural", 0.85f, "Opacity for natural note markers");
_alphaSharp = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "AlphaSharp", 0.6f, "Opacity for sharp note markers");
_alphaActiveBoost = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "AlphaActiveBoost", 0.2f, "Extra opacity for active band");
_showPrecisePoints = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "ShowPrecisePoints", true, "Show measured precise crosshair points");
_togglePrecisePointsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "TogglePrecisePointsKey", (KeyCode)289, "Toggle precise points on/off");
_precisePointSizePx = ((BaseUnityPlugin)this).Config.Bind<int>("Style", "PrecisePointSizePx", 9, "Half length of crosshair arms (px)");
_precisePointThicknessPx = ((BaseUnityPlugin)this).Config.Bind<int>("Style", "PrecisePointThicknessPx", 3, "Thickness of crosshair lines (px)");
_precisePointShowLabel = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "PrecisePointShowLabel", false, "Show labels for precise points");
_precisePointAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "PrecisePointAlpha", 0.95f, "Opacity for precise points");
_tex1x1 = new Texture2D(1, 1, (TextureFormat)4, false);
_tex1x1.SetPixel(0, 0, Color.white);
_tex1x1.Apply();
BuildNonOverlappingBands();
((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} {1} loaded. F6 overlay, F7 sharps, F8 precise points, EdgeClampDeg={2}°.", "Peak Pitch Crosshair", "0.3.3", _edgeClampDeg.Value));
}
private void BuildNonOverlappingBands()
{
NoteRange[] array = (from r in RawRanges
select new NoteRange
{
noteName = r.noteName,
minAngle = Mathf.Min(r.minAngle, r.maxAngle),
maxAngle = Mathf.Max(r.minAngle, r.maxAngle),
degree = r.degree,
sharp = r.sharp,
octave = r.octave
} into r
orderby r.Mid descending
select r).ToArray();
int num = array.Length;
float[] array2 = new float[num - 1];
for (int i = 0; i < num - 1; i++)
{
float minAngle = array[i].minAngle;
float maxAngle = array[i + 1].maxAngle;
array2[i] = 0.5f * (minAngle + maxAngle);
}
for (int j = 1; j < array2.Length; j++)
{
array2[j] = Mathf.Min(array2[j], array2[j - 1] - 0.02f);
}
_bands = new RenderBand[num];
float num2 = Mathf.Min(Mathf.Abs(_edgeClampDeg.Value), 89.9f);
for (int k = 0; k < num; k++)
{
float num3 = ((k == 0) ? array[k].maxAngle : Mathf.Min(array[k].maxAngle, array2[k - 1] - 0.02f));
float num4 = ((k == num - 1) ? array[k].minAngle : Mathf.Max(array[k].minAngle, array2[k] + 0.02f));
if (k == 0)
{
num3 = Mathf.Max(num3, num2);
}
if (k == num - 1)
{
num4 = Mathf.Min(num4, 0f - num2);
}
if (num4 > num3)
{
float mid = array[k].Mid;
num4 = mid - 0.05f;
num3 = mid + 0.05f;
}
_bands[k] = new RenderBand
{
src = array[k],
dispMin = num4,
dispMax = num3
};
}
}
private void Update()
{
//IL_0006: 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_005c: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(_toggleKey.Value))
{
_enabled.Value = !_enabled.Value;
}
if (Input.GetKeyDown(_toggleSharpsKey.Value))
{
_showSharps.Value = !_showSharps.Value;
}
if (Input.GetKeyDown(_togglePrecisePointsKey.Value))
{
_showPrecisePoints.Value = !_showPrecisePoints.Value;
}
}
private void OnGUI()
{
//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_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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ff: 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_053a: Unknown result type (might be due to invalid IL or missing references)
//IL_0544: Expected O, but got Unknown
//IL_053f: Unknown result type (might be due to invalid IL or missing references)
//IL_0544: Unknown result type (might be due to invalid IL or missing references)
//IL_055b: Unknown result type (might be due to invalid IL or missing references)
//IL_0569: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_0583: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Expected O, but got Unknown
//IL_0320: 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_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: 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_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Expected O, but got Unknown
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
if (!_enabled.Value)
{
return;
}
EnsureStylesReady();
Camera main = Camera.main;
if (!Object.op_Implicit((Object)(object)main))
{
return;
}
Vector3 forward = ((Component)main).transform.forward;
Vector3 normalized = ((Vector3)(ref forward)).normalized;
float num = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f;
if (_invertPitch.Value)
{
num = 0f - num;
}
string text = string.Format("Pitch {0:F1}° ♯:{1} Precise:{2}", num, _showSharps.Value ? "ON" : "OFF", _showPrecisePoints.Value ? "ON" : "OFF");
Vector2 val = _labelStyle.CalcSize(new GUIContent(text));
DrawTextWithBg(new Rect(10f, 10f, val.x + 8f, val.y + 4f), text);
float y = ((Component)main).transform.eulerAngles.y;
RenderBand[] bands = _bands;
foreach (RenderBand renderBand in bands)
{
NoteRange src = renderBand.src;
if (!_showSharps.Value && src.sharp)
{
continue;
}
bool flag = num >= renderBand.dispMin && num <= renderBand.dispMax;
Vector3 spScreen;
bool flag2 = TryRayToPitch(main, y, renderBand.dispMin, out spScreen);
Vector3 spScreen2;
bool flag3 = TryRayToPitch(main, y, renderBand.dispMax, out spScreen2);
float num2 = (src.sharp ? _alphaSharp.Value : _alphaNatural.Value);
float num3 = Mathf.Clamp01(num2 + ((flag && _highlightActive.Value) ? _alphaActiveBoost.Value : 0f));
Color color = GUI.color;
GUI.color = new Color(1f, 1f, 1f, num3);
int num4 = Mathf.Max(2, _tickHalfWidthPx.Value);
int thickness = Mathf.Max(1, _tickThicknessPx.Value);
int thickness2 = Mathf.Max(1, _bracketThicknessPx.Value);
if (flag2)
{
var (num5, y2) = ToGui(spScreen, main);
DrawHLine(y2, num5 - num4, num5 + num4, thickness);
}
if (flag3)
{
var (num6, y3) = ToGui(spScreen2, main);
DrawHLine(y3, num6 - num4, num6 + num4, thickness);
}
if (flag2 && flag3)
{
(int x, int y) tuple3 = ToGui(spScreen, main);
int item = tuple3.x;
int item2 = tuple3.y;
(int x, int y) tuple4 = ToGui(spScreen2, main);
int item3 = tuple4.x;
int item4 = tuple4.y;
int num7 = (item + item3) / 2;
DrawVLine(num7, Math.Min(item2, item4), Math.Max(item2, item4), thickness2);
if (_showLabels.Value)
{
int num8 = (item2 + item4) / 2;
int num9 = num7 + num4 + 6;
string jianpu = src.Jianpu;
Vector2 val2 = _labelStyle.CalcSize(new GUIContent(jianpu));
DrawTextWithBg(new Rect((float)num9, (float)num8 - val2.y * 0.5f, val2.x + 6f, val2.y + 2f), jianpu);
}
}
else if (_showLabels.Value && (flag2 || flag3))
{
Vector3 sp = (flag2 ? spScreen : spScreen2);
(int x, int y) tuple5 = ToGui(sp, main);
int item5 = tuple5.x;
int item6 = tuple5.y;
string jianpu2 = src.Jianpu;
Vector2 val3 = _labelStyle.CalcSize(new GUIContent(jianpu2));
DrawTextWithBg(new Rect((float)(item5 + num4 + 6), (float)item6 - val3.y * 0.5f, val3.x + 6f, val3.y + 2f), jianpu2);
}
GUI.color = color;
}
if (!_showPrecisePoints.Value)
{
return;
}
PrecisePoint[] precisePoints = PrecisePoints;
foreach (PrecisePoint precisePoint in precisePoints)
{
if (precisePoint.sharp && !_showSharps.Value)
{
continue;
}
float pitchDeg = (_invertPitch.Value ? (0f - precisePoint.angleDeg) : precisePoint.angleDeg);
if (TryRayToPitch(main, y, pitchDeg, out var spScreen3))
{
(int x, int y) tuple6 = ToGui(spScreen3, main);
int item7 = tuple6.x;
int item8 = tuple6.y;
Color color2 = GUI.color;
GUI.color = new Color(1f, 0.88f, 0.25f, Mathf.Clamp01(_precisePointAlpha.Value));
DrawCrosshair(item7, item8, Math.Max(4, _precisePointSizePx.Value), Math.Max(1, _precisePointThicknessPx.Value));
GUI.color = color2;
if (_precisePointShowLabel.Value)
{
string text2 = $"{precisePoint.noteName} {precisePoint.hz:F1}Hz";
Vector2 val4 = _labelStyle.CalcSize(new GUIContent(text2));
DrawTextWithBg(new Rect((float)(item7 + _precisePointSizePx.Value + 6), (float)item8 - val4.y * 0.5f, val4.x + 6f, val4.y + 2f), text2);
}
}
}
}
private void EnsureStylesReady()
{
//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_0044: 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_0073: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (_labelStyle == null || _labelOutlineStyle == null)
{
_activeFont = PickInGameFontInsideOnGUI(_preferredFontName.Value);
_labelStyle = new GUIStyle(GUI.skin.label)
{
font = _activeFont,
fontSize = Mathf.Max(12, _fontSize.Value),
fontStyle = (FontStyle)(_fontBold.Value ? 1 : 0),
alignment = (TextAnchor)3,
wordWrap = false,
clipping = (TextClipping)0
};
_labelStyle.normal.textColor = Color.white;
_labelOutlineStyle = new GUIStyle(_labelStyle);
_labelOutlineStyle.normal.textColor = Color.black;
}
}
private Font PickInGameFontInsideOnGUI(string preferContains)
{
string preferContains2 = preferContains;
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
if (array != null && array.Length != 0)
{
if (!string.IsNullOrEmpty(preferContains2))
{
Font val = ((IEnumerable<Font>)array).FirstOrDefault((Func<Font, bool>)((Font f) => Object.op_Implicit((Object)(object)f) && ((Object)f).name.IndexOf(preferContains2, StringComparison.OrdinalIgnoreCase) >= 0));
if (Object.op_Implicit((Object)(object)val))
{
return val;
}
}
string[] keys = new string[8] { "noto", "source", "cjk", "ui", "game", "din", "roboto", "segoe" };
Font val2 = ((IEnumerable<Font>)array).FirstOrDefault((Func<Font, bool>)((Font f) => keys.Any((string k) => ((Object)f).name.IndexOf(k, StringComparison.OrdinalIgnoreCase) >= 0)));
if (Object.op_Implicit((Object)(object)val2))
{
return val2;
}
return array[0];
}
return GUI.skin.font;
}
private bool TryRayToPitch(Camera cam, float yawDeg, float pitchDeg, out Vector3 spScreen)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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_0055: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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_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_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_00cd: 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_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)
pitchDeg = Mathf.Clamp(pitchDeg, -89.9f, 89.9f);
Vector3 val = Quaternion.Euler(0f, yawDeg, 0f) * Quaternion.Euler(pitchDeg, 0f, 0f) * Vector3.forward;
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(((Component)cam).transform.position, val);
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val2, ref val3, _rayMaxDist.Value, _rayLayerMask.Value))
{
spScreen = cam.WorldToScreenPoint(((RaycastHit)(ref val3)).point);
if (spScreen.z > 0f)
{
return true;
}
}
if (_fallbackWhenNoHit.Value)
{
Vector3 val4 = ((Component)cam).transform.position + val * (_rayMaxDist.Value * 0.95f);
spScreen = cam.WorldToScreenPoint(val4);
return spScreen.z > 0f;
}
spScreen = Vector3.zero;
return false;
}
private (int x, int y) ToGui(Vector3 sp, Camera cam)
{
//IL_0000: 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)
int item = Mathf.RoundToInt(sp.x);
int item2 = Mathf.RoundToInt((float)Screen.height - sp.y);
return (item, item2);
}
private void DrawHLine(int y, int xMin, int xMax, int thickness)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
Rect val = default(Rect);
((Rect)(ref val))..ctor((float)xMin, (float)(y - thickness / 2), (float)Math.Max(1, xMax - xMin), (float)thickness);
GUI.DrawTexture(val, (Texture)(object)_tex1x1);
}
private void DrawVLine(int x, int yMin, int yMax, int thickness)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
Rect val = default(Rect);
((Rect)(ref val))..ctor((float)(x - thickness / 2), (float)yMin, (float)thickness, (float)Math.Max(1, yMax - yMin));
GUI.DrawTexture(val, (Texture)(object)_tex1x1);
}
private void DrawTextWithBg(Rect rect, string text)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0024: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_012c: 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)
Color color = GUI.color;
GUI.color = new Color(0f, 0f, 0f, 0.45f);
GUI.DrawTexture(rect, (Texture)(object)_tex1x1);
GUI.color = color;
Rect val = default(Rect);
((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width - 6f, ((Rect)(ref rect)).height - 2f);
GUI.Label(new Rect(((Rect)(ref val)).x - 1f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _labelOutlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _labelOutlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y - 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _labelOutlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _labelOutlineStyle);
GUI.Label(val, text, _labelStyle);
}
private void DrawCrosshair(int x, int y, int halfSize, int thickness)
{
DrawHLine(y, x - halfSize, x + halfSize, thickness);
DrawVLine(x, y - halfSize, y + halfSize, thickness);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}