This commit is contained in:
ang-xd committed 2024-08-29 16:46:38 -04:00
1 parent 2f09baa371
commit 2cbbcca161
2 files changed
+42 -8

No files matched your search

+1 -4
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
@@ -9,9 +9,6 @@
<Description>Example mod for Mira API</Description>
<Authors>Angxl, XtraCube</Authors>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\TeleportButton.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Reactor" Version="2.3.1" />
+41 -4
View File
@@ -59,12 +59,12 @@ public abstract class CustomActionButton
/// <summary>
/// Returns the amount of uses left.
/// </summary>
public int UsesLeft { get; set; }
public int UsesLeft { get; protected set; }
/// <summary>
/// A timer variable to measure cooldowns and effects.
/// </summary>
protected float Timer;
public float Timer { get; protected set; }
/// <summary>
/// The button object in game. This is created by Mira API automatically.
@@ -134,13 +134,50 @@ public abstract class CustomActionButton
Button?.OverrideText(name);
}
/// <summary>
/// Set the button's timer.
/// </summary>
/// <param name="amount">The amount you want to set to.</param>
public void SetTimer(float time)
{
Timer = Mathf.Clamp(time, -1, float.MaxValue);
}
/// <summary>
/// Increase the button's timer.
/// </summary>
/// <param name="amount">The amount you want to increase by.</param>
public void IncreaseTimer(float amount)
{
SetTimer(Timer + amount);
}
/// <summary>
/// Decrease the button's timer.
/// </summary>
/// <param name="amount">The amount you want to decrease by.</param>
public void DecreaseTimer(float amount)
{
SetTimer(Timer - amount);
}
/// <summary>
/// Set the amount of uses this button has left.
/// </summary>
/// <param name="amount">The amount you want to set to.</param>
public void SetUses(int amount)
{
UsesLeft = Mathf.Clamp(amount, 0, int.MaxValue);
}
/// <summary>
/// Increase the amount of uses this button has left.
/// </summary>
/// <param name="amount">The amount you want to increase by. Default: 1</param>
public void IncreaseUses(int amount = 1)
{
UsesLeft += amount;
SetUses(UsesLeft + amount);
}
/// <summary>
@@ -149,7 +186,7 @@ public abstract class CustomActionButton
/// <param name="amount">The amount you want to decrease by. Default: 1</param>
public void DecreaseUses(int amount = 1)
{
UsesLeft -= amount;
SetUses(UsesLeft - amount);
}
/// <summary>