diff --git a/SceneManager/Hints.cs b/SceneManager/Hints.cs deleted file mode 100644 index 6a52d42..0000000 --- a/SceneManager/Hints.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Rage; - -namespace SceneManager -{ - class Hints - { - internal static bool Enabled { get; set; } = SettingsMenu.hints.Checked; - - internal static void Display(string message) - { - if (Enabled) - { - Game.DisplayNotification($"{message}"); - } - } - } -} diff --git a/SceneManager/Utils/GetUserInput.cs b/SceneManager/Utils/GetUserInput.cs deleted file mode 100644 index b1277f1..0000000 --- a/SceneManager/Utils/GetUserInput.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Rage; - -namespace SceneManager.Utils -{ - class GetUserInput - { - internal static void LoopForUserInput() - { - while (true) - { - bool isTextEntryOpen = (Rage.Native.NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD() == 0); - if (!isTextEntryOpen) - { - GetKeyboardInput(); - GetControllerInput(); - } - else - { - Game.LogTrivial($"A text menu is open."); - } - -#if DEBUG - if (MenuManager.menuPool.IsAnyMenuOpen()) - { - Game.DisplaySubtitle($"You are using a test build of Scene Manager. Please report any bugs/crashes in the Discord server."); - } -#endif - MenuManager.menuPool.ProcessMenus(); - GameFiber.Yield(); - } - } - - private static void GetControllerInput() - { - if (Settings.ModifierButton == ControllerButtons.None) - { - if (Game.IsControllerButtonDown(Settings.ToggleButton) && AreMenusClosed()) - { - MainMenu.mainMenu.Visible = !MainMenu.mainMenu.Visible; - } - } - else if (Game.IsControllerButtonDownRightNow(Settings.ModifierButton) && Game.IsControllerButtonDown(Settings.ToggleButton) && AreMenusClosed()) - { - MainMenu.mainMenu.Visible = !MainMenu.mainMenu.Visible; - } - } - - private static void GetKeyboardInput() - { - if (Settings.ModifierKey == System.Windows.Forms.Keys.None) - { - if (Game.IsKeyDown(Settings.ToggleKey) && AreMenusClosed()) - { - MainMenu.mainMenu.Visible = !MainMenu.mainMenu.Visible; - } - } - else if (Game.IsKeyDownRightNow(Settings.ModifierKey) && Game.IsKeyDown(Settings.ToggleKey) && AreMenusClosed()) - { - MainMenu.mainMenu.Visible = !MainMenu.mainMenu.Visible; - } - } - - private static bool AreMenusClosed() - { - if(!BarrierMenu.barrierMenu.Visible && !PathMainMenu.pathMainMenu.Visible && !PathCreationMenu.pathCreationMenu.Visible && !EditPathMenu.editPathMenu.Visible && !EditWaypointMenu.editWaypointMenu.Visible && !SettingsMenu.settingsMenu.Visible) - { - return true; - } - else - { - return false; - } - } - } -} diff --git a/SceneManager/Utils/MousePositionInWorld.cs b/SceneManager/Utils/MousePositionInWorld.cs deleted file mode 100644 index 4f17043..0000000 --- a/SceneManager/Utils/MousePositionInWorld.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Rage; - -namespace SceneManager.Utils -{ - internal static class MousePositionInWorld - { - internal static Vector3 GetPosition { get { return GetMousePositionInWorld(); } } - - internal static Vector3 GetPositionForBarrier { get { return GetMousePositionInWorld(Settings.BarrierPlacementDistance); } } - - private static Vector3 GetMousePositionInWorld(float maxDistance = 100f) - { - HitResult TracePlayerView(float maxTraceDistance = 100f, TraceFlags flags = TraceFlags.IntersectWorld) => TracePlayerView2(out Vector3 v1, out Vector3 v2, maxTraceDistance, flags); - - HitResult TracePlayerView2(out Vector3 start, out Vector3 end, float maxTraceDistance, TraceFlags flags) - { - Vector3 direction = GetPlayerLookingDirection(out start); - end = start + (maxTraceDistance * direction); - return World.TraceLine(start, end, flags); - } - - Vector3 GetPlayerLookingDirection(out Vector3 camPosition) - { - if (Camera.RenderingCamera) - { - camPosition = Camera.RenderingCamera.Position; - return Camera.RenderingCamera.Direction; - } - else - { - float pitch = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_RELATIVE_PITCH(); - float heading = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_RELATIVE_HEADING(); - - camPosition = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_COORD(); - return (Game.LocalPlayer.Character.Rotation + new Rotator(pitch, 0, heading)).ToVector().ToNormalized(); - } - } - - return TracePlayerView(maxDistance, TraceFlags.IntersectWorld).HitPosition; - } - } -} diff --git a/SceneManager/Utils/PNWUserInput.cs b/SceneManager/Utils/PNWUserInput.cs deleted file mode 100644 index 78e20e0..0000000 --- a/SceneManager/Utils/PNWUserInput.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Rage; -using Rage.Native; - -namespace SceneManager.Utils -{ - internal static class PNWUserInput - { - public static string GetUserInput(string windowTitle, string defaultText, int maxLength) - { - NativeFunction.Natives.DISABLE_ALL_CONTROL_ACTIONS(2); - - NativeFunction.Natives.DISPLAY_ONSCREEN_KEYBOARD(true, windowTitle, 0, defaultText, 0, 0, 0, maxLength); - Game.DisplayHelp("Enter the filename you would like to save your path as\n~INPUT_FRONTEND_ACCEPT~ Export path\n~INPUT_FRONTEND_CANCEL~ Cancel", true); - Game.DisplaySubtitle(windowTitle, 100000); - - while (NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD() == 0) - { - GameFiber.Yield(); - } - - NativeFunction.Natives.ENABLE_ALL_CONTROL_ACTIONS(2); - Game.DisplaySubtitle("", 5); - Game.HideHelp(); - - return NativeFunction.Natives.GET_ONSCREEN_KEYBOARD_RESULT(); - } - } -} \ No newline at end of file diff --git a/SceneManager/Utils/RNUIMouseInputHandler.cs b/SceneManager/Utils/RNUIMouseInputHandler.cs deleted file mode 100644 index 440f1f9..0000000 --- a/SceneManager/Utils/RNUIMouseInputHandler.cs +++ /dev/null @@ -1,131 +0,0 @@ -using InputManager; -using Rage; -using RAGENativeUI; -using RAGENativeUI.Elements; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - - -namespace SceneManager.Utils -{ - internal class RNUIMouseInputHandler - { - internal delegate void Function(); - - internal static void Initialize(UIMenu menu, List scrollerItems) - { - GameFiber.StartNew(() => - { - while (menu.Visible) - { - var selectedScroller = menu.MenuItems.Where(x => scrollerItems.Contains(x) && x.Selected && x.Enabled).FirstOrDefault(); - if (selectedScroller != null) - { - OnWheelScroll(menu, selectedScroller, scrollerItems); - } - - if (Game.IsKeyDown(Keys.LButton) && Rage.Native.NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD() != 0) - { - Keyboard.KeyDown(Keys.Enter); - GameFiber.Wait(1); - Keyboard.KeyUp(Keys.Enter); - } - - if (menu.SubtitleText.Contains("Path Creation Menu")) - { - DrawWaypointMarker(); - } - GameFiber.Yield(); - } - }); - } - - internal static void OnWheelScroll(UIMenu menu, UIMenuItem selectedScroller, List scrollerItems) - { - var menuScrollingDisabled = false; - var menuItems = menu.MenuItems.Where(x => x != selectedScroller); - - while (Game.IsShiftKeyDownRightNow) - { - menu.ResetKey(Common.MenuControls.Up); - menu.ResetKey(Common.MenuControls.Down); - menuScrollingDisabled = true; - ScrollMenuItem(); - if (menu.SubtitleText.Contains("Path Creation Menu") || menu.SubtitleText.Contains("Edit Waypoint")) - { - CompareScrollerValues(); - } - if(menu.SubtitleText.Contains("Path Creation Menu")) - { - DrawWaypointMarker(); - } - GameFiber.Yield(); - } - - if (menuScrollingDisabled) - { - menuScrollingDisabled = false; - menu.SetKey(Common.MenuControls.Up, GameControl.CursorScrollUp); - menu.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp); - menu.SetKey(Common.MenuControls.Down, GameControl.CursorScrollDown); - menu.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown); - } - - void ScrollMenuItem() - { - if (Game.GetMouseWheelDelta() > 0) - { - Keyboard.KeyDown(Keys.Right); - GameFiber.Wait(1); - Keyboard.KeyUp(Keys.Right); - } - else if (Game.GetMouseWheelDelta() < 0) - { - Keyboard.KeyDown(Keys.Left); - GameFiber.Wait(1); - Keyboard.KeyUp(Keys.Left); - } - } - - void CompareScrollerValues() - { - var collectorRadius = (UIMenuNumericScrollerItem)scrollerItems.Where(x => x.Text == "Collection Radius").FirstOrDefault(); - var speedZoneRadius = (UIMenuNumericScrollerItem)scrollerItems.Where(x => x.Text == "Speed Zone Radius").FirstOrDefault(); - - if (selectedScroller.Text == "Collection Radius" || selectedScroller.Text == "Speed Zone Radius") - { - if (selectedScroller == collectorRadius && collectorRadius.Value > speedZoneRadius.Value) - { - while (collectorRadius.Value > speedZoneRadius.Value) - { - speedZoneRadius.ScrollToNextOption(); - } - } - if (selectedScroller == speedZoneRadius && speedZoneRadius.Value < collectorRadius.Value) - { - collectorRadius.Value = speedZoneRadius.Value; - } - } - } - } - - private static void DrawWaypointMarker() - { - var waypointPosition = MousePositionInWorld.GetPosition; - if (SettingsMenu.threeDWaypoints.Checked && PathCreationMenu.collectorWaypoint.Checked) - { - Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, waypointPosition, 0, 0, 0, 0, 0, 0, (float)PathCreationMenu.collectorRadius.Value * 2, (float)PathCreationMenu.collectorRadius.Value * 2, 1f, 80, 130, 255, 80, false, false, 2, false, 0, 0, false); - Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, waypointPosition, 0, 0, 0, 0, 0, 0, (float)PathCreationMenu.speedZoneRadius.Value * 2, (float)PathCreationMenu.speedZoneRadius.Value * 2, 1f, 255, 185, 80, 80, false, false, 2, false, 0, 0, false); - } - else if (PathCreationMenu.stopWaypointType.Checked) - { - Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, waypointPosition, 0, 0, 0, 0, 0, 0, 1f, 1f, 1f, 255, 65, 65, 80, false, false, 2, false, 0, 0, false); - } - else - { - Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, waypointPosition, 0, 0, 0, 0, 0, 0, 1f, 1f, 1f, 65, 255, 65, 80, false, false, 2, false, 0, 0, false); - } - } - } -}