You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Model
|
|
{
|
|
public class Lobby
|
|
{
|
|
/// <summary>
|
|
/// define a lobby for QMC rapidity fight
|
|
/// attributes :
|
|
/// id : identifier of the lobby in the database
|
|
/// name : name of the lobby
|
|
/// password : password require to access at the lobby
|
|
/// idCreator : identifier of the creator player
|
|
/// </summary>
|
|
private int id;
|
|
private string? name;
|
|
private string? password;
|
|
private int nbPlayers;
|
|
private int idCreator;
|
|
/// <summary>
|
|
/// getters and setters of attributes
|
|
/// </summary>
|
|
public int? Id
|
|
{
|
|
get => id == -1 ? null : id;
|
|
private set { id = value == null || value < -1 ? -1 : value.Value; }
|
|
}
|
|
public string Name
|
|
{
|
|
get => name == null ? "" : name;
|
|
private set { name = value == "" ? null : value; }
|
|
}
|
|
public string Password
|
|
{
|
|
get => password == null ? "" : password;
|
|
private set { password = value == "" ? null : value; }
|
|
}
|
|
public int NbPlayers
|
|
{
|
|
get => nbPlayers;
|
|
set { nbPlayers = value < 0 ? 0 : value; }
|
|
}
|
|
public int? IdCreator
|
|
{
|
|
get => idCreator == -1 ? null : id;
|
|
private set { idCreator = value == null || value < -1 ? -1 : value.Value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// constructor of a lobby
|
|
/// </summary>
|
|
/// <param name="name">the name of the lobby</param>
|
|
/// <param name="idCreator">the id of the creator</param>
|
|
/// <param name="password">the password require to access to the lobby</param>
|
|
/// <param name="nbPlayer">the number of players in the lobby</param>
|
|
/// <param name="id">the id of the lobby</param>
|
|
public Lobby(string name, int idCreator, string password = "", int nbPlayer = 0, int? id = null)
|
|
{
|
|
Name = name;
|
|
IdCreator = idCreator;
|
|
Password = password;
|
|
NbPlayers = nbPlayer;
|
|
Id = id;
|
|
}
|
|
}
|
|
}
|