Skip to content
Snippets Groups Projects
Commit a820efd3 authored by Pierre Roussel's avatar Pierre Roussel
Browse files

Merge branch 'data' into 'dev'

Merging 'data' into 'dev'

See merge request !28
parents d4281c5f 4cc29a12
No related branches found
No related tags found
7 merge requests!104devV2 comm,!53feat : Intégration IHM-Main,!52Dev,!39Sylvain/feature/correction type,!30Get data classes from comm to corecomm interface,!29Get data classes from dev to comm,!28Merging 'data' into 'dev'
Showing
with 298 additions and 189 deletions
......@@ -65,6 +65,11 @@
</Compile>
<Compile Include="comm\Class1.cs" />
<Compile Include="data\Class1.cs" />
<Compile Include="data\DataCore.cs" />
<Compile Include="data\Comm_calls_Data_Client_Impl.cs" />
<Compile Include="data\Data_Client_ctrl.cs" />
<Compile Include="data\IHM_Main_calls_Data_Client_Impl.cs" />
<Compile Include="data\Programtest.cs" />
<Compile Include="ihm-game\Class1.cs" />
<Compile Include="ihm-main\Class1.cs" />
<Compile Include="MainWindow.xaml.cs">
......
using System;
using Shared.data;
using System;
using System.Collections.Generic;
using System.Data;
namespace Client.Data
{
public class Username
{
private string name;
public Username(string name)
{
this.name = name;
}
public string getUsername()
{
return name;
}
}
public class GameInfo
{
private int id;
private int nbPlayers;
private int nbMaxPlayers;
public GameInfo(int id, int nbPlayers, int nbMaxPlayers)
{
this.id = id;
this.nbPlayers = nbPlayers;
this.nbMaxPlayers = nbMaxPlayers;
}
public int getId()
{
return id;
}
public int getNbPlayers()
{
return nbPlayers;
}
public int getNbMaxPlayers()
{
return nbMaxPlayers;
}
}
{
public class Comm_calls_Data_Client_impl : Shared.interfaces.Interface_Comm_calls_Data_Client
{
private Username[] users;
private GameInfo[] games;
private List<LightUser> users = new List<LightUser>();
private List<LightGame> games = new List<LightGame>();
public Comm_calls_Data_Client_impl(){}
public void setGamesAndUsers(Username[] users, GameInfo[] games)
{
}
public void setGamesAndUsersList(List<LightUser> users, List<LightGame> games)
{
this.users = users;
this.games = games;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace Client.data
{
internal class DataCore
{
/// <summary>
/// Vue principale de l'application.
/// </summary>
private readonly MainWindow mainWindow = new MainWindow();
public DataCore()
{
//Association des vues et de leur view model
mainWindow.Show();
}
}
}
\ No newline at end of file
......@@ -15,20 +15,5 @@ namespace Client.Data
{
return implInterfaceForComm;
}
public static void Main(string[] args)
{
Data_Client data = new Data_Client();
Comm_calls_Data_Client_impl comm = data.getImplInterfaceForComm();
Username[] users = new Username[2];
users[0] = new Username("KING1");
users[1] = new Username("KING2");
GameInfo[] games = new GameInfo[2];
games[0] = new GameInfo(1, 2, 4);
games[1] = new GameInfo(2, 3, 5);
comm.setGamesAndUsers(users, games);
comm.displayUsers();
comm.displayGames();
}
}
}
......@@ -22,7 +22,7 @@ public class IHM_Main_calls_Data_Client_Impl : Data_Client_ctrl
}
User getLigthUser(logint string)
{
user= getLigthUserdeUser(login)
user = getLigthUserdeUser(login);
}
......
using Shared.data;
using System;
using System.Collections.Generic;
using System.Data;
......@@ -5,89 +6,38 @@ using System.Data;
namespace Server.Data
{
public class User
{
private string username;
private int idJoueur;
public User(string username,int idJoueur)
{
this.username = username;
this.idJoueur = idJoueur;
}
public string DisplayInfoPlayer()
{
return "Username : " + username + " / " + "IdJoueur : " + idJoueur;
}
public int getIdJoueur()
{
return idJoueur;
}
}
public class Game
{
private string idGame;
private int nbPlayer;
private int nbPlayerMax;
public Game(string idGame, int nbPlayer, int nbPlayerMax)
{
this.idGame = idGame;
this.nbPlayer = nbPlayer;
this.nbPlayerMax = nbPlayerMax;
}
public string DisplayInfoGame()
{
return "IdGame : " + idGame + " / " + "NbPlayer : " + nbPlayer + " / " + "NbPlayerMax : " + nbPlayerMax;
}
}
public class Comm_calls_Data_Server_Impl : Shared.interfaces.Interface_Comm_calls_Data_Server
{
private User user;
private static List<User> users = new List<User>();
private static List<Game> games = new List<Game>();
private LightUser user;
private static List<LightUser> users = new List<LightUser>();
private static List<LightGame> games = new List<LightGame>();
public Comm_calls_Data_Server_Impl()
{
}
public Comm_calls_Data_Server_Impl(string username, int idJoueur)
public Comm_calls_Data_Server_Impl()
{
this.user = new User(username, idJoueur);
this.user = new LightUser();
registerUser(user);
}
public User getUser()
public LightUser getUser()
{
return this.user;
}
public List<User> registerUser(User user)
public List<LightUser> registerUser(LightUser user)
{
users.Add(user);
return users;
}
public void displayUsers()
{
foreach (User user in users)
{
Console.WriteLine(user.DisplayInfoPlayer());
}
}
public void removeUser(int idJoueur)
{
foreach(User user in users)
foreach(LightUser user in users)
{
if(user.getIdJoueur() == idJoueur)
{
......@@ -97,13 +47,6 @@ namespace Server.Data
}
}
//On va juste retourner la liste des games stockés sur le serveur
public List<Game> getGames()
{
return games;
}
public Comm_calls_Data_Server_Impl getCommCallsDataServerImpl()
{
return this;
......
......@@ -19,23 +19,5 @@ namespace Server.Data
{
return implInterfaceForComm;
}
public static void Main(string[] args)
{
Data_Serveur_ctrl data = new Data_Serveur_ctrl();
Comm_calls_Data_Server_Impl comm2 = data.getImplInterfaceForComm();
User user = new User("KING8", 8);
User user2 = new User("KING9", 9);
User user3 = new User("KING10", 4);
comm2.registerUser(user);
comm2.registerUser(user2);
comm2.registerUser(user3);
comm2.displayUsers();
Console.WriteLine("*************************\n");
comm2.removeUser(4);
comm2.displayUsers();
}
}
}
\ No newline at end of file
......@@ -41,10 +41,17 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="data\Class1.cs" />
<Compile Include="data\Game.cs" />
<Compile Include="data\LightGame.cs" />
<Compile Include="data\Round.cs" />
<Compile Include="data\GameAction.cs" />
<Compile Include="data\LigthUser.cs" />
<Compile Include="data\Phase.cs" />
<Compile Include="data\Card.cs" />
<Compile Include="data\ChatMessage.cs" />
<Compile Include="data\Deck.cs" />
<Compile Include="data\Player.cs" />
<Compile Include="data\User.cs" />
<Compile Include="interfaces\IInterface1.cs" />
<Compile Include="interfaces\Interface_Comm_calls_Data_Client.cs" />
<Compile Include="interfaces\Interface_Comm_calls_Data_Server.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......
using System;
public class Card
{
private int index;
private char color;
private int value;
private bool isInHand;
private bool isHidden;
}
using System;
public class ChatMessage
{
private DateTime date;
private string sender; // username sera passé en paramètre
private string text;
private int idGame;
/* public Message(DateTime datet, string sendert, string textt, int idGamet)
{
date = datet;
sender = sendert;
text = textt;
idGame = idGamet;
}*/
}
using System;
using Card;
public class Deck
{
private int index;
private Card[] cards;
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.data
{
class Game
{
Round[] rounds { get; set; }
int turn { set; get; }
int smallBlind { set; get; }
int bingBLind { set; get; }
int currentPLayerIndex { set; get; }
Phase currentPhase { set; get; }
int pot { set; get; }
int highestBet { set; get; }
int nbNoRise { set; get; }
ChatMessage[] chat { set; get; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.data
{
enum TypeAction : ushort
{
call = 1,
rise = 2,
allin = 3,
fold = 4
}
class GameAction
{
private int id { get; set; }
private TypeAction typeAction { get; set; }
public GameAction(int id, TypeAction typeAction)
{
this.id = id;
this.typeAction = typeAction;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.data
{
enum GameStatus : ushort
{
lobby = 0,
running = 1,
paused = 2,
finished = 3
}
class LightGame
{
int id { get; set; }
GameStatus status { get; set; }
int indexRound { get; set; }
Player[] players { get; set; }
User[] spectators { get; set; }
User[] lobby { get; set; }
public LightGame(int id, GameStatus status, int indexRound, Player[] players, User[] spectators, User[] lobby)
{
this.id = id;
this.status = status;
this.indexRound = indexRound;
this.players = players;
this.spectators = spectators;
this.lobby = lobby;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class LigthUser
namespace Shared.data
{
public int id;
public string userName;// userName et login c'est la même chose
public string image;
public LigthUser(int idt = 1, string userNamet = "usernametest", string imaget = "imagetest")
public class LigthUser
{
if (idt == 1) { id = idt }
else
public int id;
public string userName;// userName et login c'est la même chose
public string image;
public LigthUser(int idt = 1, string userNamet = "usernametest", string imaget = "imagetest")
{
id = Guid.NewGuid(); // ou Guid.NewGuid().ToString()
if (idt == 1) { id = idt; }
else
{
// id = Guid.NewGuid(); // ou Guid.NewGuid().ToString()
id = 1;
}
userName = userNamet;
image = imaget;
}
userName = userNamet;
image = imaget;
}
}
\ No newline at end of file
......@@ -4,9 +4,23 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.interfaces
namespace Shared.data
{
interface IInterface1
{
}
}
enum TypePhase : ushort
{
mise1 = 1,
echange = 2,
mise2 = 2,
reveal = 4
}
public class Phase
{
GameAction[] actions { set; get; }
}
}
\ No newline at end of file
using System;
using Card;
enum PlayerRole : ushort {
smallBlind = 1,
bigBlind = 2,
nothing = 3
}
public class Player
{
private PlayerRole role;
private bool isFolded;
private int tokens;
private int tokensBet;
private Card[] hand;
}
......@@ -6,7 +6,13 @@ using System.Threading.Tasks;
namespace Shared.data
{
class Class1
class Round
{
Phase[] phases { get; set; }
public Round(Phase[] phases)
{
this.phases = phases;
}
}
}
using System;
using LigthUser;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shared.data;
//à faire hériter de ligth user
namespace Shared.data {
public class User : LightUser
{
public login: string
public password: string
public status: enum
public firstname : string
public age: int
public class User : LigthUser
{
public string password;
public bool status;
public string firstname;
public int age;
public User(int idt = 1, string userNamet = "usernametest", string imaget = "imagetest",string logint, string passwordt, string statust, string firstnamet, int aget)
{
id = idt;
userName = userNamet;
image = imaget;
login = logint;
password = passwordt;
status = statust;
firstname = firstnamet;
age = aget;
}
}
public User(int idt ,string imaget , string userNamet, string passwordt, bool statust, string firstnamet, int aget)
{
id = idt;
image = imaget;
userName = userNamet;
password = passwordt;
status = statust;
firstname = firstnamet;
age = aget;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.interfaces
namespace Shared.interfaces
{
public interface Interface_Comm_calls_Data_Client
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment