mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Updates to Modifiers
This commit is contained in:
1 parent
26284852c9
commit
9b173a4298
20 files changed
+189
-243
No files matched your search
@@ -1,20 +0,0 @@
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
[RegisterCustomRole]
|
||||
public class CustomRole : ImpostorRole, ICustomRole
|
||||
{
|
||||
public string RoleName => "fortnite killer";
|
||||
public string RoleLongDescription => "ok so your objective is to eliminate everyone with your fortnite tactical shotgun, good luck";
|
||||
public string RoleDescription => RoleLongDescription;
|
||||
public Color RoleColor => Palette.Orange;
|
||||
public ModdedRoleTeams Team => ModdedRoleTeams.Impostor;
|
||||
public LoadableAsset<Sprite> OptionsScreenshot => MiraAssets.Banner;
|
||||
|
||||
[ModdedNumberOption("Testing level", min: 3, max: 9, roleType: typeof(CustomRole))] public float testingLevel { get; set; } = 4;
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
[RegisterCustomRole]
|
||||
public class CustomRole2 : CrewmateRole, ICustomRole
|
||||
{
|
||||
public string RoleName => "fortnite defender";
|
||||
public string RoleLongDescription => "ok so your objective is to save everyone from the fortnite killer";
|
||||
public string RoleDescription => RoleLongDescription;
|
||||
public Color RoleColor => Palette.AcceptedGreen;
|
||||
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
|
||||
public LoadableAsset<Sprite> OptionsScreenshot => MiraAssets.Banner;
|
||||
|
||||
[ModdedToggleOption("Teleportation ability", roleType: typeof(CustomRole2))] public bool teleport { get; set; } = true;
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
[RegisterCustomRole]
|
||||
public class CustomRole3 : CrewmateRole, ICustomRole
|
||||
{
|
||||
public string RoleName => "fortnite helper";
|
||||
public string RoleLongDescription => "ok so your objective is to help";
|
||||
public string RoleDescription => RoleLongDescription;
|
||||
public Color RoleColor => Palette.Brown;
|
||||
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
|
||||
public LoadableAsset<Sprite> OptionsScreenshot => MiraAssets.Banner;
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
public class CustomRoleSettings : IModdedOptionGroup
|
||||
{
|
||||
public string GroupName => "Custom Role";
|
||||
|
||||
public Type AdvancedRole => typeof(CustomRole);
|
||||
|
||||
[ModdedNumberOption("amogus", min: 3, max: 9)] public float amogus { get; set; } = 1;
|
||||
|
||||
[ModdedEnumOption("dwayne the rock johnson", typeof(TestEnum))] public TestEnum dwayneTheRockJohnson { get; set; } = TestEnum.Hello;
|
||||
|
||||
public ModdedToggleOption testToggle { get; } = new ("test toggle", false);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
public class ExampleOptions : IModdedOptionGroup
|
||||
{
|
||||
public string GroupName => "General Group";
|
||||
public Color GroupColor => Color.red;
|
||||
|
||||
[ModdedToggleOption("Use Thing")]
|
||||
public bool useThing { get; set; } = false;
|
||||
|
||||
[ModdedToggleOption("Use another thing")]
|
||||
public bool useAnotherThing { get; set; } = true;
|
||||
|
||||
[ModdedNumberOption("Sussy level", min: 0, max: 10)]
|
||||
public float sussyLevel { get; set; } = 4f;
|
||||
|
||||
[ModdedStringOption("Sus choices", ["hello", "hello 2", "hello 3"])]
|
||||
public int susChoices { get; set; } = 2;
|
||||
|
||||
[ModdedEnumOption("Enum test", typeof(TestEnum))]
|
||||
public TestEnum enumTest { get; set; } = TestEnum.Bye;
|
||||
}
|
||||
|
||||
public enum TestEnum
|
||||
{
|
||||
Hello,
|
||||
Hi,
|
||||
Bye
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
public class ExampleOptions2 : IModdedOptionGroup
|
||||
{
|
||||
public string GroupName => "Example 2";
|
||||
|
||||
public ModdedToggleOption UseThing { get; } = new("Use Thingy 5", false);
|
||||
|
||||
public ModdedToggleOption UseThing2 { get; } = new("Use Thingy 6", false);
|
||||
|
||||
public ModdedStringOption Sussy { get; } = new("Sussy", 0, ["Sussy 1", "Sussy 2", "Sussy 3"]);
|
||||
|
||||
public ModdedEnumOption SussyEnum { get; } = new("Sussy Enum", 0, typeof(SussyEnum));
|
||||
|
||||
public ModdedNumberOption YeezyLevel { get; } = new("Yeezy Level", 50, 0, 100, 25, NumberSuffixes.Multiplier);
|
||||
}
|
||||
|
||||
public enum SussyEnum
|
||||
{
|
||||
Sussy,
|
||||
Baka,
|
||||
Imposter,
|
||||
Kanye
|
||||
}
|
||||
@@ -21,5 +21,6 @@ public partial class ExamplePlugin : BasePlugin, IMiraPlugin
|
||||
public override void Load()
|
||||
{
|
||||
Harmony.PatchAll();
|
||||
AddComponent<MiraDebugWindow>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities.Attributes;
|
||||
using Reactor.Utilities.ImGui;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
[RegisterInIl2Cpp]
|
||||
public class MiraDebugWindow : MonoBehaviour
|
||||
{
|
||||
public DragWindow DebuggingWindow;
|
||||
public MiraDebugWindow(IntPtr ptr) : base(ptr)
|
||||
{
|
||||
DebuggingWindow = new DragWindow(new Rect(10, 10, 0, 0), "MIRA API DEBUGGING", () =>
|
||||
{
|
||||
if (GUILayout.Button("Test modifier"))
|
||||
{
|
||||
PlayerControl.LocalPlayer.AddModifier<ModifierExample>();
|
||||
}
|
||||
if (GUILayout.Button("Remove modifier"))
|
||||
{
|
||||
PlayerControl.LocalPlayer.RemoveModifier<ModifierExample>();
|
||||
}
|
||||
});
|
||||
|
||||
DebuggingWindow.Enabled = true;
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
DebuggingWindow.OnGUI();
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,14 @@ namespace MiraAPI.Example;
|
||||
public class ModifierExample : TimedModifier
|
||||
{
|
||||
public override string ModifierName => "Timed modifier example";
|
||||
public override float Duration => 10;
|
||||
public override float Duration => 1.5f;
|
||||
public override bool AutoStart => true;
|
||||
|
||||
private System.Random _rand = new();
|
||||
|
||||
public override void OnTimerComplete()
|
||||
{
|
||||
|
||||
Player.SetColor((byte)_rand.Next(0, 18));
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
|
||||
public class SomeRandomNonGroupClass
|
||||
{
|
||||
[ModdedStringOption("Yeah, idk", ["Idk 1", "idk 2", "idk 3", "idk 4"])] public static int yeaIdk { get; set; } = 3;
|
||||
[ModdedNumberOption("Aw man", min: 45, max: 95)] public float sussyLevel { get; set; } = 63;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.Modifiers.Types;
|
||||
|
||||
namespace MiraAPI.Example
|
||||
{
|
||||
[RegisterModifier]
|
||||
public class TorchModifier : GameModifier
|
||||
{
|
||||
public override string ModifierName => "Torch";
|
||||
|
||||
[ModdedNumberOption("Torch Chance", 0, 100, 10)]
|
||||
public float chance { get; } = 50;
|
||||
[ModdedNumberOption("Torch Amount", 0, 10, 1)]
|
||||
public float amount { get; } = 3;
|
||||
|
||||
public override int GetAmountPerGame()
|
||||
{
|
||||
return (int)amount;
|
||||
}
|
||||
|
||||
public override int GetAssignmentChance()
|
||||
{
|
||||
return (int)chance;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user