protected override void OnInitialize() { _connectionStatusText = UIComponent.GetUI(ConnectionStatusText); _connectionErrorContent = UIComponent.GetUI(ConnectionErrorContent); _connectionErrorText = UIComponent.GetUI(ConnectionErrorText); _backButton = UIComponent.GetUI(BackButton); _backButton.Click += (sender, e) => { Debug.Assert(UIManager.TopPageHandler == this); UIManager.PopTopScreen(); }; var sceneManager = SceneSystem.GetSceneManagerFromRootScene(); _sceneHandler = sceneManager.ActiveMainSceneHandler as TitleScreenSceneHandler; Debug.Assert(_sceneHandler != null); _sceneHandler.ConnectionStateChanged += OnConnectionStateChanged; _sceneHandler.ConnectionError += OnConnectionError; }
protected override void OnDeinitialize() { _sceneHandler.ConnectionStateChanged -= OnConnectionStateChanged; _sceneHandler.ConnectionError -= OnConnectionError; _sceneHandler = null; }