Skip to content

Commit

Permalink
Allow custom TextScale in MessageBox
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Interkarma committed Jul 5, 2022
1 parent 87a09a5 commit ae828f7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Assets/Scripts/Game/UserInterfaceWindows/DaggerfallMessageBox.cs
Expand Up @@ -49,6 +49,18 @@ public class DaggerfallMessageBox : DaggerfallPopupWindow
KeyCode extraProceedBinding = KeyCode.None;
bool isNextMessageDeferred = false;

float textScale = 1.0f;

/// <summary>
/// Change the scale of text inside message box.
/// Must set custom TextScale immediately after creating messagebox and before setting text/tokens.
/// </summary>
public float TextScale
{
get { return textScale; }
set { textScale = value; }
}

/// <summary>
/// Default message box buttons are indices into BUTTONS.RCI.
/// </summary>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ae828f7

Please sign in to comment.