Lyall / HundredHeroesFix

A BepInEx plugin for Eiyuden Chronicle: Hundred Heroes that adds custom resolutions, ultrawide/narrower support and more.
MIT License
24 stars 4 forks source link

[Feature Request] Adjust Font Size #19

Open richardziegler opened 6 months ago

richardziegler commented 6 months ago

Hello! Thanks for your work on this mod!

Have you looked into adding an option to adjust the font size? I know that the assets for dialogue boxes won't scale with it but I am interested in what can be done here.

Also: I am a software dev and would love to spend some time looking at this myself and contribute if possible! I'm happy to chat on Discord about this if you're open to it!

Lyall commented 6 months ago

It's do-able for sure but like you said, if you just increase the font size then it will go out of the bounds of the text-bubble.

For example, this

// Set text size
[HarmonyPatch(typeof(Scenario.UI.UIConversation), nameof(Scenario.UI.UIConversation.SetText))]
[HarmonyPostfix]
public static void SetTextSize(Scenario.UI.UIConversation __instance)
{
    Log.LogInfo($"Increasing font size.");
    __instance.TextData._text.fontSize *= 2;
}

Gets you this: EiyudenChronicle_2024_05_11_23_33_11_968

Lyall commented 6 months ago

What might be better is to raise the scale of the conversation window. For example here's the vanilla game vs 1.4x scale on the conversation window.

EiyudenChronicle_2024_05_11_23_40_58_207 EiyudenChronicle_2024_05_11_23_41_04_983

richardziegler commented 6 months ago

What might be better is to raise the scale of the conversation window. For example here's the vanilla game vs 1.4x scale on the conversation window.

EiyudenChronicle_2024_05_11_23_40_58_207

EiyudenChronicle_2024_05_11_23_41_04_983

This looks incredible! I was worried there would need to be asset replacements and was starting analysis on Ghidra for RE too.

I'm about to travel for work so I'll try getting a PR open for that once I get back if you haven't already 🙂

richardziegler commented 5 months ago

What might be better is to raise the scale of the conversation window. For example here's the vanilla game vs 1.4x scale on the conversation window.

EiyudenChronicle_2024_05_11_23_40_58_207 EiyudenChronicle_2024_05_11_23_41_04_983

Hey hey, I'm back from my trip. Do you happen to remember what class the scale property was in? (Or if it was just a single property at all.) I've dug through these classes and was able to change the width of the Conversation window but scaling the whole thing I've come up dry. image

Lyall commented 5 months ago

Hey hey, I'm back from my trip. Do you happen to remember what class the scale property was in? (Or if it was just a single property at all.) I've dug through these classes and was able to change the width of the Conversation window but scaling the whole thing I've come up dry. image

Sorry I should have posted the code snippet responsible for the previous result. It would look a little something like this:

// Increase size of conversation window
[HarmonyPatch(typeof(Scenario.UI.UIConversationGroup), nameof(Scenario.UI.UIConversationGroup.Initialize))]
[HarmonyPostfix]
public static void SetTextSize(Scenario.UI.UIConversationGroup __instance)
{
    Log.LogInfo($"Increasing size of conversation window.");
    __instance.GetComponent<RectTransform>().localScale = new Vector3(1.4f, 1.4f, 1f);
}

That would get you a 1.4x increase on the size of the conversation window.

richardziegler commented 5 months ago

Hey hey, I'm back from my trip. Do you happen to remember what class the scale property was in? (Or if it was just a single property at all.) I've dug through these classes and was able to change the width of the Conversation window but scaling the whole thing I've come up dry. image

Sorry I should have posted the code snippet responsible for the previous result. It would look a little something like this:

// Increase size of conversation window
[HarmonyPatch(typeof(Scenario.UI.UIConversationGroup), nameof(Scenario.UI.UIConversationGroup.Initialize))]
[HarmonyPostfix]
public static void SetTextSize(Scenario.UI.UIConversationGroup __instance)
{
    Log.LogInfo($"Increasing size of conversation window.");
    __instance.GetComponent<RectTransform>().localScale = new Vector3(1.4f, 1.4f, 1f);
}

That would get you a 1.4x increase on the size of the conversation window.

Many thanks! I opened a PR for this functionality after implementing and testing. I appreciate you working through this with me to get it in. 😊

Lyall commented 5 months ago

I've just put out v0.9.8 with your patch included.

richardziegler commented 5 months ago

I've just put out v0.9.8 with your patch included.

Woo! Thanks! I want to see if I can detect when the conversation window size increase pushes it off the edge of the screen and then reposition it a bit to fit it inside the screen bounds. If I figure that out I'll open a new PR for that improvement too. 😊

edale2 commented 5 months ago

Is it possible to scale size of these conversation windows in the corner of the screen (preferably independently of the scaling that's already been done)? I typically don't even notice them until the conversations are 1/2 over with how small and out of the way they are.

image

richardziegler commented 5 months ago

Is it possible to scale size of these conversation windows in the corner of the screen (preferably independently of the scaling that's already been done)? I typically don't even notice them until the conversations are 1/2 over with how small and out of the way they are.

image

I imagine they should be. I will try to find time this week to look into it. 🙂

richardziegler commented 5 months ago

@edale2 Do you have a save file in a good spot where you know those conversations will happen? To not give any spoilers, I'm at a weird part in the game so I don't know when the next time I'll have some of those are. So having a save file in a good testing spot would help me nail down what UI component that is.

edale2 commented 5 months ago

https://mega.nz/file/XExXQY6A#lZquWldwT3vFyCqANyYIp6O21vlvqcPkNhrOdf5ZeAs

Save data location: C:\Users\ [username]\AppData\LocalLow\505 Games S_p_A\EiyudenChronicle\GOGSave\SaveData (may be different for Steam version)

Save slot 2. Right at the beginning of the game. Just exit the inn, leave town, dismiss the worldmap tutorial screen, and take a few steps away from the town to trigger a 2 or 3 line dialog.

After that dialog, Enter Fort Xialuke to the south, and you'll trigger a much longer set of dialog.

And after that dialog, you can go back to the worldmap, then go North to the Northern Forest, and after a short cutscene another longer dialog will start.

that'll give you one on the worldmap, one in a dungeon, and one in a "town" (insomuch as the Fort can be considered a town).

edale2 commented 4 months ago

@richardziegler Any progress on resizing those text boxes?