You are viewing a potentially older version of this package.
View all versions.
UpgradeLib
API To ease the creation of upgrades, shop items etc.
Date uploaded | 2 weeks ago |
Version | 0.0.1 |
Download link | Xaru-UpgradeLib-0.0.1.zip |
Downloads | 33 |
Dependency string | Xaru-UpgradeLib-0.0.1 |
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.