Bundle the cross-platform interface font

This commit is contained in:
josh
2026-11-27 20:53:46 -05:00
parent ba7902dd5e
commit 75afa1c194
5 changed files with 29 additions and 1 deletions

View File

@@ -132,7 +132,7 @@ namespace Soundings
private static void Stepper(VisualElement parent, string value, string id, Action minus, Action plus, bool canMinus, bool canPlus)
{
var stepper = Add(parent, "stepper");
Button down = Action("−", minus, "step", id + "-minus");
Button down = Action("-", minus, "step", id + "-minus");
down.tooltip = id == "fare" ? "Lower passenger fare by $50" : "Buy 10 fewer tons";
down.SetEnabled(canMinus);
stepper.Add(down);

View File

@@ -8,6 +8,7 @@ namespace Soundings
{
private const string SaveKey = "soundings.company.v1";
private static readonly string[] Pages = { "Operations", "Deck plans", "Shipyard", "Ports", "Finance" };
private static FontDefinition interfaceFont;
private Company company;
private Harbor harbor;
private PanelSettings panel;
@@ -39,6 +40,7 @@ namespace Soundings
harbor = gameObject.AddComponent<Harbor>();
harbor.Initialize();
displayFont = Resources.Load<Font>("Display");
interfaceFont = FontDefinition.FromFont(Resources.Load<Font>("Interface"));
panel = ScriptableObject.CreateInstance<PanelSettings>();
panel.scaleMode = PanelScaleMode.ScaleWithScreenSize;
panel.referenceResolution = new Vector2Int(1440, 810);
@@ -49,6 +51,7 @@ namespace Soundings
document.panelSettings = panel;
root = document.rootVisualElement;
root.style.flexGrow = 1;
root.style.unityFontDefinition = interfaceFont;
root.styleSheets.Add(Resources.Load<StyleSheet>("Soundings"));
company = autoSmoke ? null : Load();
Render();
@@ -406,6 +409,7 @@ namespace Soundings
private static Label Text(string value, string classes)
{
var label = new Label(value) { pickingMode = PickingMode.Ignore };
label.style.unityFontDefinition = interfaceFont;
Classes(label, classes);
return label;
}
@@ -427,6 +431,7 @@ namespace Soundings
private static Button Action(string text, Action clicked, string classes = "", string id = null)
{
var button = new Button(clicked) { text = text, name = id ?? text };
button.style.unityFontDefinition = interfaceFont;
Classes(button, "action " + classes);
return button;
}