// Copyright (c) Supernova Technologies LLC using Nova.InternalNamespace_0.InternalNamespace_10; using Nova.InternalNamespace_0.InternalNamespace_5; using System.Reflection; using System.Runtime.CompilerServices; using UnityEngine; namespace Nova { /// /// A with an adjustable, rounded-corner rectangle mesh. /// /// /// Supports a wide range of stylistic features including: /// /// Rendering images /// /// /// /// /// [ExecuteAlways] [HelpURL("https://novaui.io/manual/UIBlock2D.html")] [AddComponentMenu("Nova/UIBlock 2D")] public sealed class UIBlock2D : UIBlock, InternalType_7 { #region Public /// /// A gradient effect, visually blended with the body Color and image (i.e. Sprite, Texture, or RenderTexture), if it exists. /// /// /// Gradient.Center.Percent and /// Gradient.Radius.Percent are relative to /// CalculatedSize. Mathematically speaking:
/// Vector2 calculatedGradientCenter = Gradient.Center.Percent * CalculatedSize.XY.Value
/// Vector2 calculatedGradientRadii = Gradient.Radius.Percent * CalculatedSize.XY.Value
///
/// public ref RadialGradient Gradient { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_268.InternalMethod_953(); } /// /// A visual border drawn around the perimeter of the body. /// /// /// Border.Width.Percent is relative to half /// the minimum dimension (X or Y) of CalculatedSize. Mathematically speaking:
/// float calculatedBorderWidth = Border.Width.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value) ///
/// public ref Border Border { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_269.InternalMethod_953(); } /// /// The radial fill/cutout configuration. /// /// /// RadialFill.Center.Percent is /// relative to CalculatedSize. Mathematically speaking:
/// Vector2 calculatedRadialFillCenter = RadialFill.Center.Percent * CalculatedSize.XY.Value ///
public ref RadialFill RadialFill { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_3412.InternalMethod_953(); } /// /// A drop shadow, inner shadow, or glow effect. /// /// /// Shadow.Width.Percent and /// Shadow.Blur.Percent are /// relative to half the minimum dimension (X or Y) of CalculatedSize. /// Mathematically speaking:
/// float calculatedShadowWidth = Shadow.Width.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)
/// float calculatedShadowBlur = Shadow.Blur.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)


