scripts
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
|
||||
namespace UnityEngine.Experimental.UIElements
|
||||
{
|
||||
// Token: 0x02000323 RID: 803
|
||||
internal class IMImage : IMElement
|
||||
{
|
||||
// Token: 0x0600329E RID: 12958 RVA: 0x0004C948 File Offset: 0x0004AB48
|
||||
public IMImage()
|
||||
{
|
||||
this.scaleMode = ScaleMode.ScaleAndCrop;
|
||||
}
|
||||
|
||||
// Token: 0x17000B7D RID: 2941
|
||||
// (get) Token: 0x0600329F RID: 12959 RVA: 0x0004C958 File Offset: 0x0004AB58
|
||||
// (set) Token: 0x060032A0 RID: 12960 RVA: 0x0004C974 File Offset: 0x0004AB74
|
||||
public Texture image { get; set; }
|
||||
|
||||
// Token: 0x17000B7E RID: 2942
|
||||
// (get) Token: 0x060032A1 RID: 12961 RVA: 0x0004C980 File Offset: 0x0004AB80
|
||||
// (set) Token: 0x060032A2 RID: 12962 RVA: 0x0004C99C File Offset: 0x0004AB9C
|
||||
public ScaleMode scaleMode { get; set; }
|
||||
|
||||
// Token: 0x17000B7F RID: 2943
|
||||
// (get) Token: 0x060032A3 RID: 12963 RVA: 0x0004C9A8 File Offset: 0x0004ABA8
|
||||
// (set) Token: 0x060032A4 RID: 12964 RVA: 0x0004C9C4 File Offset: 0x0004ABC4
|
||||
public float imageAspect { get; set; }
|
||||
|
||||
// Token: 0x17000B80 RID: 2944
|
||||
// (get) Token: 0x060032A5 RID: 12965 RVA: 0x0004C9D0 File Offset: 0x0004ABD0
|
||||
// (set) Token: 0x060032A6 RID: 12966 RVA: 0x0004C9EC File Offset: 0x0004ABEC
|
||||
public bool alphaBlend { get; set; }
|
||||
|
||||
// Token: 0x060032A7 RID: 12967 RVA: 0x0004C9F8 File Offset: 0x0004ABF8
|
||||
protected override int DoGenerateControlID()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x060032A8 RID: 12968 RVA: 0x0004CA10 File Offset: 0x0004AC10
|
||||
internal override void DoRepaint(IStylePainter args)
|
||||
{
|
||||
if (this.image == null)
|
||||
{
|
||||
Debug.LogWarning("null texture passed to GUI.DrawTexture");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.imageAspect == 0f)
|
||||
{
|
||||
this.imageAspect = (float)this.image.width / (float)this.image.height;
|
||||
}
|
||||
Material material = ((!this.alphaBlend) ? GUI.blitMaterial : GUI.blendMaterial);
|
||||
float num = base.position.width / base.position.height;
|
||||
Internal_DrawTextureArguments internal_DrawTextureArguments = new Internal_DrawTextureArguments
|
||||
{
|
||||
leftBorder = 0,
|
||||
rightBorder = 0,
|
||||
topBorder = 0,
|
||||
bottomBorder = 0,
|
||||
color = GUI.color,
|
||||
texture = this.image,
|
||||
mat = material
|
||||
};
|
||||
ScaleMode scaleMode = this.scaleMode;
|
||||
if (scaleMode != ScaleMode.StretchToFill)
|
||||
{
|
||||
if (scaleMode != ScaleMode.ScaleAndCrop)
|
||||
{
|
||||
if (scaleMode == ScaleMode.ScaleToFit)
|
||||
{
|
||||
if (num > this.imageAspect)
|
||||
{
|
||||
float num2 = this.imageAspect / num;
|
||||
internal_DrawTextureArguments.screenRect = new Rect(base.position.xMin + base.position.width * (1f - num2) * 0.5f, base.position.yMin, num2 * base.position.width, base.position.height);
|
||||
internal_DrawTextureArguments.sourceRect = new Rect(0f, 0f, 1f, 1f);
|
||||
Graphics.Internal_DrawTexture(ref internal_DrawTextureArguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
float num3 = num / this.imageAspect;
|
||||
internal_DrawTextureArguments.screenRect = new Rect(base.position.xMin, base.position.yMin + base.position.height * (1f - num3) * 0.5f, base.position.width, num3 * base.position.height);
|
||||
internal_DrawTextureArguments.sourceRect = new Rect(0f, 0f, 1f, 1f);
|
||||
Graphics.Internal_DrawTexture(ref internal_DrawTextureArguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (num > this.imageAspect)
|
||||
{
|
||||
float num4 = this.imageAspect / num;
|
||||
internal_DrawTextureArguments.screenRect = base.position;
|
||||
internal_DrawTextureArguments.sourceRect = new Rect(0f, (1f - num4) * 0.5f, 1f, num4);
|
||||
Graphics.Internal_DrawTexture(ref internal_DrawTextureArguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = num / this.imageAspect;
|
||||
internal_DrawTextureArguments.screenRect = base.position;
|
||||
internal_DrawTextureArguments.sourceRect = new Rect(0.5f - num5 * 0.5f, 0f, num5, 1f);
|
||||
Graphics.Internal_DrawTexture(ref internal_DrawTextureArguments);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
internal_DrawTextureArguments.screenRect = base.position;
|
||||
internal_DrawTextureArguments.sourceRect = new Rect(0f, 0f, 1f, 1f);
|
||||
Graphics.Internal_DrawTexture(ref internal_DrawTextureArguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user