Mega UI

Mega UI

Put your own app on the store computer. You describe the screen top to bottom; Mega UI does the icon, the window, the taskbar tab and the layout.

What this is

The store computer in Megastore Simulator is a real desktop: icons, windows, a taskbar. Mega UI lets your mod put an app on it without knowing how any of that works.

Your modMega UI
Names the app and picks an iconClones a native desktop icon so yours matches the others
Lists what goes on the screen, in orderPositions everything, sizes it and spaces it
Says where a number comes fromRe-reads it every time the window opens
Writes what a button doesDraws it, handles the click and catches your exceptions
Window, title bar, minimize, close and the taskbar tab
Keeps your app out of the way of the game's own and of other mods

Why it exists

The computer is world-space UI. An icon on it is about 0.16 units across — not 90 pixels. Every first attempt at a mod UI here starts by assuming pixels, and the failure is spectacular: in the mod this library was extracted from, that assumption put the icon 108 units below the screen. It existed, it was active, it was the right size, and it was nowhere near the monitor.

Then come the rest of them. Sibling order decides who draws on top. Cloning a native button brings a LocalizeStringEvent that rewrites your label the moment the player changes language. The font has to be borrowed from the game or accented characters turn into boxes. The taskbar tab only matches the native ones if you clone one and destroy the ComputerTab component inside it.

None of that is about what your mod does. It is the same week of fighting the same five things, for every single person who tries — and it is already done here, once, for everybody.

The whole thing

csharp
var app = MegaUiApi.Register(Guid, new AppDefinition
{
    Title = "Stock Report",
    Icon  = UiIcon.Builtin("package"),
});

app.Build(ui =>
{
    ui.Header("Warehouse");

    ui.Row(r =>
    {
        r.Label("Boxes in storage");
        r.Spacer();
        r.Value(() => Warehouse.Count.ToString());
    });

    ui.Button("Order more", Warehouse.Order);
});

That is an app with an icon, a window, a taskbar tab and a live number. There is no coordinate in it, and the mod that contains it does not reference a single UI assembly.

When a stack is not the shape

Some screens are not a list at any angle. An upgrade tree, a floor plan, a whole window with its own header and tabs — those need positions, and free positioning is that, still without a single RectTransform.

csharp
ui.Diagram(ui.Area.y, d =>
{
    d.Box(d.Size.x * 0.5f, 31f, d.Size.x, 62f, headerBg);
    d.Text(20f, 24f, "MY APP", textMain, 26f, bold: true, align: UiAlign.Left);

    // Bigger than the window, and the player can drag and zoom it
    d.Region(d.Size.x * 0.5f, 260f, d.Size.x, 400f, DrawTree,
             contentWidth: 1400f, contentHeight: 900f, pan: true);
}, bleed: true);

What it does not do yet

Mega UI covers apps on the store computer. Screen overlays and HUD widgets are not in it — not because they are hard, but because scope that grows before the first version ships never ships.

Everything in the widget list is there because a real mod needed it. If you hit the wall, say so — that is how the next one gets picked.