/// Shadow.Offset.Percent is relative to /// CalculatedSize. Mathematically speaking:
/// Vector2 calculatedShadowOffset = Shadow.Offset.Percent * CalculatedSize.XY.Value ///
/// public ref Shadow Shadow { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_270.InternalMethod_953(); } /// /// The position and scale adjustments applied to the attached image (i.e. Sprite, Texture, or RenderTexture), if it exists. /// /// /// /// /// /// /// public ref ImageAdjustment ImageAdjustment { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271.InternalField_274.InternalMethod_953(); } /// /// Configures the render order of this UIBlock within a . /// /// s with a higher ZIndex are rendered on top of s with a lower ZIndex. public short ZIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => visibility.ZIndex; [MethodImpl(MethodImplOptions.AggressiveInlining)] set { visibility.ZIndex = value; InternalType_274.InternalProperty_190.InternalMethod_3031(this); } } /// /// Specifies whether the body Color, Gradient, and image (i.e. Sprite, Texture, or RenderTexture) should render. /// public bool BodyEnabled { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_273; [MethodImpl(MethodImplOptions.AggressiveInlining)] set { InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_273 = value; } } /// /// Apply local anti-aliasing to edges around the body and . /// /// /// Drastically improves visual quality in most user interfaces. In certain situations, however, such as rendering a transparent image or
/// if an image has edge softening already baked into its texture, enabling this property may result in some undesired visual artifacts. ///
public bool SoftenEdges { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_272; [MethodImpl(MethodImplOptions.AggressiveInlining)] set { InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_272 = value; } } /// /// The primary body content color. /// public override Color Color { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_266; [MethodImpl(MethodImplOptions.AggressiveInlining)] set { InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_266 = value; } } /// /// The configuration used to calculate a corner radius, applies to all four corners of the body, , and . /// /// /// CornerRadius.Percent is relative to half /// the minimum dimension (X or Y) of CalculatedSize. Mathematically speaking:
/// float calculatedCornerRadius = CornerRadius.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value) ///
public ref Length CornerRadius { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_267.InternalMethod_9(); } /// /// Configure how to store (and attempt to batch) the attached image's (i.e. Sprite, Texture, or RenderTexture) underlying texture. /// /// public ImagePackMode ImagePackMode { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (ImagePackMode)InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271.InternalField_275; [MethodImpl(MethodImplOptions.AggressiveInlining)] set { ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271; InternalVar_1.InternalField_275 = (InternalNamespace_0.InternalType_695)value; InternalMethod_142(ref InternalVar_1); visuals.Image.Mode = value; } } #region /// /// Retrieve the image texture previously assigned through or in the Editor. /// /// /// Will be null if the image is actually a or . /// /// /// public Texture2D Texture { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => texture as Texture2D; } /// /// Retrieve the image texture previously assigned through or in the Editor. /// /// /// Will be null if the image is actually a or . /// /// /// public RenderTexture RenderTexture { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => texture as RenderTexture; } /// /// Retrieve the sprite previously assigned through or in the Editor. /// /// /// Will be null if the image is actually a or . /// /// /// public Sprite Sprite { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => sprite; } #endregion #region /// /// Clear the current image assignment. /// /// /// Clears anything previously assigned via , , or in the Editor. /// public void ClearImage() { sprite = null; texture = null; if (!InternalProperty_27.InternalProperty_197) { return; } InternalMethod_141(); } /// /// Render the provided in the body of this . Replaces any existing image assignment. /// /// The texture to render in the body of this . public void SetImage(Texture2D texture) => InternalMethod_140(texture); /// /// Render the provided in the body of this . Replaces any existing image assignment. /// /// The texture to render in the body of this . public void SetImage(RenderTexture renderTexture) => InternalMethod_140(renderTexture); /// /// Render the provided in the body of this . Replaces any existing image assignment. /// /// /// Sliced sprites and packed sprites are not supported. /// /// The sprite to render in the body of this . public void SetImage(Sprite sprite) { if (sprite != null && sprite.packed && sprite.packingMode == SpritePackingMode.Tight) { Debug.LogError("Tight-packed sprite atlas not supported"); return; } texture = null; this.sprite = sprite; if (!InternalProperty_27.InternalProperty_197) { return; } InternalMethod_141(); } #endregion #endregion #region Internal [SerializeField] [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] private InternalType_8 visuals = InternalType_8.InternalField_61; [SerializeField] [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] private Texture texture = null; [SerializeField] [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] private Sprite sprite = null; [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] ref InternalNamespace_0.InternalType_80 InternalType_256.InternalProperty_270 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref visuals.InternalMethod_953(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void InternalMethod_140(Texture InternalParameter_84) { sprite = null; texture = InternalParameter_84; if (!InternalProperty_27.InternalProperty_197) { return; } InternalMethod_141(); } private protected override void InternalMethod_111() { InternalMethod_142(ref visuals.Image.InternalMethod_953()); base.InternalMethod_111(); } private void InternalMethod_141() { ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271; InternalMethod_142(ref InternalVar_1); visuals.Image.InternalField_135 = InternalVar_1.InternalField_276; } private void InternalMethod_142(ref InternalNamespace_0.InternalType_81 InternalParameter_85) { if (sprite != null) { InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2334(Sprite, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276); } else if (texture != null) { InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2332(texture, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276); } else if (InternalParameter_85.InternalField_276.InternalProperty_185) { InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2332(texture, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276); } visuals.Image.InternalField_135 = InternalParameter_85.InternalField_276; } private protected override void InternalMethod_112() { base.InternalMethod_112(); if (visuals.Image.InternalField_135.InternalProperty_86 && InternalType_274.InternalProperty_190 != null) { ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref visuals.Image.InternalMethod_953(); InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_1386(ref InternalVar_1.InternalField_276); } } internal override void InternalMethod_1856() { if (InternalProperty_27.InternalProperty_197) { InternalMethod_142(ref visuals.Image.InternalMethod_953()); } base.InternalMethod_1856(); } [Obfuscation] private protected override void OnDidApplyAnimationProperties() { base.OnDidApplyAnimationProperties(); InternalMethod_141(); } [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] internal InternalType_8.Calculated InternalProperty_42 => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalMethod_953().InternalMethod_148(CalculatedSize.XY.Value); private UIBlock2D() : base() { visibility = InternalType_36.InternalMethod_307(InternalType_11.InternalField_64); } #endregion } }