163 lines
6.8 KiB
C#
163 lines
6.8 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
// Token: 0x02000281 RID: 641
|
|
[UsedByNativeCode]
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal sealed class StylePainter : IStylePainter
|
|
{
|
|
// Token: 0x06002C07 RID: 11271 RVA: 0x0003B0C8 File Offset: 0x000392C8
|
|
public StylePainter()
|
|
{
|
|
this.Init();
|
|
}
|
|
|
|
// Token: 0x06002C08 RID: 11272 RVA: 0x0003B0E4 File Offset: 0x000392E4
|
|
public StylePainter(Vector2 pos)
|
|
: this()
|
|
{
|
|
this.mousePosition = pos;
|
|
}
|
|
|
|
// Token: 0x06002C09 RID: 11273 RVA: 0x0003B0F4 File Offset: 0x000392F4
|
|
public void DrawTexture(Rect screenRect, Texture texture, Color color, ScaleMode scaleMode = ScaleMode.StretchToFill, float borderWidth = 0f, float borderRadius = 0f, int leftBorder = 0, int topBorder = 0, int rightBorder = 0, int bottomBorder = 0)
|
|
{
|
|
Rect rect = screenRect;
|
|
Rect rect2 = new Rect(0f, 0f, 1f, 1f);
|
|
float num = (float)texture.width / (float)texture.height;
|
|
float num2 = screenRect.width / screenRect.height;
|
|
if (scaleMode != ScaleMode.StretchToFill)
|
|
{
|
|
if (scaleMode != ScaleMode.ScaleAndCrop)
|
|
{
|
|
if (scaleMode == ScaleMode.ScaleToFit)
|
|
{
|
|
if (num2 > num)
|
|
{
|
|
float num3 = num / num2;
|
|
rect = new Rect(screenRect.xMin + screenRect.width * (1f - num3) * 0.5f, screenRect.yMin, num3 * screenRect.width, screenRect.height);
|
|
}
|
|
else
|
|
{
|
|
float num4 = num2 / num;
|
|
rect = new Rect(screenRect.xMin, screenRect.yMin + screenRect.height * (1f - num4) * 0.5f, screenRect.width, num4 * screenRect.height);
|
|
}
|
|
}
|
|
}
|
|
else if (num2 > num)
|
|
{
|
|
float num5 = num / num2;
|
|
rect2 = new Rect(0f, (1f - num5) * 0.5f, 1f, num5);
|
|
}
|
|
else
|
|
{
|
|
float num6 = num2 / num;
|
|
rect2 = new Rect(0.5f - num6 * 0.5f, 0f, num6, 1f);
|
|
}
|
|
}
|
|
this.DrawTexture_Internal(rect, texture, rect2, color * this.m_OpacityColor, borderWidth, borderRadius, leftBorder, topBorder, rightBorder, bottomBorder);
|
|
}
|
|
|
|
// Token: 0x06002C0A RID: 11274 RVA: 0x0003B27C File Offset: 0x0003947C
|
|
public void DrawRect(Rect screenRect, Color color, float borderWidth = 0f, float borderRadius = 0f)
|
|
{
|
|
this.DrawRect_Internal(screenRect, color * this.m_OpacityColor, borderWidth, borderRadius);
|
|
}
|
|
|
|
// Token: 0x06002C0B RID: 11275 RVA: 0x0003B298 File Offset: 0x00039498
|
|
public void DrawText(Rect screenRect, string text, Font font, int fontSize, FontStyle fontStyle, Color fontColor, TextAnchor anchor, bool wordWrap, float wordWrapWidth, bool richText, TextClipping clipping)
|
|
{
|
|
this.DrawText_Internal(screenRect, text, font, fontSize, fontStyle, fontColor * this.m_OpacityColor, anchor, wordWrap, wordWrapWidth, richText, clipping);
|
|
}
|
|
|
|
// Token: 0x17000A0D RID: 2573
|
|
// (get) Token: 0x06002C0C RID: 11276 RVA: 0x0003B2CC File Offset: 0x000394CC
|
|
// (set) Token: 0x06002C0D RID: 11277 RVA: 0x0003B2E8 File Offset: 0x000394E8
|
|
public Vector2 mousePosition { get; set; }
|
|
|
|
// Token: 0x17000A0E RID: 2574
|
|
// (get) Token: 0x06002C0E RID: 11278 RVA: 0x0003B2F4 File Offset: 0x000394F4
|
|
// (set) Token: 0x06002C0F RID: 11279 RVA: 0x0003B310 File Offset: 0x00039510
|
|
public Rect currentWorldClip { get; set; }
|
|
|
|
// Token: 0x17000A0F RID: 2575
|
|
// (get) Token: 0x06002C10 RID: 11280 RVA: 0x0003B31C File Offset: 0x0003951C
|
|
// (set) Token: 0x06002C11 RID: 11281 RVA: 0x0003B338 File Offset: 0x00039538
|
|
public Event repaintEvent { get; set; }
|
|
|
|
// Token: 0x17000A10 RID: 2576
|
|
// (get) Token: 0x06002C12 RID: 11282 RVA: 0x0003B344 File Offset: 0x00039544
|
|
// (set) Token: 0x06002C13 RID: 11283 RVA: 0x0003B364 File Offset: 0x00039564
|
|
public float opacity
|
|
{
|
|
get
|
|
{
|
|
return this.m_OpacityColor.a;
|
|
}
|
|
set
|
|
{
|
|
this.m_OpacityColor.a = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002C14 RID: 11284
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void Init();
|
|
|
|
// Token: 0x06002C15 RID: 11285 RVA: 0x0003B374 File Offset: 0x00039574
|
|
public void DrawRect_Internal(Rect screenRect, Color color, float borderWidth, float borderRadius)
|
|
{
|
|
StylePainter.INTERNAL_CALL_DrawRect_Internal(this, ref screenRect, ref color, borderWidth, borderRadius);
|
|
}
|
|
|
|
// Token: 0x06002C16 RID: 11286
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_DrawRect_Internal(StylePainter self, ref Rect screenRect, ref Color color, float borderWidth, float borderRadius);
|
|
|
|
// Token: 0x06002C17 RID: 11287 RVA: 0x0003B384 File Offset: 0x00039584
|
|
public void DrawTexture_Internal(Rect screenRect, Texture texture, Rect sourceRect, Color color, float borderWidth, float borderRadius, int leftBorder, int topBorder, int rightBorder, int bottomBorder)
|
|
{
|
|
StylePainter.INTERNAL_CALL_DrawTexture_Internal(this, ref screenRect, texture, ref sourceRect, ref color, borderWidth, borderRadius, leftBorder, topBorder, rightBorder, bottomBorder);
|
|
}
|
|
|
|
// Token: 0x06002C18 RID: 11288
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_DrawTexture_Internal(StylePainter self, ref Rect screenRect, Texture texture, ref Rect sourceRect, ref Color color, float borderWidth, float borderRadius, int leftBorder, int topBorder, int rightBorder, int bottomBorder);
|
|
|
|
// Token: 0x06002C19 RID: 11289 RVA: 0x0003B3AC File Offset: 0x000395AC
|
|
public void DrawText_Internal(Rect screenRect, string text, Font font, int fontSize, FontStyle fontStyle, Color fontColor, TextAnchor anchor, bool wordWrap, float wordWrapWidth, bool richText, TextClipping textClipping)
|
|
{
|
|
StylePainter.INTERNAL_CALL_DrawText_Internal(this, ref screenRect, text, font, fontSize, fontStyle, ref fontColor, anchor, wordWrap, wordWrapWidth, richText, textClipping);
|
|
}
|
|
|
|
// Token: 0x06002C1A RID: 11290
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_DrawText_Internal(StylePainter self, ref Rect screenRect, string text, Font font, int fontSize, FontStyle fontStyle, ref Color fontColor, TextAnchor anchor, bool wordWrap, float wordWrapWidth, bool richText, TextClipping textClipping);
|
|
|
|
// Token: 0x06002C1B RID: 11291
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern float ComputeTextWidth(string text, Font font, int fontSize, FontStyle fontStyle, TextAnchor anchor, bool richText);
|
|
|
|
// Token: 0x06002C1C RID: 11292
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern float ComputeTextHeight(string text, float width, bool wordWrap, Font font, int fontSize, FontStyle fontStyle, TextAnchor anchor, bool richText);
|
|
|
|
// Token: 0x040007F6 RID: 2038
|
|
[NonSerialized]
|
|
internal IntPtr m_Ptr;
|
|
|
|
// Token: 0x040007FA RID: 2042
|
|
private Color m_OpacityColor = Color.white;
|
|
}
|
|
}
|