Jo Jo funguje Kappa

This commit is contained in:
Dominik G.
2025-10-06 18:15:27 +02:00
parent 807e8fc5f3
commit 515160b1ec
11 changed files with 3103 additions and 76 deletions

View File

@@ -45,6 +45,8 @@ namespace MegaKoop.UI
private Button applyButton;
private Button backButton;
private bool _initialized;
private void OnEnable()
{
// Získání UI Document
@@ -57,11 +59,11 @@ namespace MegaKoop.UI
enabled = false;
return;
}
// Získání MultiplayerLobbyController
if (multiplayerLobbyController == null)
multiplayerLobbyController = GetComponent<MultiplayerLobbyController>();
root = uiDocument.rootVisualElement;
if (root == null)
{
@@ -69,20 +71,34 @@ namespace MegaKoop.UI
enabled = false;
return;
}
// Initialize only after attached to a panel to avoid DPI/pixelsPerPoint issues
root.RegisterCallback<AttachToPanelEvent>(OnAttachedToPanel);
if (root.panel != null)
{
// Already attached (domain reload case)
OnAttachedToPanel(default);
}
}
private void OnAttachedToPanel(AttachToPanelEvent evt)
{
if (_initialized) return;
_initialized = true;
// Přidání USS stylů (pokud nejsou už v UXML)
if (mainMenuStyles != null && !root.styleSheets.Contains(mainMenuStyles))
{
root.styleSheets.Add(mainMenuStyles);
}
// Inicializace UI elementů
InitializeMenuButtons();
InitializeSettingsPanel();
// Registrace event handlerů
RegisterButtonEvents();
// Načtení nastavení
LoadSettings();
}