You are viewing a potentially older version of this package. View all versions.
Ryokune-InputAPI-1.0.1 icon

InputAPI

Simple Modded Inputs API for Content Warning!

Date uploaded 2 months ago
Version 1.0.1
Download link Ryokune-InputAPI-1.0.1.zip
Downloads 23707
Dependency string Ryokune-InputAPI-1.0.1

README

CW_InputAPI

Requirements:

  • BepInEx LTS (5.4.22)

For Developers:

Extend CWBaseInput to create new inputs. example: Inputs/ExampleInput.cs

using InputAPI;
using UnityEngine;

namespace Example.Inputs
{
    internal class ExampleInput : BaseCWInput, IExposedSetting
    {
        public override KeyCode GetDefaultKey()
        {
            return KeyCode.BackQuote;
        }

        public string GetDisplayName()
        {
            return "FooBar";
        }

        public SettingCategory GetSettingCategory()
        {
            return SettingCategory.Controls;
        }

        protected override void OnHeld(Player player)
        {
            // Implementation goes here.
        }

        protected override void OnKeyDown(Player player)
        {
            // Implementation goes here.
        }

        protected override void OnKeyUp(Player player)
        {
            // Implementation goes here.
        }
    }
}

And to use it you can simply do this inside of your Plugin.cs!

[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.visualerror.inputapi", BepInDependency.DependencyFlags.HardDependency)] // Be sure to have this!!
public class Plugin : BaseUnityPlugin
{
    internal ExampleInput Example = new ExampleInput();
}