Skip to content

Commit

Permalink
fix most non-documentation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
XtraCube committed Sep 2, 2024
1 parent 74055b8 commit 0e56a30
Show file tree
Hide file tree
Showing 35 changed files with 102 additions and 125 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{cs,vb}]
dotnet_diagnostic.CA1707.severity = none
4 changes: 2 additions & 2 deletions MiraAPI.Example/ExampleAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class ExampleAssets
{
public static LoadableResourceAsset ExampleButton { get; } = new("MiraAPI.Example.Resources.ExampleButton.png");

// Credit to EpicHorrors for the teleport button asset.
// Credit to EpicHorrors for the teleport button asset.
public static LoadableResourceAsset TeleportButton { get; } = new("MiraAPI.Example.Resources.TeleportButton.png");
public static LoadableResourceAsset Banner { get; } = new("MiraAPI.Example.Resources.FortniteBanner.jpeg");
}
}
6 changes: 3 additions & 3 deletions MiraAPI.Example/ExampleColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace MiraAPI.Example;
[RegisterCustomColors]
public static class ExampleColors
{
public static CustomColor Cerulean { get; } = new("Cerulean", new Color(0.0f, 0.48f, 0.65f));
public static CustomColor Cerulean { get; } = new("Cerulean", new Color(0.0f, 0.48f, 0.65f));

public static CustomColor Rose { get; } = new("Rose", new Color(0.98f, 0.26f, 0.62f));

public static CustomColor Gold { get; } = new("Gold", new Color(1.0f, 0.84f, 0.0f));
}
}
18 changes: 7 additions & 11 deletions MiraAPI.Example/MiraDebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
using UnityEngine;

namespace MiraAPI.Example;

[RegisterInIl2Cpp]
public class MiraDebugWindow(IntPtr ptr) : MonoBehaviour(ptr)
public class MiraDebugWindow(IntPtr cppPtr) : MonoBehaviour(cppPtr)
{
public readonly DragWindow DebuggingWindow = new(new Rect(10, 10, 0, 0), "MIRA API DEBUGGING", () =>
{
if (GUILayout.Button("Test modifier"))
{
//PlayerControl.LocalPlayer.AddModifier<ModifierTimerExample>();
}
if (GUILayout.Button("Remove modifier"))
public DragWindow DebuggingWindow { get; } = new(
new Rect(10, 10, 0, 0),
"MIRA API DEBUGGING",
() =>
{
//PlayerControl.LocalPlayer.RemoveModifier<ModifierTimerExample>();
}
})
})
{
Enabled = true,
};
Expand Down
18 changes: 9 additions & 9 deletions MiraAPI/GameModes/CustomGameModeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
namespace MiraAPI.GameModes;

/// <summary>
/// Manages custom gamemodes
/// Manages custom gamemodes.
/// </summary>
public static class CustomGameModeManager
{
/// <summary>
/// List of registered gamemodes
/// List of registered gamemodes.
/// </summary>
internal static readonly Dictionary<int, CustomGameMode> GameModes = [];

Expand All @@ -21,14 +21,14 @@ public static bool IsDefault()
}

/// <summary>
/// Current gamemode
/// Current gamemode.
/// </summary>
public static CustomGameMode? ActiveMode { get; internal set; } = new DefaultMode();

/// <summary>
/// Set current gamemode
/// Set current gamemode.
/// </summary>
/// <param name="id">gamemode ID</param>
/// <param name="id">gamemode ID.</param>
public static void SetGameMode(int id)
{
if (GameModes.TryGetValue(id, out var gameMode))
Expand All @@ -41,9 +41,9 @@ public static void SetGameMode(int id)
}

/// <summary>
/// Register gamemode from type
/// Register gamemode from type.
/// </summary>
/// <param name="gameModeType">Type of gamemode class, should inherit from <see cref="CustomGameMode"/></param>
/// <param name="gameModeType">Type of gamemode class, should inherit from <see cref="CustomGameMode"/>.</param>
internal static void RegisterGameMode(Type gameModeType)
{
if (!typeof(CustomGameMode).IsAssignableFrom(gameModeType))
Expand All @@ -59,7 +59,7 @@ internal static void RegisterGameMode(Type gameModeType)
Logger<MiraApiPlugin>.Error($"Failed to create instance of {gameModeType.Name}");
return;
}

if (GameModes.Any(x => x.Key == gameMode.Id))
{
Logger<MiraApiPlugin>.Error($"ID for gamemode {gameMode.Name} already exists!");
Expand All @@ -68,4 +68,4 @@ internal static void RegisterGameMode(Type gameModeType)

GameModes.Add(gameMode.Id, gameMode);
}
}
}
2 changes: 1 addition & 1 deletion MiraAPI/GameModes/DefaultMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ public class DefaultMode : CustomGameMode
public override string Name => "Default";

Check warning on line 6 in MiraAPI/GameModes/DefaultMode.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DefaultMode.Name'
public override string Description => "Default Among Us GameMode";

Check warning on line 7 in MiraAPI/GameModes/DefaultMode.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DefaultMode.Description'
public override int Id => 0;

