NorbiPeti
1c5ce37fce
Added API for adding more information on the debug display (not object-oriented yet) Removed the setter for block type to ensure stability Made the block API return defaults if the block no longer exists Added property to check if the block exists Made a struct for the block's color property Added missing block IDs
30 lines
No EOL
1.1 KiB
C#
30 lines
No EOL
1.1 KiB
C#
using System;
|
|
using GamecraftModdingAPI.Blocks;
|
|
|
|
namespace GamecraftModdingAPI.Utility
|
|
{
|
|
public static class DebugInterface
|
|
{
|
|
private static DebugInterfaceEngine _engine = new DebugInterfaceEngine();
|
|
|
|
/// <summary>
|
|
/// Saves the extra information to be displayed on the debug view.
|
|
/// The provided getter function is called each time the view updates so make sure it returns quickly.
|
|
/// </summary>
|
|
/// <param name="id">A global ID for the custom information</param>
|
|
/// <param name="contentGetter">A function that returns the current information</param>
|
|
public static void SetInfo(string id, Func<string> contentGetter) => _engine.SetInfo(id, contentGetter);
|
|
|
|
/// <summary>
|
|
/// Removes an information provided by a plugin.
|
|
/// </summary>
|
|
/// <param name="id">The ID of the custom information</param>
|
|
/// <returns></returns>
|
|
public static bool RemoveInfo(string id) => _engine.RemoveInfo(id);
|
|
|
|
public static void Init()
|
|
{
|
|
GameEngineManager.AddGameEngine(_engine);
|
|
}
|
|
}
|
|
} |