From fd2480287f89d5ba86ce2e5c749826745d95353b Mon Sep 17 00:00:00 2001 From: Provini <71570801+Provini@users.noreply.github.com> Date: Tue, 7 Jun 2022 13:08:42 -0400 Subject: [PATCH 1/3] Added the ability to fine-tune notification position --- Notification/NotificationSystem.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Notification/NotificationSystem.cs b/Notification/NotificationSystem.cs index dbf549d..79d75d7 100644 --- a/Notification/NotificationSystem.cs +++ b/Notification/NotificationSystem.cs @@ -16,6 +16,9 @@ public class NotificationSystem public static Color DefaultColour = new Color(0.1764f, 0.2549f, .3333f, 1f); public static MelonPreferences_Entry NotificationAlpha; public static MelonPreferences_Entry NotificationAlignment; + public static MelonPreferences_Entry NotificationCoordinateAlignment; + public static MelonPreferences_Entry NotificationX; + public static MelonPreferences_Entry NotificationY; public static bool UseVRChatNotificationSystem; //AssetBundle Parts @@ -48,8 +51,14 @@ public static void SetupNotifications() MelonPreferences.CreateCategory("ReModCore", "ReMod.Core"); NotificationAlpha = MelonPreferences.CreateEntry("ReModCore", "NotificationAlpha", .7f, "Notification Alpha", "Controls transparency of the notification system."); NotificationAlignment = MelonPreferences.CreateEntry("ReModCore", "NotificationAlignment", "centerMiddle", "Notification Alignment"); + NotificationCoordinateAlignment = MelonPreferences.CreateEntry("ReModCore", "NotificationCoordinateAlignment", false, "Use Coordinate Alignment"); + NotificationX = MelonPreferences.CreateEntry("ReModCore", "NotificationX", .5f, "Notification X", "Controls the X position of the notification system."); + NotificationY = MelonPreferences.CreateEntry("ReModCore", "NotificationY", .5f, "Notification Y", "Controls the Y position of the notification system."); NotificationAlignment.OnValueChanged += UpdateNotificationAlignment; + NotificationCoordinateAlignment.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null); + NotificationX.OnValueChanged += (_ ,_) => UpdateNotificationAlignment(null, null); + NotificationY.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null); //Create UIX settings enum RegSettingsEnum("ReModCore", "NotificationAlignment", new[] {("centerMiddle", "Middle Centered"), ("topCenter", "Top Centered"), ("topLeft", "Top Left"), ("topRight", "Top Right"), ("bottomCenter", "Bottom Centered"), ("bottomLeft", "Bottom Left"), ("bottomRight", "Bottom Right")}); @@ -116,6 +125,14 @@ public static void CloseNotification() private static void UpdateNotificationAlignment(string sender, string args) { if (_notificationRect == null) return; + + if (NotificationCoordinateAlignment.Value == true) + { + _notificationRect.anchorMin = new Vector2(NotificationX.Value, NotificationY.Value); + _notificationRect.anchorMax = new Vector2(NotificationX.Value, NotificationY.Value); + _notificationRect.pivot = new Vector2(NotificationX.Value, NotificationY.Value); + return; + } switch (NotificationAlignment.Value) { @@ -222,4 +239,4 @@ private static bool RegSettingsEnum(string settingsCat, string settingsName, ILi #endregion } -} \ No newline at end of file +} From 787edeea59faa816cd0c3cc2154b7ff62d3c83a1 Mon Sep 17 00:00:00 2001 From: Provini <71570801+Provini@users.noreply.github.com> Date: Tue, 7 Jun 2022 13:31:12 -0400 Subject: [PATCH 2/3] Update NotificationSystem.cs --- Notification/NotificationSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notification/NotificationSystem.cs b/Notification/NotificationSystem.cs index 79d75d7..e7a1460 100644 --- a/Notification/NotificationSystem.cs +++ b/Notification/NotificationSystem.cs @@ -126,7 +126,7 @@ private static void UpdateNotificationAlignment(string sender, string args) { if (_notificationRect == null) return; - if (NotificationCoordinateAlignment.Value == true) + if (NotificationCoordinateAlignment.Value) { _notificationRect.anchorMin = new Vector2(NotificationX.Value, NotificationY.Value); _notificationRect.anchorMax = new Vector2(NotificationX.Value, NotificationY.Value); From e913db7d8c5985d6cb8c2df83e04179439cefe55 Mon Sep 17 00:00:00 2001 From: Provini <71570801+Provini@users.noreply.github.com> Date: Tue, 7 Jun 2022 14:00:24 -0400 Subject: [PATCH 3/3] Fixed small typo for consistency in code --- Notification/NotificationSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notification/NotificationSystem.cs b/Notification/NotificationSystem.cs index e7a1460..5e3283b 100644 --- a/Notification/NotificationSystem.cs +++ b/Notification/NotificationSystem.cs @@ -57,7 +57,7 @@ public static void SetupNotifications() NotificationAlignment.OnValueChanged += UpdateNotificationAlignment; NotificationCoordinateAlignment.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null); - NotificationX.OnValueChanged += (_ ,_) => UpdateNotificationAlignment(null, null); + NotificationX.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null); NotificationY.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null); //Create UIX settings enum