Jo Jo funguje Kappa
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user