public Player UpdateAndGetPlayer(int index, string name, int damage) { if (String.IsNullOrEmpty(name) && damage == 0) { if (index < Players.Count) { Players.RemoveAt(index); if (DontShowIfAlone && Players.Count() <= 1) { Fake_Players.Clear(); } else { Fake_Players.RemoveAt(index); } } return(null); } while (index >= Players.Count) { Players.Add(new Player() { Index = Players.Count, Name = LocalizationHelper.GetString(LocalizationHelper.UnknownPlayerStringId) }); if (DontShowIfAlone && Players.Count() <= 1) { Fake_Players.Clear(); } else { Fake_Players.Add(Players[Players.Count() - 1]); } } Player player = Players[index]; if (!String.IsNullOrEmpty(name)) { player.Name = name; } else if (String.IsNullOrEmpty(player.Name)) { player.Name = LocalizationHelper.GetString(LocalizationHelper.UnknownPlayerStringId); } if (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerInExpedition) { player.Damage = damage; } return(player); }
public Player UpdateAndGetPlayer(int index, string name, int damage) { if (string.IsNullOrEmpty(name) && damage == 0) { if (index < Players.Count) { Players.RemoveAt(index); if (DontShowIfAlone && Players.Count() <= 1) { Fake_Players.Clear(); } else { Fake_Players.RemoveAt(index); } } return(null); } while (index >= Players.Count) { Players.Add(new Player() { Index = Players.Count, Name = LocalizationHelper.GetString(LocalizationHelper.UnknownPlayerStringId) }); if (DontShowIfAlone && Players.Count() <= 1) { Fake_Players.Clear(); } else { Fake_Players.Add(Players[Players.Count() - 1]); } } var player = Players[index]; if (!string.IsNullOrEmpty(name)) { player.Name = name; } else if (string.IsNullOrEmpty(player.Name)) { player.Name = LocalizationHelper.GetString(LocalizationHelper.UnknownPlayerStringId); } player.Damage = damage; return(player); }