Slime Modding Utilities

版本 v1.0.0·更新於 2021-10-27

A utility mod that provides common functionality for modders.

模組介紹 作者原文

Slime Modding Utilities (SMU)

A utility mod for Nickelodeon All Star Brawl. This mod does nothing on its own, but has a bunch of nifty features that modders can make use of.

SMU.Events

Contains handy extension methods for safely firing off events, without the worry of an exception stopping the chain.

public static void InvokeAll(this Action action, params object args)

SMU.Constants

Contains methods to translate character and stage IDs into their human-readable names, and vice versa.

public static bool TryGetIdFromName(string name, out string id);

public static string GetIdFromName(string name);

public static bool TryGetNameFromId(string id, out string name);

public static string GetNameFromId(string id);

public static List GetCharacterIds();

public static List GetStageIds();

SMU.Reflection

Contains handy extension methods to help get and set private fields and properties, invoke private methods, and copy Unity components.

public static U GetField(this T obj, string fieldName);

public static U GetProperty(this T obj, string propertyName);

public static void SetField(this T obj, string fieldName, U value);

public static void SetProperty(this T obj, string propertyName, U value);

public static T InvokeMethod(this object obj, string methodName, params object args);

public static Component CopyComponent(this Component original, Type overridingType,

GameObject destination, Type originalTypeOverride = null);

SMU.Utilities

Contains extra utility classes with miscellaneous functionality

  • ImageHelper
  • Utility class for loading external images from various locations; creates Texture2D and Sprite objects

public static Texture2D LoadTextureRaw(byte bytes);

public static Texture2D LoadTextureFromFile(string path);

public static Texture2D LoadTextureFromResources(string resourcePath);

public static Sprite LoadSpriteRaw(byte image, float pixelsPerUnit = 100.0f);

public static Sprite LoadSpriteFromTexture(Texture2D texture, float pixelsPerUnit = 100.0f);

public static Sprite LoadSpriteFromFile(string path, float pixelsPerUnit = 100.0f);

public static Sprite LoadSpriteFromResources(string resourcePath, float pixelsPerUnit = 100.0f);

  • SharedCoroutineStarter
  • Provides a way to start coroutines from any class, without having to derive from MonoBehaviour

public static new Coroutine StartCoroutine(IEnumerator routine);

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

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

BepInEx-BepInExPack_NASB

檔案與校驗

檔案名稱
Slime_Modding_Utilities-1.0.0.zip
檔案大小
23.4 KiB