Giter Site home page Giter Site logo

mtdui's Introduction

MTDUI

A simple UI library for 20 Minutes Till Dawn.

Installation

If your game isn't modded with BepinEx, DO THAT FIRST! Simply go to the latest BepinEx release and extract BepinEx_x64_VERSION.zip directly into your game's folder, then run the game once to install BepinEx properly.

Next, go to the latest release of this mod and extract it directly into your game's folder. Make sure it's extracted directly into your game's folder and not into a subfolder!

For Developers

MTDUI is primarily meant to be used in conjunction with the BepInEx configuration system.

NOTE: MTDUI is still in early development, and as such only currently supports a few types of config options:

ConfigEntry Type Supported
Enum
Int
Float
Bool
String
Others?

Support for new ConfigEntry types will be added as the library matures.

Example Usage

using MTDUI;
// Create a new configuration file using the BepInEx config system
var customFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "GameSpeed.cfg"), true);

// Add a config option
var gameSpeed = customFile.Bind("General", "Game Speed", 1, "The speed at which the game runs.");

// Register the config option with MTDUI's in-game mod settings
// 1, 2, 3, 4, 5, and 10 are valid options that can be selected
// NOTE: Enums and Bools will have this list automatically filled, but you need to manually add values for ints/floats
// This is visible on the title screen and pause menu by default
ModOptions.Register(gameSpeed, new List<int>(){ 1, 2, 3, 4, 5, 10 });
// gameSpeed should now be updated when changed in the ingame UI (or when the cfg file is manually modified)
// Use gameSpeed.Value when you want to actually use the value

// Other options:
// You can control which menu a setting will appear on by using ConfigEntryLocationType
// This can be useful if you have settings you don't want people to change mid-run
ModOptions.Register(gameSpeed, new List<int>(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.PauseOnly); // only appears in the in-game pause menu
ModOptions.Register(gameSpeed, new List<int>(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.MainOnly); // only appears on the title screen
// You can make the option appear on a custom sub-menu by passing a string
ModOptions.Register(gameSpeed, new List<int>(){ 1, 2, 3, 4, 5, 10 }, ConfigEntryLocationType.Everywhere, "Custom SubMenu"); // appears in a "Custom SubMenu" tab


// You can use RegisterOptionInModList to add configs to a "Mod List" subpanel
// This section is mostly intended to be used for activation/deactivation, as to not clutter up the submenu with inactive mods
// The expected usage is to disable the rest of the plugin if enabled
activateMod = Config.Bind("General", "Activation", true, "If false, the mod does not load");
ModOptions.RegisterOptionInModList(activateMod);
if (!activateMod.Value) return;

For more information on how the BepInEx config system works, check out the official documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.