Skip to content
Ashley edited this page Jul 16, 2022 · 9 revisions

A state is an object held by each member that describes their current situation in the game. It can describe various properties about the member, but more importantly, it controls how each member sees and interacts with the room. A state has many parts to it, including theme, presets, and ui.

Creating a State Asset

To create a state asset, either go to AssetsCreateHackboxState Asset, or right-click in the assets window, and go to CreateHackboxState Asset, and then name the state asset appropriately:

image

Then edit the theme of the state by dropping in a theme asset object on the Theme property. From there, you can adjust the parameters of the header and main sections of the UI, and then you can specify the set of components that will appear in the state.

image

Parameters in the parameter list of each component will add/override the parameters specified in the preset that it derives from.

Creating a State in code

To create a State object, use new Hackbox.State(), and then configure the properties and parameters of the state, for example:

Hackbox.State state = new Hackbox.State() { state.Theme = someTheme; }

//Example of header parameter changes
state.SetHeaderText("Some header text");
state.SetHeaderParameter("backgroundColor", Color.white);

//Example of adding a component
Hackbox.UIComponent newComponent = new Hackbox.UIComponent()
{
    Name = "Some component name",
    Preset = somePreset,    
};
newComponent.SetParameterValue<Color>("textColor", Color.red);
state.Components.Add(newComponent);
Clone this wiki locally