-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using MiraAPI.Example.Modifiers; | ||
using MiraAPI.Hud; | ||
using MiraAPI.Modifiers; | ||
using MiraAPI.Utilities.Assets; | ||
using Reactor.Utilities.Extensions; | ||
using UnityEngine; | ||
|
||
namespace MiraAPI.Example.Buttons; | ||
|
||
[RegisterButton] | ||
public class TestButton : CustomActionButton | ||
{ | ||
public override string Name => "Test Button"; | ||
public override float Cooldown => 0f; | ||
public override LoadableAsset<Sprite> Sprite => ExampleAssets.ExampleButton; | ||
|
||
protected override void OnClick() | ||
{ | ||
var randomPlayer = PlayerControl.AllPlayerControls.ToArray().Random(); | ||
PlayerControl.LocalPlayer.RpcAddModifier<ModifierParams>("test", 1, randomPlayer); | ||
} | ||
|
||
public override bool Enabled(RoleBehaviour? role) | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using MiraAPI.Modifiers; | ||
using Reactor.Utilities; | ||
|
||
namespace MiraAPI.Example.Modifiers; | ||
|
||
[RegisterModifier] | ||
public class ModifierParams : BaseModifier | ||
{ | ||
public override string ModifierName => "ModifierParams"; | ||
|
||
public ModifierParams(string param1, int param2, PlayerControl playerControl) | ||
{ | ||
Logger<ExamplePlugin>.Error($"Param1: {param1}, Param2: {param2}"); | ||
Logger<ExamplePlugin>.Error($"Player: {playerControl.PlayerId}"); | ||
} | ||
} |