Merge branch 'master' into setupBranch

This commit is contained in:
Lars
2020-10-22 15:46:20 +02:00
10 changed files with 595 additions and 436 deletions

View File

@@ -1,11 +1,12 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace SharedClientServer
{
class User
class User : IEquatable<User>
{
private string _username;
private int _score;
@@ -30,6 +31,42 @@ namespace SharedClientServer
_turnToDraw = false;
}
public static bool operator ==(User u1, User u2)
{
if (object.ReferenceEquals(u1, null))
{
return object.ReferenceEquals(u2, null);
}
return u1.Equals(u2 as object);
}
public static bool operator !=(User u1, User u2)
{
if (object.ReferenceEquals(u1, null))
{
return object.ReferenceEquals(u2, null);
}
return u1.Equals(u2 as object);
}
public override bool Equals(object obj)
{
if ((obj == null) || !this.GetType().Equals(obj.GetType()))
{
return false;
}
else
{
return this.Equals(obj as User);
}
}
public bool Equals([AllowNull] User other)
{
return other.Username == this.Username;
}
public string Username
{
get { return _username; }