diff --git a/Sledgemapper.Shared/Entities/Note.cs b/Sledgemapper.Shared/Entities/Note.cs new file mode 100644 index 0000000..6dac5bb --- /dev/null +++ b/Sledgemapper.Shared/Entities/Note.cs @@ -0,0 +1,11 @@ +namespace Sledgemapper.Shared.Entities +{ + + + public class Note :BaseMapEntity + { + public string Text { get; set; } + } + + +} diff --git a/Sledgemapper/Sledgemapper.cs b/Sledgemapper/Sledgemapper.cs index f5ea365..8aab4a9 100644 --- a/Sledgemapper/Sledgemapper.cs +++ b/Sledgemapper/Sledgemapper.cs @@ -197,6 +197,55 @@ namespace Sledgemapper } } + if (mouseState.RightButton == ButtonState.Released && mouseState.RightButton != oldMouseState.RightButton) + { + var contextMenu = new TextButton { Text = "New Note" }; + contextMenu.Click += (s, e) => + { + _desktop.HideContextMenu(); + var noteWindow = new NoteWindow(); + Window window = new() + { + Title = "Note" + }; + + // var content = new LoginRegisterWindow(); + // content.RdoLogin.IsPressed = true; + // content.RdoLogin.Click += (s, e) => + // { + // content.TxtFirstname.Visible = false; + // content.TxtLastname.Visible = false; + // content.TxtInitials.Visible = false; + // content.LblFirstname.Visible = false; + // content.LblLastname.Visible = false; + // content.LblInitials.Visible = false; + // content.BtnLogin.Visible = true; + // content.BtnRegister.Visible = false; + // window.Title = "Login"; + // }; + + // content.RdoRegister.Click += (s, e) => + // { + // content.TxtFirstname.Visible = true; + // content.TxtLastname.Visible = true; + // content.TxtInitials.Visible = true; + // content.LblFirstname.Visible = true; + // content.LblLastname.Visible = true; + // content.LblInitials.Visible = true; + // content.BtnLogin.Visible = false; + // content.BtnRegister.Visible = true; + // window.Title = "Register"; + // }; + + // content.BtnRegister.Click += OnButtonRegisterClick; + // content.BtnLogin.Click += OnButtonLoginClick; + + window.Content = noteWindow; + window.ShowModal(_desktop); + }; + _desktop.ShowContextMenu(contextMenu, mouseState.Position); + } + if (newState.IsKeyDown(Keys.LeftControl) && mouseState.LeftButton == ButtonState.Pressed && ((mouseState.LeftButton != oldMouseState.LeftButton) || (_state.SelectedTile.X != _state.HoveredTile.X && _state.SelectedTile.Y != _state.HoveredTile.Y))) diff --git a/Sledgemapper/UI/NoteWindow.Generated.cs b/Sledgemapper/UI/NoteWindow.Generated.cs new file mode 100644 index 0000000..4627877 --- /dev/null +++ b/Sledgemapper/UI/NoteWindow.Generated.cs @@ -0,0 +1,77 @@ +/* Generated by MyraPad at 29/11/2020 23:51:26 */ +using Myra.Graphics2D; +using Myra.Graphics2D.TextureAtlases; +using Myra.Graphics2D.UI; +using Myra.Graphics2D.Brushes; + +#if !STRIDE +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +#else +using Stride.Core.Mathematics; +#endif + +namespace Sledgemapper.UI +{ + partial class NoteWindow: Grid + { + private void BuildUI() + { + NoteText = new TextBox(); + NoteText.Multiline = true; + NoteText.Wrap = true; + NoteText.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; + NoteText.Id = "NoteText"; + + var scrollViewer1 = new ScrollViewer(); + scrollViewer1.Content = NoteText; + + BtnCancel = new TextButton(); + BtnCancel.Text = "Cancel"; + BtnCancel.Width = 70; + BtnCancel.Height = 20; + BtnCancel.Padding = new Thickness(5); + BtnCancel.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; + BtnCancel.Id = "BtnCancel"; + + BtnOk = new TextButton(); + BtnOk.Text = "Ok"; + BtnOk.Width = 70; + BtnOk.Height = 20; + BtnOk.Padding = new Thickness(5); + BtnOk.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; + BtnOk.Id = "BtnOk"; + + var horizontalStackPanel1 = new HorizontalStackPanel(); + horizontalStackPanel1.Spacing = 10; + horizontalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right; + horizontalStackPanel1.GridRow = 1; + horizontalStackPanel1.Widgets.Add(BtnCancel); + horizontalStackPanel1.Widgets.Add(BtnOk); + + + RowSpacing = 13; + ColumnsProportions.Add(new Proportion + { + Type = Myra.Graphics2D.UI.ProportionType.Fill, + }); + RowsProportions.Add(new Proportion + { + Type = Myra.Graphics2D.UI.ProportionType.Fill, + }); + RowsProportions.Add(new Proportion + { + Type = Myra.Graphics2D.UI.ProportionType.Auto, + }); + Width = 400; + Height = 300; + Widgets.Add(scrollViewer1); + Widgets.Add(horizontalStackPanel1); + } + + + public TextBox NoteText; + public TextButton BtnCancel; + public TextButton BtnOk; + } +} \ No newline at end of file diff --git a/Sledgemapper/UI/NoteWindow.cs b/Sledgemapper/UI/NoteWindow.cs new file mode 100644 index 0000000..cd5e4bf --- /dev/null +++ b/Sledgemapper/UI/NoteWindow.cs @@ -0,0 +1,11 @@ +/* Generated by MyraPad at 29/11/2020 23:50:42 */ +namespace Sledgemapper.UI +{ + public partial class NoteWindow + { + public NoteWindow() + { + BuildUI(); + } + } +} \ No newline at end of file diff --git a/Sledgemapper/UI/noteWindow.xml b/Sledgemapper/UI/noteWindow.xml new file mode 100644 index 0000000..f31c4d0 --- /dev/null +++ b/Sledgemapper/UI/noteWindow.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file