more notes functionalities
This commit is contained in:
parent
1e244795fc
commit
6d607b6d02
5 changed files with 38 additions and 15 deletions
|
@ -156,6 +156,8 @@ namespace Sledgemapper
|
||||||
item.LblNoteText.Text = $"{note.ToString()} - {note.Text}";
|
item.LblNoteText.Text = $"{note.ToString()} - {note.Text}";
|
||||||
item.BtnNoteCenter.Image = new TextureRegion(_location);
|
item.BtnNoteCenter.Image = new TextureRegion(_location);
|
||||||
item.BtnNoteView.Image = new TextureRegion(_eye);
|
item.BtnNoteView.Image = new TextureRegion(_eye);
|
||||||
|
item.BtnNoteCenter.Click += (s, e) => { CenterOnTile(note.X, note.Y); };
|
||||||
|
item.BtnNoteView.Click += (s, e) => { EditNote(note); window.Close(); };
|
||||||
content.StackNotesList.AddChild(item);
|
content.StackNotesList.AddChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +165,23 @@ namespace Sledgemapper
|
||||||
window.ShowModal(_desktop);
|
window.ShowModal(_desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditNote(Note note)
|
||||||
|
{
|
||||||
|
_state.SelectedNote = note;
|
||||||
|
var noteWindow = new NoteWindow();
|
||||||
|
|
||||||
|
Window window = new()
|
||||||
|
{
|
||||||
|
Title = $" Note on {note.X}:{note.Y}"
|
||||||
|
};
|
||||||
|
noteWindow.NoteText.Text = note.Text;
|
||||||
|
noteWindow.BtnOk.Click += OnButtonNoteOkClick;
|
||||||
|
noteWindow.BtnCancel.Click += OnButtonNoteCancelClick;
|
||||||
|
|
||||||
|
window.Content = noteWindow;
|
||||||
|
window.ShowModal(_desktop);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
KeyboardState newState = Keyboard.GetState();
|
KeyboardState newState = Keyboard.GetState();
|
||||||
|
@ -227,8 +246,8 @@ namespace Sledgemapper
|
||||||
|
|
||||||
if (mouseState.RightButton == ButtonState.Released && mouseState.RightButton != oldMouseState.RightButton)
|
if (mouseState.RightButton == ButtonState.Released && mouseState.RightButton != oldMouseState.RightButton)
|
||||||
{
|
{
|
||||||
_state.SelectedTile.X = _state.HoveredTile.X;
|
_state.SelectedNote.X = _state.HoveredTile.X;
|
||||||
_state.SelectedTile.Y = _state.HoveredTile.Y;
|
_state.SelectedNote.Y = _state.HoveredTile.Y;
|
||||||
|
|
||||||
var contextMenu = new TextButton { Text = "New Note" };
|
var contextMenu = new TextButton { Text = "New Note" };
|
||||||
contextMenu.Click += OnContextMenuNewNoteClick;
|
contextMenu.Click += OnContextMenuNewNoteClick;
|
||||||
|
@ -913,11 +932,11 @@ namespace Sledgemapper
|
||||||
{
|
{
|
||||||
var note = new Note
|
var note = new Note
|
||||||
{
|
{
|
||||||
X = _state.SelectedTile.X,
|
X = _state.SelectedNote.X,
|
||||||
Y = _state.SelectedTile.Y,
|
Y = _state.SelectedNote.Y,
|
||||||
Text = localContent.NoteText.Text
|
Text = localContent.NoteText.Text
|
||||||
};
|
};
|
||||||
_sessionData.Notes.TryAdd(note.ToString(), note);
|
_sessionData.Notes.AddOrUpdate(note.ToString(), note, (key, oldValue) => note);
|
||||||
|
|
||||||
button.Text = "Wait...";
|
button.Text = "Wait...";
|
||||||
// localContent.LblLoginError.Text = "";
|
// localContent.LblLoginError.Text = "";
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Sledgemapper
|
||||||
public Tile HoveredTile { get; set; }
|
public Tile HoveredTile { get; set; }
|
||||||
public Wall SelectedWall { get; set; }
|
public Wall SelectedWall { get; set; }
|
||||||
public Overlay SelectedOverlay { get; set; }
|
public Overlay SelectedOverlay { get; set; }
|
||||||
|
public Note SelectedNote { get; set; }
|
||||||
public int TileSize { get; set; }
|
public int TileSize { get; set; }
|
||||||
public string CurrentTileId { get; set; }
|
public string CurrentTileId { get; set; }
|
||||||
public string CurrentWallId { get; set; }
|
public string CurrentWallId { get; set; }
|
||||||
|
@ -25,6 +26,7 @@ namespace Sledgemapper
|
||||||
HoveredTile = new() { X = 1, Y = 1 };
|
HoveredTile = new() { X = 1, Y = 1 };
|
||||||
SelectedWall = new() { X = 1, Y = 1 };
|
SelectedWall = new() { X = 1, Y = 1 };
|
||||||
SelectedOverlay = new() { X = 1, Y = 1 };
|
SelectedOverlay = new() { X = 1, Y = 1 };
|
||||||
|
SelectedNote = new() { X = 1, Y = 1 };
|
||||||
TileSize = 30;
|
TileSize = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* Generated by MyraPad at 01/12/2020 15:39:17 */
|
/* Generated by MyraPad at 01/12/2020 23:04:35 */
|
||||||
using Myra;
|
|
||||||
using Myra.Graphics2D;
|
using Myra.Graphics2D;
|
||||||
using Myra.Graphics2D.TextureAtlases;
|
using Myra.Graphics2D.TextureAtlases;
|
||||||
using Myra.Graphics2D.UI;
|
using Myra.Graphics2D.UI;
|
||||||
|
@ -26,15 +25,15 @@ namespace Sledgemapper.UI
|
||||||
LblNoteText.Id = "LblNoteText";
|
LblNoteText.Id = "LblNoteText";
|
||||||
|
|
||||||
BtnNoteView = new ImageButton();
|
BtnNoteView = new ImageButton();
|
||||||
BtnNoteView.Width = 30;
|
BtnNoteView.Width = 20;
|
||||||
BtnNoteView.Height = 30;
|
BtnNoteView.Height = 20;
|
||||||
BtnNoteView.Padding = new Thickness(5);
|
BtnNoteView.Padding = new Thickness(5);
|
||||||
BtnNoteView.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
BtnNoteView.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||||
BtnNoteView.Id = "BtnNoteView";
|
BtnNoteView.Id = "BtnNoteView";
|
||||||
|
|
||||||
BtnNoteCenter = new ImageButton();
|
BtnNoteCenter = new ImageButton();
|
||||||
BtnNoteCenter.Width = 30;
|
BtnNoteCenter.Width = 20;
|
||||||
BtnNoteCenter.Height = 30;
|
BtnNoteCenter.Height = 20;
|
||||||
BtnNoteCenter.Padding = new Thickness(5);
|
BtnNoteCenter.Padding = new Thickness(5);
|
||||||
BtnNoteCenter.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
BtnNoteCenter.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||||
BtnNoteCenter.Id = "BtnNoteCenter";
|
BtnNoteCenter.Id = "BtnNoteCenter";
|
||||||
|
@ -42,6 +41,9 @@ namespace Sledgemapper.UI
|
||||||
|
|
||||||
Spacing = 15;
|
Spacing = 15;
|
||||||
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||||
|
Margin = new Thickness(0, 0, 0, 8);
|
||||||
|
Padding = new Thickness(4);
|
||||||
|
Background = new SolidBrush("#404040FF");
|
||||||
Widgets.Add(LblNoteText);
|
Widgets.Add(LblNoteText);
|
||||||
Widgets.Add(BtnNoteView);
|
Widgets.Add(BtnNoteView);
|
||||||
Widgets.Add(BtnNoteCenter);
|
Widgets.Add(BtnNoteCenter);
|
||||||
|
@ -52,4 +54,4 @@ namespace Sledgemapper.UI
|
||||||
public ImageButton BtnNoteView;
|
public ImageButton BtnNoteView;
|
||||||
public ImageButton BtnNoteCenter;
|
public ImageButton BtnNoteCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="NoteListItem" OutputPath="C:\dev\Map\Sledgemapper\UI" />
|
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="NoteListItem" OutputPath="C:\dev\Map\Sledgemapper\UI" />
|
||||||
<HorizontalStackPanel Spacing="15" VerticalAlignment="Center">
|
<HorizontalStackPanel Spacing="15" VerticalAlignment="Center" Margin="0, 0, 0, 8" Padding="4" Background="#404040FF">
|
||||||
<Label Text="13:13 - Something like this, very long and trimmed" AutoEllipsisMethod="Character" Width="300" VerticalAlignment="Center" Id="LblNoteText" />
|
<Label Text="13:13 - Something like this, very long and trimmed" AutoEllipsisMethod="Character" Width="300" VerticalAlignment="Center" Id="LblNoteText" />
|
||||||
<ImageButton Width="30" Height="30" Padding="5" VerticalAlignment="Center" Id="BtnNoteView" />
|
<ImageButton Width="20" Height="20" Padding="5" VerticalAlignment="Center" Id="BtnNoteView" />
|
||||||
<ImageButton Width="30" Height="30" Padding="5" VerticalAlignment="Center" Id="BtnNoteCenter" />
|
<ImageButton Width="20" Height="20" Padding="5" VerticalAlignment="Center" Id="BtnNoteCenter" />
|
||||||
</HorizontalStackPanel>
|
</HorizontalStackPanel>
|
||||||
</Project>
|
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue