From ae828f75d37d38dd552afe366ae04a6d22fb65a6 Mon Sep 17 00:00:00 2001 From: Interkarma Date: Tue, 5 Jul 2022 11:08:00 +1000 Subject: [PATCH] Allow custom TextScale in MessageBox Allows for MessageBox with custom text scale and overall smaller/larger box size. Useful for popups with a large amount of text that need to shrink a bit to fit on screen. While other UI windows might also benefit from this kind of thing, I prefer to limit to message box for now as it's a very simple control. --- .../UserInterfaceWindows/DaggerfallMessageBox.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallMessageBox.cs b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallMessageBox.cs index fc6c7aec2a..a0b03d73af 100644 --- a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallMessageBox.cs +++ b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallMessageBox.cs @@ -49,6 +49,18 @@ public class DaggerfallMessageBox : DaggerfallPopupWindow KeyCode extraProceedBinding = KeyCode.None; bool isNextMessageDeferred = false; + float textScale = 1.0f; + + /// + /// Change the scale of text inside message box. + /// Must set custom TextScale immediately after creating messagebox and before setting text/tokens. + /// + public float TextScale + { + get { return textScale; } + set { textScale = value; } + } + /// /// Default message box buttons are indices into BUTTONS.RCI. /// @@ -227,6 +239,7 @@ protected override void Setup() label.HorizontalAlignment = HorizontalAlignment.Center; label.VerticalAlignment = VerticalAlignment.Middle; + label.TextScale = TextScale; messagePanel.Components.Add(label); buttonPanel.HorizontalAlignment = HorizontalAlignment.Center;