Skip to content

Commit

Permalink
font update
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniMacaroni committed Oct 17, 2023
1 parent b983a07 commit 6810715
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SonsGameManager/ModManagerUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal static void Create()
vertical.SetParent(mainContainer);

var exitButton = SBgButton
.Text("x").Background(GetBackgroundSprite(EBackground.Round28), Image.Type.Sliced).Color(ColorFromString("#FF234B"), -0.25f)
.RichText("\uF00D").Background(GetBackgroundSprite(EBackground.Round28), Image.Type.Sliced).Color(ColorFromString("#FF234B"), -0.25f)
.Pivot(1, 1).Anchor(AnchorType.TopRight).Position(-60, -60)
.Size(60, 60).Ppu(1.7f).Notify(Close);
exitButton.SetParent(mainContainer);
Expand Down
4 changes: 2 additions & 2 deletions SonsGameManager/ModSettingsUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public static void Create()
panel.Add(SBgButton
.Background(ButtonBg).Background("#990508").Ppu(3)
.Pivot(0, 0).Anchor(AnchorType.BottomLeft).Position(80, 80).Size(300, 60)
.RichText(SpriteText("arrow_left") + " Back").FontSize(20).Notify(Close));
.RichText("\uF060 Back").FontColor("#ff5856").UpperCase().FontSize(20).Notify(Close));

panel.Add(SBgButton
.Background(ButtonBg).Background("#796C4E").Ppu(3)
.Pivot(0, 0).Anchor(AnchorType.BottomLeft).Position(390, 80).Size(200, 60)
.RichText("Revert " + SpriteText("arrow_right")).FontSize(20).Notify(RevertSettings));
.RichText("Revert \uf0e2").FontColor("#c3ba8b").UpperCase().FontSize(20).Notify(RevertSettings));
}

public static void Open(string id)
Expand Down
Binary file modified SonsSdk/Resources/bundle
Binary file not shown.
13 changes: 11 additions & 2 deletions SonsSdk/SUI/SUI.AssetBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using Color = System.Drawing.Color;
using Debug = System.Diagnostics.Debug;
using Debugger = Il2CppSystem.Diagnostics.Debugger;
using Object = UnityEngine.Object;
Expand Down Expand Up @@ -59,7 +60,16 @@ private static void InitBundleContent()
{
if (asset.name is "atlas")
{
atlas = new TMP_SpriteAsset(asset.Pointer);
TMP_Settings.defaultSpriteAsset = new TMP_SpriteAsset(asset.Pointer);
continue;
}

if (asset.name is "forkawesome")
{
if (TMP_Settings.fallbackFontAssets == null)
TMP_Settings.fallbackFontAssets = new();
TMP_Settings.fallbackFontAssets.Add(new TMP_FontAsset(asset.Pointer));
RLog.Msg(Color.Orange, $"Loaded additional fallback font: {asset.name}");
continue;
}

Expand All @@ -73,7 +83,6 @@ private static void InitBundleContent()
GameResources.Sprites[asset.name] = new Sprite(asset.Pointer);
}

TMP_Settings.defaultSpriteAsset = atlas;
RLog.DebugBig("Loaded bundle content");
}
}
7 changes: 4 additions & 3 deletions SonsSdk/SUI/SettingsRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ SContainerOptions Wrap(SUiElement element, ConfigEntry config, Action customReve
.PHeight(65)
.Add(element)
.Add(SContainer.PWidth(100) -
SBgButton.Text("Revert")
SBgButton.Text("Revert").UpperCase().FontSize(16).FontColor("#c3ba8b")
.Background(ButtonBg)
.Ppu(3)
.Font(EFont.RobotoLight)
//.Font(EFont.RobotoLight)
.Notify(customRevertAction ?? config.ResetToDefault)
.Dock(EDockType.Fill)
.Margin(7, 0, 7, 7)
Expand Down Expand Up @@ -369,7 +369,7 @@ private void ValidateDividers()
if(_dividers.ContainsKey(cfg.CategoryName))
continue;

var divider = SLabelDivider.Text(cfg.CategoryName).FontColor("#ea2f4e40").OnClick(() =>
var divider = SLabelDivider.RichText("\uf0d7 " + cfg.CategoryName).FontColor("#ea2f4e40").OnClick(() =>
{
ToggleCategory(cfg.CategoryName, !_dividers[cfg.CategoryName].Item2);
} );
Expand Down Expand Up @@ -437,6 +437,7 @@ public void ToggleCategory(string identifier, bool show)

var tuple = _dividers[identifier];
tuple.Item2 = show;
tuple.Item1.RichText((show?"\uf0d7 ":"\uf0da ") + identifier);
_dividers[identifier] = tuple;
}
}
Expand Down

0 comments on commit 6810715

Please sign in to comment.