public Screen(ConfirmationPopUp proxy, string title, string description, TimeSpan?timeout = null, MenuScreen underlyingMenuScreen = null) { this.proxy = proxy; this.underlyingMenuScreen = underlyingMenuScreen; underlyingMenuScreen?.DisableInput(); Game.UI.LoadLayoutToElement(MenuUIManager.MenuRoot, Game.ResourceCache, "UI/PopUpConfirmationLayout.xml"); this.popUpWindow = (Window)MenuUIManager.MenuRoot.GetChild("PopUpConfirmationWindow"); popUpWindow.Visible = true; popUpWindow.BringToFront(); using (var titleElem = (Text)popUpWindow.GetChild("Title", true)) { titleElem.Value = title; } using (var descriptionElem = (Text)popUpWindow.GetChild("Description", true)) { descriptionElem.Value = description; } confirmButton = (Button)popUpWindow.GetChild("ConfirmButton", true); confirmButton.Released += Button_Released; cancelButton = (Button)popUpWindow.GetChild("CancelButton", true); cancelButton.Released += Button_Released; taskSource = new TaskCompletionSource <bool>(); if (timeout != null) { timeoutCancel = new CancellationTokenSource(); Task.Delay(timeout.Value, timeoutCancel.Token).ContinueWith(TimeOutExpired, TaskContinuationOptions.NotOnCanceled); } }
protected MenuUIManager(IMenuController menuController) { MenuRoot = UI.Root; MenuRoot.SetDefaultStyle(Game.PackageManager.GetXmlFile("UI/MainMenuStyle.xml", true)); this.MenuController = menuController; MainMenu = new MainMenu(this); OptionsScreen = new OptionsScreen(this); PauseMenu = new PauseMenu(this); LoadingScreen = new LoadingScreen(this); SaveGameScreen = new SaveGameScreen(this); LoadGameScreen = new LoadGameScreen(this); PackagePickingScreen = new PackagePickingScreen(this); LevelPickingScreen = new LevelPickingScreen(this); LevelSettingsScreen = new LevelSettingsScreen(this); LevelCreationScreen = new LevelCreationScreen(this); SaveAsScreen = new SaveAsScreen(this); EndScreen = new EndScreen(this); AboutScreen = new AboutScreen(this); FileBrowsingPopUp = new FileSystemBrowsingPopUp(this); ConfirmationPopUp = new ConfirmationPopUp(this); ErrorPopUp = new ErrorPopUp(this); PreviousScreens = new Stack <MenuScreen>(); }