Esempio n. 1
0
        //Filters factory method
        public static AuctionFilter Get(Hashtable filterHash)
        {
            AuctionFilterType filterType = (AuctionFilterType)(byte)filterHash.GetValue <byte>((int)SPC.Type, (byte)AuctionFilterType.ColorFilter);

            switch (filterType)
            {
            case AuctionFilterType.ObjectTypeFilter:
            {
                AuctionObjectType objectType = (AuctionObjectType)(byte)filterHash.GetValue <byte>((int)SPC.ObjectType, (byte)AuctionObjectType.Module);
                return(new AuctionObjectTypeFilter(objectType));
            }

            case AuctionFilterType.ColorFilter:
            {
                ObjectColor objectColor = (ObjectColor)(byte)filterHash.GetValue <byte>((int)SPC.Color, (byte)ObjectColor.blue);
                return(new ColorFilter(objectColor));
            }

            case AuctionFilterType.WorkshopFilter:
            {
                Workshop workshop = (Workshop)(byte)filterHash.Value <byte>((int)SPC.Workshop, (byte)Workshop.Arlen);
                return(new WorkshopFilter(workshop));
            }

            case AuctionFilterType.PriceFilter:
            {
                int minPrice = filterHash.GetValue <int>((int)SPC.MinPrice, 0);
                int maxPrice = filterHash.GetValue <int>((int)SPC.MaxPrice, int.MaxValue);
                return(new PriceFilter(minPrice, maxPrice));
            }

            case AuctionFilterType.LevelFilter:
            {
                int minLevel = filterHash.GetValue <int>((int)SPC.MinLevel, 0);
                int maxLevel = filterHash.GetValue <int>((int)SPC.MaxLevel, int.MaxValue);
                return(new LevelFilter(minLevel, maxLevel));
            }

            default:
            {
                log.ErrorFormat("unsupported filter = {0}", filterType);
                return(null);
            }
            }
        }
Esempio n. 2
0
 public static string Key(AuctionObjectType objType)
 {
     return(AuctionFilterType.ObjectTypeFilter.ToString() + objType.ToString());
 }
 public AuctionObjectTypeFilter(AuctionObjectType type)
 {
     mAuctionObjectType = type;
 }