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.
68 lines
1.9 KiB
68 lines
1.9 KiB
using System.Collections.ObjectModel;
|
|
using System.Data;
|
|
using System.Numerics;
|
|
using Models.Game;
|
|
|
|
namespace Stub
|
|
{
|
|
public class Stub
|
|
{
|
|
public ReadOnlyObservableCollection<Player> ListPlayer { get; private set; }
|
|
private readonly ObservableCollection<Player> listplayer = new ObservableCollection<Player>();
|
|
public ReadOnlyObservableCollection<Map> ListMap { get; private set; }
|
|
private readonly ObservableCollection<Map> listmap = new ObservableCollection<Map>();
|
|
|
|
public Game ThePartie { get; private set; }
|
|
|
|
public Stub()
|
|
{
|
|
ListPlayer = new ReadOnlyObservableCollection<Player>(listplayer);
|
|
ListMap = new ReadOnlyObservableCollection<Map>(listmap);
|
|
ThePartie = new Game();
|
|
LoadPlayer();
|
|
LoadMap();
|
|
}
|
|
|
|
public void LoadPlayer()
|
|
{
|
|
|
|
listplayer.Add(new Player());
|
|
listplayer.Add(new Player("Lucas", "profile.jpg"));
|
|
listplayer.Add(new Player("relavergne", "profile.jpg"));
|
|
listplayer.Add(new Player("reneveu", "profile.jpg"));
|
|
}
|
|
|
|
public void LoadMap()
|
|
{
|
|
|
|
listmap.Add(new Map("profile.jpg"));
|
|
listmap.Add(new Map("montagne1.png"));
|
|
listmap.Add(new Map("tmp1.jpeg"));
|
|
}
|
|
|
|
public void Add(string pseudo, string profilePicture)
|
|
{
|
|
listplayer.Add(new Player(pseudo, profilePicture));
|
|
}
|
|
|
|
public void Pop(string pseudo, string profilePicture)
|
|
{
|
|
listplayer.Remove(new Player(pseudo, profilePicture));
|
|
}
|
|
|
|
public bool Modify(string pseudo, string newpseudo)
|
|
{
|
|
foreach (var index in listplayer)
|
|
{
|
|
if (index.Pseudo == pseudo)
|
|
{
|
|
index.Pseudo = newpseudo;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|