Check warning on line 8 in MiraAPI/GameModes/DefaultMode.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DefaultMode.Id'
}
}
2 changes: 1 addition & 1 deletion MiraAPI/GameModes/RegisterGameModeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ internal static void Register(Assembly assembly)
}
}
}
}
}
2 changes: 2 additions & 0 deletions MiraAPI/GameOptions/OptionGroupSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public static class OptionGroupSingleton<T> where T : AbstractOptionGroup
/// <summary>
/// Gets the instance of the option group.
/// </summary>
#pragma warning disable CA1000
public static T Instance => _instance ??= ModdedOptionsManager.Groups.OfType<T>().Single();
#pragma warning restore CA1000
}
2 changes: 2 additions & 0 deletions MiraAPI/Hud/CustomButtonSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public static class CustomButtonSingleton<T> where T : CustomActionButton
/// <summary>
/// Gets the instance of the button.
/// </summary>
#pragma warning disable CA1000
public static T Instance => _instance ??= CustomButtonManager.CustomButtons.OfType<T>().Single();
#pragma warning restore CA1000
}
2 changes: 1 addition & 1 deletion MiraAPI/Hud/RegisterButtonAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace MiraAPI.Hud;
/// Attribute to register a button in the HUD. Necessary for the button to be recognized by Mira.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class RegisterButtonAttribute : Attribute;
public class RegisterButtonAttribute : Attribute;
6 changes: 3 additions & 3 deletions MiraAPI/MiraApiPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace MiraAPI;
[ReactorModFlags(ModFlags.RequireOnAllClients)]
public partial class MiraApiPlugin : BasePlugin

Check warning on line 17 in MiraAPI/MiraApiPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'MiraApiPlugin'
{
public Harmony Harmony { get; } = new(Id);
private static MiraPluginManager PluginManager { get; set; }
private static MiraPluginManager? PluginManager { get; set; }

public static Color MiraColor = new Color32(238, 154, 112, 255);
public Harmony Harmony { get; } = new(Id);

Check warning on line 21 in MiraAPI/MiraApiPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'MiraApiPlugin.Harmony'
public static Color MiraColor { get; } = new Color32(238, 154, 112, 255);

Check warning on line 22 in MiraAPI/MiraApiPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'MiraApiPlugin.MiraColor'

public override void Load()

Check warning on line 24 in MiraAPI/MiraApiPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'MiraApiPlugin.Load()'
{
Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/Modifiers/ModifierComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace MiraAPI.Modifiers;
/// The component for handling modifiers.
/// </summary>
[RegisterInIl2Cpp]
public class ModifierComponent(IntPtr ptr) : MonoBehaviour(ptr)
public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
{
/// <summary>
/// Gets the active modifiers on the player.
Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/Networking/SyncModifiersRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace MiraAPI.Networking;

[RegisterCustomRpc((uint)MiraRpc.SyncModifiers)]
internal class SyncModifiersRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
internal sealed class SyncModifiersRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
{
public override RpcLocalHandling LocalHandling => RpcLocalHandling.None;

Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/Networking/SyncOptionsRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MiraAPI.Networking;

// METHOD RPC DOESNT WORK WITH THE ARRAYS AND STUFF SO THIS IS HOW WE WILL DO IT FOR NOW
[RegisterCustomRpc((uint)MiraRpc.SyncGameOptions)]
internal class SyncOptionsRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
internal sealed class SyncOptionsRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
{
public override RpcLocalHandling LocalHandling => RpcLocalHandling.None;

Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/Networking/SyncRoleOptionsRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace MiraAPI.Networking;

[RegisterCustomRpc((uint)MiraRpc.SyncRoleOptions)]
internal class SyncRoleOptionsRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
internal sealed class SyncRoleOptionsRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc<MiraApiPlugin, NetData[]>(plugin, id)
{
public override RpcLocalHandling LocalHandling => RpcLocalHandling.None;

Expand Down
10 changes: 5 additions & 5 deletions MiraAPI/Patches/Colors/ScrollingColorsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace MiraAPI.Patches.Colors;
[HarmonyPatch(typeof(PlayerTab))]
public static class ScrollingColorsPatch
{
/// Collider
private static BoxCollider2D _collider;
// Collider
private static BoxCollider2D? _collider;

/// <summary>
/// Add scrolling to the colors tab
Expand All @@ -20,7 +20,7 @@ public static void AddScrollingToColorsTabPatch(PlayerTab __instance)
{
return;
}

var tab = PlayerCustomizationMenu.Instance.Tabs[1].Tab;

if (__instance.scroller == null)
Expand All @@ -31,7 +31,7 @@ public static void AddScrollingToColorsTabPatch(PlayerTab __instance)
var maskObj = new GameObject
{
layer = 5,
name = "SpriteMask"
name = "SpriteMask",
};
maskObj.transform.SetParent(__instance.transform);
maskObj.transform.localPosition = new Vector3(0, 0, 0);
Expand All @@ -55,4 +55,4 @@ public static void AddScrollingToColorsTabPatch(PlayerTab __instance)

__instance.SetScrollerBounds();
}
}
}
5 changes: 2 additions & 3 deletions MiraAPI/Patches/GameModes/ConsolePatches.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

/*
/*
[HarmonyPatch]
public static class ConsolePatches
{
Expand Down Expand Up @@ -69,4 +68,4 @@ public static bool MapCanUsePatch(MapConsole __instance, [HarmonyArgument(0)] Ne
canUse = couldUse = true;
return true;
}
}*/
}*/
6 changes: 2 additions & 4 deletions MiraAPI/Patches/GameModes/DeadBodyPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


/*
/*
[HarmonyPatch(typeof(DeadBody))]
public static class DeadBodyPatch
{
Expand All @@ -10,4 +8,4 @@ public static bool OnClickPatch(DeadBody __instance)
{
return CustomGameModeManager.ActiveMode == null || CustomGameModeManager.ActiveMode.CanReport(__instance);
}
}*/
}*/
6 changes: 2 additions & 4 deletions MiraAPI/Patches/GameModes/GameLogicPatches.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


/*
/*
[HarmonyPatch]
public static class GameLogicPatches
{
Expand All @@ -19,4 +17,4 @@ public static bool AssignRolesPatch(LogicRoleSelectionNormal __instance)
CustomGameModeManager.ActiveMode?.AssignRoles(out runOriginal, __instance);
return runOriginal;
}
}*/
}*/
8 changes: 3 additions & 5 deletions MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


/*
/*
/// <summary>
/// Allow Impostors to kill each other if can kill is enabled in gamemode or friendly fire is toggled on
/// </summary>
Expand All @@ -16,11 +14,11 @@ public static bool Prefix(ImpostorRole __instance, [HarmonyArgument(0)] Networke
{
return true;
}
__result = target is { Disconnected: false, IsDead: false } &&
target.PlayerId != __instance.Player.PlayerId && !(target.Role == null) &&
!(target.Object == null) && !target.Object.inVent && !target.Object.inMovingPlat;
return false;
}
}*/
}*/
6 changes: 2 additions & 4 deletions MiraAPI/Patches/GameModes/MapBehaviourPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


