remove guid, reduce latency (gets stuck sometimes tho)
This commit is contained in:
parent
6bc6a039bd
commit
7044ffda79
19 changed files with 291 additions and 251 deletions
|
@ -5,6 +5,4 @@ public class HostConfiguration
|
|||
public bool EnableServicePointDisplay { get; set; } = true;
|
||||
|
||||
public int ServicePointDisplayMinFrameTimeMs { get; set; } = 25;
|
||||
|
||||
public int ClientDisplayMinFrameTimeMs { get; set; } = 25;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,23 @@ using System.Text.Json.Serialization;
|
|||
|
||||
namespace TanksServer.Models;
|
||||
|
||||
internal sealed class Player(string name, Guid id)
|
||||
internal sealed class Player : IEquatable<Player>
|
||||
{
|
||||
public string Name => name;
|
||||
|
||||
[JsonIgnore] public Guid Id => id;
|
||||
public required string Name { get; init; }
|
||||
|
||||
[JsonIgnore] public PlayerControls Controls { get; } = new();
|
||||
|
||||
public Scores Scores { get; } = new();
|
||||
|
||||
public DateTime LastInput { get; set; } = DateTime.Now;
|
||||
|
||||
public override bool Equals(object? obj) => obj is Player p && Equals(p);
|
||||
|
||||
public bool Equals(Player? other) => other?.Name == Name;
|
||||
|
||||
public override int GetHashCode() => Name.GetHashCode();
|
||||
|
||||
public static bool operator ==(Player? left, Player? right) => Equals(left, right);
|
||||
|
||||
public static bool operator !=(Player? left, Player? right) => !Equals(left, right);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue