private static async Task <bool> ShowDialogAsync(ModalDialogBase dialog) { if (dialog != null) { return(await dialog.ShowDialogAsync() == true); } return(false); }
public MainScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; _uiState = serviceScope.GetRequiredService <ISectorUiState>(); _player = serviceScope.GetRequiredService <IPlayer>(); _transitionPool = serviceScope.GetRequiredService <ITransitionPool>(); _animationBlockerService = serviceScope.GetRequiredService <IAnimationBlockerService>(); var uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); _camera = new Camera(); _personEffectsPanel = new PersonConditionsPanel(_uiState, screenX: 8, screenY: 8, uiContentStorage: uiContentStorage); _personEquipmentModal = new PersonPropsModalDialog( uiContentStorage, game.GraphicsDevice, _uiState, ((LivGame)game).ServiceProvider); _personStatsModal = new PersonStatsModalDialog( uiContentStorage, game.GraphicsDevice, _uiState); _containerModal = new ContainerModalDialog( _uiState, uiContentStorage, Game.GraphicsDevice, serviceScope); var humanActorTaskSource = serviceScope.GetRequiredService <IHumanActorTaskSource <ISectorTaskSourceContext> >(); var mainPerson = _player.MainPerson; if (mainPerson is null) { throw new InvalidOperationException("Main person is not initalized. Generate globe first."); } _bottomMenu = new BottomMenuPanel( humanActorTaskSource, mainPerson.GetModule <ICombatActModule>(), uiContentStorage, mainPerson.GetModule <IEquipmentModule>(), _uiState); _bottomMenu.PropButtonClicked += BottomMenu_PropButtonClicked; _bottomMenu.StatButtonClicked += BottomMenu_StatButtonClicked; }
public static bool ShowModal(ModalDialogBase dialog) { var wnd = GetInstance(); wnd.ModalsContainer.Children.Add(dialog); dialog.Owner = wnd; dialog.SetParent(wnd.MainContent); dialog.ModalShow += wnd.OnModalShow; dialog.ModalClose += wnd.OnModalClose; var result = dialog.ShowHandlerDialog(); dialog.Owner = null; dialog.SetParent(null); dialog.ModalShow -= wnd.OnModalShow; dialog.ModalClose -= wnd.OnModalClose; wnd.ModalsContainer.Children.Remove(dialog); return(result); }
void DestroyDialog(ModalDialogBase dialog) { Destroy(dialog.gameObject); }