/*
/*
[HarmonyPatch(typeof(MapBehaviour))]
public static class MapBehaviourPatch
{
Expand All @@ -17,4 +15,4 @@ public static bool ShowSabotagePatch(MapBehaviour __instance)
return true;
}
}*/
}*/
6 changes: 2 additions & 4 deletions MiraAPI/Patches/GameModes/OnDeathPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


/*
/*
[HarmonyPatch(typeof(KillAnimation))]
public static class OnDeathPatch
{
Expand All @@ -10,4 +8,4 @@ public static void OnDeathPostfix([HarmonyArgument(0)] PlayerControl source, [Ha
{
CustomGameModeManager.ActiveMode?.OnDeath(target);
}
}*/
}*/
8 changes: 2 additions & 6 deletions MiraAPI/Patches/GameModes/VentPatches.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@


/*
/*
[HarmonyPatch(typeof(Vent))]
public static class VentPatches
{
[HarmonyPrefix]
[HarmonyPatch(nameof(Vent.CanUse))]
public static bool CanUseVentPatch(Vent __instance, ref float __result, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse)
Expand Down Expand Up @@ -47,5 +44,4 @@ public static bool SetOutlinePatch(Vent __instance, [HarmonyArgument(0)] bool on
return false;
}
}*/
}*/
2 changes: 1 addition & 1 deletion MiraAPI/Patches/Modifiers/VentPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public static void CanUseVentPatch(Vent __instance, ref float __result, [Harmony
}
__result = num;
}
}
}
1 change: 0 additions & 1 deletion MiraAPI/Patches/Options/GameSettingMenuPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ private static void UpdateText(GameSettingMenu menu, GameOptionsMenu settings, R
}

roles.roleChances.Clear();
roles.roleChances = null;
roles.AdvancedRolesSettings.gameObject.SetActive(false);
roles.RoleChancesSettings.gameObject.SetActive(true);
roles.SetQuotaTab();
Expand Down
4 changes: 2 additions & 2 deletions MiraAPI/Patches/Roles/TaskPanelPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace MiraAPI.Patches.Roles;
public static class TaskPanelPatch
{
/// <summary>
/// This patch is to override the automatic updating of the y position on the tab (which is in base game),
/// This patch is to override the automatic updating of the y position on the tab (which is in base game)
/// because I can't change the custom tab y pos if it's being overriden every frame.
/// Im sure there is an easier/better way, but this is the fix that worked for me
/// Im sure there is an easier/better way, but this is the fix that worked for me.
/// </summary>
[HarmonyPrefix]
[HarmonyPatch(nameof(TaskPanelBehaviour.Update))]
Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/PluginLoading/IMiraPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ public interface IMiraPlugin
{
string OptionsTitleText { get; }
public ConfigFile GetConfigFile();
}
}
Loading

0 comments on commit 0e56a30

Please sign in to comment.