private bool ManageRoundRemoval(RoundBase round) { bool containsSoughtRound = Rounds.Contains(round); if (containsSoughtRound) { bool removalSuccessful = Rounds.Remove(round); if (removalSuccessful) { round.MarkForDeletion(); bool stillContainsRounds = Rounds.Count > 0; if (stillContainsRounds) { GetFirstRound().Construct(); } FindIssues(); return(true); } } return(false); }
/// <summary> /// Discards the active round and all of its associted data. /// </summary> public void DiscardActiveRound() { if (ActiveRound != null) { Rounds.Remove(ActiveRound); BroadcastGameState(); } }
public void DeleteRounds(Tournament tourney, IList <Round> roundsToRemove) { foreach (var round in roundsToRemove) { round.Tournament = null; tourney.Rounds.Remove(round); Rounds.Remove(round); } SaveChanges(); }
public override Entities.RoundAuctionsStatus DeleteRound(RoundAuction roundAuctionToDelete) { Rounds?.Remove(roundAuctionToDelete); if (Rounds == null || Rounds.Count == 0) { return(new RoundAuctionsStatusHasNotRounds(Auction)); } return(this); }
public void Remove(Round round) { Rounds.Remove(round); }
/// <summary> /// Creates the round. /// </summary> private void CreateRound() { // 6B: Wait until it's time to create a new round. 20x per second or so. if (BandwidthReduction && (Time.time < TimeLastRoundSent + ROUND_LENGTH || CurrentGameState != Game.GameStates.LevelLoaded)) { return; } //===== Start a new round ===== //6C: Mark the number and time for the new round CurrentRound++; TimeLastRoundSent = Time.time; Round newRound = new Round(CurrentRound, TimeLastRoundSent); // Update all charater locations foreach (SceneCharacter3D character in SceneCharacters.Values) { // Make sure nobody falls through the ground if (character.transform.position.y < 0) { character.transform.position = new Vector3( character.transform.position.x, 10f, character.transform.position.z ); } // 6D: Save the character state in the round ObjectState characterState = character.GetCurrentState(); newRound.CurrentObjectStates.Add(((Character)character).Id, characterState); // 7: Send the character's state to all players ////Debug.Log ("Updating char " + character.BaseCharacter.Id + character.transform.ToCoordinates ()); GetComponent <NetworkView>().RPC( "UpdateCharacter", RPCMode.Others, character.BaseCharacter.Id, character.transform.position, character.transform.localEulerAngles.y, character.walking, character.head.transform.localRotation, character.state.velocity, character.crouch_factor); } // 8: Send the new round to players GetComponent <NetworkView>().RPC("NewRound", RPCMode.Others, newRound.RoundNumber); // Remove old round(s) int[] roundNums = new int[Rounds.Keys.Count]; Rounds.Keys.CopyTo(roundNums, 0); foreach (int oldRound in roundNums) { if (oldRound < CurrentRound - RoundsToKeep) { Rounds.Remove(oldRound); } } // Add this round to the list of recent rounds Rounds.Add(CurrentRound, newRound); }