Teardown

Teardown

Electronic Sign
wu_dl  [developer] 29 Jun, 2023 @ 5:40am
Localization Request
Hello guys, I've added multi-lingual support to the editor besides the default English/Character input. Non-textable elements are picked and rendered in form of images, things like glyphs and emojis that can be transformed into .PNG files would be available.
Pull Requests
If you have localization demand or anything willing to be displayed, please leave your comment below.
Merge
If you want to submit your own set of display items, here's the info.
File Structure
MOD ├─...(other files) │ ├─locale │ └─zh_CN (locale name) │ ├─a (Pinyin, the code of Chinese character pronunciation) │ │ ├─1 (tone) │ │ │ 1.png (indexed from 1) │ │ │ ... (other index.png) │ │ │ │ │ └─... (other tones) │ │ │ └─...(other codes) │ ├─models │ ... │ ├─prefabs │ ... │ ├─resources │ ... │ └─scripts char_picker.lua context_menu.lua screen.lua sign_editor.lua ... (other aux scripts)
  • File Forming & Naming: Use zh_CN for instance, the Prompt Menu switches locale, the Search Box in the UI gives pronunciation code + tone, and Picker pinpoints the index. Your directory form and file naming should comply with this standard and can be altered according to your language or content.
Scripting
You can refer to the scripts and modify them. The shape of the sign board has the tags below (all String type):
  • "locale": Current locale code, same to the name of locale folder like "en_US", "zh_CN".
  • "row[n]_content" (n for row index, currently 1~3): Display contents of the screen, for English/Characters it's the string itself with all Spaces(' ') substituted for Underline('_'), for non-textable ones it's the paths of images wrapped in a pair of '\' then concatenated as a whole string, like:
    \MOD/locale/zh_CN/a/1/1.png\\MOD/locale/zh_CN/a/1/1.png\\...\
  • "row[n]_display": Display mode, "static"=Static, "roll_l"=Rolling Left, "roll_r"=Rolling Right
The scripts then manipulate those tags and draw the UI, here are some briefings:
  • screen.lua: Invoked by screens. Get display contents & mode and draw them.
  • char_picker.lua: Invoked by sign_editor.lua, drawing the Picker in the UI.
  • context_menu.lua: Invoked by sign_editor.lua, drawing the Prompt Menu in the UI after clicking the "More..." button.
  • sign_editor.lua: Main script, drawing all other UI contents and processing data.
You may open and check the scripts for detail.
Image Processing
The glyph images I used for zh_CN were from a fontset generator. I wrote a Python script to facilitate batch processes such as categorizing images and making their backgrounds transparent. You can get it and the source glyphs(zh_CN) from my Github Repo[github.com]. Images should be with White(#FFFFFF) foreground and transparent background.
Last edited by wu_dl; 30 Jun, 2023 @ 4:48am