UI Basics - S&box Wiki

https://wiki.facepunch.com/sbox/UI

S&box Wiki Home / UI Basics View Edit History Title Tag (UI Basics) There's 2 good ways to make UI right now in s&box. You can either use Razor , or make Panels yourself. We recommend using Razor . Here's an example panel that has a Label which counts up forever. [UseTemplate] public class MyPanel : Panel { public Label MyLabel { get ; set ; } public override void Tick() { Label . Text = $"{Time.Now}" ; } } [UseTemplate] will load a template with the same class name ( MyPanel.html ). < link rel = "stylesheet" href = "MyPanel.scss" /> < div > < label class = "name" @ref = "MyLabel" > Placeholder Text </ label > </ div > <link rel="stylesheet" href="MyPanel.scss"/> will load a stylesheet with the file name that you specify. It works on relative paths from your .html file. MyPanel { position: absolute; left: 64px; top: 64px; .n...

Linked on 2023-01-04 19:24:28 | Similar Links