public override void Draw( float offsetX, float offsetY, Renderer2D renderer) { renderer.Color = new Color32(255, 255, 255, 255); if (sprite != null) { renderer.AddSprite( offsetX + LocalLeftX, offsetY + LocalTopY, Width, Height, sprite); } else if (texture != null) { renderer.AddTexturedRectangle( offsetX + LocalLeftX, offsetY + LocalTopY, Width, Height, texture); } else { renderer.AddRectangle( offsetX + LocalLeftX, offsetY + LocalTopY, Width, Height); } }
public override void Draw( float offsetX, float offsetY, Renderer2D renderer) { Color32 tmpColor = (On) ? OnColor : OffColor; renderer.Color = tmpColor; if (sprite != null) { renderer.AddSprite( offsetX + LocalLeftX + BorderWidth, offsetY + LocalTopY + BorderWidth, Width - (BorderWidth * 2f), Height - (BorderWidth * 2f), sprite); } else if (texture != null) { renderer.AddTexturedRectangle( offsetX + LocalLeftX + BorderWidth, offsetY + LocalTopY + BorderWidth, Width - (BorderWidth * 2f), Height - (BorderWidth * 2f), texture); } else { renderer.AddRectangle( offsetX + LocalLeftX + BorderWidth, offsetY + LocalTopY + BorderWidth, Width - (BorderWidth * 2f), Height - (BorderWidth * 2f)); } Color32 tmpTextColor = (On) ? OnTextColor : OffTextColor; renderer.Color = tmpTextColor; renderer.AddText( Text, offsetX + LocalLeftX + (Width * 0.5f), offsetY + LocalTopY + (Height * 0.5f), Width - (BorderWidth * 4f), Height - (BorderWidth * 4f), AlignX.Center, AlignY.Center); }