Archived
Private
Public Access
1
0
This repository has been archived on 2026-02-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ProjectBackup/C#/FiveM/Framework/Framework.Client/Utils/UI.cs
2023-07-31 21:20:56 +02:00

33 lines
1.0 KiB
C#

using System;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core.Native;
namespace Framework.Client.Utils {
public static class UI {
public static async Task<string> DisplayTextInput(string title, int maxLength) {
API.AddTextEntry("CH_INPUT", title);
API.DisplayOnscreenKeyboard(1, "CH_INPUT", "", "", "", "", "", maxLength);
while (API.UpdateOnscreenKeyboard() == 0) {
await BaseScript.Delay(0);
}
if (API.UpdateOnscreenKeyboard() != 2) {
var result = API.GetOnscreenKeyboardResult();
await BaseScript.Delay(0);
return result;
}
await BaseScript.Delay(0);
return null;
}
public static async Task<T> DisplayTextInput<T>(string title, int maxLength) {
var result = await DisplayTextInput(title, maxLength);
return (T)Convert.ChangeType(result, typeof(T));
}
}
}