CompareTo() public abstract method

Compares current combination to another one
public abstract CompareTo ( object combination ) : int
combination object combination to compare to
return int
示例#1
0
        private Player FindBiggestSequentialCombinationHolder( )
        {
            CardCombination biggest = null;
            CardCombination second  = null;

            Player biggestPlayer = null;
            Player secondPlayer  = null;

            foreach (DictionaryEntry de in _mapSequentialCombinationToPlayer)
            {
                CardCombination current = de.Key as CardCombination;

                if (biggest != null)
                {
                    if (current.CompareTo(biggest) > 0)
                    {
                        biggest       = current;
                        biggestPlayer = de.Value as Player;
                    }
                    else if (current.CompareTo(biggest) == 0)
                    {
                        second       = current;
                        secondPlayer = de.Value as Player;
                    }
                }
                else
                {
                    biggest       = current;
                    biggestPlayer = de.Value as Player;
                }
            }

            if (biggest != null && second != null)
            {
                if (biggestPlayer == secondPlayer || biggestPlayer == _game.GetTeamPlayer(secondPlayer))
                {
                    return(biggestPlayer);
                }
            }
            else if (biggest != null)
            {
                return(biggestPlayer);
            }

            return(null);
        }