mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-28 09:39:08 +00:00
that def doesnt work
This commit is contained in:
1 parent
b2137230da
commit
bf5dadc6a0
2 files changed
-40
No files matched your search
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using Reactor.Utilities.Attributes;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MiraAPI.Hud.Tools;
|
||||
|
||||
[RegisterInIl2Cpp]
|
||||
public class TextInput : MonoBehaviour
|
||||
{
|
||||
public TextBoxTMP textBox;
|
||||
|
||||
public Action<string>? OnTextChanged;
|
||||
|
||||
public delegate bool ValidateInput(string input);
|
||||
public ValidateInput? Validate;
|
||||
|
||||
public static void Create(Action<string>? onTextChanged = null, ValidateInput? validate = null)
|
||||
{
|
||||
var source = FindObjectOfType<NameTextBehaviour>(true);
|
||||
var input = Instantiate(source);
|
||||
var inputBox = input.gameObject.AddComponent<TextInput>();
|
||||
inputBox.textBox = source.nameSource;
|
||||
inputBox.OnTextChanged = onTextChanged;
|
||||
inputBox.Validate = validate;
|
||||
|
||||
inputBox.textBox.OnChange = new Button.ButtonClickedEvent();
|
||||
inputBox.textBox.OnChange.AddListener((UnityEngine.Events.UnityAction)(() =>
|
||||
{
|
||||
var text = inputBox.textBox.text;
|
||||
if (inputBox.Validate != null && !inputBox.Validate(text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inputBox.OnTextChanged?.Invoke(text);
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ internal static class GamePresetsTabPatches
|
||||
saveButton.OnClick.AddListener(
|
||||
(UnityAction)(() =>
|
||||
{
|
||||
|
||||
}));
|
||||
|
||||
var holder = new GameObject("PresetHolder");
|
||||
|
||||
Reference in new issue
Block a user