public void AddUser(User user) { if (user.Email != null) { if (Size > Users.Count && user.Coins >= 10000) { user.Coins -= 10000; user.CoinsTable += 10000; Users.Add(user); ReadyPlayers.Add(user); user.PlayIntable = this; } } //Strings += "Игрок "+ User. }
/// <summary> /// Makes a player ready/unready for job allocations /// </summary> public void SetPlayerReady(ConnectedPlayer player, bool isReady, CharacterSettings charSettings = null) { if (isReady) { // Update connection with locked in job prefs if (charSettings != null) { player.CharacterSettings = charSettings; } else { Logger.LogError($"{player.Username} was set to ready with NULL character settings:\n{player}"); } ReadyPlayers.Add(player); Logger.Log($"Set {player.Username} to ready with these character settings:\n{charSettings}"); } else { ReadyPlayers.Remove(player); Logger.Log($"Set {player.Username} to NOT ready!"); } }
private void WatchForReadyCheckChanges(Dictionary <long, HashSet <string> > readyPlayersBefore) { foreach (var player in readyPlayersBefore.Keys) { if (player == Game1.player.UniqueMultiplayerID) { continue; /* Don't care about current player */ } ReadyPlayers.GetOrCreateDefault(player); var checksBefore = readyPlayersBefore[player]; var checksNow = ReadyPlayers[player]; var newCheck = checksNow.FirstOrDefault(c => !checksBefore.Contains(c)); var removedCheck = checksBefore.FirstOrDefault(c => !checksNow.Contains(c)); var playerName = PlayerHelpers.GetPlayerWithUniqueId(player).Name; var options = ConfigHelper.GetOptions(); if (newCheck != null && newCheck != "wakeup") { if (options.ShowReadyInfoInChatBox) { _helper.SelfInfoMessage($"{playerName} is now ready {GetFriendlyReadyCheckName(newCheck)}."); } if (options.ShowLastPlayerReadyInfoInChatBox) { WarnIfIAmLastPlayerReady(newCheck); } } if (removedCheck != null && removedCheck != "wakeup" && options.ShowReadyInfoInChatBox) { _helper.SelfInfoMessage($"{playerName} is no longer ready {GetFriendlyReadyCheckName(removedCheck)}."); } } }
public void ClearReadyPlayers() { ReadyPlayers.Clear(); }
public bool IsPlayerWaiting(long playerId) { return(ReadyPlayers.GetOrCreateDefault(playerId).Any(r => r != "wakeup")); }