Ejemplo n.º 1
0
        public bool TransferToNextRound(RoundBase currentRound)
        {
            bool roundHasFinished = currentRound.GetPlayState() == PlayStateEnum.Finished;

            if (roundHasFinished)
            {
                RoundBase nextRound            = currentRound.GetNextRound();
                bool      hasRoundToTransferTo = nextRound != null;

                if (hasRoundToTransferTo)
                {
                    PlayerReferences = currentRound.GetAdvancingPlayerReferences();
                    bool hasPlayerReferencesToTransfer = PlayerReferences.Count > 0;

                    if (hasPlayerReferencesToTransfer)
                    {
                        nextRound.ReceiveTransferedPlayerReferences(this);
                        return(true);
                    }

                    // LOG Error: Tried to transfer advancing player references to next round without any player references.
                    return(false);
                }

                // LOG Error: Tried to transfer advancing player references to nonexistent next round.
                return(false);
            }

            // LOG Error: Tried to transfer advancing player references to next round before current round is finished.
            return(false);
        }
        public override bool NewValueValid(int inValue, out int outValue, RoundBase parent)
        {
            bool tournamentHasNotBegun = parent.GetPlayState() == PlayStateEnum.NotBegun;

            if (tournamentHasNotBegun)
            {
                outValue = inValue;
                return(true);
            }

            outValue = -1;
            return(false);
        }