bug fixes
This commit is contained in:
parent
2a796509c8
commit
1759f7cd8e
12 changed files with 151 additions and 48 deletions
|
@ -79,6 +79,11 @@ namespace Sledgemapper
|
|||
SessionData.Walls.Remove(tile.ToString(), out var _);
|
||||
});
|
||||
|
||||
Connection.On<Note>("DeleteNote", (tile) =>
|
||||
{
|
||||
SessionData.Notes.Remove(tile.ToString(), out var _);
|
||||
});
|
||||
|
||||
Connection.On<Overlay>("DeleteOverlay", (tile) =>
|
||||
{
|
||||
SessionData.Overlays.Remove(tile.ToString(), out var _);
|
||||
|
@ -98,6 +103,15 @@ namespace Sledgemapper
|
|||
}
|
||||
});
|
||||
|
||||
Connection.On<Player>("RemovePlayer", (player) =>
|
||||
{
|
||||
var p = SessionData.Players.FirstOrDefault(m => m.UserId == player.UserId);
|
||||
if (p != null)
|
||||
{
|
||||
SessionData.Players.Remove(p);
|
||||
}
|
||||
});
|
||||
|
||||
Connection.On<Wall>("NewWall", (tile) =>
|
||||
{
|
||||
SessionData.Walls.Remove(tile.ToString(), out var _);
|
||||
|
|
|
@ -436,7 +436,6 @@ namespace Sledgemapper
|
|||
DrawNotes();
|
||||
DrawGrid(visibleTilesX, visibleTilesY);
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_sessionData.SessionName))
|
||||
{
|
||||
var isoffscreen = IsOffscreen(_state.SelectedTile);
|
||||
|
@ -469,8 +468,6 @@ namespace Sledgemapper
|
|||
var uas = new List<float> { ua1, ua2, ua3, ua4 };
|
||||
if (uas.Any(u => u > 0 && u < 1))
|
||||
{
|
||||
|
||||
|
||||
var ua = uas.Where(u => u > 0 && u < 1).Min();
|
||||
|
||||
var i = uas.IndexOf(ua);
|
||||
|
@ -647,58 +644,38 @@ namespace Sledgemapper
|
|||
{
|
||||
posX = tile.X * _state.TileSize + _state.TileSize / 2f;
|
||||
posY = tile.Y * _state.TileSize + _state.TileSize / 2f;
|
||||
|
||||
// _spriteBatch.Draw(content, new Vector2(posX, posY),null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
|
||||
// _spriteBatch.Draw(content, new Vector2(posX, posY),null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
|
||||
}
|
||||
_spriteBatch.Draw(content, new Vector2(posX + _state.TileSize / 25, posY + _state.TileSize / 25), null, Color.Black * .2f, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
|
||||
_spriteBatch.Draw(content, new Vector2(posX, posY), null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPlayers()
|
||||
{
|
||||
try
|
||||
foreach (var player in _sessionData.Players.Copy())
|
||||
{
|
||||
foreach (var player in _sessionData.Players.Copy())
|
||||
{
|
||||
|
||||
var color = player.Color.ToColor();
|
||||
_spriteBatch.DrawRectangle(new Rectangle(player.Position.X * _state.TileSize - 4, player.Position.Y * _state.TileSize - 4, _state.TileSize + 7, _state.TileSize + 7), color, 2);
|
||||
|
||||
foreach (var font in _fonts.Keys)
|
||||
{
|
||||
System.Console.WriteLine(font);
|
||||
}
|
||||
|
||||
var ffont = _fonts.FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize).Value ?? _fonts.Last().Value;
|
||||
|
||||
var fscale = _state.TileSize / ((float)ffont.LineSpacing * 2);
|
||||
_spriteBatch.DrawString(ffont,
|
||||
player.Initials,
|
||||
new Vector2(player.Position.X * _state.TileSize + 2, player.Position.Y * _state.TileSize + _state.TileSize - 2 - ffont.LineSpacing * fscale),
|
||||
color,
|
||||
0,
|
||||
Vector2.Zero,
|
||||
fscale,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
foreach (var player in _sessionData.Players.Copy())
|
||||
{
|
||||
var isOffscreen = IsOffscreen(player.Position);
|
||||
if (isOffscreen)
|
||||
{
|
||||
DrawPlayerPointer(player);
|
||||
}
|
||||
}
|
||||
var color = player.Color.ToColor();
|
||||
_spriteBatch.DrawRectangle(new Rectangle(player.Position.X * _state.TileSize - 4, player.Position.Y * _state.TileSize - 4, _state.TileSize + 7, _state.TileSize + 7), color, 2);
|
||||
var ffont = _fonts.FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize).Value ?? _fonts.Last().Value;
|
||||
var fscale = _state.TileSize / ((float)ffont.LineSpacing * 2);
|
||||
_spriteBatch.DrawString(ffont,
|
||||
player.Initials,
|
||||
new Vector2(player.Position.X * _state.TileSize + 2, player.Position.Y * _state.TileSize + _state.TileSize - 2 - ffont.LineSpacing * fscale),
|
||||
color,
|
||||
0,
|
||||
Vector2.Zero,
|
||||
fscale,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
foreach (var player in _sessionData.Players.Copy())
|
||||
{
|
||||
System.Console.WriteLine(ex.Message);
|
||||
var isOffscreen = IsOffscreen(player.Position);
|
||||
if (isOffscreen)
|
||||
{
|
||||
DrawPlayerPointer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1209,6 +1186,7 @@ namespace Sledgemapper
|
|||
window.Content = content;
|
||||
|
||||
window.ShowModal(_desktop);
|
||||
content.TxtSession.SetKeyboardFocus();
|
||||
}
|
||||
|
||||
private void OnMenuConnectLoginSelected(object sender, EventArgs e)
|
||||
|
@ -1248,9 +1226,10 @@ namespace Sledgemapper
|
|||
|
||||
content.BtnRegister.Click += OnButtonRegisterClick;
|
||||
content.BtnLogin.Click += OnButtonLoginClick;
|
||||
|
||||
|
||||
window.Content = content;
|
||||
window.ShowModal(_desktop);
|
||||
content.TxtEmail.SetKeyboardFocus();
|
||||
}
|
||||
|
||||
private async void OnMenuConnectSyncSelected(object sender, EventArgs e)
|
||||
|
@ -1294,6 +1273,7 @@ namespace Sledgemapper
|
|||
window.Content = content;
|
||||
|
||||
window.ShowModal(_desktop);
|
||||
content.TxtSession.SetKeyboardFocus();
|
||||
}
|
||||
|
||||
private void OnMenuFileSaveSelected(object sender, EventArgs e)
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace Sledgemapper
|
|||
var color = new Color(int.Parse(hexs[0], System.Globalization.NumberStyles.HexNumber),
|
||||
int.Parse(hexs[1], System.Globalization.NumberStyles.HexNumber),
|
||||
int.Parse(hexs[2], System.Globalization.NumberStyles.HexNumber));
|
||||
System.Console.WriteLine(color);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue