display note on grid
This commit is contained in:
parent
ec98d53f48
commit
af7d9ee6cb
2 changed files with 43 additions and 0 deletions
|
@ -26,6 +26,7 @@ namespace Sledgemapper.Shared.Entities
|
||||||
Map = new ConcurrentDictionary<string, Tile>();
|
Map = new ConcurrentDictionary<string, Tile>();
|
||||||
Overlays = new ConcurrentDictionary<string, Overlay>();
|
Overlays = new ConcurrentDictionary<string, Overlay>();
|
||||||
Walls = new ConcurrentDictionary<string, Wall>();
|
Walls = new ConcurrentDictionary<string, Wall>();
|
||||||
|
Notes = new ConcurrentDictionary<string, Note>();
|
||||||
Players = new List<Player>();
|
Players = new List<Player>();
|
||||||
Colors = new List<string>();
|
Colors = new List<string>();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +34,7 @@ namespace Sledgemapper.Shared.Entities
|
||||||
public ConcurrentDictionary<string, Tile> Map { get; set; }
|
public ConcurrentDictionary<string, Tile> Map { get; set; }
|
||||||
public ConcurrentDictionary<string, Wall> Walls { get; set; }
|
public ConcurrentDictionary<string, Wall> Walls { get; set; }
|
||||||
public ConcurrentDictionary<string, Overlay> Overlays { get; set; }
|
public ConcurrentDictionary<string, Overlay> Overlays { get; set; }
|
||||||
|
public ConcurrentDictionary<string, Note> Notes { get; set; }
|
||||||
public bool IsValid { get; set; }
|
public bool IsValid { get; set; }
|
||||||
public List<Player> Players { get; set; }
|
public List<Player> Players { get; set; }
|
||||||
public List<string> Colors { get; set; }
|
public List<string> Colors { get; set; }
|
||||||
|
|
|
@ -208,7 +208,17 @@ namespace Sledgemapper
|
||||||
{
|
{
|
||||||
Title = "Note"
|
Title = "Note"
|
||||||
};
|
};
|
||||||
|
noteWindow.BtnOk.Click += (s, e) =>
|
||||||
|
{
|
||||||
|
var note = new Note
|
||||||
|
{
|
||||||
|
X = _state.SelectedTile.X,
|
||||||
|
Y = _state.SelectedTile.Y,
|
||||||
|
Text = noteWindow.NoteText.Text
|
||||||
|
};
|
||||||
|
_sessionData.Notes.TryAdd(note.ToString(), note);
|
||||||
|
|
||||||
|
};
|
||||||
// var content = new LoginRegisterWindow();
|
// var content = new LoginRegisterWindow();
|
||||||
// content.RdoLogin.IsPressed = true;
|
// content.RdoLogin.IsPressed = true;
|
||||||
// content.RdoLogin.Click += (s, e) =>
|
// content.RdoLogin.Click += (s, e) =>
|
||||||
|
@ -386,6 +396,8 @@ namespace Sledgemapper
|
||||||
|
|
||||||
DrawWalls();
|
DrawWalls();
|
||||||
DrawOverlays();
|
DrawOverlays();
|
||||||
|
DrawNotes();
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(_sessionData.SessionName))
|
if (string.IsNullOrWhiteSpace(_sessionData.SessionName))
|
||||||
{
|
{
|
||||||
|
@ -548,6 +560,35 @@ namespace Sledgemapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawNotes()
|
||||||
|
{
|
||||||
|
foreach (var note in _sessionData.Notes.Values)
|
||||||
|
{
|
||||||
|
var ffont = _fonts.FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize / 8).Value ?? _fonts.Last().Value;
|
||||||
|
var fscale = 1f;
|
||||||
|
|
||||||
|
|
||||||
|
var screenPosition = new Point(note.X * _state.TileSize - (int)_viewportCenter.X, note.Y * _state.TileSize - (int)_viewportCenter.Y);
|
||||||
|
|
||||||
|
var x = screenPosition.X / _state.TileSize;
|
||||||
|
var y = screenPosition.Y / _state.TileSize;
|
||||||
|
|
||||||
|
_spriteBatch.DrawString(ffont,
|
||||||
|
"N",
|
||||||
|
new Vector2(
|
||||||
|
x * _state.TileSize + _state.TileSize - _state.TileSize/3,
|
||||||
|
y * _state.TileSize + 2
|
||||||
|
),
|
||||||
|
Color.Black,
|
||||||
|
0,
|
||||||
|
Vector2.Zero,
|
||||||
|
fscale,
|
||||||
|
SpriteEffects.None,
|
||||||
|
0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawOverlays()
|
private void DrawOverlays()
|
||||||
{
|
{
|
||||||
foreach (var tile in _sessionData.Overlays.Values)
|
foreach (var tile in _sessionData.Overlays.Values)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue