Skip to content
cfloutier edited this page Apr 27, 2024 · 16 revisions

/!\ under progress

This set of controls is used by the K2D2 Kerbal Space Program 2 mod

You can use this repo as an example of use of the controls. https://github.com/cfloutier/test_k2ui


UI Builder

Creates a new Visual Tree Asset

all controls are available in the UI Builder :

image

.uss

all uss files are located in the K2UI/Runtime/Controls/USS folder use The main K2UI.uss as it includes all others uss files

Controls

Uss

please use the KerbalUI Theme

And include the K2UI.uss file in your xml definition.

This uss defines global variables and includes all others uss that is used by all controls. Complex controls could have it's own uss file ex : K2Toggle.uss or K2Compas.uss

to edit those file I adds them to the UIBuilder. But only the main K2UI.uss is needed for your own UI file.

KTools

Ktool are a set of classes used by the Controls

  • Settings : a set of class used to bind values with controls and save it to local disc as player preferences.
  • ColorTools : A set of tools for colors
    • Convert colors from and to htlml codes. with parseColor and formatColorHtml
    • Create gradients and color colections with getRandomColorArray and getRainbowColorArray
    • use Hue Saturation Value space to and adjust colors with FromHSV, ToHSV and changeColorHSV
  • Extensions : A set of Function that extends standard cs primitives
  • ReflexionTool : tools to call reflexion. It is used to call private and protected functions and to access properties. Useful to call 'forbidden' interanl fucntion from the main game (Ksp2 main engine)
  • StrTools a set of tools used to convert to string different kind to values : like Duration, Distances and Vectors

Clone this wiki locally