From 0d2a9d97002bca9542a64b63cbe59a5278460760 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:06:45 -0400 Subject: [PATCH] fix warnings --- MiraAPI/Hud/InputBox.cs | 114 ------------------ MiraAPI/Modifiers/ModifierManager.cs | 11 +- .../Patches/Options/GamePresetsTabPatches.cs | 6 +- .../Patches/Options/GameSettingMenuPatches.cs | 1 - MiraAPI/Patches/Roles/RoleManagerPatches.cs | 2 +- MiraAPI/Presets/PresetManager.cs | 2 +- MiraAPI/Presets/SavePresetPopup.cs | 25 ++-- MiraAPI/Utilities/Extensions.cs | 2 +- 8 files changed, 34 insertions(+), 129 deletions(-) delete mode 100644 MiraAPI/Hud/InputBox.cs diff --git a/MiraAPI/Hud/InputBox.cs b/MiraAPI/Hud/InputBox.cs deleted file mode 100644 index 43dfb95..0000000 --- a/MiraAPI/Hud/InputBox.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using MiraAPI.Utilities.Assets; -using Reactor.Utilities.Attributes; -using UnityEngine; -using UnityEngine.Events; -using UnityEngine.UI; - -namespace MiraAPI.Hud; - -/// -/// Simple input box for user input. -/// -[RegisterInIl2Cpp] -public class InputBox : MonoBehaviour -{ - public InputField inputField = null!; - - public void CreateDialog(string title, string placeholder, string submitText, Action onSubmit) - { - var canvasObj = new GameObject("DialogCanvas"); - canvasObj.transform.SetParent(transform); - canvasObj.layer = LayerMask.NameToLayer("UI"); - - var canvas = canvasObj.AddComponent(); - canvas.renderMode = RenderMode.ScreenSpaceOverlay; - canvas.overrideSorting = true; - canvas.sortingOrder = 1000; // Ensure the canvas is on top of other UI elements - - canvasObj.AddComponent().uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; - canvasObj.AddComponent(); - - var panelObj = new GameObject("DialogPanel"); - panelObj.transform.SetParent(canvasObj.transform); - var panelRect = panelObj.AddComponent(); - var img = panelObj.AddComponent(); - - img.color = new Color(1, 1, 1, 0.9f); - img.raycastTarget = true; - img.sprite = MiraAssets.RoundedBox.LoadAsset(); - img.type = Image.Type.Sliced; - - panelRect.sizeDelta = new Vector2(300, 200); - panelRect.anchoredPosition = Vector2.zero; - - var titleText = CreateText(panelObj, title); - titleText.alignment = TextAnchor.MiddleCenter; - titleText.fontSize = 26; - titleText.fontStyle = FontStyle.Bold; - titleText.color = Color.white; - - var titleRect = titleText.GetComponent(); - titleRect.sizeDelta = new Vector2(280, 50); - titleRect.anchoredPosition = new Vector2(0, 70); - - var inputObj = new GameObject("InputField"); - inputObj.transform.SetParent(panelObj.transform); - var inputRect = inputObj.AddComponent(); - inputRect.sizeDelta = new Vector2(220, 40); - inputRect.anchoredPosition = new Vector2(0, 20); - - var inputBg = inputObj.AddComponent(); - inputBg.color = new Color(1, 1, 1, 0.8f); - - inputField = inputObj.AddComponent(); - inputField.textComponent = CreateText(inputObj, string.Empty, 18, Color.black); - inputField.placeholder = CreateText(inputObj, placeholder, 18, new Color(0.5f, 0.5f, 0.5f)); - - var buttonObj = new GameObject("SubmitButton"); - buttonObj.transform.SetParent(panelObj.transform); - var button = buttonObj.AddComponent