|
@@ -2,25 +2,41 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.Threading.Tasks;
|
|
|
using MafiaTelegramBot.Controllers;
|
|
|
-using MafiaTelegramBot.Models;
|
|
|
using MafiaTelegramBot.Resources;
|
|
|
|
|
|
namespace MafiaTelegramBot.DataBase
|
|
|
{
|
|
|
- public class User
|
|
|
+ public class UserEntity
|
|
|
{
|
|
|
public long Id { get; init; }
|
|
|
public long ChatId { get; init; }
|
|
|
- public string Username { get; init; } = strings.no_name;
|
|
|
- public int Games { get; set; } = 0;
|
|
|
- public string NickName { get; set; } = "";
|
|
|
- public int Wins { get; set; } = 0;
|
|
|
- public Dictionary<Roles, int> RoleGames = new();
|
|
|
- public Dictionary<Roles, int> RoleWins = new();
|
|
|
+
|
|
|
+ private string _username = strings.no_name;
|
|
|
+ public string Username
|
|
|
+ {
|
|
|
+ get => _username;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if(_username != strings.no_name) OnPropertyChangedListener("Username", value);
|
|
|
+ _username = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private string _nickName = "";
|
|
|
+ public string NickName
|
|
|
+ {
|
|
|
+ get => _nickName;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if(_nickName != "") OnPropertyChangedListener("NickName", value);
|
|
|
+ _nickName = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Dictionary<Roles, StatisticsEntity> Statistics = new();
|
|
|
|
|
|
private Roles _currentRole = Roles.None;
|
|
|
public int TurnOrder = -1;
|
|
|
-
|
|
|
private string _roomKey = "";
|
|
|
|
|
|
|
|
@@ -63,7 +79,7 @@ namespace MafiaTelegramBot.DataBase
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
{
|
|
|
- return obj is User user && user.Id == Id;
|
|
|
+ return obj is UserEntity user && user.Id == Id;
|
|
|
}
|
|
|
|
|
|
public override int GetHashCode()
|
|
@@ -80,5 +96,10 @@ namespace MafiaTelegramBot.DataBase
|
|
|
{
|
|
|
return roles.ResourceManager.GetString(_currentRole.ToString())!;
|
|
|
}
|
|
|
+
|
|
|
+ private void OnPropertyChangedListener<T>(string property, T value)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|