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:
- Inherit from StarterKitPanel
- Override CreateUI() to build your panel
- Call base.Initialize(gameState) to set up
- Use Subscribe() for event subscriptions (auto-disposed)
public abstract class StarterKitPanel : BasePanel
- Inheritance
-
objectStarterKitPanel
- Derived
- Inherited Members
Fields
BackgroundButton
protected static readonly Color BackgroundButton
Field Value
BackgroundButtonHover
protected static readonly Color BackgroundButtonHover
Field Value
BackgroundHeader
protected static readonly Color BackgroundHeader
Field Value
BackgroundPanel
protected static readonly Color BackgroundPanel
Field Value
BackgroundPanelLight
protected static readonly Color BackgroundPanelLight
Field Value
BackgroundRowAlt
protected static readonly Color BackgroundRowAlt
Field Value
BackgroundRowPlayer
protected static readonly Color BackgroundRowPlayer
Field Value
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
TextIncome
protected static readonly Color TextIncome
Field Value
TextLabel
protected static readonly Color TextLabel
Field Value
TextPrimary
protected static readonly Color TextPrimary
Field Value
TextSecondary
protected static readonly Color TextSecondary
Field Value
TextWarning
protected static readonly Color TextWarning
Field Value
gameState
protected GameState gameState
Field Value
subscriptions
protected CompositeDisposable subscriptions
Field Value
Properties
GameState
The GameState reference.
public GameState GameState { get; }
Property Value
Methods
CreateColorIndicator(Color, float)
Create a color indicator box.
protected VisualElement CreateColorIndicator(Color color, float size = 16)
Parameters
colorColorsizefloat
Returns
CreateColumn(Justify, Align)
Create a column container with flex-column layout.
protected VisualElement CreateColumn(Justify justify = Justify.FlexStart, Align align = Align.Stretch)
Parameters
Returns
CreateGoldText(string)
Create a gold-colored label.
protected Label CreateGoldText(string text)
Parameters
textstring
Returns
CreateHeader(string)
Create a header label with default StarterKit styling.
protected Label CreateHeader(string text)
Parameters
textstring
Returns
CreateLabelText(string)
Create a small label text.
protected Label CreateLabelText(string text)
Parameters
textstring
Returns
CreateRow(Justify, Align)
Create a row container with flex-row layout.
protected VisualElement CreateRow(Justify justify = Justify.FlexStart, Align align = Align.Center)
Parameters
Returns
CreateRowEntry(bool)
Create a row entry with alternating background (for lists).
protected VisualElement CreateRowEntry(bool alternate = false)
Parameters
alternatebool
Returns
CreateSecondaryText(string)
Create a secondary text label.
protected Label CreateSecondaryText(string text)
Parameters
textstring
Returns
CreateStyledButton(string, Action)
Create a styled button with default StarterKit styling.
protected Button CreateStyledButton(string text, Action onClick)
Parameters
textstringonClickAction
Returns
CreateStyledPanel(string, float?)
Create a styled panel container with default StarterKit styling.
protected VisualElement CreateStyledPanel(string name, float? minWidth = null)
Parameters
namestringminWidthfloat?
Returns
CreateText(string)
Create a normal text label.
protected Label CreateText(string text)
Parameters
textstring
Returns
CreateTitle(string)
Create a title label with default StarterKit styling.
protected Label CreateTitle(string text)
Parameters
textstring
Returns
Initialize(GameState)
Initialize the panel with GameState reference. Call this from subclass Initialize() method.
protected bool Initialize(GameState gameStateRef)
Parameters
gameStateRefGameState
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
handlerAction<T>
Type Parameters
T