コード例 #1
0
        public override bool isContain(DecoratorPreferencesInterface pref)
        {
            if (pref.GetType().IsAssignableFrom(typeof(OptionalPreferences)))
            {
                //if (pref.GetType() != typeof(OptionalPreferences))
                return(false);
            }
            OptionalPreferences opPref       = ((OptionalPreferences)pref);
            BuyInPolicyDecPref  matchingPref = (BuyInPolicyDecPref)getMatchingOptionalPref(opPref);

            //if we found matchig optinal pref and he have the same policy
            if (matchingPref != null && matchingPref.buyInPolicy == buyInPolicy)
            {
                //if we still need to check the rest of the chain
                if (matchingPref.nextDecPref != null)
                {
                    //return its result
                    return(nextDecPref.isContain(pref));
                }
                //if we don't have anything else to check return true.
                else
                {
                    return(true);
                }
            }
            //if we couldent found or if we found pref with different value.
            else if (matchingPref == null && nextDecPref != null)
            {
                return(nextDecPref.isContain(opPref));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed, int minRank, int maxRank)
 {
     this.firstDecPref      = firstDecPref;
     this.isSpectateAllowed = isSpectateAllowed;
     this.minRank           = minRank;
     this.maxRank           = maxRank;
     isLeague = true;
 }
コード例 #3
0
 public MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed)
 {
     this.firstDecPref      = firstDecPref;
     this.isSpectateAllowed = isSpectateAllowed;
     minRank  = -2;
     maxRank  = -2;
     isLeague = false;
 }
コード例 #4
0
 public OptionalPreferences getMatchingOptionalPref(OptionalPreferences toGet)
 {
     while (toGet != null)
     {
         if (GetType() == toGet.GetType())
         {
             return(toGet);
         }
         toGet = toGet.nextDecPref;
     }
     return(null);
 }
コード例 #5
0
        public OptionalPreferences getOptionalPref(OptionalPreferences wantedPref)
        {
            OptionalPreferences temp = firstDecPref;

            while (temp != null)
            {
                if (temp.GetType() == wantedPref.GetType())
                {
                    return(temp);
                }
                temp = temp.nextDecPref;
            }
            return(null);
        }
コード例 #6
0
 public GamePolicyDecPref(GameTypePolicy gamePolicy, int limit, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.gamePolicy = gamePolicy;
     this.limit      = limit;
 }
コード例 #7
0
 public BuyInPolicyDecPref(int buyInPolicy, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.buyInPolicy = buyInPolicy;
 }
コード例 #8
0
 public OptionalPreferences(OptionalPreferences nextPref)
 {
     nextDecPref = nextPref;
 }
コード例 #9
0
 public MaxPlayersDecPref(int maxPlayers, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.maxPlayers = maxPlayers;
 }
コード例 #10
0
 public StartingAmountChipsCedPref(int startingChipsPolicy, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.startingChipsPolicy = startingChipsPolicy;
 }
コード例 #11
0
 public MinBetDecPref(int minimalBet, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.minimalBet = minimalBet;
 }