Пример #1
0
        //Inequality operators are for the standard hand ordering used by player and AI
        public static bool operator <(TileID t1, TileID t2)
        {
            HandSortingMethod m = HandSortingMethod.Default;

            if (m.SuitOrder[t1.Suit] < m.SuitOrder[t2.Suit])
            {
                return(true);
            }
            else if (m.SuitOrder[t1.Suit] > m.SuitOrder[t2.Suit])
            {
                return(false);
            }
            else
            {
                if (t1.Number < t2.Number)
                {
                    return(true);
                }
                else if (t1.Number > t2.Number)
                {
                    return(false);
                }
                else
                {
                    if (t1.Aka == false && t2.Aka == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Пример #2
0
 //Creates a collection using a list and an access key for the tiles in that list
 public CustomSortedTileCollection(HandSortingMethod sortingMethod, List <Tile> list, int accessKey = 0)
 {
     _accessKey = accessKey;
     sorting    = sortingMethod;
     for (int i = 0; i < list.Count; i++)
     {
         Add(list[i], _accessKey);
     }
 }
Пример #3
0
        //***********************************************************************
        //***************************** New Methods *****************************
        //***********************************************************************

        //Sets the sorting method and re-sorts the hand
        public void SetSortingMethod(HandSortingMethod sortingMethod, int accessKey = 0)
        {
            if ((accessKey != _accessKey) && _accessKey != 0)
            {
                return;
            }
            List <Tile> temp = GetTileList();

            Clear(_accessKey);
            sorting = sortingMethod;
            for (int i = 0; i < temp.Count; i++)
            {
                Add(temp[i], _accessKey);
            }
        }
Пример #4
0
        //***********************************************************************
        //**************************** Constructors *****************************
        //***********************************************************************

        //Creates an empty collection
        public CustomSortedTileCollection(HandSortingMethod sortingMethod)
        {
            sorting = sortingMethod;
        }