Detailed logo, smaller icons inside the casing frame, sliders and other widgets, EMI panels, list screens, in-game bug reports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4051a18f24
commit
ba4dbd1052
+42
-15
@@ -10,11 +10,13 @@ What it writes:
|
||||
config/fancymenu/customization/ layouts, built here from fancymenu_template.txt:
|
||||
createrp_title.txt the title screen
|
||||
createrp_screens.txt connecting / loading / disconnected screens: our background and logo
|
||||
createrp_lists.txt server list, world list and their dialogs: our background
|
||||
createrp_pause.txt the game menu
|
||||
config/fancymenu/custom_gui_screens.txt the game menu is our own screen that replaces Minecraft's one, so that
|
||||
buttons other mods add to the pause screen (Mods, Create) never get into it
|
||||
config/fancymenu/customizablemenus.txt, options.txt which screens are customised; window title and icon
|
||||
kubejs/assets/minecraft/…/widget/ button sprites for the whole game: andesite casing, brass under the cursor
|
||||
kubejs/assets/… branding/resources/…: sprites for the whole game (buttons, sliders, separators,
|
||||
the language icon, EMI's panels) — andesite casing, brass under the cursor
|
||||
config/create-client.toml Create's own button is taken out of the title screen and the game menu
|
||||
"""
|
||||
import re
|
||||
@@ -31,7 +33,7 @@ ROOT = Path(__file__).resolve().parent.parent.parent
|
||||
sys.path.insert(0, str(ROOT / 'tools' / 'signs'))
|
||||
from render import BASELINE, LINE_H, Font # noqa: E402 (the pixel font reader made for the building signs)
|
||||
|
||||
MENU, ICONS, UI = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons', ROOT / 'branding' / 'ui'
|
||||
MENU, ICONS, RESOURCES = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons', ROOT / 'branding' / 'resources'
|
||||
WINDOW_TITLE = 'Create RP'
|
||||
HOST = 'create.fulldroper.ks.ua'
|
||||
GIT = 'https://git.fulldroper.ks.ua/Pinecraft-CreateRP/client'
|
||||
@@ -39,9 +41,15 @@ LATEST_RELEASE = 'https://git.fulldroper.ks.ua/api/v1/repos/Pinecraft-CreateRP/c
|
||||
ASSET = '[source:local]/config/fancymenu/assets/'
|
||||
SCREENS = 'net.minecraft.client.gui.screens.'
|
||||
# screens that get our background and logo: (FancyMenu's name, class)
|
||||
PLAIN_SCREENS = [('connect_screen', 'ConnectScreen'), ('disconnected_screen', 'DisconnectedScreen'),
|
||||
('generic_dirt_message_screen', 'GenericMessageScreen'), ('receiving_level_screen', 'ReceivingLevelScreen'),
|
||||
('progress_screen', 'ProgressScreen'), ('level_loading_screen', 'LevelLoadingScreen')]
|
||||
PLAIN_SCREENS = [('connect_screen', SCREENS + 'ConnectScreen'), ('disconnected_screen', SCREENS + 'DisconnectedScreen'),
|
||||
('generic_dirt_message_screen', SCREENS + 'GenericMessageScreen'),
|
||||
('receiving_level_screen', SCREENS + 'ReceivingLevelScreen'),
|
||||
('progress_screen', SCREENS + 'ProgressScreen'), ('level_loading_screen', SCREENS + 'LevelLoadingScreen')]
|
||||
# screens with lists, a title and a search box: only our background, the logo would cover them
|
||||
LIST_SCREENS = [('join_multiplayer_screen', SCREENS + 'multiplayer.JoinMultiplayerScreen'),
|
||||
('select_world_screen', SCREENS + 'worldselection.SelectWorldScreen'),
|
||||
('direct_join_server_screen', SCREENS + 'DirectJoinServerScreen'),
|
||||
('edit_server_screen', SCREENS + 'EditServerScreen')]
|
||||
PAUSE_GUI = 'createrp_pause'
|
||||
|
||||
|
||||
@@ -185,9 +193,15 @@ class Layout:
|
||||
|
||||
|
||||
# --- the screens ------------------------------------------------------------------------------------------------------
|
||||
def logo_size() -> tuple:
|
||||
w, h = Image.open(MENU / 'logo.png').size
|
||||
return w // 3, h // 3
|
||||
|
||||
|
||||
def title_screen(version: str, labels: dict) -> Layout:
|
||||
lay = Layout('title', 'title_screen', background='background.png', fireflies=True)
|
||||
lay.image('logo.png', 'mid-centered', -110, -104, 221, 60)
|
||||
lw, lh = logo_size()
|
||||
lay.image('logo.png', 'mid-centered', -(lw // 2), -44 - lh, lw, lh)
|
||||
# a button-high gap under the logo, then rows 24 apart
|
||||
lay.button('mid-centered', -100, -24, 200, label='Грати', action=('joinserver', HOST), active=server('online'))
|
||||
for state, tip in (('online', 'Сервер онлайн'), ('maintenance', 'Технічні роботи'), ('offline', 'Сервер офлайн')):
|
||||
@@ -225,17 +239,27 @@ def plain_screens() -> Layout:
|
||||
"""Connecting, loading terrain, disconnected and the like: the dimmed key art and the logo at the top."""
|
||||
lay = Layout('screens', '%fancymenu:universal_layout%', background='background_dim.png',
|
||||
whitelist=[name for name, _ in PLAIN_SCREENS])
|
||||
lay.image('logo.png', 'top-centered', -110, 16, 221, 60)
|
||||
lw, lh = logo_size()
|
||||
lay.image('logo.png', 'top-centered', -(lw // 2), 16, lw, lh)
|
||||
return lay
|
||||
|
||||
|
||||
def list_screens() -> Layout:
|
||||
return Layout('lists', '%fancymenu:universal_layout%', background='background_dim.png',
|
||||
whitelist=[name for name, _ in LIST_SCREENS])
|
||||
|
||||
|
||||
def game_menu() -> Layout:
|
||||
lay = Layout('pause', PAUSE_GUI)
|
||||
lay.image('logo.png', 'mid-centered', -110, -112, 221, 60)
|
||||
lw, lh = logo_size()
|
||||
lay.image('logo.png', 'mid-centered', -(lw // 2), -52 - lh, lw, lh)
|
||||
lay.button('mid-centered', -102, -28, 204, label='Назад до гри', action=('closegui', ''))
|
||||
lay.button('mid-centered', -102, -4, 100, label='Залишити відгук', active=NEVER)
|
||||
lay.button('mid-centered', 2, -4, 100, label='Знайшов баг?', action=('paste_to_chat', 'false:/bug '),
|
||||
tooltip='Опиши, що сталося, і натисни Enter — розробники отримають задачу з твоїм ніком і місцем у світі',
|
||||
visible=[(SERVER_IP, 'if', HOST)])
|
||||
lay.button('mid-centered', 2, -4, 100, label='Знайшов баг?', action=('openlink', GIT + '/issues/new'),
|
||||
tooltip='Відкриє в браузері сторінку створення задачі в нашому Git')
|
||||
tooltip='Відкриє в браузері сторінку створення задачі в нашому Git', visible=[(SERVER_IP, 'if_not', HOST)])
|
||||
lay.button('mid-centered', -102, 20, 100, label='Налаштування...', action=('opengui', SCREENS + 'options.OptionsScreen'))
|
||||
lay.button('mid-centered', 2, 20, 100, label='Скарги на гравців', active=NEVER)
|
||||
# leaving: from our server straight to the title screen, from another one to the server list as usual
|
||||
@@ -297,11 +321,12 @@ def main() -> None:
|
||||
shutil.copyfile(ICONS / icon, fm / 'assets' / icon)
|
||||
|
||||
(fm / 'customization' / 'title_screen_layout.txt').unlink(missing_ok=True) # the name used before the generator
|
||||
for name, layout in (('title', title_screen(version, labels)), ('screens', plain_screens()), ('pause', game_menu())):
|
||||
for name, layout in (('title', title_screen(version, labels)), ('screens', plain_screens()), ('lists', list_screens()),
|
||||
('pause', game_menu())):
|
||||
(fm / 'customization' / f'createrp_{name}.txt').write_text(layout.text(), encoding='utf-8', newline='\n')
|
||||
(fm / 'custom_gui_screens.txt').write_text(CUSTOM_GUIS, encoding='utf-8', newline='\n')
|
||||
(fm / 'customizablemenus.txt').write_text(
|
||||
'type = customizablemenus\n\n' + ''.join(f'{SCREENS}{c} {{\n}}\n\n' for c in ['TitleScreen'] + [c for _, c in PLAIN_SCREENS]),
|
||||
'type = customizablemenus\n\n' + ''.join(f'{c} {{\n}}\n\n' for c in [SCREENS + 'TitleScreen'] + [c for _, c in PLAIN_SCREENS + LIST_SCREENS]),
|
||||
encoding='utf-8', newline='\n')
|
||||
|
||||
options = (fm / 'options.txt').read_text(encoding='utf-8')
|
||||
@@ -311,12 +336,14 @@ def main() -> None:
|
||||
options = option(options, 'custom_window_icon_32', '/config/fancymenu/assets/favicon-32x32.png')
|
||||
options = option(options, 'custom_window_icon_macos', '')
|
||||
options = option(options, 'global_background_panorama', '')
|
||||
options = option(options, 'global_menu_background_texture', ASSET + 'background_dim.png') # every other menu screen
|
||||
(fm / 'options.txt').write_text(options, encoding='utf-8')
|
||||
|
||||
sprites = config.parent / 'kubejs' / 'assets' / 'minecraft' / 'textures' / 'gui' / 'sprites' / 'widget'
|
||||
sprites.mkdir(parents=True, exist_ok=True)
|
||||
for sprite in UI.iterdir(): # button.png, button_highlighted.png, button_disabled.png and their .mcmeta
|
||||
shutil.copyfile(sprite, sprites / sprite.name)
|
||||
for source in RESOURCES.rglob('*'): # branding/resources/<namespace>/… → kubejs/assets/<namespace>/…
|
||||
if source.is_file():
|
||||
target = config.parent / 'kubejs' / 'assets' / source.relative_to(RESOURCES)
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(source, target)
|
||||
|
||||
create = config / 'create-client.toml' # Create draws its button itself; row 0 switches it off
|
||||
if create.is_file():
|
||||
|
||||
Reference in New Issue
Block a user