
UpgradeLib
API To ease the creation of upgrades, shop items etc.
Last updated | 2 months ago |
Total downloads | 61 |
Total rating | 0 |
Categories | Tools Libraries |
Dependency string | Xaru-UpgradeLib-0.0.1 |
Dependants | 1 other package depends on this package |
README
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
-
Download the .dll:
- Download the
.dll
file from Thunderstore and move it to the current working directory of your plugin.
- Download the
-
Link the .dll in your
csproj
:
<ItemGroup>
<Reference Include="UpgradeLib.dll">
<HintPath>UpgradeLib.dll</HintPath>
</Reference>
</ItemGroup>
Usage
- Initialize UpgradeLib:
- Typically, this is done in your mod’s
Awake
method:
- Typically, this is done in your mod’s
UpgradeLibManager.Init("com.yourname.yourmod");
- 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.