Architecture Interfaces
Canonical source. Defined in the
PixelEngine.Architecturenamespace. These are the contracts that the Module Pattern is built on.
Interface Summary
| Interface | Purpose | Implemented By |
|---|---|---|
IConfiguration |
Serializable settings, tunables | readonly struct (plain C#) / struct (MonoBehaviour) |
IReference |
External dependencies, assets | readonly struct (plain C#) / struct (MonoBehaviour) |
IState |
Runtime mutable data | class with private set properties |
IComponents |
Child sub-systems, composed modules | class with private set properties |
IView |
UI panels, HUD, menus | MonoBehaviour implementing Open/Close/Show/Hide |
IFrame |
Per-frame tick participant | Types that need frame-based processing |
Module Marker Interfaces
namespace PixelEngine.Architecture
{
/// <summary>
/// Marker for serializable settings (tunables, tweakables).
/// </summary>
public interface IConfiguration { }
/// <summary>
/// Marker for external dependencies (other modules, assets).
/// </summary>
public interface IReference { }
/// <summary>
/// Marker for runtime mutable state.
/// </summary>
public interface IState { }
/// <summary>
/// Marker for child sub-systems or composed modules.
/// </summary>
public interface IComponents { }
}
These are marker interfaces with no members. They exist to enforce the Module Pattern structure and enable generic constraints.
View Interface
For UI panels, HUD elements, menus -- anything that opens/closes/shows/hides.
namespace PixelEngine.Architecture
{
public interface IView
{
void Open();
void Close();
void Show();
void Hide();
void Refresh();
bool isOpen { get; }
bool isVisible { get; }
}
}
| Method / Property | What It Does | Typical Use |
|---|---|---|
Open() |
Activate + show | Player opens inventory |
Close() |
Deactivate completely | Player closes inventory |
Show() |
Set visible (already open) | Tab back to a panel |
Hide() |
Set invisible (stay open) | Tab away from a panel |
Refresh() |
Re-read data, update display | Data changed, UI needs update |
isOpen |
Whether the view is currently open | Guard logic |
isVisible |
Whether the view is currently visible | Guard logic |
State Transitions
Open() --> isOpen = true, isVisible = true (fully active)
Show() --> isOpen = unchanged, isVisible = true (just visibility)
Hide() --> isOpen = unchanged, isVisible = false
Close() --> isOpen = false, isVisible = false (fully inactive)
Frame Interface
For systems that participate in a per-frame tick loop.
namespace PixelEngine.Architecture
{
/// <summary>
/// Marker for types that participate in per-frame tick loops.
/// </summary>
public interface IFrame { }
}
How They Fit Together
flowchart LR
P["PixelEngine.Architecture"] --> IC["IConfiguration\nModule.Configuration struct"]
P --> IR["IReference\nModule.Reference struct"]
P --> IS["IState\nModule.State class"]
P --> ICO["IComponents\nModule.Components class"]
P --> IV["IView\nUI panels, HUD, menus"]
P --> IF["IFrame\nPer-frame tick participants"]
Package Location
These interfaces ship with the package. Your code references them via using PixelEngine.Architecture; -- no generation needed.
Packages/
com.pixelengine/
Runtime/
com.pixelengine.asmdef
Architecture/
IConfiguration.cs
IReference.cs
IState.cs
IComponents.cs
IView.cs
IFrame.cs
See Also
- Module Pattern -- how these interfaces are used in practice
- Script Templates -- auto-generate modules with these interfaces