Home

Awesome

APFramework UI System

[!IMPORTANT]
The project is currently considered in the state of pre-release, which means breaking change will happen all the time as I figure out how to generalize the usage of it better. If you're interested in using it in production, make sure to fork it out and simply modify it to suite your project better.

A Text Mesh Pro based text only UI system for Unity

APFramework is a framework created by DK Liao used in Autopanic and Autopanic Zero.

The UI System for APFramework is designed with two goals in mind:

This really helps due to the solo nature of both games made with APFramework, allowing multitude of menus of different functions to be created with ease.

The UI system is heavily coupled with Text Mesh Pro at the moment but should be easily modifiable to suit other packages or game engine.

showcase

The creation of this UI system is heavily inspired by PhiOS (mirror repo) made by phi6.

How to Use

A quick UI code would look like this:

public class SuperQuickMenu : GeneralUISystemWithNavigation
{
    protected override void InitializeUI()
    {
        AddButton("This is a quick single Button", ButtonPressedAction);
    }
    void ButtonPressedAction() => _ = 0;
}

By inheriting the GeneralUISystemWithNavigation class, you can quickly initialize UI by overriding InitializeUI(). The quickest way to setup a UI is to simply create an UI initialized with a single WindowElement. That wouldn't be much useful at all so usually you'd want to initialize a WindowUI then add in all the elements:

public class BiggerWindow : GeneralUISystemWithNavigation
{
    protected override void InitializeUI()
    {
        WindowUI systemWindow = NewWindow("A New Window", DefaultSetup);
        AddText("This is a non-selectable text", systemWindow);
        AddToggle("This is a Toggle", systemWindow);
        AddButton("This is a Button", systemWindow);
        SliderUI slider = AddSlider("This is a simple Slider with range", systemWindow);
        slider.SetLimit(-10, 10);
        SliderUIChoice sliderChoice = AddSliderWithChoice("This is a Slider that takes string options", systemWindow);
        sliderChoice.AddChoice("Low");
        sliderChoice.AddChoice("Medium");
        sliderChoice.AddChoice("High");
        systemWindow.AutoResize();
    }
}

Study example UIs within the Script folder should give you a good idea:

Some other quick notes:

Detailed Design Dive (WIP)

Requirement

Features

Input

Window Elements

Window

Futurework

Fonts Included

For demonstration purpose, two fonts are included in this project:

Both of which are licensed under OFL.

Several magic numbers are specifically tuned around these two fonts and the need to display Chinese characters properly, therefore when coupled with different fonts several adjustments will have to be made.