Table of Contents

Class StarterKitPanel

Namespace
StarterKit
Assembly
StarterKit.dll

STARTERKIT - Base class for StarterKit UI panels. Extends ENGINE's BasePanel with:

  • GameState reference
  • EventBus subscription management (CompositeDisposable)
  • USS stylesheet loading
  • Common styling constants

Usage:

  1. Inherit from StarterKitPanel
  2. Override CreateUI() to build your panel
  3. Call base.Initialize(gameState) to set up
  4. Use Subscribe() for event subscriptions (auto-disposed)
public abstract class StarterKitPanel : BasePanel
Inheritance
object
StarterKitPanel
Derived
Inherited Members

Fields

BackgroundButton

protected static readonly Color BackgroundButton

Field Value

Color

BackgroundButtonHover

protected static readonly Color BackgroundButtonHover

Field Value

Color

BackgroundHeader

protected static readonly Color BackgroundHeader

Field Value

Color

BackgroundPanel

protected static readonly Color BackgroundPanel

Field Value

Color

BackgroundPanelLight

protected static readonly Color BackgroundPanelLight

Field Value

Color

BackgroundRowAlt

protected static readonly Color BackgroundRowAlt

Field Value

Color

BackgroundRowPlayer

protected static readonly Color BackgroundRowPlayer

Field Value

Color

FontSizeHeader

protected const int FontSizeHeader = 20

Field Value

int

FontSizeLarge

protected const int FontSizeLarge = 18

Field Value

int

FontSizeNormal

protected const int FontSizeNormal = 14

Field Value

int

FontSizeSmall

protected const int FontSizeSmall = 12

Field Value

int

RadiusLg

protected const float RadiusLg = 8

Field Value

float

RadiusMd

protected const float RadiusMd = 6

Field Value

float

RadiusSm

protected const float RadiusSm = 3

Field Value

float

SpacingLg

protected const float SpacingLg = 15

Field Value

float

SpacingMd

protected const float SpacingMd = 10

Field Value

float

SpacingSm

protected const float SpacingSm = 6

Field Value

float

SpacingXs

protected const float SpacingXs = 4

Field Value

float

TextGold

protected static readonly Color TextGold

Field Value

Color

TextIncome

protected static readonly Color TextIncome

Field Value

Color

TextLabel

protected static readonly Color TextLabel

Field Value

Color

TextPrimary

protected static readonly Color TextPrimary

Field Value

Color

TextSecondary

protected static readonly Color TextSecondary

Field Value

Color

TextWarning

protected static readonly Color TextWarning

Field Value

Color

gameState

protected GameState gameState

Field Value

GameState

subscriptions

protected CompositeDisposable subscriptions

Field Value

CompositeDisposable

Properties

GameState

The GameState reference.

public GameState GameState { get; }

Property Value

GameState

Methods

CreateColorIndicator(Color, float)

Create a color indicator box.

protected VisualElement CreateColorIndicator(Color color, float size = 16)

Parameters

color Color
size float

Returns

VisualElement

CreateColumn(Justify, Align)

Create a column container with flex-column layout.

protected VisualElement CreateColumn(Justify justify = Justify.FlexStart, Align align = Align.Stretch)

Parameters

justify Justify
align Align

Returns

VisualElement

CreateGoldText(string)

Create a gold-colored label.

protected Label CreateGoldText(string text)

Parameters

text string

Returns

Label

CreateHeader(string)

Create a header label with default StarterKit styling.

protected Label CreateHeader(string text)

Parameters

text string

Returns

Label

CreateLabelText(string)

Create a small label text.

protected Label CreateLabelText(string text)

Parameters

text string

Returns

Label

CreateRow(Justify, Align)

Create a row container with flex-row layout.

protected VisualElement CreateRow(Justify justify = Justify.FlexStart, Align align = Align.Center)

Parameters

justify Justify
align Align

Returns

VisualElement

CreateRowEntry(bool)

Create a row entry with alternating background (for lists).

protected VisualElement CreateRowEntry(bool alternate = false)

Parameters

alternate bool

Returns

VisualElement

CreateSecondaryText(string)

Create a secondary text label.

protected Label CreateSecondaryText(string text)

Parameters

text string

Returns

Label

CreateStyledButton(string, Action)

Create a styled button with default StarterKit styling.

protected Button CreateStyledButton(string text, Action onClick)

Parameters

text string
onClick Action

Returns

Button

CreateStyledPanel(string, float?)

Create a styled panel container with default StarterKit styling.

protected VisualElement CreateStyledPanel(string name, float? minWidth = null)

Parameters

name string
minWidth float?

Returns

VisualElement

CreateText(string)

Create a normal text label.

protected Label CreateText(string text)

Parameters

text string

Returns

Label

CreateTitle(string)

Create a title label with default StarterKit styling.

protected Label CreateTitle(string text)

Parameters

text string

Returns

Label

Initialize(GameState)

Initialize the panel with GameState reference. Call this from subclass Initialize() method.

protected bool Initialize(GameState gameStateRef)

Parameters

gameStateRef GameState

Returns

bool

OnDestroy()

Called when the panel is destroyed. Disposes event subscriptions. Override to add cleanup, but always call base.OnDestroy().

protected virtual void OnDestroy()

Subscribe<T>(Action<T>)

Subscribe to an EventBus event. Subscription is auto-disposed on OnDestroy.

protected void Subscribe<T>(Action<T> handler) where T : struct, IGameEvent

Parameters

handler Action<T>

Type Parameters

T