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.
95 lines
3.1 KiB
95 lines
3.1 KiB
using System.Runtime.Serialization;
|
|
|
|
namespace Model.Classes
|
|
{
|
|
[DataContract(Name = "personnage")]
|
|
public class Personnage : ObjetOhara
|
|
{
|
|
[DataMember(Name = "prime")]
|
|
public double Prime { get; set; }
|
|
[DataMember(Name = "epithete")]
|
|
public string Epithete { get; set; }
|
|
[DataMember(Name = "age")]
|
|
public int Age { get; set; }
|
|
[DataMember(Name = "taille")]
|
|
public double Taille { get; set; }
|
|
[DataMember(Name = "origine")]
|
|
public string Origine { get; set; }
|
|
[DataMember(Name = "biographie")]
|
|
public string Biographie { get; set; }
|
|
[DataMember(Name = "citation")]
|
|
public string Citation { get; set; }
|
|
[DataMember(Name = "equipage", EmitDefaultValue = false)]
|
|
public Equipage? Equipage { get; set; }
|
|
[DataMember(Name = "fruit", EmitDefaultValue = false)]
|
|
public List<FruitDuDemon> Fruit { get; set; } = new List<FruitDuDemon>();
|
|
|
|
|
|
|
|
|
|
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation) : base(nom)
|
|
{
|
|
if (prime < 0)
|
|
{
|
|
Prime = 0;
|
|
}
|
|
else
|
|
{
|
|
Prime = prime;
|
|
}
|
|
Epithete = epithete;
|
|
Age = age;
|
|
if (taille < 0)
|
|
{
|
|
Taille = 0;
|
|
}
|
|
else
|
|
{
|
|
Taille = taille;
|
|
}
|
|
|
|
Origine = origine;
|
|
Biographie = biographie;
|
|
Citation = citation;
|
|
|
|
|
|
}
|
|
|
|
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation, string image) : this(nom, prime, epithete, age, taille, origine, biographie, citation)
|
|
{
|
|
Image = image;
|
|
}
|
|
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation, string image, Equipage equipage, List<FruitDuDemon> fruit) : this(nom, prime, epithete, age, taille, origine, biographie, citation, image)
|
|
{
|
|
Equipage = equipage;
|
|
Fruit = fruit;
|
|
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (obj == null) return false;
|
|
if (this.GetType() != obj.GetType())
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
Personnage o = (Personnage)obj;
|
|
return o.Nom == Nom;
|
|
}
|
|
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
|
|
return HashCode.Combine(Prime, Epithete, Age, Origine,Biographie, Citation,Equipage,Fruit);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return "Personnage :" + Nom + " " + EstFavori + " " + Prime + " " + Epithete + " " + Age + " " + Origine + " " + Biographie + " "+ Citation+" " +Equipage+" " + Fruit+" "+ Image;
|
|
}
|
|
}
|
|
} |