protected override void Update(GameTime gameTime)
        {
            UiState.Update();
            Shortcuts.Update();

            if (!GraphicsDevice.Viewport.Bounds.Contains(UiState.Mouse.Position))
            {
                _window.LastHitTest = null;
            }

            if (Modals.Count > 0)
            {
                Modals.Update();
                _waitForMouseUp = true;
                return;
            }

            if (!_waitForMouseUp)
            {
                _window.Update();
            }
            else
            {
                _waitForMouseUp = !MouseManager.AreAllUp();
            }
        }
 /// <summary>
 /// Useful for glossing, evening if tp doesn't have morphological Perfective
 /// </summary>
 /// <returns></returns>
 public bool IsPerfect()
 {
     if (Modals.Contains(Words.pini))
     {
         return(true);
     }
     return(false);
 }
        public static void Show(Point location, string text, Action onYes, string caption = "Are you sure?")
        {
            var strSize = _font.MeasureString(text);

            Modals.Add(new ConfirmationBox(
                           new Rectangle(
                               location.X,
                               location.Y,
                               Math.Max((int)strSize.X + Margin * 2, 150),
                               Math.Max((int)strSize.Y + Ui.CaptionHeight + ButtonHeight + 8 + Margin,
                                        Ui.CaptionHeight + ButtonHeight + Margin * 2)), caption, text, onYes));
        }
        public static void Show(Point location, string text, string caption = "Information")
        {
            var strSize = _font.MeasureString(text);

            Modals.Add(new MessageBox(
                           new Rectangle(
                               location.X,
                               location.Y,
                               Math.Max((int)strSize.X + Margin * 2, 100),
                               Math.Max((int)strSize.Y + Ui.CaptionHeight + ButtonHeight + 8 + Margin,
                                        Ui.CaptionHeight + ButtonHeight + Margin * 2)), caption, text));
        }
        internal void PushModal(View view)
        {
            try
            {
                Modals.Add(view);
                Content = view;

                OnContentChanged();
            }
            catch (System.Exception ex)
            {
                string title = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                BalizaFacil.App.Instance.UnhandledException(title, ex);
            }
        }
 protected void Click()
 {
     if (EditorMode)
     {
         var title      = EntityObject == null ? "Создание" : "Редактирование";
         var parameters = new ModalParameters();
         parameters.Add("EntityObject", EntityObject ?? new Entity());
         parameters.Add("Creating", EntityObject == null);
         Modals.Show <EntityEditor>(title, parameters);
     }
     else
     {
         if (EntityObject.Link != null)
         {
             Navigation.NavigateTo(EntityObject.Link);
         }
     }
 }
        private protected override void FillControl(ControlBase control, Context context)
        {
            DockLayout layout = new(control);

            rebind = new Button(layout)
            {
                Text = get().ToString(),
                Dock = Dock.Fill
            };

            rebind.Clicked += (_, _) => // Using pressed instead of clicked causes that the mouse is used as new bind.
            {
                CloseHandel modal = Modals.OpenBlockingModal(rebind, Language.PressAnyKeyOrButton);

                context.Input.ListenForAnyKeyOrButton(
                    keyOrButton =>
                {
                    modal.Close();

                    set(keyOrButton);
                    rebind.Text = keyOrButton.ToString();

                    Provider.Validate();
                });
            };

            Button resetBind = new(layout)
            {
                ImageName   = Source.GetIconName("reset"),
                Size        = new Size(width: 40, height: 40),
                ToolTipText = Language.Reset,
                Dock        = Dock.Right
            };

            resetBind.Pressed += (_, _) =>
            {
                reset();
                rebind.Text = get().ToString();
            };
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            _map.PreRender(_spriteBatch, _drawComponents);
            _uiRenderer.PreRender(_spriteBatch, Window.ClientBounds);
            for (var i = 0; i < _panelCount; i++)
            {
                _panels[i].PreRender(_spriteBatch, _drawComponents);
            }
            GraphicsDevice.SetRenderTarget(null);

            _spriteBatch.UsualBegin();

            _uiRenderer.DrawBackground(_spriteBatch);
            _window.Draw(_spriteBatch, _drawComponents);

            for (var i = 0; i < Modals.Count; i++)
            {
                Modals.Draw(i, _spriteBatch, _drawComponents);
            }

            _spriteBatch.UsualEnd();
        }
        internal void PopModal()
        {
            try
            {
                if (Pages.LastOrDefault() is IDisappearView view)
                {
                    view.OnDisappearing();
                }

                if (Modals.Count > 0)
                {
                    Modals.RemoveAt(Modals.Count - 1);
                }

                if (Modals.Count > 0)
                {
                    Content = Modals.Last();
                }
                else if (Pages.Count > 0)
                {
                    Content = Pages.Last();
                }
                else
                {
                    FlowManager.Instance.CloseApp();
                    return;
                }

                OnContentChanged();
            }
            catch (System.Exception ex)
            {
                string title = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                BalizaFacil.App.Instance.UnhandledException(title, ex);
            }
        }
 private void Close()
 {
     Modals.RemoveLast();
 }
Example #11
0
 public void Show(Point position)
 {
     SetRect(new Rectangle(position.X, position.Y, _cleanRect.Width, _cleanRect.Height));
     IsDirty = true;
     Modals.Add(this);
 }
Example #12
0
 public void Close()
 {
     Modals.RemoveLast();
 }
Example #13
0
        private void FillWorldList()
        {
            Debug.Assert(worldList != null);

            worldList.DeleteAllChildren();

            foreach ((WorldInformation info, string path) in worldProvider.Worlds)
            {
                GroupBox world = new(worldList)
                {
                    Text = info.Name
                };

                DockLayout layout = new(world);

                VerticalLayout infoPanel = new(layout)
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                Label date = new(infoPanel)
                {
                    Text = $"{info.Creation.ToLongDateString()} - {info.Creation.ToLongTimeString()}",
                    Font = Fonts.Small
                };

                Label version = new(infoPanel)
                {
                    Text      = info.Version,
                    Font      = Fonts.Small,
                    TextColor = GameInformation.Instance.Version == info.Version ? Color.Green : Color.Red
                };

                Label file = new(infoPanel)
                {
                    Text      = path,
                    Font      = Fonts.Path,
                    TextColor = Color.Grey
                };

                HorizontalLayout buttons = new(layout)
                {
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                Button load = new(buttons)
                {
                    ImageName   = Source.GetIconName("load"),
                    ImageSize   = new Size(width: 40, height: 40),
                    ToolTipText = Language.Load
                };

                Button delete = new(buttons)
                {
                    ImageName   = Source.GetIconName("delete"),
                    ImageSize   = new Size(width: 40, height: 40),
                    ToolTipText = Language.Delete
                };

                load.Pressed += (_, _) => worldProvider.LoadWorld(info, path);

                delete.Pressed += (_, _) => Modals.OpenBooleanModal(
                    this,
                    Language.DeleteWorldQuery,
                    () =>
                {
                    worldProvider.DeleteWorld(path);
                    Refresh();
                },
                    () => {});
            }
        }