diff --git a/MiraAPI/MiraApiConfig.cs b/MiraAPI/MiraApiConfig.cs
new file mode 100644
index 0000000..10c9776
--- /dev/null
+++ b/MiraAPI/MiraApiConfig.cs
@@ -0,0 +1,23 @@
+using BepInEx;
+using BepInEx.Configuration;
+using BepInEx.Unity.IL2CPP;
+using HarmonyLib;
+using MiraAPI.PluginLoading;
+using Reactor;
+using Reactor.Networking;
+using Reactor.Networking.Attributes;
+using Reactor.Utilities;
+using UnityEngine;
+
+namespace MiraAPI;
+
+///
+/// Mira API Config File Handler
+///
+public class MiraApiConfig(ConfigFile config)
+{
+ ///
+ /// Gets whether the modifiers hud should be on the left side of the screen (under roles/task tab). Recommended for streamers.
+ ///
+ public ConfigEntry ModifiersHudLeftSide { get; private set; } = config.Bind("Displays", "Show Modifiers HUD on Left Side", false);
+}
diff --git a/MiraAPI/MiraApiPlugin.cs b/MiraAPI/MiraApiPlugin.cs
index 8654cf6..aa7f3c6 100644
--- a/MiraAPI/MiraApiPlugin.cs
+++ b/MiraAPI/MiraApiPlugin.cs
@@ -30,6 +30,10 @@ public partial class MiraApiPlugin : BasePlugin
///
public static Color DefaultHeaderColor { get; } = new Color32(77, 77, 77, 255);
+ ///
+ /// Gets the Mira Api Config Handler.
+ ///
+ public MiraApiConfig? MiraConfig { get; private set; }
private static MiraPluginManager? PluginManager { get; set; }
internal Harmony Harmony { get; } = new(Id);
@@ -40,6 +44,7 @@ public partial class MiraApiPlugin : BasePlugin
ReactorCredits.Register("Mira API", Version, true, ReactorCredits.AlwaysShow);
+ MiraConfig = new MiraApiConfig(Config);
PluginManager = new MiraPluginManager();
PluginManager.Initialize();
}
diff --git a/MiraAPI/Modifiers/ModifierComponent.cs b/MiraAPI/Modifiers/ModifierComponent.cs
index 5c29dc2..4f556f5 100644
--- a/MiraAPI/Modifiers/ModifierComponent.cs
+++ b/MiraAPI/Modifiers/ModifierComponent.cs
@@ -6,6 +6,7 @@ using System.Linq;
using Il2CppInterop.Runtime.Attributes;
using MiraAPI.Modifiers.ModifierDisplay;
using MiraAPI.Modifiers.Types;
+using MiraAPI.Patches.Roles;
using Reactor.Utilities;
using Reactor.Utilities.Attributes;
using UnityEngine;
@@ -126,7 +127,18 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
if (_player.AmOwner && ModifierDisplay && HudManager.InstanceExists)
{
- ModifierDisplay!.gameObject.SetActive(MeetingHud.Instance || HudManager.Instance.TaskPanel.isActiveAndEnabled);
+ var taskPanelOpen = HudManager.Instance.TaskPanel.open;
+ var roleTabOpen = HudManagerPatches.RoleTab != null && HudManagerPatches.RoleTab.open;
+ var leftSideHud = PluginSingleton.Instance.MiraConfig!.ModifiersHudLeftSide.Value;
+
+ if (leftSideHud && (taskPanelOpen || roleTabOpen))
+ {
+ ModifierDisplay!.gameObject.SetActive(false);
+ }
+ else
+ {
+ ModifierDisplay!.gameObject.SetActive(MeetingHud.Instance || HudManager.Instance.TaskPanel.isActiveAndEnabled);
+ }
}
}
diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs
index f1a614e..0836935 100644
--- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs
+++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs
@@ -1,9 +1,12 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
+using MiraAPI.Patches.Roles;
using MiraAPI.Utilities.Assets;
+using Reactor.Utilities;
using Reactor.Utilities.Attributes;
using Reactor.Utilities.Extensions;
using TMPro;
@@ -94,6 +97,16 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr)
IsOpen = false;
_children.gameObject.SetActive(false);
+
+ if (PluginSingleton.Instance.MiraConfig!.ModifiersHudLeftSide.Value)
+ {
+ var aspect = GetComponent();
+ _toggleButton.transform.localPosition = new Vector3(-1f, 2.7f, 0f);
+ _children.transform.localPosition = new Vector3(-0.2f, -0.05f, 0f);
+ aspect.Alignment = AspectPosition.EdgeAlignments.LeftTop;
+ aspect.DistanceFromEdge = new Vector3(1.8f, 2.55f, -20f);
+ aspect.AdjustPosition();
+ }
}
///
@@ -109,7 +122,16 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr)
///
public void ToggleTab()
{
- IsOpen = !IsOpen;
+ SetOpened(!IsOpen);
+ }
+
+ ///
+ /// Use this to set the visibility of the modifiers tab.
+ ///
+ /// Whether it should be visible or not.
+ public void SetOpened(bool val)
+ {
+ IsOpen = val;
_children.gameObject.SetActive(IsOpen);
RefreshModifiers();
}
@@ -118,7 +140,6 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr)
{
_modifiers.Remove(component.Modifier!);
component.gameObject.DestroyImmediate();
-
RefreshModifiers();
}
@@ -194,13 +215,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr)
_toggleBtnText.text = $"Modifiers ({filteredModifiers.Count})";
- if (filteredModifiers.Count == 0)
- {
- _toggleButton.gameObject.SetActive(false);
- return;
- }
-
- _toggleButton.gameObject.SetActive(true);
+ _toggleButton.gameObject.SetActive(filteredModifiers.Count != 0);
foreach (var mod in modifiersToAdd)
{
diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs
index 29affce..348f739 100644
--- a/MiraAPI/Patches/Roles/HudManagerPatches.cs
+++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs
@@ -12,7 +12,7 @@ namespace MiraAPI.Patches.Roles;
public static class HudManagerPatches
{
// Custom role tab.
- private static TaskPanelBehaviour? _roleTab;
+ public static TaskPanelBehaviour? RoleTab;
///
/// Fixes Kill Button not showing for Neutral killing role.
@@ -38,9 +38,9 @@ public static class HudManagerPatches
__instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage);
}
- if (_roleTab)
+ if (RoleTab)
{
- _roleTab?.gameObject.SetActive(isActive);
+ RoleTab?.gameObject.SetActive(isActive);
}
}
@@ -62,16 +62,16 @@ public static class HudManagerPatches
if (role is ICustomRole { Configuration.RoleHintType: RoleHintType.RoleTab } customRole)
{
- if (_roleTab == null)
+ if (RoleTab == null)
{
- _roleTab = CustomRoleManager.CreateRoleTab(customRole);
+ RoleTab = CustomRoleManager.CreateRoleTab(customRole);
}
- CustomRoleManager.UpdateRoleTab(_roleTab, customRole);
+ CustomRoleManager.UpdateRoleTab(RoleTab, customRole);
}
- else if (_roleTab)
+ else if (RoleTab)
{
- _roleTab?.gameObject.Destroy();
+ RoleTab?.gameObject.Destroy();
}
}
}