Skip to content

Game.EndFrameBarrier

Assembly:
Assembly-CSharp (inferred)

Namespace: Game.Prefabs

Type:
abstract class

Base:
InfomodeBasePrefab, IGradientInfomode

Summary:
This file actually documents Game.Prefabs.GradientInfomodeBasePrefab — an abstract prefab that implements IGradientInfomode and provides a simple gradient legend configuration used by infomodes (info overlays). It exposes public color fields for low/medium/high stops, a step count, legend type and optional localized label IDs. It also provides convenience properties that return fully-opaque colors and localized labels resolved via a cached localized string builder.


Fields

  • private System.Diagnostics.Stopwatch m_Stopwatch
    This field is not present on GradientInfomodeBasePrefab. The actual class defines the following fields:
  • private static readonly CachedLocalizedStringBuilder<string> kLabels — cached localized-string builder used to resolve label IDs into LocalizedString values (builds keys like "Infoviews.LABEL[hash]").
  • public Color m_Low — low gradient color (default: red).
  • public Color m_Medium — medium gradient color (default: yellow).
  • public Color m_High — high gradient color (default: green).
  • public int m_Steps — number of steps for the gradient (default: 11).
  • public GradientLegendType m_LegendType — legend display type.
  • public string m_LowLabelId, m_MediumLabelId, m_HighLabelId — optional localized label IDs for low/medium/high (tooltips indicate common label IDs like "Good, Bad, Low, High, Weak, Strong, Old, Young").

  • private Unity.Jobs.JobHandle <producerHandle>k__BackingField
    This field is not present on GradientInfomodeBasePrefab. See the actual public and private fields listed above (kLabels and the m_* public fields) which control the gradient appearance and labels.

Properties

  • public Unity.Jobs.JobHandle producerHandle { get; private set }
    This property is not part of GradientInfomodeBasePrefab. The actual class exposes these properties (read-only):
  • public Color lowColor — returns m_Low with alpha forced to 1 (opaque).
  • public Color mediumColor — returns m_Medium with alpha forced to 1 (opaque).
  • public Color highColor — returns m_High with alpha forced to 1 (opaque).
  • public GradientLegendType legendType — returns m_LegendType.
  • public LocalizedString? lowLabel — resolves m_LowLabelId via the cached builder; returns null if id is null/empty.
  • public LocalizedString? mediumLabel — resolves m_MediumLabelId.
  • public LocalizedString? highLabel — resolves m_HighLabelId.

Constructors

  • public EndFrameBarrier()
    GradientInfomodeBasePrefab does not declare an explicit constructor in the source; it has the default (parameterless) constructor provided by the runtime. Because the class is abstract, it cannot be instantiated directly — concrete subclasses will invoke the base constructor implicitly.

Methods

  • protected virtual OnCreate() : System.Void
    GradientInfomodeBasePrefab does not declare OnCreate in the provided file. The methods actually present are:

  • private static LocalizedString? GetLabel(string id)
    Resolves a label ID into a LocalizedString using the kLabels cached builder. Returns null if the provided id is null or empty.

  • public override void GetColors(out Color color0, out Color color1, out Color color2, out float steps, out float speed, out float tiling, out float fill)
    Implementation of the IGradientInfomode (or base contract) that outputs the color triplet and gradient parameters. It sets:

    • color0 = m_Low
    • color1 = m_Medium
    • color2 = m_High
    • steps = m_Steps
    • speed = 0f
    • tiling = 0f
    • fill = 0f
  • private static Color Opaque(Color color)
    Utility that sets the alpha of the given color to 1f and returns it. Used by the opaque color properties.

Usage Example

// Example subclass that configures the gradient and reads the computed values.
public class MyGradientInfomodePrefab : GradientInfomodeBasePrefab
{
    public MyGradientInfomodePrefab()
    {
        // configure colors and labels (these fields are public)
        m_Low = Color.blue;
        m_Medium = Color.cyan;
        m_High = Color.white;
        m_Steps = 5;
        m_LowLabelId = "Low";
        m_MediumLabelId = "Medium";
        m_HighLabelId = "High";
        m_LegendType = GradientLegendType.Default;
    }

    // You can override behavior or simply rely on the base GetColors implementation.
    public override void GetColors(out Color color0, out Color color1, out Color color2,
                                   out float steps, out float speed, out float tiling, out float fill)
    {
        // reuse base behavior (assigns color0..color2 and steps)
        base.GetColors(out color0, out color1, out color2, out steps, out speed, out tiling, out fill);

        // Example: adjust step count at runtime
        steps = Mathf.Max(2, steps);
    }

    public void DebugPrint()
    {
        Debug.Log($"Low: {lowColor}, Medium: {mediumColor}, High: {highColor}");
        Debug.Log($"LowLabel: {lowLabel?.ToString() ?? \"(none)\"}");
    }
}

Note: This documentation is adapted from the source file Game/Prefabs/GradientInfomodeBasePrefab.cs. The header name of this document is Game.EndFrameBarrier as requested, but the content describes GradientInfomodeBasePrefab found in the Game.Prefabs namespace.