using OWML.Common; using OWML.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; using UnityEngine.UI; namespace QSB.Utility { public static class DebugBoxManager { private static GameObject _boxPrefab; public static void Init() { _boxPrefab = QSBCore.ConversationAssetBundle.LoadAsset("assets/dialoguebubble.prefab"); var font = (Font)Resources.Load(@"fonts\english - latin\spacemono-bold"); if (font == null) { DebugLog.ToConsole("Error - Font is null!", MessageType.Error); } _boxPrefab.GetComponent().font = font; _boxPrefab.GetComponent().color = Color.white; } public static GameObject CreateBox(Transform parent, float vertOffset, string text) { var newBox = UnityEngine.Object.Instantiate(_boxPrefab); newBox.SetActive(false); newBox.transform.parent = parent; newBox.transform.localPosition = new Vector3(0, vertOffset, 0); newBox.transform.rotation = parent.rotation; var lookAt = newBox.AddComponent(); lookAt.SetValue("_useLookAt", false); lookAt.SetValue("_localFacingVector", Vector3.back); lookAt.SetValue("_localRotationAxis", Vector3.up); newBox.GetComponent().text = text; newBox.AddComponent(); newBox.SetActive(true); return newBox; } } }