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.
Ohara_MAUI/Sources/Model/Classes/FruitDuDemon.cs

107 lines
3.6 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "fruitdudemon")]
public class FruitDuDemon : ObjetOhara,INotifyPropertyChanged
{
[DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; }
[DataMember(Name = "type")]
public string Type { get; set; }
[DataMember(Name = "premierchap")]
public int PremierChap { get; set; }
[DataMember(Name = "premierep")]
public int PremierEp { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "forces")]
public string Forces { get; set; }
[DataMember(Name = "faiblesses")]
public string Faiblesses { get; set; }
[DataMember(Name = "utilisateur", EmitDefaultValue = false)]
public List<Personnage> Utilisateur { get; set; } = new List<Personnage>();
public event PropertyChangedEventHandler? PropertyChanged;
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom)
{
NomRomanise = nomRomanise;
Type = type;
if (premierEp < 0)
{
PremierEp = 0;
}
else
{
PremierEp = premierEp;
}
if (premierChap < 0)
{
premierChap = 0;
}
else
{
PremierChap = premierChap;
}
Description = description;
Forces = forces;
Faiblesses = faiblesses;
}
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses)
{
Image = image;
}
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image, List<Personnage> utilisateur) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses, image)
{
Utilisateur = utilisateur;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
FruitDuDemon o = (FruitDuDemon)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Type, PremierChap, PremierEp, Description, Forces, Faiblesses);
}
public override string ToString()
{
return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
}
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}