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.BtnNoteCenter.Image = new TextureRegion(_location);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -163,6 +165,23 @@ namespace Sledgemapper
|
|||
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)
|
||||
{
|
||||
KeyboardState newState = Keyboard.GetState();
|
||||
|
@ -227,8 +246,8 @@ namespace Sledgemapper
|
|||
|
||||
if (mouseState.RightButton == ButtonState.Released && mouseState.RightButton != oldMouseState.RightButton)
|
||||
{
|
||||
_state.SelectedTile.X = _state.HoveredTile.X;
|
||||
_state.SelectedTile.Y = _state.HoveredTile.Y;
|
||||
_state.SelectedNote.X = _state.HoveredTile.X;
|
||||
_state.SelectedNote.Y = _state.HoveredTile.Y;
|
||||
|
||||
var contextMenu = new TextButton { Text = "New Note" };
|
||||
contextMenu.Click += OnContextMenuNewNoteClick;
|
||||
|
@ -913,11 +932,11 @@ namespace Sledgemapper
|
|||
{
|
||||
var note = new Note
|
||||
{
|
||||
X = _state.SelectedTile.X,
|
||||
Y = _state.SelectedTile.Y,
|
||||
X = _state.SelectedNote.X,
|
||||
Y = _state.SelectedNote.Y,
|
||||
Text = localContent.NoteText.Text
|
||||
};
|
||||
_sessionData.Notes.TryAdd(note.ToString(), note);
|
||||
_sessionData.Notes.AddOrUpdate(note.ToString(), note, (key, oldValue) => note);
|
||||
|
||||
button.Text = "Wait...";
|
||||
// localContent.LblLoginError.Text = "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue