Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Friendly Clock v1.1.2
BepInEx/plugins/FriendlyClock.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("FriendlyClock")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+1648d84239d4f4b3767ac1ca964b38dc616755ee")] [assembly: AssemblyProduct("FriendlyClock")] [assembly: AssemblyTitle("FriendlyClock")] [assembly: AssemblyVersion("1.1.2.0")] namespace FriendlyClock; public sealed class DialGraphic : MaskableGraphic { public enum Part { Face, Hand, Cap } public Part part; private bool _editMode; private int _segments = 12; private Texture2D _texture; private static readonly Vector2 LightDir = new Vector2(-0.6f, 0.8f); private static readonly Color32 Shadow = new Color32((byte)28, (byte)20, (byte)14, byte.MaxValue); private static readonly Color32 BronzeDark = new Color32((byte)92, (byte)62, (byte)32, byte.MaxValue); private static readonly Color32 BronzeLight = new Color32((byte)196, (byte)146, (byte)84, byte.MaxValue); private static readonly Color32 Cream = new Color32((byte)240, (byte)226, (byte)180, byte.MaxValue); public override Texture mainTexture { get { if (!((Object)(object)_texture != (Object)null)) { return (Texture)(object)Graphic.s_WhiteTexture; } return (Texture)(object)_texture; } } public void SetTexture(Texture2D texture) { if ((Object)(object)_texture != (Object)null) { Object.Destroy((Object)(object)_texture); } _texture = texture; ((Graphic)this).SetAllDirty(); } protected override void OnDestroy() { ((Graphic)this).OnDestroy(); if ((Object)(object)_texture != (Object)null) { Object.Destroy((Object)(object)_texture); } } public void SetEditMode(bool enabled) { if (_editMode != enabled) { _editMode = enabled; ((Graphic)this).SetVerticesDirty(); } } public void SetSegments(int count) { count = Mathf.Clamp(count, 2, 48); if (_segments != count) { _segments = count; ((Graphic)this).SetVerticesDirty(); } } protected override void OnPopulateMesh(VertexHelper vh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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) vh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; float width = ((Rect)(ref rect)).width; rect = ((Graphic)this).rectTransform.rect; float num = Mathf.Min(width, ((Rect)(ref rect)).height) * 0.5f; if (!(num <= 0f)) { if ((Object)(object)_texture != (Object)null) { Textured(vh, num); } else if (part == Part.Hand) { Hand(vh, num); } else if (part == Part.Cap) { Cap(vh, num); } else { Face(vh, num); } } } private void Face(VertexHelper vh, float r) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0081: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) float num = (_editMode ? 1.25f : 1f); Ring(vh, r * 1.02f, 0f, new Color32((byte)0, (byte)0, (byte)0, (byte)90), new Color32((byte)0, (byte)0, (byte)0, (byte)90), new Vector2(2f, -2.5f)); Ring(vh, r, r * 0.965f, Shadow, Shadow, Vector2.zero); Ring(vh, r * 0.965f, r * 0.84f, Tint(BronzeDark, num), Tint(BronzeLight, num), Vector2.zero); Ring(vh, r * 0.84f, r * 0.815f, Tint(BronzeLight, num), Tint(new Color32((byte)236, (byte)196, (byte)128, byte.MaxValue), num), Vector2.zero); Ring(vh, r * 0.815f, 0f, new Color32((byte)18, (byte)18, (byte)24, byte.MaxValue), new Color32((byte)18, (byte)18, (byte)24, byte.MaxValue), Vector2.zero); float radius = r * 0.79f; int num3; float num4; float num5; Color val; float num6; float num7; float angle; float angle2; for (int i = 0; i < _segments; num5 = num4, val = ((num3 != 0) ? Color.Lerp(Color32.op_Implicit(new Color32((byte)246, (byte)208, (byte)92, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)204, (byte)90, (byte)56, byte.MaxValue)), num5 * num5) : Color.Lerp(Color32.op_Implicit(new Color32((byte)58, (byte)84, (byte)118, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)26, (byte)38, (byte)68, byte.MaxValue)), num5)), val *= ((i % 2 == 0) ? 1f : 0.92f), val.a = 1f, num6 = (float)i / (float)_segments - 0.25f, num7 = (float)(i + 1) / (float)_segments - 0.25f, angle = Angle(num6 + 0.0022f), angle2 = Angle(num7 - 0.0022f), Quad(vh, Point(r * 0.06f, angle), Point(radius, angle), Point(radius, angle2), Point(r * 0.06f, angle2), Color32.op_Implicit(val), Color32.op_Implicit(val)), i++) { float num2 = ((float)i + 0.5f) / (float)_segments; if (num2 > 0.25f) { num3 = ((num2 < 0.75f) ? 1 : 0); if (num3 != 0) { num4 = (num2 - 0.25f) / 0.5f; continue; } } else { num3 = 0; } num4 = Mathf.Repeat(num2 - 0.75f, 1f) / 0.5f; } Crescent(vh, new Vector2(-0.48f, -0.1f) * r, r * 0.13f, Cream); Star(vh, new Vector2(-0.4f, 0.36f) * r, r * 0.055f, Cream); Star(vh, new Vector2(-0.2f, 0.52f) * r, r * 0.035f, Cream); Star(vh, new Vector2(-0.22f, 0.24f) * r, r * 0.03f, Cream); Star(vh, new Vector2(-0.6f, 0.2f) * r, r * 0.03f, Cream); for (int j = 0; j < 4; j++) { Stud(vh, r, (float)j / 4f, num); } } private void Textured(VertexHelper vh, float r) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_003f: 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_005c: 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_006f: 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) Color32 val = Color32.op_Implicit(((Graphic)this).color); vh.AddVert(new Vector3(0f - r, 0f - r), val, new Vector4(0f, 0f)); vh.AddVert(new Vector3(0f - r, r), val, new Vector4(0f, 1f)); vh.AddVert(new Vector3(r, r), val, new Vector4(1f, 1f)); vh.AddVert(new Vector3(r, 0f - r), val, new Vector4(1f, 0f)); vh.AddTriangle(0, 1, 2); vh.AddTriangle(0, 2, 3); } private static void Hand(VertexHelper vh, float r) { //IL_0025: 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_0033: Unknown result type (might be due to invalid IL or missing references) Vector2 o = default(Vector2); ((Vector2)(ref o))..ctor(1.5f, -1.5f); Color32 c = default(Color32); ((Color32)(ref c))..ctor((byte)20, (byte)16, (byte)12, (byte)200); Arrow(vh, r, o, c); Arrow(vh, r, Vector2.zero, Cream); } private static void Cap(VertexHelper vh, float r) { //IL_0012: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Disc(vh, r * 0.13f, new Vector2(1.5f, -1.5f), new Color32((byte)20, (byte)16, (byte)12, (byte)200)); Disc(vh, r * 0.12f, Vector2.zero, Shadow); Disc(vh, r * 0.1f, Vector2.zero, BronzeLight); Disc(vh, r * 0.04f, Vector2.zero, Shadow); } private static void Arrow(VertexHelper vh, float r, Vector2 o, Color32 c) { //IL_0009: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0059: 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_0061: Unknown result type (might be due to invalid IL or missing references) //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) //IL_007b: 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_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_00a1: 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_00ab: Unknown result type (might be due to invalid IL or missing references) float num = r * 0.028f; Quad(vh, o + new Vector2(0f - num, (0f - r) * 0.1f), o + new Vector2(0f - num, r * 0.54f), o + new Vector2(num, r * 0.54f), o + new Vector2(num, (0f - r) * 0.1f), c, c); Tri(vh, o + new Vector2((0f - r) * 0.085f, r * 0.5f), o + new Vector2(0f, r * 0.74f), o + new Vector2(r * 0.085f, r * 0.5f), c); } private static void Stud(VertexHelper vh, float r, float at, float boost) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0078: 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_0084: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //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) Vector2 a = OnClock(r * 0.8f, at); Vector2 b = OnClock(r * 1.03f, at - 0.028f); Vector2 c = OnClock(r * 1.03f, at + 0.028f); Vector2 val = OnClock(r * 1.03f, at); Tri(vh, OnClock(r * 0.78f, at), OnClock(r * 1.06f, at - 0.032f), OnClock(r * 1.06f, at + 0.032f), Shadow); Tri(vh, a, b, val, Tint(BronzeLight, boost)); Tri(vh, a, val, c, Tint(BronzeDark, boost)); } private static void Crescent(VertexHelper vh, Vector2 centre, float radius, Color32 c) { //IL_003f: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0072: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a1: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_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) Vector2 val3 = default(Vector2); Vector2 val4 = default(Vector2); for (int i = 0; i < 16; i++) { float num = (float)Math.PI * (0.5f + (float)i / 16f); float num2 = (float)Math.PI * (0.5f + (float)(i + 1) / 16f); Vector2 val = new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * radius; Vector2 val2 = new Vector2(Mathf.Cos(num2), Mathf.Sin(num2)) * radius; ((Vector2)(ref val3))..ctor(val.x * 0.35f, val.y); ((Vector2)(ref val4))..ctor(val2.x * 0.35f, val2.y); Quad(vh, centre + val3, centre + val, centre + val2, centre + val4, c, c); } } private static void Star(VertexHelper vh, Vector2 centre, float size, Color32 c) { //IL_0009: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float num = size * 0.22f; Diamond(vh, centre, num, size, c); Diamond(vh, centre, size, num, c); } private static void Diamond(VertexHelper vh, Vector2 centre, float halfW, float halfH, Color32 c) { //IL_0001: 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_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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003d: 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_004f: 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_0061: 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_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) Tri(vh, centre + new Vector2(0f, halfH), centre + new Vector2(halfW, 0f), centre + new Vector2(0f - halfW, 0f), c); Tri(vh, centre + new Vector2(0f, 0f - halfH), centre + new Vector2(0f - halfW, 0f), centre + new Vector2(halfW, 0f), c); } private static void Ring(VertexHelper vh, float outer, float inner, Color32 dark, Color32 light, Vector2 o) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_002d: 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_003f: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 96; i++) { float angle = Angle((float)i / 96f); float angle2 = Angle((float)(i + 1) / 96f); Color32 ca = Lit(dark, light, angle); Color32 cb = Lit(dark, light, angle2); Quad(vh, Point(inner, angle) + o, Point(outer, angle) + o, Point(outer, angle2) + o, Point(inner, angle2) + o, ca, cb); } } private static Color32 Lit(Color32 dark, Color32 light, float angle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0023: Unknown result type (might be due to invalid IL or missing references) return Color32.Lerp(dark, light, 0.5f + 0.5f * Vector2.Dot(Point(1f, angle), LightDir)); } private static Color32 Tint(Color32 c, float k) { //IL_0005: 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_002d: 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) return new Color32((byte)Mathf.Min(255f, (float)(int)c.r * k), (byte)Mathf.Min(255f, (float)(int)c.g * k), (byte)Mathf.Min(255f, (float)(int)c.b * k), c.a); } private static void Disc(VertexHelper vh, float radius, Vector2 o, Color32 c) { //IL_0007: 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_0009: Unknown result type (might be due to invalid IL or missing references) Ring(vh, radius, 0f, c, c, o); } private static float Angle(float fraction) { return (float)Math.PI / 2f - fraction * (float)Math.PI * 2f; } private static Vector2 Point(float radius, float angle) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Vector2(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius); } private static Vector2 OnClock(float radius, float fraction) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Point(radius, Angle(fraction)); } private static void Tri(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c, Color32 color) { //IL_0008: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0036: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = vh.currentVertCount; vh.AddVert(Vector2.op_Implicit(a), color, Vector4.zero); vh.AddVert(Vector2.op_Implicit(b), color, Vector4.zero); vh.AddVert(Vector2.op_Implicit(c), color, Vector4.zero); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); } private static void Quad(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Color32 ca, Color32 cb) { //IL_0008: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0036: 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_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_004a: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = vh.currentVertCount; vh.AddVert(Vector2.op_Implicit(a), ca, Vector4.zero); vh.AddVert(Vector2.op_Implicit(b), ca, Vector4.zero); vh.AddVert(Vector2.op_Implicit(c), cb, Vector4.zero); vh.AddVert(Vector2.op_Implicit(d), cb, Vector4.zero); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } } public enum ClockStyle { Dial, Words, DialAndWords } [BepInPlugin("com.mous.friendlyclock", "Friendly Clock", "1.1.2")] public class FriendlyClockPlugin : BaseUnityPlugin { public const string PluginGuid = "com.mous.friendlyclock"; public const string PluginName = "Friendly Clock"; public const string PluginVersion = "1.1.2"; internal const string DefaultWords = "Midnight,Early Morning,Before Dawn,Dawn,Morning,Late Morning,Midday,Afternoon,Evening,Dusk,Night,Late Night"; private ConfigEntry<bool> _enabled; private ConfigEntry<ClockStyle> _style; private ConfigEntry<bool> _showDay; private ConfigEntry<float> _size; private ConfigEntry<float> _fontSize; private ConfigEntry<float> _opacity; private ConfigEntry<Vector2> _position; private ConfigEntry<string> _words; private ConfigEntry<float> _tipWidth; private ConfigEntry<float> _tipFontSize; private ConfigEntry<Color> _tipBackground; private const string PhaseFileName = "FriendlyClock.phases.md"; private DateTime _phaseStamp; private string[] _fileWords; private string[] _fileTips; private RectTransform _root; private RectTransform _tip; private TextMeshProUGUI _tipText; private readonly List<Image> _rules = new List<Image>(); private const float TipPadding = 10f; private DialGraphic _face; private static readonly string[] AssetFiles = new string[3] { "clock_face.png", "clock_hand.png", "clock_cap.png" }; private readonly DialGraphic[] _parts = new DialGraphic[3]; private readonly DateTime[] _assetStamps = new DateTime[3]; private float _nextAssetCheck; private RectTransform _hand; private TextMeshProUGUI _label; private bool _dragging; private Vector2 _dragOffset; private static readonly int[] HeadingSizes = new int[3] { 150, 130, 115 }; internal const string RuleMark = "\u001frule\u001f"; private static readonly Func<Texture2D, byte[], bool> LoadImage = (Func<Texture2D, byte[], bool>)Delegate.CreateDelegate(typeof(Func<Texture2D, byte[], bool>), Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule", throwOnError: true).GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) })); private void Awake() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Show the clock."); _style = ((BaseUnityPlugin)this).Config.Bind<ClockStyle>("1 - General", "Style", ClockStyle.DialAndWords, "Dial = day/night dial only, Words = fuzzy time of day only, DialAndWords = both."); _showDay = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "ShowDayCounter", false, "Show the current day number."); _size = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "Size", 110f, new ConfigDescription("Dial diameter in HUD units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(48f, 240f), Array.Empty<object>())); _fontSize = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "FontSize", 20f, new ConfigDescription("Font size of the words / day counter.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 40f), Array.Empty<object>())); _opacity = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "Opacity", 0.95f, new ConfigDescription("Overall opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>())); _position = ((BaseUnityPlugin)this).Config.Bind<Vector2>("2 - Layout", "Position", new Vector2(0.17f, 0.12f), "Clock center on screen (0..1, x from left, y from bottom). Or open the inventory and drag the clock."); _words = ((BaseUnityPlugin)this).Config.Bind<string>("3 - Words", "DayPhases", "Midnight,Early Morning,Before Dawn,Dawn,Morning,Late Morning,Midday,Afternoon,Evening,Dusk,Night,Late Night", "Comma-separated phase names spread evenly across the day, starting at midnight. The dial draws one segment per phase (12 = two hours each; use a count divisible by 4 so sunrise/sunset land on segment edges). Ignored while BepInEx/config/FriendlyClock.phases.md exists: there each '## Word' heading is a phase and the markdown below it shows on hover (inventory, map or game menu open)."); _tipWidth = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Tooltip", "MaxWidth", 380f, new ConfigDescription("Maximum width of the FriendlyClock.phases.md hover tooltip.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(150f, 1000f), Array.Empty<object>())); _tipFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Tooltip", "FontSize", 18f, new ConfigDescription("Base font size of the tooltip (headings scale from it).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 40f), Array.Empty<object>())); _tipBackground = ((BaseUnityPlugin)this).Config.Bind<Color>("4 - Tooltip", "Background", new Color(0.05f, 0.04f, 0.03f, 0.9f), "Tooltip background color (RGBA)."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Friendly Clock 1.1.2 loaded"); } private void Update() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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) if ((Object)(object)Hud.instance == (Object)null || (Object)(object)EnvMan.instance == (Object)null || ((Object)(object)_root == (Object)null && !TryCreate())) { return; } bool value = _enabled.Value; if (((Component)_root).gameObject.activeSelf != value) { ((Component)_root).gameObject.SetActive(value); } if (value) { ClockStyle value2 = _style.Value; float value3 = _size.Value; float num = Mathf.Repeat(EnvMan.instance.GetDayFraction(), 1f); bool flag = InventoryGui.IsVisible(); _root.sizeDelta = new Vector2(value3, value3); ((Component)_root).GetComponent<CanvasGroup>().alpha = _opacity.Value; ((Component)_face).gameObject.SetActive(value2 != ClockStyle.Words); _face.SetEditMode(flag); CheckFiles(); string[] array = _fileWords ?? _words.Value.Split(new char[1] { ',' }); int num2 = PhaseIndex(num, array.Length); _face.SetSegments(array.Length); ((Transform)_hand).localRotation = Quaternion.Euler(0f, 0f, (0f - (num - 0.25f)) * 360f); string text = ((value2 == ClockStyle.Dial) ? "" : array[num2].Trim()); if (_showDay.Value) { text = text + ((text == "") ? "" : "\n") + $"<size=80%>Day {EnvMan.instance.GetDay()}</size>"; } if (((TMP_Text)_label).text != text) { ((TMP_Text)_label).text = text; } ((TMP_Text)_label).fontSize = _fontSize.Value; RectTransform rectTransform = ((TMP_Text)_label).rectTransform; bool flag2 = value2 != ClockStyle.Words; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, flag2 ? 0f : 0.5f); rectTransform.anchorMax = val; rectTransform.anchorMin = val; rectTransform.pivot = new Vector2(0.5f, flag2 ? 1f : 0.5f); rectTransform.anchoredPosition = new Vector2(0f, flag2 ? (-4f) : 0f); ((TMP_Text)_label).verticalAlignment = (VerticalAlignmentOptions)(flag2 ? 256 : 512); Drag(flag); object tip; if (!flag && !Minimap.IsOpen() && !Menu.IsVisible()) { tip = null; } else { string[] fileTips = _fileTips; tip = ((fileTips != null) ? fileTips[num2] : null); } Tooltip((string)tip); } } private void Tooltip(string tip) { //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_004e: 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_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_00b9: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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) Vector3 mousePosition = Input.mousePosition; Camera val = UiCamera(); bool flag = !string.IsNullOrEmpty(tip) && !_dragging && ((((Component)_face).gameObject.activeSelf && RectTransformUtility.RectangleContainsScreenPoint(((Graphic)_face).rectTransform, Vector2.op_Implicit(mousePosition), val)) || OverText((TMP_Text)(object)_label, Vector2.op_Implicit(mousePosition), val)); if (((Component)_tip).gameObject.activeSelf != flag) { ((Component)_tip).gameObject.SetActive(flag); if (flag) { Canvas component = ((Component)_tip).GetComponent<Canvas>(); component.overrideSorting = true; component.sortingOrder = 30000; } } if (flag) { ((Graphic)((Component)_tip).GetComponent<Image>()).color = _tipBackground.Value; ((TMP_Text)_tipText).fontSize = _tipFontSize.Value; float num = _tipWidth.Value - 20f; string text = tip.Replace("\u001frule\u001f", "\u00a0"); float num2 = Mathf.Min(num, ((TMP_Text)_tipText).GetPreferredValues(text, num, 0f).x); float y = ((TMP_Text)_tipText).GetPreferredValues(text, num2, 0f).y; if (((TMP_Text)_tipText).text != text) { ((TMP_Text)_tipText).text = text; } _tip.sizeDelta = new Vector2(num2, y) + 20f * Vector2.one; PlaceRules(tip); Vector2 val2 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(_root, Vector2.op_Implicit(mousePosition), val, ref val2); bool flag2 = mousePosition.x < (float)Screen.width * 0.5f; bool flag3 = mousePosition.y < (float)Screen.height * 0.5f; _tip.pivot = new Vector2(flag2 ? 0f : 1f, flag3 ? 0f : 1f); _tip.anchoredPosition = val2 + new Vector2(flag2 ? 16f : (-16f), flag3 ? 16f : (-16f)); } } private void PlaceRules(string tip) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) HashSet<int> hashSet = new HashSet<int>(); int num = tip.IndexOf("\u001frule\u001f", StringComparison.Ordinal); int num2 = 0; while (num >= 0) { hashSet.Add(num - num2 * ("\u001frule\u001f".Length - 1)); num = tip.IndexOf("\u001frule\u001f", num + 1, StringComparison.Ordinal); num2++; } int num3 = 0; if (hashSet.Count > 0) { ((TMP_Text)_tipText).ForceMeshUpdate(false, false); TMP_TextInfo textInfo = ((TMP_Text)_tipText).textInfo; Rect rect = ((TMP_Text)_tipText).rectTransform.rect; Vector2 val2 = default(Vector2); for (int i = 0; i < textInfo.characterCount; i++) { if (hashSet.Contains(textInfo.characterInfo[i].index)) { TMP_LineInfo val = textInfo.lineInfo[textInfo.characterInfo[i].lineNumber]; if (num3 == _rules.Count) { _rules.Add(Child<Image>("Rule", ((TMP_Text)_tipText).transform)); } Image obj = _rules[num3++]; ((Component)obj).gameObject.SetActive(true); ((Graphic)obj).color = new Color(0.54f, 0.51f, 0.45f, 0.9f); RectTransform rectTransform = ((Graphic)obj).rectTransform; ((Vector2)(ref val2))..ctor(0.5f, 0.5f); rectTransform.pivot = val2; Vector2 anchorMin = (rectTransform.anchorMax = val2); rectTransform.anchorMin = anchorMin; rectTransform.sizeDelta = new Vector2(((Rect)(ref rect)).width, 2f); rectTransform.anchoredPosition = new Vector2(((Rect)(ref rect)).center.x, (val.ascender + val.descender) * 0.5f); } } } for (int j = num3; j < _rules.Count; j++) { ((Component)_rules[j]).gameObject.SetActive(false); } } private static bool OverText(TMP_Text text, Vector2 screen, Camera cam) { //IL_0006: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0053: 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_0075: 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_007d: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(text.rectTransform, screen, cam, ref val)) { return false; } Bounds textBounds = text.textBounds; if (((Bounds)(ref textBounds)).size.x > 0f) { Rect val2 = Rect.MinMaxRect(((Bounds)(ref textBounds)).min.x - 6f, ((Bounds)(ref textBounds)).min.y - 6f, ((Bounds)(ref textBounds)).max.x + 6f, ((Bounds)(ref textBounds)).max.y + 6f); return ((Rect)(ref val2)).Contains(val); } return false; } private Camera UiCamera() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Canvas rootCanvas = ((Component)_root).GetComponentInParent<Canvas>().rootCanvas; if ((int)rootCanvas.renderMode != 0) { return rootCanvas.worldCamera; } return null; } private void Drag(bool editing) { //IL_0002: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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) //IL_0100: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009a: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Input.mousePosition.x / (float)Screen.width, Input.mousePosition.y / (float)Screen.height); if (!_dragging && editing && Input.GetMouseButtonDown(0)) { Camera val2 = UiCamera(); if (RectTransformUtility.RectangleContainsScreenPoint(((Component)_face).gameObject.activeSelf ? ((Graphic)_face).rectTransform : ((TMP_Text)_label).rectTransform, Vector2.op_Implicit(Input.mousePosition), val2)) { _dragging = true; _dragOffset = _position.Value - val; } } Vector2 value = _position.Value; if (_dragging) { ((Vector2)(ref value))..ctor(Mathf.Clamp01(val.x + _dragOffset.x), Mathf.Clamp01(val.y + _dragOffset.y)); if (!editing || !Input.GetMouseButton(0)) { _dragging = false; _position.Value = value; } } RectTransform root = _root; Vector2 anchorMin = (_root.anchorMax = value); root.anchorMin = anchorMin; _root.anchoredPosition = Vector2.zero; } internal static int PhaseIndex(float dayFraction, int count) { return Mathf.Clamp((int)((float)count * Mathf.Repeat(dayFraction, 1f)), 0, count - 1); } internal static List<KeyValuePair<string, string>> ParsePhases(string md) { List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); string text = null; StringBuilder stringBuilder = new StringBuilder(); foreach (string item in md.Replace("\r", "").Split(new char[1] { '\n' }).Append("## ")) { if (!item.StartsWith("## ")) { stringBuilder.AppendLine(item); continue; } if (text != null) { list.Add(new KeyValuePair<string, string>(text, MarkdownToTmp(stringBuilder.ToString()))); } text = item.Substring(3).Trim(); stringBuilder.Clear(); } return list; } internal static string MarkdownToTmp(string md) { List<string> list = new List<string>(); string[] array = md.Replace("\r", "").Split(new char[1] { '\n' }); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); bool flag = false; while (text.StartsWith(">")) { flag = true; text = text.Substring(1).TrimStart(Array.Empty<char>()); } int num = (flag ? 1 : 0); Match match; text = ((!(match = Regex.Match(text, "^(#{1,6})\\s+(.*)$")).Success) ? ((!Regex.IsMatch(text, "^([-*_])( *\\1){2,}$")) ? ((!(match = Regex.Match(text, "^[-*+]\\s+(.*)$")).Success) ? ((num > 0) ? $"<indent={num}em>{Inline(text)}</indent>" : Inline(text)) : $"<indent={num}em>•<indent={num + 1}em>{Inline(match.Groups[1].Value)}</indent>") : "\u001frule\u001f") : $"<size={((match.Groups[1].Length <= 3) ? HeadingSizes[match.Groups[1].Length - 1] : 100)}%><b>{Inline(match.Groups[2].Value)}</b></size>"); list.Add((flag && text != "\u001frule\u001f") ? ("<color=#F2E0B3>" + text + "</color>") : text); } return string.Join("\n", list).Trim(new char[1] { '\n' }); } private static string Inline(string s) { s = Regex.Replace(s, "\\*\\*(.+?)\\*\\*|__(.+?)__", (Match m) => "<b>" + m.Groups[1].Value + m.Groups[2].Value + "</b>"); s = Regex.Replace(s, "(?<![\\w*])\\*(?!\\s)(.+?)(?<!\\s)\\*(?![\\w*])|(?<!\\w)_(?!\\s)(.+?)(?<!\\s)_(?!\\w)", (Match m) => "<i>" + m.Groups[1].Value + m.Groups[2].Value + "</i>"); return Regex.Replace(s, "~~(.+?)~~", "<s>$1</s>"); } private bool TryCreate() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_029d: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) TMP_Text val = (Object.op_Implicit((Object)(object)Hud.instance.m_statusEffectTemplate) ? ((Component)Hud.instance.m_statusEffectTemplate).GetComponentInChildren<TMP_Text>(true) : null); if ((Object)(object)val == (Object)null) { return false; } GameObject val2 = new GameObject("FriendlyClock", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); _root = (RectTransform)val2.transform; ((Transform)_root).SetParent(Hud.instance.m_rootObject.transform, false); _root.pivot = new Vector2(0.5f, 0.5f); CanvasGroup component = val2.GetComponent<CanvasGroup>(); component.blocksRaycasts = false; component.interactable = false; _face = Part("Face", (Transform)(object)_root, DialGraphic.Part.Face); _hand = ((Graphic)Part("Hand", ((Component)_face).transform, DialGraphic.Part.Hand)).rectTransform; Part("Cap", ((Component)_face).transform, DialGraphic.Part.Cap); Array.Clear(_assetStamps, 0, _assetStamps.Length); _nextAssetCheck = 0f; _label = Child<TextMeshProUGUI>("Label", (Transform)(object)_root); ((TMP_Text)_label).font = val.font; ((TMP_Text)_label).fontSharedMaterial = val.fontSharedMaterial; ((TMP_Text)_label).alignment = (TextAlignmentOptions)514; ((TMP_Text)_label).textWrappingMode = (TextWrappingModes)0; ((Graphic)_label).color = new Color(0.95f, 0.88f, 0.7f); ((TMP_Text)_label).rectTransform.sizeDelta = new Vector2(240f, 60f); GameObject val3 = new GameObject("Tooltip", new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(CanvasGroup), typeof(Image) }); _tip = (RectTransform)val3.transform; ((Transform)_tip).SetParent((Transform)(object)_root, false); RectTransform tip = _tip; RectTransform tip2 = _tip; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); tip2.anchorMax = val4; tip.anchorMin = val4; CanvasGroup component2 = val3.GetComponent<CanvasGroup>(); component2.ignoreParentGroups = true; component2.blocksRaycasts = false; ((Graphic)val3.GetComponent<Image>()).raycastTarget = false; _tipText = Child<TextMeshProUGUI>("Text", (Transform)(object)_tip); _rules.Clear(); ((TMP_Text)_tipText).rectTransform.offsetMin = Vector2.one * 10f; ((TMP_Text)_tipText).rectTransform.offsetMax = -Vector2.one * 10f; ((TMP_Text)_tipText).font = val.font; ((TMP_Text)_tipText).fontSharedMaterial = val.fontSharedMaterial; ((TMP_Text)_tipText).alignment = (TextAlignmentOptions)257; ((TMP_Text)_tipText).textWrappingMode = (TextWrappingModes)1; ((Graphic)_tipText).color = new Color(0.93f, 0.93f, 0.9f); val3.SetActive(false); return true; } private DialGraphic Part(string name, Transform parent, DialGraphic.Part part) { DialGraphic dialGraphic = Child<DialGraphic>(name, parent); dialGraphic.part = part; ((Graphic)dialGraphic).SetVerticesDirty(); return _parts[(int)part] = dialGraphic; } private void CheckFiles() { //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown if (Time.unscaledTime < _nextAssetCheck) { return; } _nextAssetCheck = Time.unscaledTime + 1f; string text = Path.Combine(Paths.ConfigPath, "FriendlyClock.phases.md"); DateTime dateTime = (File.Exists(text) ? File.GetLastWriteTimeUtc(text) : default(DateTime)); if (dateTime != _phaseStamp) { _phaseStamp = dateTime; _fileWords = (_fileTips = null); if (dateTime != default(DateTime)) { try { List<KeyValuePair<string, string>> list = ParsePhases(File.ReadAllText(text)); if (list.Count == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(text + " has no '## Word' headings; using DayPhases")); } else { _fileWords = list.Select((KeyValuePair<string, string> p) => p.Key).ToArray(); _fileTips = list.Select((KeyValuePair<string, string> p) => p.Value).ToArray(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loaded {list.Count} phases from {text}"); } } catch (IOException ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not read " + text + ": " + ex.Message)); } } } string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); for (int num = 0; num < AssetFiles.Length; num++) { string text2 = Path.Combine(directoryName, AssetFiles[num]); DateTime dateTime2 = (File.Exists(text2) ? File.GetLastWriteTimeUtc(text2) : default(DateTime)); if (dateTime2 == _assetStamps[num]) { continue; } _assetStamps[num] = dateTime2; Texture2D val = null; if (dateTime2 != default(DateTime)) { try { val = new Texture2D(2, 2, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)2 }; if (!LoadImage(val, File.ReadAllBytes(text2))) { throw new InvalidDataException("not a PNG/JPG"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loaded {AssetFiles[num]} ({((Texture)val).width}x{((Texture)val).height})"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load " + text2 + ": " + ex2.Message)); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } val = null; } } _parts[num].SetTexture(val); } } private static T Child<T>(string name, Transform parent) where T : Graphic { //IL_0021: 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_002c: 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_0039: 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_0044: 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_004f: 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_0056: 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) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(T) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; T component = val.GetComponent<T>(); ((Graphic)component).raycastTarget = false; return component; } private void OnDestroy() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)((Component)_root).gameObject); } } }