SeafrogHan is a complete Chinese localization mod for Seafrog. The game enforces CRC checks on its asset bundles, making direct file modification impossible. To bypass this limitation, the project relies on runtime patching to intercept and replace text directly within Unity's TextMeshPro components. The repository includes the C# injection code, the translation maps, and the Python toolchain required to generate pixel-perfect custom fonts.
- Chain of Responsibility Pattern: Translation matching relies on a series of distinct handlers. Because the game features complex and dynamic runtime text contexts, we pass string evaluation through a structured sequence in the
Handler/directory until a translation condition is successfully met. - Runtime Hooking: The core logic intercepts Unity
TextMeshProrendering events just in time. This functions essentially like a runtime proxy, trapping and redefining fundamental operations on text objects without ever touching the original game assemblies. - Pixel-Perfect Image Post-Processing: Replicating the vanilla game's jagged font style requires stripping out automatic anti-aliasing. We run Python scripts (
scripts/fix.pyandscripts/normalize.py) to convert blurred alpha edges into pure binary colors.
- BepInEx: The standard injection framework for Unity modding. Serves as the plugin entry point and module loader.
- HarmonyLib: A library for patching, replacing, and decorating .NET methods during runtime.
- UnityPy: A powerful Python library for extracting and manipulating Unity asset bundles programmatically.
- fnt2TMPro: A specialized utility for turning
.fntfiles into standard Unity TextMeshPro assets. - ParaTranz: The collaborative localization platform managing the translated string data.
We use five primary typefaces: KN Maiyuan, KN Maiyuan BlueWhiteStroke, KN Maiyuan WhiteStroke, AaHuanMengKongJianXiangSuTi SDF, and ZhanKuKuHei SDF. Generating the jagged-edge variants requires a strict pipeline:
- We extract the required display characters using Python.
- We generate the
.fntconfiguration using Snowb. For stroke variants like KN Maiyuan BlueWhiteStroke, must set properties accurately: Font Size32, Line Height28, Padding3, Spacing3, Stroke Width2(outer with Round cap/join), and adjusting fixed canvas size (Width/Height:2048x2048). - We run our Python processing scripts to binarize the
.pngoutput colors into jagged, clear edges. - Using Unity Editor
2020.3.49f1c1, we process the fonts into TextMeshPro format viafnt2TMPro.- Requirements: The Unity image settings demand
RGBA 32 bit,Full Rect, and aPointfilter without compression. The shaders must be set toTextMeshPro/Spriteto preserve the original image colors. Both padding and bundle sizing (e.g.,2048x2048, padding5) are adjusted to maintain clarity across device resolutions.
- Requirements: The Unity image settings demand
- We package the fonts into bundles via the Asset Bundle Browser and load them out of the game's
Bepinex/plugins/resourcesdirectory.
SeafrogHan/
├── Handler/ # Chain of Responsibility translation modules
│ ├── ITranslationHandler.cs # Interface defining the handler contract
│ ├── TranslationContext.cs # Evaluation state passed through the chain
│ ├── TranslationHandlerBase.cs # Base class for shared handler logic
│ └── [...Other Handlers].cs # Specific matching logic (e.g., MapEntityHandler)
├── resources/ # Language data and reference files
│ ├── cur_characters.txt # Exported character list for font mapping
│ └── *.csv # Raw translation dictionaries pulled from ParaTranz
├── scripts/ # Automation pipeline for packaging and manipulation
│ ├── extract_*.py # Scripts to scrape text and metadata from Unity assets
│ ├── fix.py # Removes anti-aliasing from base font imagery
│ └── normalize.py # Binarizes color output for the stroke font variants
├── LICENSE # Project license (GNU LGPLv2.1)
├── MissingStringTracker.cs # Utility component for logging untranslated text during testing
├── Plugin.cs # BepInEx entry point and Harmony patching orchestrator
├── ResourceLoader.cs # Custom asset bundle loader for injecting external fonts
├── SeafrogHan.csproj # .NET 6.0 build configuration
└── TranslationManager.cs # Core module initializing and querying CSV dictionaries
This project is licensed under the GNU Lesser General Public License v2.1.
Note: This project is for educational purposes only. Please support the original game.