From 8b6dec31b5eeaa6bb43f1e761740f4e07736f0ae Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Fri, 27 Nov 2020 15:07:36 -0700 Subject: [PATCH] Added UserInput class by PNW to handle user-defined filename for Export Path --- SceneManager/PNWUserInput.cs | 28 ++++++++++++++++++++++++++++ SceneManager/SceneManager.csproj | 5 +++++ 2 files changed, 33 insertions(+) create mode 100644 SceneManager/PNWUserInput.cs diff --git a/SceneManager/PNWUserInput.cs b/SceneManager/PNWUserInput.cs new file mode 100644 index 0000000..92268e1 --- /dev/null +++ b/SceneManager/PNWUserInput.cs @@ -0,0 +1,28 @@ +using Rage; +using Rage.Native; + +namespace SceneManager +{ + 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/SceneManager.csproj b/SceneManager/SceneManager.csproj index 02725e6..8b24f01 100644 --- a/SceneManager/SceneManager.csproj +++ b/SceneManager/SceneManager.csproj @@ -31,6 +31,10 @@ 4 + + False + bin\Debug\InputManager.dll + D:\Program Files\Rockstar Games\Grand Theft Auto V\RAGENativeUI.dll @@ -64,6 +68,7 @@ +