public void pAB(dynamic view, dynamic p, Group_Model group) { view.AB.Content = (string)p.A.B.user.username; Player_Model player = new Player_Model((string)p.A.B.user.username, (string)p.A.B.type, (string)p.A.B.role, "A.B", (bool)p.A.B.ready); group.listPlayers[1] = player; }
public void DisplayPlayerName(dynamic p) { if (p.A.A is object) { this.ProfilePicAA = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.A)); this._basicMode.pAA(this._coopView, p, this._group); } else { this._coopView.AA.Content = "+ Joueur"; this.ProfilePicAA = null; this._group.listPlayers[0] = null; } if (p.A.B is object) { this.ProfilePicAB = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.B)); this._basicMode.pAB(this._coopView, p, this._group); } else { this._coopView.AB.Content = "+ Joueur"; this.ProfilePicAB = null; this._group.listPlayers[1] = null; } if (p.A.C is object) { this._coopView.AC.Content = (string)p.A.C.user.username; this.ProfilePicAC = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.C)); Player_Model player = new Player_Model((string)p.A.C.user.username, (string)p.A.C.type, (string)p.A.C.role, "A.C", (bool)p.A.C.ready); this._group.listPlayers[2] = player; } else { this._coopView.AC.Content = "+ Joueur"; this.ProfilePicAC = null; this._group.listPlayers[2] = null; } if (p.A.D is object) { this._coopView.AD.Content = (string)p.A.D.user.username; this.ProfilePicAD = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.D)); Player_Model player = new Player_Model((string)p.A.D.user.username, (string)p.A.D.type, (string)p.A.D.role, "A.D", (bool)p.A.D.ready); this._group.listPlayers[3] = player; } else { this._coopView.AD.Content = "+ Joueur"; this.ProfilePicAD = null; this._group.listPlayers[3] = null; } }
public Group_Model BuildTournamenGroup(dynamic g) { this._listPlayers.Clear(); if (g.players.Count != 0) { foreach (dynamic player in g.players) { Player_Model p = new Player_Model((string)player.user.username, (string)player.user.avatar, (string)player.type, (string)player.role, "A.A", (bool)player.ready); this._listPlayers.Add(p); } } return(new Group_Model((string)g.id, new CreateGroup_Server((string)g.name, (string)g.difficulty, (string)g.mode), this._listPlayers, this._listReady)); }
public Player_Model CreatePlayer(dynamic player) { Player_Model p = null; if (player is object) { if ((string)player.user.avatar != null) { new Player_Model((string)player.user.username, (string)player.user.avatar, (string)player.type, (string)player.role, "A.A", (bool)player.ready); } } return(p); }
public Group_Model BuildSoloGroup(dynamic g) { Player_Model pAA = this.CreatePlayer(g.A.A); this._listPlayers = new List <Player_Model> { pAA }; Group_Model group = new Group_Model((string)g.id, new CreateGroup_Server((string)g.name, (string)g.difficulty, (string)g.mode), this._listPlayers); return(group); }
//Generál ellenfeleket public void GenerateOpponents() { List <string> names = new List <string> { "Bot Ond", "Andrew Id", "Robot Gida" }; for (var i = 0; i < numberOfOpponents; i++) { Player temp = new Player(names[i]); temp.SetUniqueID(i); temp.AddActiveDeck(cardFactory.GetStarterDeck()); Player_Model bot = new Player_Model(temp); playerDictionary.Add(i, bot); playerKeyList.Add(i); } }
public Group_Model BuildCoopGroup(dynamic g) { Player_Model pAA = this.CreatePlayer(g.A.A); Player_Model pAB = this.CreatePlayer(g.A.B); Player_Model pAC = this.CreatePlayer(g.A.C); Player_Model pAD = this.CreatePlayer(g.A.D); this._listPlayers = new List <Player_Model> { pAA, pAB, pAC, pAD }; Group_Model group = new Group_Model((string)g.id, new CreateGroup_Server((string)g.name, (string)g.difficulty, (string)g.mode), this._listPlayers); return(group); }
public Classic_ViewModel(UserControl_Classic classicView, HomePage_ViewModel homePageViewModel, Group_Model group) { this._classicView = classicView; this._homePageViewModel = homePageViewModel; this._group = group; this._basicMode = new BasicMode(homePageViewModel, group); ReturnToGroupsList = new GeneralCommands <object>(this._basicMode.RetunToGroups_List, this._basicMode.CanRetunToGroups_List); ReadyToStart = new GeneralCommands <object>(this._basicMode.ReadyTo_Start, this._basicMode.CanBeReadyTo_Start); AddPlayerCommand = new GeneralCommands <object>(AddPlayer, CanAddPlayer); this._basicMode.EmitGroup(); SocketService.MySocket.Off("list groups"); SocketService.MySocket.On("list groups", (data) => { this._classicView.Dispatcher.Invoke(() => { JArray jsonArray = JArray.Parse(data.ToString()); foreach (object i in jsonArray) { dynamic p = JObject.Parse(i.ToString()); #region CLASSIC if (p.mode == "CLASSIC" && p.name == group.createGroup.name) { if (p.A.A is object) { this._classicView.AA.Content = (string)p.A.A.user.username; this.ProfilePicAA = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.A)); Player_Model player = new Player_Model((string)p.A.A.user.username, (string)p.A.A.type, (string)p.A.A.role, "A.A", (bool)p.A.A.ready); this._group.listPlayers[0] = player; if ((string)p.A.A.user.username == GLOBAL_USER && p.A.B == null) { this._classicView.AB.IsEnabled = true; this._classicView.AB.Content = "Ajouter un joueur virtuel AB"; this.VABisOn = true; this._classicView.BB.IsEnabled = true; } } else { this._classicView.AA.Content = "+ Joueur: Devineur"; this.ProfilePicAA = null; this._group.listPlayers[0] = null; } if (p.A.B is object) { Player_Model player = new Player_Model((string)p.A.B.user.username, (string)p.A.B.type, (string)p.A.B.role, "A.B", (bool)p.A.B.ready); this._group.listPlayers[1] = player; if (p.A.B.type == "REAL") { this._classicView.AB.Content = (string)p.A.B.user.username; this.ProfilePicAB = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.B)); } else { this._classicView.AB.Content = VIRTUAL_AB; this._classicView.AvatarAB.ImageSource = this._basicMode.DisplayAvatar(System.Environment.CurrentDirectory.Replace("\\bin\\Debug", "/Assets/profile_virtual_player.png")); this._classicView.AB.IsEnabled = true; this._classicView.BB.IsEnabled = true; } } else if (p.A.B == null && this.VABisOn == false) { this._classicView.AB.Content = "+ Joueur: Auteur"; this.ProfilePicAB = null; this._group.listPlayers[1] = null; } if (p.B.A is object) { this._classicView.BA.Content = (string)p.B.A.user.username; this.ProfilePicBA = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.B.A)); Player_Model player = new Player_Model((string)p.B.A.user.username, (string)p.B.A.type, (string)p.B.A.role, "B.A", (bool)p.B.A.ready); this._group.listPlayers[2] = player; if ((string)p.B.A.user.username == GLOBAL_USER && p.B.B == null) { this._classicView.BB.IsEnabled = true; this._classicView.BB.Content = "Ajouter un joueur virtuel BB"; this.VBBisON = true; this._classicView.AB.IsEnabled = true; } } else { this._classicView.BA.Content = "+ Joueur: Devineur"; this.ProfilePicBA = null; this._group.listPlayers[2] = null; } if (p.B.B is object) { Player_Model player = new Player_Model((string)p.B.B.user.username, (string)p.B.B.type, (string)p.B.B.role, "B.B", (bool)p.B.B.ready); this._group.listPlayers[3] = player; if (p.B.B.type == "REAL") { this._classicView.BB.Content = (string)p.B.B.user.username; this.ProfilePicBB = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.B.B)); } else { this._classicView.BB.Content = VIRTUAL_BB; this._classicView.BB.IsEnabled = true; this._classicView.AvatarBB.ImageSource = this._basicMode.DisplayAvatar(System.Environment.CurrentDirectory.Replace("\\bin\\Debug", "/Assets/profile_virtual_player.png")); this._classicView.AB.IsEnabled = true; } } else if (p.B.B == null && this.VBBisON == false) { this._classicView.BB.Content = "+ Joueur: Auteur"; this._group.listPlayers[3] = null; this.ProfilePicBB = null; } this.EnablePlayersButtons(p); this.DisableReadyButton(p); } #endregion } }); }); }