Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 0aee9df

Browse files
authored
Merge pull request #27 from Provini/master
Added the ability to fine-tune notification position
2 parents cd034ba + 9da20e5 commit 0aee9df

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Notification/NotificationSystem.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class NotificationSystem
1616
public static Color DefaultColour = new Color(0.1764f, 0.2549f, .3333f, 1f);
1717
public static MelonPreferences_Entry<float> NotificationAlpha;
1818
public static MelonPreferences_Entry<string> NotificationAlignment;
19+
public static MelonPreferences_Entry<bool> NotificationCoordinateAlignment;
20+
public static MelonPreferences_Entry<float> NotificationX;
21+
public static MelonPreferences_Entry<float> NotificationY;
1922
public static bool UseVRChatNotificationSystem;
2023

2124
//AssetBundle Parts
@@ -48,8 +51,14 @@ public static void SetupNotifications()
4851
MelonPreferences.CreateCategory("ReModCore", "ReMod.Core");
4952
NotificationAlpha = MelonPreferences.CreateEntry("ReModCore", "NotificationAlpha", .7f, "Notification Alpha", "Controls transparency of the notification system.");
5053
NotificationAlignment = MelonPreferences.CreateEntry("ReModCore", "NotificationAlignment", "centerMiddle", "Notification Alignment");
54+
NotificationCoordinateAlignment = MelonPreferences.CreateEntry("ReModCore", "NotificationCoordinateAlignment", false, "Use Coordinate Alignment");
55+
NotificationX = MelonPreferences.CreateEntry("ReModCore", "NotificationX", .5f, "Notification X", "Controls the X position of the notification system.");
56+
NotificationY = MelonPreferences.CreateEntry("ReModCore", "NotificationY", .5f, "Notification Y", "Controls the Y position of the notification system.");
5157

5258
NotificationAlignment.OnValueChanged += UpdateNotificationAlignment;
59+
NotificationCoordinateAlignment.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null);
60+
NotificationX.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null);
61+
NotificationY.OnValueChanged += (_, _) => UpdateNotificationAlignment(null, null);
5362

5463
//Create UIX settings enum
5564
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()
116125
private static void UpdateNotificationAlignment(string sender, string args)
117126
{
118127
if (_notificationRect == null) return;
128+
129+
if (NotificationCoordinateAlignment.Value)
130+
{
131+
_notificationRect.anchorMin = new Vector2(NotificationX.Value, NotificationY.Value);
132+
_notificationRect.anchorMax = new Vector2(NotificationX.Value, NotificationY.Value);
133+
_notificationRect.pivot = new Vector2(NotificationX.Value, NotificationY.Value);
134+
return;
135+
}
119136

120137
switch (NotificationAlignment.Value)
121138
{
@@ -222,4 +239,4 @@ private static bool RegSettingsEnum(string settingsCat, string settingsName, ILi
222239

223240
#endregion
224241
}
225-
}
242+
}

0 commit comments

Comments
 (0)