public ActionResult CreatePlayerStats(int id) { PlayerStatsModel playerStats = new PlayerStatsModel(usersBLL); playerStats.GameID = id; return(View(playerStats)); }
private static void PrintPlayerStat(PlayerStatsModel log) { var gun = string.IsNullOrEmpty(log.Guns?.FirstOrDefault()?.Weapon.Name) ? log.Guns?.FirstOrDefault()?.Weapon.ToString() ?? "" : log.Guns?.FirstOrDefault()?.Weapon.Name ?? ""; Console.WriteLine(Environment.NewLine); //{ string.Join(" | ", log.Achievements?.Select(x => x.AchievementId.GetDescription()).ToList())} Console.WriteLine( ($"PlayerName: {log.Player.NickName},Kills: {log.Kills},Deaths: {log.Deaths},Assists: {log.Assists}," + $"Friendly Kills: {log.FriendlyKills},K/D ratio: {log.KdRatio},Total Games: {log.TotalGames},Kills Per Game: {log.KillsPerGame}," + $"Points: {log.Points},Acheivements: " + $"Death Per Game: {log.DeathPerGame},Favorite Gun: {gun},Head shot: {log.HeadShotsCount}%,Defused bombs: {log.Defuse},Explode Bombs: {log.Explode}").Replace(',', '\n')); }
public object Stats(string name) { var playerStats = new PlayerStatsModel(); using (var dbmanager = new DataManager()) { playerStats = dbmanager.GetPlayerStats(name); if (dbmanager.StateOfCurrentOperation == OperationState.Failed) { return(HttpStatusCode.NotFound); } } return(playerStats); }
public ActionResult CreatePlayerStats(PlayerStatsModel player) { if (ModelState.IsValid) { var user = Session["Users"] as Users; PlayerStats insertPlayer = new PlayerStats(); insertPlayer.Misses = player.Misses; insertPlayer.Points = player.Points; insertPlayer.Rebounds = player.Rebounds; insertPlayer.UserID = player.UserID; insertPlayer.Assists = player.Assists; insertPlayer.TeamID = user.TeamID; insertPlayer.GameID = player.GameID; bool checkDuplicate = playerStats.GetStats().Exists(m => m.GameID == insertPlayer.GameID && m.UserID == insertPlayer.UserID); if (checkDuplicate) { ViewBag.Message = "Stat already created for Player Please Update!"; return(View(player)); } else { playerStats.InsertStats(insertPlayer); } bool checkPlayer = playerStats.GetStats().Exists(m => m.GameID == insertPlayer.GameID && m.UserID == insertPlayer.UserID); if (checkPlayer) { ViewBag.Message = "Player Stat Created!"; } else if (checkPlayer == false) { ViewBag.Message = "Player Stat Was Not Created!"; return(View(player)); } } else { ViewBag.Message = "Invalid Entry"; } return(View(player)); }
public void DisposeTest() { var _saveStatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"SaveState\nhl94.zs3"); var _statreader = new StatReader(_saveStatePath); var PSM = new PlayerStatManager(_statreader); var PSmodel = new PlayerStatsModel(); //Call Dispose PSM.Dispose(); //Calling The GetScoringSummary Method should fail as the FileStream Reader should be null. Exception ex = Assert.Throws<System.NullReferenceException>(() => PSmodel = PSM.GetPlayerStats()); //Verify The Expected Exception was thrown. Assert.Equal("Object reference not set to an instance of an object.", ex.Message); }
public ActionResult UpdatePlayerStats(int id) { PlayerStatsModel player = new PlayerStatsModel(usersBLL); PlayerStats playerUpdated = playerStats.GetStats().Find(m => m.StatID == id); player.StatID = playerUpdated.StatID; player.Misses = playerUpdated.Misses; player.GameID = playerUpdated.GameID; player.Assists = playerUpdated.Assists; player.Points = playerUpdated.Points; player.Rebounds = playerUpdated.Rebounds; player.UserID = playerUpdated.UserID; return(View(player)); }
public ActionResult UpdatePlayerStats(PlayerStatsModel player) { if (ModelState.IsValid) { PlayerStats checkUpdate = playerStats.GetStats().Find(m => m.StatID == player.StatID); var user = Session["Users"] as Users; PlayerStats playerUpdate = new PlayerStats(); playerUpdate.Misses = player.Misses; playerUpdate.Points = player.Points; playerUpdate.Rebounds = player.Rebounds; playerUpdate.UserID = player.UserID; playerUpdate.Assists = player.Assists; playerUpdate.TeamID = user.TeamID; playerUpdate.GameID = player.GameID; playerUpdate.StatID = player.StatID; playerStats.UpdateStats(playerUpdate); PlayerStats updatedPlayer = playerStats.GetStats().Find(m => m.StatID == player.StatID); if (updatedPlayer != checkUpdate) { ViewBag.Message = "Update Successful"; } else if (updatedPlayer == checkUpdate) { ViewBag.Message = "Update Failed"; return(View(player)); } else { } } else { ViewBag.Message = "Invalid Entry"; } return(View(player)); }
public async Task <IEnumerable <PlayerStatsModel> > GetPlayersStatsModelInner(string userId, int count, int skip, SortForPlayerStats sort, string player = null, string playerUserId = null) { var players = player == null ? null : Enumerable.Repeat(player, 1); var total = await _matchListService.GetMatchCount(userId, players); var mathes = await _matchListService.GetMatches(userId, total == 0? 1 : total, 0, players); var result = new Dictionary <string, PlayerStatsModel>(); foreach (var matchInfo in mathes) { var matchService = await _matchListService.GetMatchService(userId, matchInfo.MatchId); var matchState = await matchService.GetStateAsync(); if (matchState.State != MatchState.NotStarted) { var playersStats = await matchService.GetPlayersMatchStats(); if (((player == null || matchInfo.FirstPlayer == player) && playerUserId == null) || (playerUserId != null && matchState.FirstPlayerUserId == playerUserId)) { var firstPlayerCurrentStats = new PlayerStatsModel { Player = matchInfo.FirstPlayer, Matches = 1, Completed = matchInfo.State == MatchState.Completed ? 1 : 0, Won = matchInfo.Winner == Player.First ? 1 : 0, Lost = matchInfo.Winner == Player.Second ? 1 : 0, AggregatedMatchStats = playersStats.FirstPlayer }; if (matchInfo.FirstPlayer != null) { result[matchInfo.FirstPlayer] = result.TryGetValue(matchInfo.FirstPlayer, out var firstPlayerOldStats) ? firstPlayerOldStats + firstPlayerCurrentStats : firstPlayerCurrentStats; } } if (((player == null || matchInfo.SecondPlayer == player) && playerUserId == null) || (playerUserId != null && matchState.SecondPlayerUserId == playerUserId)) { var secondPlayerCurrentStats = new PlayerStatsModel { Player = matchInfo.SecondPlayer, Matches = 1, Completed = matchInfo.State == MatchState.Completed ? 1 : 0, Won = matchInfo.Winner == Player.Second ? 1 : 0, Lost = matchInfo.Winner == Player.First ? 1 : 0, AggregatedMatchStats = playersStats.SecondPlayer }; if (matchInfo.SecondPlayer != null) { result[matchInfo.SecondPlayer] = result.TryGetValue(matchInfo.SecondPlayer, out var secondPlayerOldStats) ? secondPlayerOldStats + secondPlayerCurrentStats : secondPlayerCurrentStats; } } } } return(result.Values.BySortForPlayerStats(sort).Skip(skip).Take(count)); }
public ServerSummaryModel() { Model = new PlayerStatsModel(); Model.GetAllPlayerData(); }
void Start() { timeModel = GameUIService.GetTimeModel(); playerStatsModel = GameUIService.GetPlayerStatsModel(); }
public GameUIService(Image uberOuter) { if (TimeModel == null) { TimeModel = new TimeModel(); TimeModel.Month = TimeModel.Months[Random.Range(0, 11)]; } else TimeModel.Day++; //Set the wake up hour TimeModel.Hour = 6; TimeModel.Minute = 0; if (PlayerStatsModel == null) PlayerStatsModel = new PlayerStatsModel(); uberModel = new UberModel(false); this.uberOuter = uberOuter; InputManager.instance.onCameraClickPressedListener += ShowUberUI; InputManager.instance.onCameraClickUpListener += HideUberUI; if(uberOuter != null) uberOuter.gameObject.SetActive(false); }
public static void Reset() { TimeModel = null; PlayerStatsModel = null; }
public PlayerStatsModel GetPlayerStats() { PlayerStatsModel psm = new PlayerStatsModel(); var hometeamid = GetTeamID(HomeorAwayTeam.Home); var awayteamid = GetTeamID(HomeorAwayTeam.Away); var hometeamaabbreviation = Utils.GetTeamAbbreviation(hometeamid); var awayteamaabbreviation = Utils.GetTeamAbbreviation(awayteamid); //Get The HomeTeam Roster, Then For Each Player Get All The Player Stats foreach (var player in Utils.GetTeamRoster(hometeamaabbreviation)) { if (player.Position == "G") { var goalsagainst = _statreader.ReadStat(9472 + player.RosterID); var assists = _statreader.ReadStat(9524 + player.RosterID); var points = assists; var shotsagainst = _statreader.ReadStat(9576 + player.RosterID); var playername = player.FirstName + " " + player.LastName; var ps = new PlayerStatsModel.PlayerStats() { Assissts = assists, GoalsAgainst = goalsagainst, Player = playername, Team = awayteamaabbreviation, Points = points, ShotsAgainst = shotsagainst }; psm.Add(ps); } else { var goals = _statreader.ReadStat(9472 + player.RosterID); var assists = _statreader.ReadStat(9524 + player.RosterID); var points = goals + assists; var shots = _statreader.ReadStat(9576 + player.RosterID); var pim = _statreader.ReadStat(9628 + player.RosterID); var playername = player.FirstName + " " + player.LastName; var ps = new PlayerStatsModel.PlayerStats() { Assissts = assists, Goals = goals, PenaltyMinutes = pim, Player = playername, Team = hometeamaabbreviation, Points = points, Shots = shots }; psm.Add(ps); } } //Get The AwayTeam Roster, Then For Each Player Get All The Player Stats foreach (var player in Utils.GetTeamRoster(awayteamaabbreviation)) { if (player.Position == "G") { var goalsagainst = _statreader.ReadStat(9498 + player.RosterID); var assists = _statreader.ReadStat(9550 + player.RosterID); var points = assists; var shotsagainst = _statreader.ReadStat(9602 + player.RosterID); var playername = player.FirstName + " " + player.LastName; var ps = new PlayerStatsModel.PlayerStats() { Assissts = assists, GoalsAgainst = goalsagainst, Player = playername, Team = awayteamaabbreviation, Points = points, ShotsAgainst = shotsagainst }; psm.Add(ps); } else { var goals = _statreader.ReadStat(9498 + player.RosterID); var assists = _statreader.ReadStat(9550 + player.RosterID); var points = goals + assists; var shots = _statreader.ReadStat(9602 + player.RosterID); var pim = _statreader.ReadStat(9654 + player.RosterID); var playername = player.FirstName + " " + player.LastName; var ps = new PlayerStatsModel.PlayerStats() { Assissts = assists, Goals = goals, PenaltyMinutes = pim, Player = playername, Team = awayteamaabbreviation, Points = points, Shots = shots }; psm.Add(ps); } } return psm; }