PlayerActionsHelper

版本 v0.0.1·更新於 2023-10-13

Various managers for community usage.

模組介紹 作者原文

Player Actions Helper

A mod designed to make creating player actions simpler.

Register an action with PlayerActionManager.RegisterPlayerAction() in your mod's awake function.

Access that action with player.data.playerActions.GetPlayerAction() in your mod.

Change log

v0.0.1

  • Fixed a small bug

v0.0.0

  • Initial Release

Properties

RegisteredActions

ReadOnlyDictionary RegisteredActions { get; }

Description

A list of all actions registered so far.

Classes

ActionInfo

class ActionInfo

Fields

  • string name;
  • BindingSource keyboardlayout;
  • BindingSource controllerLayout;

Constructors

ActionInfo()

ActionInfo ActionInfo(string name, BindingSource keyboardlayout = null, BindingSource controllerLayout = null)

Description

Creates a set of information for usage in binding player actions.

Parameters

  • string name The name for the action.
  • BindingSource keyboardlayout An optional parameter for setting the default keyboard layout.
  • BindingSource controllerLayout An optional parameter for setting the default controller layout.

Example Usage

PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));

Functions

RegisterPlayerAction()

void RegisterPlayerAction(ActionInfo actionInfo)

Description

Registers an action to be automatically generated for players.

NOTE: You should only be registering actions in your mod's awake function. If you register them any later, they will not show in rebind controls.

Parameters

  • ActionInfo actionInfo the details of the action to be registered.

Example Usage

PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));

ExtensionMethods

GetPlayerAction()

PlayerAction GetPlayerAction(this PlayerActions playerActions, string name)

Description

Returns a registered PlayerAction that has been created for the player. Returns null if the action doesn't exist.

Parameters

  • string name the name of the registered action.

Example Usage

player.data.playerActions.GetPlayerAction(name);

ActionWasPressed()

bool ActionWasPressed(this PlayerActions playerActions, string name)

Description

Returns whether a registered action was pressed. Returns false if the action doesn't exist.

Note that this is an alternative to fetching the action and then checking the PlayerAction::WasPressed property.

Parameters

  • string name the name of the registered action.

Example Usage

player.data.playerActions.ActionWasPressed(name);

ActionIsPressed()

bool ActionIsPressed(this PlayerActions playerActions, string name)

Description

Returns whether a registered action is pressed. Returns false if the action doesn't exist.

Note that this is an alternative to fetching the action and then checking the PlayerAction::IsPressed property.

Parameters

  • string name the name of the registered action.

Example Usage

player.data.playerActions.ActionIsPressed(name);

ActionWasReleased()

bool ActionWasReleased(this PlayerActions playerActions, string name)

Description

Returns whether a registered action was released. Returns false if the action doesn't exist.

Note that this is an alternative to fetching the action and then checking the PlayerAction::WasReleased property.

Parameters

  • string name the name of the registered action.

Example Usage

player.data.playerActions.ActionWasReleased(name);

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack_ROUNDS

檔案與校驗

檔案名稱
PlayerActionsHelper-0.0.1.zip
檔案大小
21.0 KiB