Skip to content

Commit 52f89ec

Browse files
committed
Update PopupText.cs
Discovered a new place that displays popup text at the top of the screen. These strings may be grammar tokenized, so this display must call ProcessGrammar().
1 parent 466719d commit 52f89ec

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Assets/Scripts/Game/UserInterface/PopupText.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Project: Daggerfall Unity
1+
// Project: Daggerfall Unity
22
// Copyright: Copyright (C) 2009-2023 Daggerfall Workshop
33
// Web Site: http://www.dfworkshop.net
44
// License: MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -14,6 +14,7 @@
1414
using System.Collections.Generic;
1515
using UnityEngine;
1616
using DaggerfallConnect.Arena2;
17+
using DaggerfallWorkshop.Localization;
1718

1819
namespace DaggerfallWorkshop.Game.UserInterface
1920
{
@@ -113,11 +114,13 @@ public void AddText(string text, float delayInSeconds = popDelay)
113114
else
114115
// set next no-scroll delay
115116
nextPopDelay = Mathf.Max(nextPopDelay, delayInSeconds);
116-
TextLabel label = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, Vector2.zero, text);
117+
// Apply grammar processor before display
118+
string pgText = GrammarManager.grammarProcessor.ProcessGrammar(text);
119+
TextLabel label = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, Vector2.zero, pgText);
117120
label.HorizontalAlignment = HorizontalAlignment.Center;
118121
label.Parent = Parent;
119122
textRows.AddLast(label);
120-
GameManager.Instance.PlayerEntity.Notebook.AddMessage(text);
123+
GameManager.Instance.PlayerEntity.Notebook.AddMessage(pgText);
121124
}
122125

123126
/// <summary>

0 commit comments

Comments
 (0)