Details

Last Updated
4 months ago
First Uploaded
4 months ago
Downloads
106
Likes
0
Size
9.9KB
Dependency string
Xaru-UpgradeLib-0.0.1
Dependants

Categories

UpgradeLib Developer Guide

Overview

UpgradeLib is a small library that handles the registration and unloading of upgrades for your project.

Using UpgradeLib for Plugin Development

  1. Download the .dll:

    • Download the .dll file from Thunderstore and move it to the current working directory of your plugin.
  2. Link the .dll in your csproj:

<ItemGroup>
    <Reference Include="UpgradeLib.dll">
      <HintPath>UpgradeLib.dll</HintPath>
    </Reference>
</ItemGroup>

Usage

  1. Initialize UpgradeLib:
    • Typically, this is done in your mod’s Awake method:
UpgradeLibManager.Init("com.yourname.yourmod");
  1. Create and register an upgrade:
var myUpgrade = new UpgradeDefinition(
    id: 10001,
    internalName: "MY_UNIQUE_UPGRADE",
    title: "Example Upgrade",
    description: "Does something special when purchased.",
    price: 500,
    stackable: false,
    onPurchased: (fromSave) =>
    {
        // Code to run when the player unlocks or loads this upgrade
    },
    onLockedAllUpgrades: () =>
    {
        // Code to handle logic when all upgrades are locked (e.g., on game over)
    }
);

UpgradeLibManager.RegisterUpgrade(myUpgrade);

TODO / Needs Testing

  • Multiplayer support has not been tested. Please test and report any issues.

Contact

If any issues occur, feel free to DM me on Discord: rammmmy.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.