Decompiled source of ImuiBepInEx v1.0.0
plugins/ImuiBepInEx.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Imui.Controls; using Imui.Core; using Imui.IO; using Imui.IO.Events; using Imui.IO.Rendering; using Imui.IO.Touch; using Imui.IO.UGUI; using Imui.IO.Utility; using Imui.Rendering; using Imui.Style; using Imui.Utility; using ImuiBepInEx; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.TextCore; using UnityEngine.TextCore.LowLevel; using UnityEngine.TextCore.Text; using UnityEngine.U2D; using UnityEngine.UI; [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("ImuiBepInEx")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9c6abab97a642debc44544985a6ada35257126b8")] [assembly: AssemblyProduct("ImuiBepInEx")] [assembly: AssemblyTitle("ImuiBepInEx")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsUnmanagedAttribute : Attribute { } } internal class ImuiAssertException : Exception { public ImuiAssertException(string message) : base(message) { } } internal static class ImAssert { [HideInCallstack] [Conditional("IMUI_DEBUG")] public static void IsTrue(bool value, string message) { if (!value) { throw new ImuiAssertException(message); } } [HideInCallstack] [Conditional("IMUI_DEBUG")] public static void IsFalse(bool value, string message) { if (value) { throw new ImuiAssertException(message); } } } namespace Imui.Utility { public struct ImCircularBuffer<T> { public readonly int Capacity; public int Head; public int Count; public T[] Array; public ref T this[Index index] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref Array[(Head + (index.IsFromEnd ? (Count - index.Value) : index.Value)) % Capacity]; } } public ImCircularBuffer(int capacity) { Capacity = capacity; Head = 0; Count = 0; Array = new T[capacity]; } public ImCircularBuffer(T[] array) { if (array == null) { throw new ArgumentNullException("array"); } Capacity = array.Length; Head = 0; Count = 0; Array = array; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public ref T Get(int index) { return ref Array[(Head + index) % Capacity]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Set(int index, T value) { Array[(Head + index) % Capacity] = value; } public void Clear() { Head = 0; Count = 0; } public int PushBack(T value) { Head = (Head - 1) % Capacity; if (Head < 0) { Head += Capacity; } Array[Head] = value; if (Count < Capacity) { Count++; } return Head; } public bool TryPopBack(out T value) { if (Count == 0) { value = default(T); return false; } value = Array[Head]; Head = (Head + 1) % Capacity; Count--; return true; } public int PushFront(T value) { int num = (Head + Count) % Capacity; Array[num] = value; if (Count == Capacity) { Head = (Head + 1) % Capacity; } else { Count++; } return num; } public bool TryPeekFront(out T value) { if (Count == 0) { value = default(T); return false; } value = Array[(Head + Count - 1) % Capacity]; return true; } public bool TryPopFront(out T value) { if (Count == 0) { value = default(T); return false; } value = Array[(Head + Count - 1) % Capacity]; Count--; return true; } } internal struct ImDynamicArray<T> { public int Count; public T[] Array; public ImDynamicArray(int capacity) { Array = new T[capacity]; Count = 0; } public bool RemoveAtFast(int index) { if (index < 0 || index >= Count) { throw new IndexOutOfRangeException($"{index} out of range, count: {Count}"); } Array[index] = Array[Count - 1]; Count--; return true; } public void RemoveAt(int index) { if (index < 0 || index >= Count) { throw new IndexOutOfRangeException($"{index} out of range, count: {Count}"); } System.Array.Copy(Array, index + 1, Array, index, --Count - index); } public void Add(T value) { EnsureCapacity(Count + 1); Array[Count++] = value; } public void Push(in T value) { EnsureCapacity(Count + 1); Array[Count++] = value; } public bool TryPop(out T value) { if (Count > 0) { value = Pop(); return true; } value = default(T); return false; } public T Pop() { return Array[--Count]; } public T TryPeek(T @default = default(T)) { if (Count == 0) { return @default; } return Peek(); } public bool TryPeek(out T value) { if (Count == 0) { value = default(T); return false; } value = Peek(); return true; } public ref T Peek() { return ref Array[Count - 1]; } public void Clear(bool zero) { if (zero) { for (int i = 0; i < Count; i++) { Array[i] = default(T); } } Count = 0; } public static implicit operator ReadOnlySpan<T>(ImDynamicArray<T> array) { return ((ReadOnlySpan<T>)array.Array).Slice(0, array.Count); } private void EnsureCapacity(int count) { if (count > Array.Length) { int num; for (num = Array.Length * 2; num < count; num *= 2) { } System.Array.Resize(ref Array, num); } } } internal readonly struct ImEnumValue<TEnum> where TEnum : struct, Enum { private readonly long longValue; private readonly ulong ulongValue; private readonly bool signed; public ImEnumValue(long value) { longValue = value; ulongValue = 0uL; signed = true; } public ImEnumValue(ulong value) { longValue = 0L; ulongValue = value; signed = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ImEnumValue<TEnum>operator |(ImEnumValue<TEnum> val0, TEnum val1) { return val0 | ImEnumUtility<TEnum>.ToValue(val1); } public static ImEnumValue<TEnum>operator |(ImEnumValue<TEnum> val0, ImEnumValue<TEnum> val1) { if (!val0.signed) { return val0.ulongValue | val1.ulongValue; } return val0.longValue | val1.longValue; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ImEnumValue<TEnum>operator &(ImEnumValue<TEnum> val0, TEnum val1) { return val0 & ImEnumUtility<TEnum>.ToValue(val1); } public static ImEnumValue<TEnum>operator &(ImEnumValue<TEnum> val0, ImEnumValue<TEnum> val1) { if (!val0.signed) { return val0.ulongValue & val1.ulongValue; } return val0.longValue & val1.longValue; } public static ImEnumValue<TEnum>operator ~(ImEnumValue<TEnum> val) { if (!val.signed) { return ~val.ulongValue; } return ~val.longValue; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(ImEnumValue<TEnum> val0, TEnum val1) { return val0 == ImEnumUtility<TEnum>.ToValue(val1); } public static bool operator ==(ImEnumValue<TEnum> val0, ImEnumValue<TEnum> val1) { return val0.Equals(val1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(ImEnumValue<TEnum> val0, TEnum val1) { return val0 != ImEnumUtility<TEnum>.ToValue(val1); } public static bool operator !=(ImEnumValue<TEnum> val0, ImEnumValue<TEnum> val1) { return !val0.Equals(val1); } public static bool operator ==(ImEnumValue<TEnum> val0, int val1) { return val0.Equals(val1); } public static bool operator !=(ImEnumValue<TEnum> val0, int val1) { return !val0.Equals(val1); } public static implicit operator ImEnumValue<TEnum>(int val) { if (!ImEnumUtility<TEnum>.Signed) { return new ImEnumValue<TEnum>((ulong)val); } return new ImEnumValue<TEnum>(val); } public static implicit operator ImEnumValue<TEnum>(long val) { return new ImEnumValue<TEnum>(val); } public static implicit operator ImEnumValue<TEnum>(ulong val) { return new ImEnumValue<TEnum>(val); } public TEnum ToEnumType() { if (!signed) { return ImEnumUtility<TEnum>.FromValueUnsigned(ulongValue); } return ImEnumUtility<TEnum>.FromValueSigned(longValue); } public bool Equals(ImEnumValue<TEnum> other) { if (signed != other.signed || !signed) { return ulongValue == other.ulongValue; } return longValue == other.longValue; } public override bool Equals(object obj) { if (obj is ImEnumValue<TEnum> other) { return Equals(other); } return false; } public override int GetHashCode() { return HashCode.Combine(longValue, ulongValue, signed); } } internal static class ImEnumUtility<TEnum> where TEnum : struct, Enum { public const string FLAGS_SEPARATOR = " | "; public static readonly bool IsFlags = typeof(TEnum).GetCustomAttribute<FlagsAttribute>() != null; public static readonly string[] Names = Enum.GetNames(typeof(TEnum)); public static readonly TEnum[] Values = Enum.GetValues(typeof(TEnum)) as TEnum[]; public static readonly Type Type = Enum.GetUnderlyingType(typeof(TEnum)); public static readonly string TypeName = Type.Name; public static readonly bool Signed = Type == typeof(sbyte) || Type == typeof(short) || Type == typeof(int) || Type == typeof(long); public static ImEnumValue<TEnum> ToValue(TEnum e) { if (!Signed) { return ToValueUnsigned(e); } return ToValueSigned(e); } public static bool IsFlagSet(TEnum value, TEnum flag) { if (!IsFlags) { return false; } if (ToValue(flag) == 0) { return ToValue(value) == 0; } return (ToValue(value) & flag) == flag; } public static void SetFlag(ref TEnum value, TEnum flag, bool active) { if (IsFlags) { ImEnumValue<TEnum> imEnumValue = ToValue(value); ImEnumValue<TEnum> imEnumValue2 = ToValue(flag); if (imEnumValue2 == 0 && active) { imEnumValue = 0; } if (imEnumValue2 != 0 && active) { imEnumValue |= imEnumValue2; } if (imEnumValue2 != 0 && !active) { imEnumValue &= ~imEnumValue2; } value = imEnumValue.ToEnumType(); } } public static int Format(TEnum value, Span<char> output, string flagsSeparator = " | ") { if (!IsFlags) { int num = Array.IndexOf(Values, value); if (num < 0) { return 0; } if (!((ReadOnlySpan<char>)Names[num]).TryCopyTo(output)) { return 0; } return Names[num].Length; } ReadOnlySpan<char> readOnlySpan = flagsSeparator; int num2 = 0; ImEnumValue<TEnum> imEnumValue = ToValue(value); bool flag = imEnumValue == 0; for (int i = 0; i < Values.Length; i++) { ImEnumValue<TEnum> imEnumValue2 = ToValue(Values[i]); if (!((imEnumValue2 | value) == imEnumValue) || !(imEnumValue2 != 0 || flag)) { continue; } int num3; if (num2 != 0) { num3 = num2; if (!readOnlySpan.TryCopyTo(output.Slice(num3, output.Length - num3))) { return num2; } num2 += readOnlySpan.Length; } ReadOnlySpan<char> readOnlySpan2 = Names[i]; num3 = num2; if (readOnlySpan2.TryCopyTo(output.Slice(num3, output.Length - num3))) { num2 += readOnlySpan2.Length; if (flag) { break; } continue; } return num2; } return num2; } public static TEnum FromValueUnsigned(ulong value) { if (Type == typeof(byte)) { byte b = (byte)value; return UnsafeUtility.As<byte, TEnum>(ref b); } if (Type == typeof(ushort)) { ushort num = (ushort)value; return UnsafeUtility.As<ushort, TEnum>(ref num); } if (Type == typeof(uint)) { uint num2 = (uint)value; return UnsafeUtility.As<uint, TEnum>(ref num2); } if (Type == typeof(ulong)) { return UnsafeUtility.As<ulong, TEnum>(ref value); } throw new Exception($"Underlying type of {typeof(TEnum)} is signed"); } public static TEnum FromValueSigned(long value) { if (Type == typeof(sbyte)) { sbyte b = (sbyte)value; return UnsafeUtility.As<sbyte, TEnum>(ref b); } if (Type == typeof(short)) { short num = (short)value; return UnsafeUtility.As<short, TEnum>(ref num); } if (Type == typeof(int)) { int num2 = (int)value; return UnsafeUtility.As<int, TEnum>(ref num2); } if (Type == typeof(long)) { return UnsafeUtility.As<long, TEnum>(ref value); } throw new Exception($"Underlying type of {typeof(TEnum)} is unsigned"); } public static long ToValueSigned(TEnum value) { if (Type == typeof(sbyte)) { return UnsafeUtility.As<TEnum, sbyte>(ref value); } if (Type == typeof(short)) { return UnsafeUtility.As<TEnum, short>(ref value); } if (Type == typeof(int)) { return UnsafeUtility.As<TEnum, int>(ref value); } if (Type == typeof(long)) { return UnsafeUtility.As<TEnum, long>(ref value); } throw new Exception($"Underlying type of {typeof(TEnum)} is unsigned"); } public static ulong ToValueUnsigned(TEnum value) { if (Type == typeof(byte)) { return UnsafeUtility.As<TEnum, byte>(ref value); } if (Type == typeof(ushort)) { return UnsafeUtility.As<TEnum, ushort>(ref value); } if (Type == typeof(uint)) { return UnsafeUtility.As<TEnum, uint>(ref value); } if (Type == typeof(ulong)) { return UnsafeUtility.As<TEnum, ulong>(ref value); } throw new Exception($"Underlying type of {typeof(TEnum)} is signed"); } } public static class ImProfiler { [MethodImpl(MethodImplOptions.AggressiveInlining)] [Conditional("IMUI_PROFILE")] public static void BeginSample(string name) { } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Conditional("IMUI_PROFILE")] public static void EndSample() { } } public static class ImUnityUtility { public static void Destroy(Object obj) { Object.Destroy(obj); } } } namespace Imui.Rendering { public class ImMeshBuffer { public int VerticesCount; public int IndicesCount; public ImVertex[] Vertices; public int[] Indices; public ImMeshData[] Meshes; public int MeshesCount; public ImMeshBuffer(int meshesCapacity, int verticesCapacity, int indicesCapacity) { Vertices = new ImVertex[verticesCapacity]; Indices = new int[indicesCapacity]; Meshes = new ImMeshData[meshesCapacity]; Clear(); } public void Trim() { if (MeshesCount != 0) { ref ImMeshData reference = ref Meshes[MeshesCount - 1]; while ((reference.VerticesCount == 0 || reference.IndicesCount == 0) && MeshesCount > 1) { reference = ref Meshes[--MeshesCount - 1]; } } } public void Sort() { Span<ImMeshData> span = new Span<ImMeshData>(Meshes, 0, MeshesCount); for (int i = 1; i < span.Length; i++) { ImMeshData imMeshData = span[i]; int num = i - 1; while (num >= 0 && span[num].Order > imMeshData.Order) { span[num + 1] = span[num]; num--; } span[num + 1] = imMeshData; } } public void Clear() { MeshesCount = 0; VerticesCount = 0; IndicesCount = 0; } public void NextMesh() { if (MeshesCount > 0) { ref ImMeshData reference = ref Meshes[MeshesCount - 1]; if (reference.VerticesCount == 0 && reference.IndicesCount == 0) { reference.ClearOptions(); return; } } EnsureMeshesCapacity(MeshesCount + 1); ref ImMeshData reference2 = ref Meshes[MeshesCount++]; reference2.Clear(); reference2.IndicesOffset = IndicesCount; reference2.VerticesOffset = VerticesCount; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void EnsureMeshesCapacity(int size) { if (Meshes.Length < size) { Array.Resize(ref Meshes, Mathf.NextPowerOfTwo(size)); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void EnsureVerticesCapacity(int size) { if (Vertices.Length < size) { Array.Resize(ref Vertices, Mathf.NextPowerOfTwo(size)); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void EnsureIndicesCapacity(int size) { if (Indices.Length < size) { Array.Resize(ref Indices, Mathf.NextPowerOfTwo(size)); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void AddIndices(int count) { IndicesCount += count; Meshes[MeshesCount - 1].IndicesCount += count; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void AddVertices(int count) { VerticesCount += count; Meshes[MeshesCount - 1].VerticesCount += count; } } public struct ImMeshClipRect { public bool Enabled; public Rect Rect; } public struct ImMeshMaskRect { public bool Enabled; public Rect Rect; public float Radius; } public struct ImMeshData { public Texture MainTex; public Texture FontTex; public Material Material; public int IndicesOffset; public int VerticesOffset; public int VerticesCount; public int IndicesCount; public MeshTopology Topology; public int Order; public ImMeshClipRect ClipRect; public ImMeshMaskRect MaskRect; public float InvColorMul; public void ClearOptions() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) MainTex = null; FontTex = null; Material = null; Topology = (MeshTopology)0; Order = 0; ClipRect = default(ImMeshClipRect); MaskRect = default(ImMeshMaskRect); InvColorMul = 0f; } public void Clear() { IndicesOffset = 0; VerticesOffset = 0; VerticesCount = 0; IndicesCount = 0; ClearOptions(); } } public class ImMeshDrawer { public const float MAIN_TEX_ID = 0f; public const float FONT_TEX_ID = 1f; private const int SQRT_TABLE_SIZE = 500; private const float SQRT_TABLE_RES = 0.1f; private const float SQRT_TABLE_MAX = 50f; public float Atlas; public Color32 Color; public Vector4 ScaleOffset; internal readonly ImMeshBuffer buffer; private readonly float[] invSqrtLut; public ImMeshDrawer(ImMeshBuffer buffer) { this.buffer = buffer; invSqrtLut = new float[500]; invSqrtLut[0] = 0f; for (int i = 1; i < invSqrtLut.Length; i++) { invSqrtLut[i] = 1f / Mathf.Sqrt((float)i * 0.1f); } } public void Clear() { buffer.Clear(); } public void NextMesh() { buffer.NextMesh(); } public ref ImMeshData GetMesh() { return ref buffer.Meshes[buffer.MeshesCount - 1]; } public void AddLine(ReadOnlySpan<Vector2> path, bool closed, float thickness, float outerScale, float innerScale) { //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_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) //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_0099: 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_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0407: 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_0120: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_02bf: 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_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_058a: 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_05c0: 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_0626: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) float num = thickness * outerScale; float num2 = thickness * innerScale; int num3 = buffer.IndicesCount; int num4 = buffer.VerticesCount; int num5 = (path.Length - ((!closed) ? 1 : 0)) * 6; int num6 = (path.Length - ((!closed) ? 1 : 0)) * 4; buffer.EnsureIndicesCapacity(num3 + num5); buffer.EnsureVerticesCapacity(num4 + num6); for (int i = 0; i < path.Length - 1; i++) { Vector2 val = path[i]; Vector2 val2 = path[i + 1]; float num7 = val2.x - val.x; float num8 = val2.y - val.y; float num9 = num7 * num7 + num8 * num8; float num10 = ((num9 < 50f) ? invSqrtLut[(int)(num9 / 0.1f)] : (1f / Mathf.Sqrt(num9))); float num11 = (0f - num8) * num10; float num12 = num7 * num10; ref ImVertex reference = ref buffer.Vertices[num4]; reference.Position.x = val.x + num11 * -1f * num; reference.Position.y = val.y + num12 * -1f * num; reference.Color = Color; reference.UV.x = ScaleOffset.z; reference.UV.y = ScaleOffset.w; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[num4 + 1]; reference2.Position.x = val.x + num11 * num2; reference2.Position.y = val.y + num12 * num2; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w + ScaleOffset.y; reference2.Atlas = Atlas; ref ImVertex reference3 = ref buffer.Vertices[num4 + 2]; reference3.Position.x = val2.x + num11 * -1f * num; reference3.Position.y = val2.y + num12 * -1f * num; reference3.Color = Color; reference3.UV.x = ScaleOffset.z + ScaleOffset.x; reference3.UV.y = ScaleOffset.w; reference3.Atlas = Atlas; ref ImVertex reference4 = ref buffer.Vertices[num4 + 3]; reference4.Position.x = val2.x + num11 * num2; reference4.Position.y = val2.y + num12 * num2; reference4.Color = Color; reference4.UV.x = ScaleOffset.z + ScaleOffset.x; reference4.UV.y = ScaleOffset.w + ScaleOffset.y; reference4.Atlas = Atlas; buffer.Indices[num3] = num4; buffer.Indices[num3 + 1] = num4 + 1; buffer.Indices[num3 + 2] = num4 + 3; buffer.Indices[num3 + 3] = num4 + 3; buffer.Indices[num3 + 4] = num4 + 2; buffer.Indices[num3 + 5] = num4; num3 += 6; num4 += 4; } if (closed) { Vector2 val3 = path[path.Length - 1]; Vector2 val4 = path[0]; float num13 = val4.x - val3.x; float num14 = val4.y - val3.y; float num15 = num13 * num13 + num14 * num14; float num16 = ((num15 < 50f) ? invSqrtLut[(int)(num15 / 0.1f)] : (1f / Mathf.Sqrt(num15))); float num11 = (0f - num14) * num16; float num12 = num13 * num16; ref ImVertex reference5 = ref buffer.Vertices[num4]; reference5.Position.x = val3.x + num11 * -1f * num; reference5.Position.y = val3.y + num12 * -1f * num; reference5.Color = Color; reference5.UV.x = ScaleOffset.z; reference5.UV.y = ScaleOffset.w; reference5.Atlas = Atlas; ref ImVertex reference6 = ref buffer.Vertices[num4 + 1]; reference6.Position.x = val3.x + num11 * num2; reference6.Position.y = val3.y + num12 * num2; reference6.Color = Color; reference6.UV.x = ScaleOffset.z; reference6.UV.y = ScaleOffset.w + ScaleOffset.y; reference6.Atlas = Atlas; ref ImVertex reference7 = ref buffer.Vertices[num4 + 2]; reference7.Position.x = val4.x + num11 * -1f * num; reference7.Position.y = val4.y + num12 * -1f * num; reference7.Color = Color; reference7.UV.x = ScaleOffset.z + ScaleOffset.x; reference7.UV.y = ScaleOffset.w; reference7.Atlas = Atlas; ref ImVertex reference8 = ref buffer.Vertices[num4 + 3]; reference8.Position.x = val4.x + num11 * num2; reference8.Position.y = val4.y + num12 * num2; reference8.Color = Color; reference8.UV.x = ScaleOffset.z + ScaleOffset.x; reference8.UV.y = ScaleOffset.w + ScaleOffset.y; reference8.Atlas = Atlas; buffer.Indices[num3] = num4; buffer.Indices[num3 + 1] = num4 + 1; buffer.Indices[num3 + 2] = num4 + 3; buffer.Indices[num3 + 3] = num4 + 3; buffer.Indices[num3 + 4] = num4 + 2; buffer.Indices[num3 + 5] = num4; } buffer.AddIndices(num5); buffer.AddVertices(num6); } public void AddLineMiter(ReadOnlySpan<Vector2> path, bool closed, float thickness, float outerScale, float innerScale) { //IL_014c: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_004d: 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_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_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_0077: 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_0088: 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_024b: 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_02db: 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_00c1: 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_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) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0485: 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_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049b: 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_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: 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_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: 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_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) if (path.Length < 2) { return; } thickness = Mathf.Max(1f, thickness); float num = thickness * outerScale; float num2 = thickness * innerScale; int num3 = (closed ? path.Length : (path.Length - 1)); float num13; float num14; if (closed) { Vector2 val = path[path.Length - 1]; Vector2 val2 = path[0]; Vector2 val3 = path[1]; float num4 = val2.x - val.x; float num5 = val2.y - val.y; float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5); if (num6 > 0f) { num4 /= num6; num5 /= num6; } float num7 = val3.x - val2.x; float num8 = val3.y - val2.y; float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8); if (num9 > 0f) { num7 /= num9; num8 /= num9; } float num10 = num4 + num7; float num11 = num5 + num8; float num12 = Mathf.Sqrt(num10 * num10 + num11 * num11); if (num12 > 0f) { num10 /= num12; num11 /= num12; } num13 = 0f - num11; num14 = num10; } else { Vector2 val4 = path[0]; Vector2 val5 = path[1]; float num15 = val5.x - val4.x; float num16 = val5.y - val4.y; float num17 = Mathf.Sqrt(num15 * num15 + num16 * num16); num15 /= num17; num16 /= num17; num13 = 0f - num16; num14 = num15; } int num18 = buffer.IndicesCount; int num19 = buffer.VerticesCount; int num20 = num3 * 6; int num21 = num3 * 2 + 2; buffer.EnsureIndicesCapacity(num18 + num20); buffer.EnsureVerticesCapacity(num19 + num21); ref ImVertex reference = ref buffer.Vertices[num19]; reference.Position.x = path[0].x + num13 * -1f * num; reference.Position.y = path[0].y + num14 * -1f * num; reference.Color = Color; reference.UV.x = ScaleOffset.z; reference.UV.y = ScaleOffset.w; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[num19 + 1]; reference2.Position.x = path[0].x + num13 * num2; reference2.Position.y = path[0].y + num14 * num2; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w + ScaleOffset.y; reference2.Atlas = Atlas; for (int i = 0; i < num3; i++) { Vector2 val6 = path[i]; Vector2 val7 = path[(i + 1) % path.Length]; float num31; float num32; float num33; if (i <= path.Length - 3 || closed) { Vector2 val8 = path[(i + 2) % path.Length]; float num22 = val7.x - val6.x; float num23 = val7.y - val6.y; float num24 = Mathf.Sqrt(num22 * num22 + num23 * num23); if (num24 > 0f) { num22 /= num24; num23 /= num24; } float num25 = val8.x - val7.x; float num26 = val8.y - val7.y; float num27 = Mathf.Sqrt(num25 * num25 + num26 * num26); if (num27 > 0f) { num25 /= num27; num26 /= num27; } float num28 = num22 + num25; float num29 = num23 + num26; float num30 = Mathf.Sqrt(num28 * num28 + num29 * num29); if (num30 > 0f) { num28 /= num30; num29 /= num30; } num31 = 0f - num29; num32 = num28; num33 = num31 * (0f - num23) + num32 * num22; if (Mathf.Abs(num33) < 0.01f) { num31 = 0f - num26; num32 = num25; num33 = 1f; } } else { float num34 = val7.x - val6.x; float num35 = val7.y - val6.y; float num36 = Mathf.Sqrt(num34 * num34 + num35 * num35); float num37 = num34 / num36; num35 /= num36; num31 = 0f - num35; num32 = num37; num33 = 1f; } ref ImVertex reference3 = ref buffer.Vertices[num19 + 2]; reference3.Position.x = val7.x + num31 * -1f * num / num33; reference3.Position.y = val7.y + num32 * -1f * num / num33; reference3.Color = Color; reference3.UV.x = ScaleOffset.z; reference3.UV.y = ScaleOffset.w + ScaleOffset.y; reference3.Atlas = Atlas; ref ImVertex reference4 = ref buffer.Vertices[num19 + 3]; reference4.Position.x = val7.x + num31 * num2 / num33; reference4.Position.y = val7.y + num32 * num2 / num33; reference4.Color = Color; reference4.UV.x = ScaleOffset.z + ScaleOffset.x; reference4.UV.y = ScaleOffset.w + ScaleOffset.y; reference4.Atlas = Atlas; buffer.Indices[num18] = num19; buffer.Indices[num18 + 1] = num19 + 1; buffer.Indices[num18 + 2] = num19 + 3; buffer.Indices[num18 + 3] = num19 + 3; buffer.Indices[num18 + 4] = num19 + 2; buffer.Indices[num18 + 5] = num19; num18 += 6; num19 += 2; } buffer.AddIndices(num20); buffer.AddVertices(num21); } public void AddTriangleFan(Vector2 center, float from, float to, float radius, int segments) { //IL_0051: 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_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_00c9: 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_00fb: 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_017a: 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_01ae: 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) int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + 2 + segments); buffer.EnsureIndicesCapacity(indicesCount + 3 * segments); ref ImVertex reference = ref buffer.Vertices[verticesCount]; reference.Position.x = center.x; reference.Position.y = center.y; reference.Color = Color; reference.UV.x = ScaleOffset.z; reference.UV.y = ScaleOffset.w; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[verticesCount + 1]; reference2.Position.x = center.x + Mathf.Cos(from) * radius; reference2.Position.y = center.y + Mathf.Sin(from) * radius; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w; reference2.Atlas = Atlas; float num = 1f / (float)segments * (to - from); for (int i = 0; i < segments; i++) { float num2 = from + num * (float)(i + 1); int num3 = verticesCount + i + 2; ref ImVertex reference3 = ref buffer.Vertices[num3]; reference3.Position.x = center.x + Mathf.Cos(num2) * radius; reference3.Position.y = center.y + Mathf.Sin(num2) * radius; reference3.Color = Color; reference3.UV.x = ScaleOffset.z; reference3.UV.y = ScaleOffset.w; reference3.Atlas = Atlas; buffer.Indices[indicesCount + i * 3] = verticesCount; buffer.Indices[indicesCount + i * 3 + 1] = num3; buffer.Indices[indicesCount + i * 3 + 2] = num3 - 1; } buffer.AddVertices(2 + segments); buffer.AddIndices(3 * segments); } public void AddTriangleFanTextured(Vector2 center, float from, float to, float radius, int segments) { //IL_0018: 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_0079: 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_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_00b2: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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) int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; float num = center.x - radius; float num2 = center.y - radius; float num3 = radius * 2f; float num4 = radius * 2f; buffer.EnsureVerticesCapacity(verticesCount + 2 + segments); buffer.EnsureIndicesCapacity(indicesCount + 3 * segments); ref ImVertex reference = ref buffer.Vertices[verticesCount]; reference.Position.x = center.x; reference.Position.y = center.y; reference.Color = Color; reference.UV.x = ScaleOffset.z + (center.x - num) / num3 * ScaleOffset.x; reference.UV.y = ScaleOffset.w + (center.y - num2) / num4 * ScaleOffset.y; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[verticesCount + 1]; reference2.Position.x = center.x + Mathf.Cos(from) * radius; reference2.Position.y = center.y + Mathf.Sin(from) * radius; reference2.Color = Color; reference2.UV.x = ScaleOffset.z + (reference2.Position.x - num) / num3 * ScaleOffset.x; reference2.UV.y = ScaleOffset.w + (reference2.Position.y - num2) / num4 * ScaleOffset.y; reference2.Atlas = Atlas; float num5 = 1f / (float)segments * (to - from); for (int i = 0; i < segments; i++) { float num6 = from + num5 * (float)(i + 1); int num7 = verticesCount + i + 2; ref ImVertex reference3 = ref buffer.Vertices[num7]; reference3.Position.x = center.x + Mathf.Cos(num6) * radius; reference3.Position.y = center.y + Mathf.Sin(num6) * radius; reference3.Color = Color; reference3.UV.x = ScaleOffset.z + (reference3.Position.x - num) / num3 * ScaleOffset.x; reference3.UV.y = ScaleOffset.w + (reference3.Position.y - num2) / num4 * ScaleOffset.y; reference3.Atlas = Atlas; buffer.Indices[indicesCount + i * 3] = verticesCount; buffer.Indices[indicesCount + i * 3 + 1] = num7; buffer.Indices[indicesCount + i * 3 + 2] = num7 - 1; } buffer.AddVertices(2 + segments); buffer.AddIndices(3 * segments); } public void AddQuadTextured(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { //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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + 4); buffer.EnsureIndicesCapacity(indicesCount + 6); ref ImVertex reference = ref buffer.Vertices[verticesCount]; reference.Position.x = x0; reference.Position.y = y0; reference.Color = Color; reference.UV.x = ScaleOffset.z; reference.UV.y = ScaleOffset.w; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[verticesCount + 1]; reference2.Position.x = x1; reference2.Position.y = y1; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w + ScaleOffset.y; reference2.Atlas = Atlas; ref ImVertex reference3 = ref buffer.Vertices[verticesCount + 2]; reference3.Position.x = x2; reference3.Position.y = y2; reference3.Color = Color; reference3.UV.x = ScaleOffset.z + ScaleOffset.x; reference3.UV.y = ScaleOffset.w + ScaleOffset.y; reference3.Atlas = Atlas; ref ImVertex reference4 = ref buffer.Vertices[verticesCount + 3]; reference4.Position.x = x3; reference4.Position.y = y3; reference4.Color = Color; reference4.UV.x = ScaleOffset.z + ScaleOffset.x; reference4.UV.y = ScaleOffset.w; reference4.Atlas = Atlas; buffer.Indices[indicesCount] = verticesCount; buffer.Indices[indicesCount + 1] = verticesCount + 1; buffer.Indices[indicesCount + 2] = verticesCount + 2; buffer.Indices[indicesCount + 3] = verticesCount + 2; buffer.Indices[indicesCount + 4] = verticesCount + 3; buffer.Indices[indicesCount + 5] = verticesCount; buffer.AddIndices(6); buffer.AddVertices(4); } public void AddQuadTextured(ImVertex v0, ImVertex v1, ImVertex v2, ImVertex v3) { int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + 4); buffer.EnsureIndicesCapacity(indicesCount + 6); buffer.Vertices[verticesCount] = v0; buffer.Vertices[verticesCount + 1] = v1; buffer.Vertices[verticesCount + 2] = v2; buffer.Vertices[verticesCount + 3] = v3; buffer.Indices[indicesCount] = verticesCount; buffer.Indices[indicesCount + 1] = verticesCount + 1; buffer.Indices[indicesCount + 2] = verticesCount + 2; buffer.Indices[indicesCount + 3] = verticesCount + 2; buffer.Indices[indicesCount + 4] = verticesCount + 3; buffer.Indices[indicesCount + 5] = verticesCount; buffer.AddIndices(6); buffer.AddVertices(4); } public void AddQuadTextured(float x, float y, float w, float h) { //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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + 4); buffer.EnsureIndicesCapacity(indicesCount + 6); ref ImVertex reference = ref buffer.Vertices[verticesCount]; reference.Position.x = x; reference.Position.y = y; reference.Color = Color; reference.UV.x = ScaleOffset.z; reference.UV.y = ScaleOffset.w; reference.Atlas = Atlas; ref ImVertex reference2 = ref buffer.Vertices[verticesCount + 1]; reference2.Position.x = x; reference2.Position.y = y + h; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w + ScaleOffset.y; reference2.Atlas = Atlas; ref ImVertex reference3 = ref buffer.Vertices[verticesCount + 2]; reference3.Position.x = x + w; reference3.Position.y = y + h; reference3.Color = Color; reference3.UV.x = ScaleOffset.z + ScaleOffset.x; reference3.UV.y = ScaleOffset.w + ScaleOffset.y; reference3.Atlas = Atlas; ref ImVertex reference4 = ref buffer.Vertices[verticesCount + 3]; reference4.Position.x = x + w; reference4.Position.y = y; reference4.Color = Color; reference4.UV.x = ScaleOffset.z + ScaleOffset.x; reference4.UV.y = ScaleOffset.w; reference4.Atlas = Atlas; buffer.Indices[indicesCount] = verticesCount; buffer.Indices[indicesCount + 1] = verticesCount + 1; buffer.Indices[indicesCount + 2] = verticesCount + 2; buffer.Indices[indicesCount + 3] = verticesCount + 2; buffer.Indices[indicesCount + 4] = verticesCount + 3; buffer.Indices[indicesCount + 5] = verticesCount; buffer.AddIndices(6); buffer.AddVertices(4); } public void AddFilledConvexMesh(ReadOnlySpan<Vector2> points) { //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_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_0191: 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) int verticesCount = buffer.VerticesCount; int num = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + points.Length); buffer.EnsureIndicesCapacity(num + (points.Length - 2) * 3); ref readonly Vector2 reference = ref points[0]; ref ImVertex reference2 = ref buffer.Vertices[verticesCount]; reference2.Position.x = reference.x; reference2.Position.y = reference.y; reference2.Color = Color; reference2.UV.x = ScaleOffset.z; reference2.UV.y = ScaleOffset.w; reference2.Atlas = Atlas; ref readonly Vector2 reference3 = ref points[1]; ref ImVertex reference4 = ref buffer.Vertices[verticesCount + 1]; reference4.Position.x = reference3.x; reference4.Position.y = reference3.y; reference4.Color = Color; reference4.UV.x = ScaleOffset.z; reference4.UV.y = ScaleOffset.w; reference4.Atlas = Atlas; for (int i = 2; i < points.Length; i++) { ref readonly Vector2 reference5 = ref points[i]; ref ImVertex reference6 = ref buffer.Vertices[verticesCount + i]; reference6.Position.x = reference5.x; reference6.Position.y = reference5.y; reference6.Color = Color; reference6.UV.x = ScaleOffset.z; reference6.UV.y = ScaleOffset.w; reference6.Atlas = Atlas; buffer.Indices[num] = verticesCount + i; buffer.Indices[num + 1] = verticesCount + i - 1; buffer.Indices[num + 2] = verticesCount; num += 3; } buffer.AddVertices(points.Length); buffer.AddIndices((points.Length - 2) * 3); } public void AddFilledConvexMeshTextured(ReadOnlySpan<Vector2> points, float x, float y, float w, float h) { //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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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) int verticesCount = buffer.VerticesCount; int num = buffer.IndicesCount; buffer.EnsureVerticesCapacity(verticesCount + points.Length); buffer.EnsureIndicesCapacity(num + (points.Length - 2) * 3); ref readonly Vector2 reference = ref points[0]; ref ImVertex reference2 = ref buffer.Vertices[verticesCount]; reference2.Position.x = reference.x; reference2.Position.y = reference.y; reference2.Color = Color; reference2.UV.x = ScaleOffset.z + (reference.x - x) / w * ScaleOffset.x; reference2.UV.y = ScaleOffset.w + (reference.y - y) / h * ScaleOffset.y; reference2.Atlas = Atlas; ref readonly Vector2 reference3 = ref points[1]; ref ImVertex reference4 = ref buffer.Vertices[verticesCount + 1]; reference4.Position.x = reference3.x; reference4.Position.y = reference3.y; reference4.Color = Color; reference4.UV.x = ScaleOffset.z + (reference3.x - x) / w * ScaleOffset.x; reference4.UV.y = ScaleOffset.w + (reference3.y - y) / h * ScaleOffset.y; reference4.Atlas = Atlas; for (int i = 2; i < points.Length; i++) { ref readonly Vector2 reference5 = ref points[i]; ref ImVertex reference6 = ref buffer.Vertices[verticesCount + i]; reference6.Position.x = reference5.x; reference6.Position.y = reference5.y; reference6.Color = Color; reference6.UV.x = ScaleOffset.z + (reference5.x - x) / w * ScaleOffset.x; reference6.UV.y = ScaleOffset.w + (reference5.y - y) / h * ScaleOffset.y; reference6.Atlas = Atlas; buffer.Indices[num] = verticesCount + i; buffer.Indices[num + 1] = verticesCount + i - 1; buffer.Indices[num + 2] = verticesCount; num += 3; } buffer.AddVertices(points.Length); buffer.AddIndices((points.Length - 2) * 3); } } public class ImMeshRenderer : IDisposable { private const MeshUpdateFlags MESH_UPDATE_FLAGS = 15; private static readonly int MainTexId = Shader.PropertyToID("_MainTex"); private static readonly int FontTexId = Shader.PropertyToID("_FontTex"); private static readonly int ViewProjectionId = Shader.PropertyToID("_VP"); private static readonly int MaskEnabledId = Shader.PropertyToID("_MaskEnable"); private static readonly int MaskRectId = Shader.PropertyToID("_MaskRect"); private static readonly int MaskCornerRadiusId = Shader.PropertyToID("_MaskCornerRadius"); private static readonly int InvColorMul = Shader.PropertyToID("_InvColorMul"); private readonly MaterialPropertyBlock properties; private Mesh mesh; private bool disposed; private Material wireframeMaterial; private Mesh wireframeMesh; private int[] wireframeIndicesBuffer; public ImMeshRenderer() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown properties = new MaterialPropertyBlock(); mesh = new Mesh(); mesh.MarkDynamic(); } public void Render(CommandBuffer cmd, ImMeshBuffer buffer, Vector2 screenSize, float screenScale, Vector2Int targetSize) { //IL_00a0: 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_00f4: 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_012f: 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_0145: 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_0150: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_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_0198: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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_0372: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: 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_0331: 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_0364: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(true); buffer.Trim(); buffer.Sort(); mesh.SetIndexBufferParams(buffer.IndicesCount, (IndexFormat)1); mesh.SetVertexBufferParams(buffer.VerticesCount, ImVertex.VertexAttributes); mesh.SetVertexBufferData<ImVertex>(buffer.Vertices, 0, 0, buffer.VerticesCount, 0, (MeshUpdateFlags)15); mesh.SetIndexBufferData<int>(buffer.Indices, 0, 0, buffer.IndicesCount, (MeshUpdateFlags)15); NativeArray<SubMeshDescriptor> val = default(NativeArray<SubMeshDescriptor>); val..ctor(buffer.MeshesCount, (Allocator)2, (NativeArrayOptions)0); for (int i = 0; i < buffer.MeshesCount; i++) { ref ImMeshData reference = ref buffer.Meshes[i]; int num = i; SubMeshDescriptor val2 = default(SubMeshDescriptor); ((SubMeshDescriptor)(ref val2)).topology = reference.Topology; ((SubMeshDescriptor)(ref val2)).indexStart = reference.IndicesOffset; ((SubMeshDescriptor)(ref val2)).indexCount = reference.IndicesCount; ((SubMeshDescriptor)(ref val2)).baseVertex = 0; ((SubMeshDescriptor)(ref val2)).firstVertex = reference.VerticesOffset; ((SubMeshDescriptor)(ref val2)).vertexCount = reference.VerticesCount; val[num] = val2; } mesh.SetSubMeshes<SubMeshDescriptor>(val, (MeshUpdateFlags)15); mesh.UploadMeshData(false); Vector2 val3 = screenScale * new Vector2((float)((Vector2Int)(ref targetSize)).x / screenSize.x, (float)((Vector2Int)(ref targetSize)).y / screenSize.y); float num2 = Mathf.Min(val3.x, val3.y); screenSize /= screenScale; Matrix4x4 identity = Matrix4x4.identity; Matrix4x4 gPUProjectionMatrix = GL.GetGPUProjectionMatrix(Matrix4x4.Ortho(0f, screenSize.x, 0f, screenSize.y, -32769f, 32768f), true); cmd.SetGlobalMatrix(ViewProjectionId, identity * gPUProjectionMatrix); Vector4 val4 = default(Vector4); Rect val5 = default(Rect); for (int j = 0; j < buffer.MeshesCount; j++) { ref ImMeshData reference2 = ref buffer.Meshes[j]; properties.SetTexture(MainTexId, reference2.MainTex); properties.SetTexture(FontTexId, reference2.FontTex); properties.SetFloat(InvColorMul, reference2.InvColorMul); if (reference2.MaskRect.Enabled) { float num3 = reference2.MaskRect.Radius * num2; Rect rect = reference2.MaskRect.Rect; float num4 = ((Rect)(ref rect)).width / 2f; float num5 = ((Rect)(ref rect)).height / 2f; ((Vector4)(ref val4))..ctor((((Rect)(ref rect)).x + num4) * val3.x, (((Rect)(ref rect)).y + num5) * val3.y, num4 * val3.x, num5 * val3.y); properties.SetInteger(MaskEnabledId, 1); properties.SetVector(MaskRectId, val4); properties.SetFloat(MaskCornerRadiusId, num3); } else { properties.SetInteger(MaskEnabledId, 0); } if (reference2.ClipRect.Enabled) { float num6 = ((Rect)(ref reference2.ClipRect.Rect)).xMin * val3.x; float num7 = ((Rect)(ref reference2.ClipRect.Rect)).yMin * val3.y; float num8 = ((Rect)(ref reference2.ClipRect.Rect)).width * val3.x; float num9 = ((Rect)(ref reference2.ClipRect.Rect)).height * val3.y; ((Rect)(ref val5))..ctor(num6, num7, num8, num9); cmd.EnableScissorRect(val5); } cmd.DrawMesh(mesh, Matrix4x4.identity, reference2.Material, j, -1, properties); if (reference2.ClipRect.Enabled) { cmd.DisableScissorRect(); } } } public void RenderWireframe(CommandBuffer cmd, ImMeshBuffer buffer, Vector2 screenSize, float screenScale) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_01a9: 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_01ed: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_023f: 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_024b: 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_024d: 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) if (!Object.op_Implicit((Object)(object)wireframeMaterial)) { wireframeMaterial = new Material(AssetsManager.LoadAsset<Shader>("assets/imui/imui_wireframe.shader")); } if (!Object.op_Implicit((Object)(object)wireframeMesh)) { wireframeMesh = new Mesh(); wireframeMesh.MarkDynamic(); } wireframeMesh.Clear(true); int num = Mathf.NextPowerOfTwo(buffer.IndicesCount * 2); if (wireframeIndicesBuffer == null) { wireframeIndicesBuffer = new int[num]; } if (wireframeIndicesBuffer.Length < num) { Array.Resize(ref wireframeIndicesBuffer, num); } for (int i = 0; i < buffer.IndicesCount / 3; i++) { int num2 = buffer.Indices[3 * i]; int num3 = buffer.Indices[3 * i + 1]; int num4 = buffer.Indices[3 * i + 2]; wireframeIndicesBuffer[i * 6] = num2; wireframeIndicesBuffer[i * 6 + 1] = num3; wireframeIndicesBuffer[i * 6 + 2] = num3; wireframeIndicesBuffer[i * 6 + 3] = num4; wireframeIndicesBuffer[i * 6 + 4] = num4; wireframeIndicesBuffer[i * 6 + 5] = num2; } wireframeMesh.SetIndexBufferParams(buffer.IndicesCount * 2, (IndexFormat)1); wireframeMesh.SetVertexBufferParams(buffer.VerticesCount, ImVertex.VertexAttributes); wireframeMesh.SetVertexBufferData<ImVertex>(buffer.Vertices, 0, 0, buffer.VerticesCount, 0, (MeshUpdateFlags)15); wireframeMesh.SetIndexBufferData<int>(wireframeIndicesBuffer, 0, 0, buffer.IndicesCount * 2, (MeshUpdateFlags)15); if (wireframeMesh.subMeshCount != 1) { wireframeMesh.subMeshCount = 1; } SubMeshDescriptor val = default(SubMeshDescriptor); ((SubMeshDescriptor)(ref val)).topology = (MeshTopology)3; ((SubMeshDescriptor)(ref val)).indexStart = 0; ((SubMeshDescriptor)(ref val)).indexCount = buffer.IndicesCount * 2; ((SubMeshDescriptor)(ref val)).baseVertex = 0; ((SubMeshDescriptor)(ref val)).firstVertex = 0; ((SubMeshDescriptor)(ref val)).vertexCount = buffer.VerticesCount; SubMeshDescriptor val2 = val; wireframeMesh.SetSubMesh(0, val2, (MeshUpdateFlags)15); wireframeMesh.UploadMeshData(false); screenSize /= screenScale; Matrix4x4 identity = Matrix4x4.identity; Matrix4x4 gPUProjectionMatrix = GL.GetGPUProjectionMatrix(Matrix4x4.Ortho(0f, screenSize.x, 0f, screenSize.y, -32768f, 32767f), true); cmd.SetGlobalMatrix(ViewProjectionId, identity * gPUProjectionMatrix); cmd.DrawMesh(wireframeMesh, Matrix4x4.identity, wireframeMaterial, 0, -1); } public void Dispose() { if (!disposed) { ImUnityUtility.Destroy((Object)(object)mesh); if (Object.op_Implicit((Object)(object)wireframeMesh)) { ImUnityUtility.Destroy((Object)(object)wireframeMesh); } if (Object.op_Implicit((Object)(object)wireframeMaterial)) { ImUnityUtility.Destroy((Object)(object)wireframeMaterial); } mesh = null; wireframeMesh = null; wireframeMaterial = null; wireframeIndicesBuffer = null; disposed = true; } } } public enum ImTextOverflow { Overflow, Ellipsis, Truncate } public enum ImGlyphRenderMode { Smooth, Sdf } public struct ImTextLine { public int Start; public int Count; public float OffsetX; public float Width; } public struct ImTextLayout { public float Size; public float Scale; public float OffsetX; public float OffsetY; public float Width; public float Height; public ImTextLine[] Lines; public int LinesCount; public float LineHeight; public ImTextOverflow Overflow; public float OverflowWidth; } public readonly struct ImTextClipRect { public readonly float Left; public readonly float Right; public readonly float Top; public readonly float Bottom; public ImTextClipRect(float left, float right, float top, float bottom) { Left = left; Right = right; Top = top; Bottom = bottom; } } public class ImTextDrawer : IDisposable { [Flags] public enum GlyphFlag { None = 0, Empty = 1 } public struct GlyphData { public int x; public int y; public int w; public int h; public float bearingX; public float bearingY; public float advance; public GlyphFlag flag; public float uv0x; public float uv0y; public float uv1x; public float uv1y; public GlyphData(Glyph g) { //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_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) GlyphRect glyphRect = g.glyphRect; GlyphMetrics metrics = g.metrics; x = ((GlyphRect)(ref glyphRect)).x; y = ((GlyphRect)(ref glyphRect)).y; w = ((GlyphRect)(ref glyphRect)).width; h = ((GlyphRect)(ref glyphRect)).height; bearingX = ((GlyphMetrics)(ref metrics)).horizontalBearingX; bearingY = ((GlyphMetrics)(ref metrics)).horizontalBearingY; advance = ((GlyphMetrics)(ref metrics)).horizontalAdvance; flag = GlyphFlag.None; uv0x = (float)x / 1024f; uv0y = (float)y / 1024f; uv1x = (float)(x + w) / 1024f; uv1y = (float)(y + h) / 1024f; } } public static class ReflectionUtility { private static MethodInfo removeFontAssetMethod; private static MethodInfo rebuildFontAssetCacheMethod; private static MethodInfo updateAtlasTexturesInQueueMethod; static ReflectionUtility() { Type type = typeof(FontAsset).Assembly.GetType("UnityEngine.TextCore.Text.TextResourceManager"); if (type != null) { removeFontAssetMethod = type.GetMethod("RemoveFontAsset", BindingFlags.Static | BindingFlags.Public); rebuildFontAssetCacheMethod = type.GetMethod("RebuildFontAssetCache", BindingFlags.Static | BindingFlags.NonPublic); } updateAtlasTexturesInQueueMethod = typeof(FontAsset).GetMethod("UpdateAtlasTexturesInQueue", BindingFlags.Static | BindingFlags.NonPublic); } public static void UpdateAtlasTexturesInQueue() { updateAtlasTexturesInQueueMethod?.Invoke(null, null); } public static void RemoveFontAsset(FontAsset asset) { removeFontAssetMethod?.Invoke(null, new object[1] { asset }); } public static void RebuildFontAssetCache() { rebuildFontAssetCacheMethod?.Invoke(null, null); } } private const string ELLIPSIS_FALLBACK = "..."; private const string ELLIPSIS_ONE_CHAR = "…"; private const char NEW_LINE = '\n'; private const char SPACE = ' '; private const char TAB = '\t'; private const int TAB_SPACES = 4; private const int GLYPH_LOOKUP_CAPACITY = 256; private const float FONT_ATLAS_W = 1024f; private const float FONT_ATLAS_H = 1024f; private const int FONT_ATLAS_PADDING = 2; private static ImTextLayout sharedLayout = new ImTextLayout { Lines = new ImTextLine[128] }; public Color32 Color; private FontAsset fontAsset; private ImGlyphRenderMode renderMode; private float lineHeight; private float renderSize; private float descentLine; private GlyphData[] glyphsLookup; private float ellipsisWidth; private GlyphData[] ellipsisGlyphs; private string ellipsisStr; private bool atlasDirty; private readonly ImMeshBuffer buffer; private bool disposed; public Texture2D FontAtlas => fontAsset.atlasTexture; public FontAsset FontAsset => fontAsset; public ImGlyphRenderMode RenderMode => renderMode; public bool IsFontLoaded => Object.op_Implicit((Object)(object)FontAsset); public float FontRenderSize => renderSize; public float FontLineHeight => lineHeight; public ImTextDrawer(ImMeshBuffer buffer) { this.buffer = buffer; glyphsLookup = new GlyphData[256]; ellipsisGlyphs = new GlyphData["...".Length]; } public void LoadFont(Font font) { LoadFont(font, font.fontSize); } public void LoadFont(Font font, int sampleSize, ImGlyphRenderMode renderMode = ImGlyphRenderMode.Smooth) { //IL_0014: 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_0026: 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_005b: 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_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_008e: 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_001c: Unknown result type (might be due to invalid IL or missing references) UnloadFont(); GlyphRenderMode val = (GlyphRenderMode)(renderMode switch { ImGlyphRenderMode.Smooth => 4121, ImGlyphRenderMode.Sdf => 4169, _ => throw new NotImplementedException(), }); this.renderMode = renderMode; fontAsset = FontAsset.CreateFontAsset(font, sampleSize, 2, val, 1024, 1024, (AtlasPopulationMode)1, false); fontAsset.ReadFontAssetDefinition(); FaceInfo faceInfo = fontAsset.faceInfo; renderSize = ((FaceInfo)(ref faceInfo)).pointSize; faceInfo = fontAsset.faceInfo; lineHeight = ((FaceInfo)(ref faceInfo)).lineHeight; faceInfo = fontAsset.faceInfo; descentLine = ((FaceInfo)(ref faceInfo)).descentLine; for (uint num = 0u; num < glyphsLookup.Length; num++) { if (!fontAsset.HasCharacter((char)num, false, true)) { glyphsLookup[num] = default(GlyphData); } else { glyphsLookup[num] = new GlyphData(((TextElement)fontAsset.characterLookupTable[num]).glyph); } } glyphsLookup[32].flag |= GlyphFlag.Empty; glyphsLookup[9].flag |= GlyphFlag.Empty; glyphsLookup[9].advance = glyphsLookup[32].advance * 4f; ellipsisWidth = 0f; if (fontAsset.HasCharacter("…"[0], false, true)) { ellipsisGlyphs[0] = new GlyphData(((TextElement)fontAsset.characterLookupTable["…"[0]]).glyph); ellipsisWidth += ellipsisGlyphs[0].advance; ellipsisStr = "…"; } else { for (int i = 0; i < "...".Length; i++) { ellipsisGlyphs[i] = glyphsLookup[(uint)"..."[i]]; ellipsisWidth += ellipsisGlyphs[i].advance; } ellipsisStr = "..."; } ApplyAtlasChanges(force: true); } public void UnloadFont() { if (!((Object)(object)fontAsset == (Object)null)) { ReflectionUtility.UpdateAtlasTexturesInQueue(); ReflectionUtility.RemoveFontAsset(fontAsset); ImUnityUtility.Destroy((Object)(object)fontAsset); fontAsset = null; ReflectionUtility.RebuildFontAssetCache(); } } public void ApplyAtlasChanges(bool force = false) { if (atlasDirty || force) { ReflectionUtility.UpdateAtlasTexturesInQueue(); atlasDirty = false; } } public float GetLineHeightFromFontSize(float size) { return FontLineHeight * (size / FontRenderSize); } public float GetFontSizeFromLineHeight(float height) { return FontRenderSize * (height / FontLineHeight); } public float GetCharacterAdvance(char c, float size) { //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) float num = size / FontRenderSize; if (c < 'Ā') { return glyphsLookup[(uint)c].advance * num; } if (fontAsset.characterLookupTable.TryGetValue(c, out var value)) { GlyphMetrics metrics = ((TextElement)value).glyph.metrics; return ((GlyphMetrics)(ref metrics)).horizontalAdvance * num; } return 0f; } public float GetCharacterAdvance(char c) { //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) if (c < 'Ā') { return glyphsLookup[(uint)c].advance; } if (fontAsset.characterLookupTable.TryGetValue(c, out var value)) { GlyphMetrics metrics = ((TextElement)value).glyph.metrics; return ((GlyphMetrics)(ref metrics)).horizontalAdvance; } return 0f; } public void AddTextWithLayout(ReadOnlySpan<char> text, in ImTextLayout layout, float x, float y, in ImTextClipRect clipRect) { Dictionary<uint, Character> characterLookupTable = fontAsset.characterLookupTable; float num = lineHeight * layout.Scale; float num2 = x; y -= num; buffer.EnsureVerticesCapacity(buffer.VerticesCount + text.Length * 4); buffer.EnsureIndicesCapacity(buffer.IndicesCount + text.Length * 6); for (int i = 0; i < layout.LinesCount; i++) { ref ImTextLine reference = ref layout.Lines[i]; float num3 = float.MaxValue; if (reference.Width - layout.OverflowWidth > 1f) { num3 = ((layout.Overflow == ImTextOverflow.Ellipsis) ? (num2 + layout.OverflowWidth - ellipsisWidth * layout.Scale) : ((layout.Overflow == ImTextOverflow.Truncate) ? (num2 + layout.OverflowWidth) : num3)); } for (int j = 0; j < reference.Count; j++) { char c = text[reference.Start + j]; if (x > clipRect.Right) { break; } if (c < 'Ā') { ref GlyphData reference2 = ref glyphsLookup[(uint)c]; float num4 = reference2.advance * layout.Scale; if (x + num4 > num3) { if (layout.Overflow == ImTextOverflow.Ellipsis && layout.OverflowWidth > ellipsisWidth * layout.Scale) { for (int k = 0; k < ellipsisStr.Length; k++) { x += AddGlyphQuad(in ellipsisGlyphs[k], x + reference.OffsetX, y + layout.OffsetY, layout.Scale); } } break; } x = (((reference2.flag & GlyphFlag.Empty) == 0) ? (x + AddGlyphQuad(in reference2, x + reference.OffsetX, y + layout.OffsetY, layout.Scale)) : (x + num4)); } else { if (!characterLookupTable.TryGetValue(c, out var value)) { continue; } GlyphData glyph = new GlyphData(((TextElement)value).glyph); float num5 = glyph.advance * layout.Scale; if (x + num5 > num3) { if (layout.Overflow == ImTextOverflow.Ellipsis) { for (int l = 0; l < ellipsisStr.Length; l++) { x += AddGlyphQuad(in ellipsisGlyphs[l], x + reference.OffsetX, y + layout.OffsetY, layout.Scale); } } break; } x += AddGlyphQuad(in glyph, x + reference.OffsetX, y + layout.OffsetY, layout.Scale); } } if (!(y < clipRect.Bottom)) { y -= num; x = num2; continue; } break; } } private void AddControlGlyphQuad(char c, float px, float py, float scale) { //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_0013: 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_0087: Unknown result type (might be due to invalid IL or missing references) Color32 color = Color; Color.SetAlpha(0.5f * Color.GetAlpha()); ref GlyphData glyph = ref glyphsLookup[92]; switch (c) { case '\n': AddGlyphQuad(in glyphsLookup[110], px + AddGlyphQuad(in glyph, px, py, scale), py, scale); break; case '\t': AddGlyphQuad(in glyphsLookup[116], px + AddGlyphQuad(in glyph, px, py, scale), py, scale); break; } Color = color; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private float AddGlyphQuad(in GlyphData glyph, float px, float py, float scale) { //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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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) float num = scale * (float)glyph.w; float num2 = scale * (float)glyph.h; float num3 = scale * glyph.bearingX; float num4 = scale * (glyph.bearingY - (float)glyph.h - descentLine); float num5 = px + num3; float num6 = py + num4; float x = num5 + num; float y = num6 + num2; int verticesCount = buffer.VerticesCount; int indicesCount = buffer.IndicesCount; ref ImVertex reference = ref buffer.Vertices[verticesCount]; reference.Position.x = num5; reference.Position.y = num6; reference.Color = Color; reference.UV.x = glyph.uv0x; reference.UV.y = glyph.uv0y; reference.Atlas = 1f; ref ImVertex reference2 = ref buffer.Vertices[verticesCount + 1]; reference2.Position.x = num5; reference2.Position.y = y; reference2.Color = Color; reference2.UV.x = glyph.uv0x; reference2.UV.y = glyph.uv1y; reference2.Atlas = 1f; ref ImVertex reference3 = ref buffer.Vertices[verticesCount + 2]; reference3.Position.x = x; reference3.Position.y = y; reference3.Color = Color; reference3.UV.x = glyph.uv1x; reference3.UV.y = glyph.uv1y; reference3.Atlas = 1f; ref ImVertex reference4 = ref buffer.Vertices[verticesCount + 3]; reference4.Position.x = x; reference4.Position.y = num6; reference4.Color = Color; reference4.UV.x = glyph.uv1x; reference4.UV.y = glyph.uv0y; reference4.Atlas = 1f; buffer.Indices[indicesCount] = verticesCount; buffer.Indices[indicesCount + 1] = verticesCount + 1; buffer.Indices[indicesCount + 2] = verticesCount + 2; buffer.Indices[indicesCount + 3] = verticesCount + 2; buffer.Indices[indicesCount + 4] = verticesCount + 3; buffer.Indices[indicesCount + 5] = verticesCount; buffer.AddVertices(4); buffer.AddIndices(6); return glyph.advance * scale; } public ref readonly ImTextLayout BuildTempLayout(ReadOnlySpan<char> text, float boundsWidth, float boundsHeight, float alignX, float alignY, float size, bool wrap, ImTextOverflow overflow) { FillLayout(text, boundsWidth, boundsHeight, alignX, alignY, size, wrap, overflow, ref sharedLayout); return ref sharedLayout; } public void FillLayout(ReadOnlySpan<char> text, float boundsWidth, float boundsHeight, float alignX, float alignY, float size, bool wrap, ImTextOverflow overflow, ref ImTextLayout layout) { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) layout.LinesCount = 0; layout.Scale = size / FontRenderSize; layout.OffsetX = boundsWidth * alignX; layout.OffsetY = 0f; layout.Width = 0f; layout.Height = 0f; layout.Size = size; layout.LineHeight = lineHeight * layout.Scale; layout.OverflowWidth = boundsWidth; layout.Overflow = overflow; if (text.IsEmpty) { return; } wrap = wrap && boundsWidth > 0f; float num = ((overflow == ImTextOverflow.Overflow) ? float.MinValue : 0f); float num2 = 0f; float num3 = 0f; int num4 = 0; int length = text.Length; Dictionary<uint, Character> characterLookupTable = fontAsset.characterLookupTable; int num5 = ((overflow == ImTextOverflow.Overflow || boundsHeight <= 0f) ? int.MaxValue : ((int)((boundsHeight + 0.001f) / layout.LineHeight))); int num6 = -1; float num7 = 0f; bool flag = false; for (int i = 0; i < length; i++) { char c = text[i]; float num8; Character value; GlyphMetrics metrics; if (c < 'Ā') { num8 = glyphsLookup[(uint)c].advance; } else if (characterLookupTable.TryGetValue(c, out value)) { metrics = ((TextElement)value).glyph.metrics; num8 = ((GlyphMetrics)(ref metrics)).horizontalAdvance; } else { if (!fontAsset.HasCharacter(c, false, true)) { continue; } atlasDirty = true; metrics = ((TextElement)characterLookupTable[c]).glyph.metrics; num8 = ((GlyphMetrics)(ref metrics)).horizontalAdvance; } if (flag && c != ' ') { num6 = i; num7 = num3; } flag = c == ' '; float num9 = num8 * layout.Scale; bool flag2 = c == '\n'; bool flag3 = flag2; if (!flag3 && wrap && num3 > 0f && num3 + num9 > boundsWidth + 0.0001f) { if (num6 != -1) { num3 = num7; i = num6; } flag3 = true; } if (flag3) { ref ImTextLine reference = ref layout.Lines[layout.LinesCount]; reference.Width = num3; reference.Start = num4; reference.Count = i - num4 + (flag2 ? 1 : 0); reference.OffsetX = Mathf.Max(boundsWidth - num3, num) * alignX; if (reference.Width > num2) { num2 = reference.Width; } layout.LinesCount++; if (layout.LinesCount >= num5) { break; } layout.OffsetX = Mathf.Min(reference.OffsetX, layout.OffsetX); num3 = num9; num4 = i + (flag2 ? 1 : 0); if (layout.LinesCount >= layout.Lines.Length) { Array.Resize(ref layout.Lines, layout.Lines.Length * 2); } num6 = -1; } else { num3 += num9; } } if (layout.LinesCount < num5 && (text.Length > num4 || text[num4 - 1] == '\n')) { ref ImTextLine reference2 = ref layout.Lines[layout.LinesCount]; reference2.Width = num3; reference2.Start = num4; reference2.Count = length - num4; reference2.OffsetX = Mathf.Max(boundsWidth - num3, num) * alignX; if (reference2.Width > num2) { num2 = reference2.Width; } layout.OffsetX = Mathf.Min(reference2.OffsetX, layout.OffsetX); layout.LinesCount++; } layout.Width = num2; layout.Height = layout.LineHeight * (float)layout.LinesCount; layout.OffsetY = (0f - (boundsHeight - (float)layout.LinesCount * layout.LineHeight)) * alignY; } public void Dispose() { if (!disposed) { UnloadFont(); disposed = true; } } } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ImVertex { public static readonly VertexAttributeDescriptor[] VertexAttributes = (VertexAttributeDescriptor[])(object)new VertexAttributeDescriptor[4] { new VertexAttributeDescriptor((VertexAttribute)0, (VertexAttributeFormat)0, 2, 0), new VertexAttributeDescriptor((VertexAttribute)3, (VertexAttributeFormat)2, 4, 0), new VertexAttributeDescriptor((VertexAttribute)4, (VertexAttributeFormat)0, 2, 0), new VertexAttributeDescriptor((VertexAttribute)5, (VertexAttributeFormat)0, 1, 0) }; public Vector2 Position; public Color32 Color; public Vector2 UV; public float Atlas; public ImVertex(Vector2 position, Color32 color, Vector2 uv, float atlas) { //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) //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_000f: 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) Position = position; Color = color; UV = uv; Atlas = atlas; } public ImVertex(ImVertex vertex) { //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_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_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) Position = vertex.Position; Color = vertex.Color; UV = vertex.UV; Atlas = vertex.Atlas; } } } namespace Imui.IO { public interface IImuiInput { public delegate bool RaycasterDelegate(float x, float y); string Clipboard { get { return GUIUtility.systemCopyBuffer ?? string.Empty; } set { GUIUtility.systemCopyBuffer = value; } } Vector2 MousePosition { get; } double Time { get; } bool WasMouseDownThisFrame { get; } ref readonly ImMouseEvent MouseEvent { get; } ref readonly ImTextEvent TextEvent { get; } int KeyboardEventsCount { get; } void UseMouseEvent(); void UseTextEvent(); ref readonly ImKeyboardEvent GetKeyboardEvent(int index); void UseKeyboardEvent(int index); void RequestTouchKeyboard(uint owner, ReadOnlySpan<char> text, ImTouchKeyboardSettings settings); void UseRaycaster(RaycasterDelegate raycaster); void Pull(); } public interface IImuiRenderer { Vector2 GetScreenSize(); float GetScale(); Vector2Int SetupRenderTarget(CommandBuffer cmd); void Schedule(IImuiRenderDelegate renderDelegate); } public interface IImuiRenderDelegate { void Render(IImuiRenderingContext context); } public interface IImuiRenderingScheduler : IDisposable { void Schedule(IImuiRenderDelegate renderDelegate); } public interface IImuiRenderingContext : IDisposable { CommandBuffer CreateCommandBuffer(); void ReleaseCommandBuffer(CommandBuffer cmd); void ExecuteCommandBuffer(CommandBuffer cmd); } } namespace Imui.IO.Utility { public class ImDynamicRenderTexture : IDisposable { private const int RES_MIN = 32; private const int RES_MAX = 4096; private RenderTexture prevTexture; private bool disposed; public RenderTexture Texture { get; private set; } public Vector2Int SetupRenderTarget(CommandBuffer cmd, Vector2Int requestedSize, out bool textureChanged) { //IL_0008: 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_0030: 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) AssertDisposed(); textureChanged = SetupTexture(requestedSize, 1f, out var targetSize); cmd.Clear(); cmd.SetRenderTarget(RenderTargetIdentifier.op_Implicit((Texture)(object)Texture)); cmd.ClearRenderTarget(true, true, Color.clear); return targetSize; } private bool SetupTexture(Vector2Int size, float scale, out Vector2Int targetSize) { //IL_003f: 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_00cc: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown AssertDisposed(); ReleasePrevTexture(); int num = Mathf.Clamp((int)((float)((Vector2Int)(ref size)).x * scale), 32, 4096); int num2 = Mathf.Clamp((int)((float)((Vector2Int)(ref size)).y * scale), 32, 4096); targetSize = new Vector2Int(num, num2); if (num == 0 || num2 == 0) { return false; } if (Object.op_Implicit((Object)(object)Texture) && Texture.IsCreated() && ((Texture)Texture).width == num && ((Texture)Texture).height == num2) { return false; } if (Object.op_Implicit((Object)(object)Texture)) { if (!Object.op_Implicit((Object)(object)prevTexture)) { prevTexture = Texture; Texture = null; } else { ReleaseActiveTexture(); } } RenderTextureDescriptor val = default(RenderTextureDescriptor); ((RenderTextureDescriptor)(ref val))..ctor(num, num2, (RenderTextureFormat)0, 0, 0, (RenderTextureReadWrite)1); Texture = new RenderTexture(val) { name = "ImuiRenderBuffer" }; return Texture.Create(); } private void ReleasePrevTexture() { if (Object.op_Implicit((Object)(object)prevTexture)) { prevTexture.Release(); prevTexture = null; } } private void ReleaseActiveTexture() { if (Object.op_Implicit((Object)(object)Texture)) { Texture.Release(); Texture = null; } } [HideInCallstack] private void AssertDisposed() { if (disposed) { throw new ObjectDisposedException("ImDynamicRenderTexture"); } } public void Dispose() { if (!disposed) { ReleasePrevTexture(); ReleaseActiveTexture(); disposed = true; } } } [Flags] public enum ImKeyboardCommandFlag : uint { None = 0u, Select = 1u, JumpWord = 2u, SelectAll = 4u, Copy = 8u, Paste = 0x10u, Cut = 0x20u, JumpEnd = 0x40u } public static class ImKeyboardCommandsHelper { public static bool TryGetCommand(ImKeyboardEvent evt, out ImKeyboardCommandFlag command) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.operatingSystemFamily != 1) { return TryGetCommandGeneric(evt, out command); } return TryGetCommandMacOS(evt, out command); } public static bool TryGetCommandMacOS(ImKeyboardEvent evt, out ImKeyboardCommandFlag result) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0025: 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_0053: 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: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Invalid comparison between Unknown and I4 result = ImKeyboardCommandFlag.None; bool flag = (int)evt.Key >= 273 && (int)evt.Key <= 276; bool flag2 = ((Enum)evt.Modifiers).HasFlag((Enum)(object)(EventModifiers)4); bool flag3 = ((Enum)evt.Modifiers).HasFlag((Enum)(object)(EventModifiers)8); bool flag4 = ((Enum)evt.Modifiers).HasFlag((Enum)(object)(EventModifiers)1); if (flag && flag3 && !flag2) { result |= ImKeyboardCommandFlag.JumpEnd; } else if (flag && !flag3 && flag2) { result |= ImKeyboardCommandFlag.JumpWord; } if (flag && flag4) { result |= ImKeyboardCommandFlag.Select; } if (flag3 && (int)evt.Key == 97) { result |= ImKeyboardCommandFlag.SelectAll; } if (flag3 && (int)evt.Key == 99) { result |= ImKeyboardCommandFlag.Copy; } if (flag3 && (int)evt.Key == 118) { result |= ImKeyboardCommandFlag.Paste; } if (flag3 && (int)evt.Key == 120) { result |= ImKeyboardCommandFlag.Cut; } return result != ImKeyboardCommandFlag.None; } public static bool TryGetCommandGeneric(ImKeyboardEvent evt, out ImKeyboardCommandFlag command) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0024: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Invalid comparison between Unknown and I4 command = ImKeyboardCommandFlag.None; bool num = (int)evt.Key >= 273 && (int)evt.Key <= 276; bool flag = ((Enum)evt.Modifiers).HasFlag((Enum)(object)(EventModifiers)2); if (num && ((Enum)evt.Modifiers).HasFlag((Enum)(object)(EventModifiers)1)) { command |= ImKeyboardCommandFlag.Select; } if (num && flag) { command |= ImKeyboardCommandFlag.JumpWord; } if (flag && (int)evt.Key == 97) { command |= ImKeyboardCommandFlag.SelectAll; } if (flag && (int)evt.Key == 99) { command |= ImKeyboardCommandFlag.Copy; } if (flag && (int)evt.Key == 118) { command |= ImKeyboardCommandFlag.Paste; } if (flag && (int)evt.Key == 120) { command |= ImKeyboardCommandFlag.Cut; } return command != ImKeyboardCommandFlag.None; } } public static class ImUnityInputWrapper { public unsafe static Vector2 MousePosition { get { //IL_002d: 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_006e: 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) Mouse current = Mouse.current; Vector2? obj; if (current == null) { obj = null; } else { Vector2Control position = ((Pointer)current).position; obj = ((position != null) ? new Vector2?(Unsafe.Read<Vector2>((void*)((InputControl<Vector2>)(object)position).value)) : null); } Vector2? val = obj; if (!val.HasValue) { Touchscreen current2 = Touchscreen.current; Vector2? obj2; if (current2 == null) { obj2 = null; } else { Vector2Control position2 = ((Pointer)current2).position; obj2 = ((position2 != null) ? new Vector2?(Unsafe.Read<Vector2>((void*)((InputControl<Vector2>)(object)position2).value)) : null); } Vector2? val2 = obj2; return val2.GetValueOrDefault(); } return val.GetValueOrDefault(); } } public static bool TouchScreenSupported { get { Touchscreen current = Touchscreen.current; if (current == null) { return false; } return ((InputDevice)current).enabled; } } public static bool IsControlPressed { get { Keyboard current = Keyboard.current; if (current == null) { return false; } return current.ctrlKey.isPressed; } } public unsafe static bool IsTouchBeganThisFrame() { //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) Touchscreen current = Touchscreen.current; if (current == null) { return false; } ReadOnlyArray<TouchControl> touches = current.touches; for (int i = 0; i < touches.Count; i++) { if (*(int*)((InputControl<TouchPhase>)(object)touches[i].phase).value == 1) { return true; } } return false; } } public static class ImUnityScrollUtility { public static Vector2 ProcessScrollDelta(float dx, float dy) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return new Vector2(dx, dy); } } } namespace Imui.IO.UGUI { [RequireComponent(typeof(CanvasRenderer))] [ExecuteAlways] public class ImuiUnityGUIBackend : Graphic, IImuiRenderer, IImuiInput, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler, IBeginDragHandler, IScrollHandler { public enum ScalingMode { Inherited, Custom } private const float CUSTOM_SCALE_MIN = 0.05f; private const float CUSTOM_SCALE_MAX = 16f; private const int MOUSE_EVENTS_QUEUE_SIZE = 4; private const int KEYBOARD_EVENTS_QUEUE_SIZE = 16; private const float HELD_DOWN_DELAY = 0.2f; private const float MULTI_CLICK_TIME_THRESHOLD = 0.2f; private const float MULTI_CLICK_POS_THRESHOLD = 20f; private const float CLICK_POS_THRESHOLD = 8f; private const int MAX_MOUSE_BUTTONS = 3; private static Texture2D ClearTexture; private static readonly Vector3[] TempBuffer = (Vector3[])(object)new Vector3[4]; private static Material DefaultMaterial; [SerializeField] private ScalingMode scalingMode; [SerializeField] private float customScale = 1f; private IImuiInput.RaycasterDelegate raycaster; private ImDynamicRenderTexture texture; private ImCircularBuffer<ImMouseEvent> mouseEventsQueue; private ImCircularBuffer<ImKeyboardEvent> nextKeyboardEvents; private ImCircularBuffer<ImKeyboardEvent> keyboardEvents; private IImuiRenderingScheduler scheduler; private Vector2 mousePosition; private ImMouseEvent mouseEvent; private ImTextEvent textEvent; private ImTouchKeyboard touchKeyboardHandler; private bool elementHovered; private double time; private bool mouseHeldDown; private ImMouseDevice mouseDownDevice; private float[] mouseDownTime = new float[3]; private int[] mouseDownCount = new int[3]; private Vector2[] mouseDownPos = (Vector2[])(object)new Vector2[3]; private bool[] possibleClick = new bool[3]; public bool WasMouseDownThisFrame { get; private set; } public Vector2 MousePosition => mousePosition; public double Time => time; public ref readonly ImMouseEvent MouseEvent => ref mouseEvent; public ref readonly ImTextEvent TextEvent => ref textEvent; public int KeyboardEventsCount => keyboardEvents.Count; public override Texture mainTexture { get { if (!((Object)(object)texture?.Texture == (Object)null)) { return (Texture)(object)texture.Texture; } return (Texture)(object)ClearTexture; } } public override Material defaultMaterial { get { if (!Object.op_Implicit((Object)(object)DefaultMaterial)) { return ((Graphic)this).defaultMaterial; } return DefaultMaterial; } } public float CustomScale { get { return customScale; } set { customScale = Mathf.Clamp(value, 0.05f, 16f); } } public ScalingMode Scaling { get { return scalingMode; } set { scalingMode = value; } } protected override void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ((UIBehaviour)this).Awake(); if (!Object.op_Implicit((Object)(object)DefaultMaterial)) { Shader val = AssetsManager.LoadAsset<Sh