mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
oops
This commit is contained in:
1 parent
2f09baa371
commit
2cbbcca161
2 files changed
+42
-8
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
@@ -9,9 +9,6 @@
|
|||||||
<Description>Example mod for Mira API</Description>
|
<Description>Example mod for Mira API</Description>
|
||||||
<Authors>Angxl, XtraCube</Authors>
|
<Authors>Angxl, XtraCube</Authors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Resources\TeleportButton.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Reactor" Version="2.3.1" />
|
<PackageReference Include="Reactor" Version="2.3.1" />
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ public abstract class CustomActionButton
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the amount of uses left.
|
/// Returns the amount of uses left.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UsesLeft { get; set; }
|
public int UsesLeft { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A timer variable to measure cooldowns and effects.
|
/// A timer variable to measure cooldowns and effects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected float Timer;
|
public float Timer { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The button object in game. This is created by Mira API automatically.
|
/// The button object in game. This is created by Mira API automatically.
|
||||||
@@ -134,13 +134,50 @@ public abstract class CustomActionButton
|
|||||||
Button?.OverrideText(name);
|
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>
|
/// <summary>
|
||||||
/// Increase the amount of uses this button has left.
|
/// Increase the amount of uses this button has left.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="amount">The amount you want to increase by. Default: 1</param>
|
/// <param name="amount">The amount you want to increase by. Default: 1</param>
|
||||||
public void IncreaseUses(int amount = 1)
|
public void IncreaseUses(int amount = 1)
|
||||||
{
|
{
|
||||||
UsesLeft += amount;
|
SetUses(UsesLeft + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -149,7 +186,7 @@ public abstract class CustomActionButton
|
|||||||
/// <param name="amount">The amount you want to decrease by. Default: 1</param>
|
/// <param name="amount">The amount you want to decrease by. Default: 1</param>
|
||||||
public void DecreaseUses(int amount = 1)
|
public void DecreaseUses(int amount = 1)
|
||||||
{
|
{
|
||||||
UsesLeft -= amount;
|
SetUses(UsesLeft - amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in new issue
Block a user