Example #1
0
        public static List <SizePair> MatchGrow(string grow, SizeUsePlace place)
        {
            var result = new List <SizePair>();

            foreach (var lookupGrow in LookupSizes.UniversalGrowth)
            {
                if (lookupGrow.Use == SizeUse.СlothesOnly && place == SizeUsePlace.Human)
                {
                    continue;
                }
                if (lookupGrow.Use == SizeUse.HumanOnly && place == SizeUsePlace.Сlothes)
                {
                    continue;
                }
                if (lookupGrow.Appropriated.Contains(grow))
                {
                    result.Add(new SizePair(null, lookupGrow.Name));
                }

                if (lookupGrow.Name == grow)
                {
                    foreach (var toAdd in lookupGrow.Appropriated)
                    {
                        result.Add(new SizePair(null, toAdd));
                    }
                }
            }
            return(result);
        }
Example #2
0
        public static List <SizePair> MatchSize(object sizeStd, string size, SizeUsePlace place)
        {
            var stdAtt = GetSizeStandartAttributeFromStd(sizeStd);
            var stds   = new List <Type>();

            stds.Add(sizeStd.GetType());
            if (place == SizeUsePlace.Сlothes && stdAtt.Sex != ClothesSex.Universal)
            {
                var type   = GetСlothesTypeFromStd(sizeStd);
                var unisex = GetStandartsForСlothes(type).FirstOrDefault(x => x.Sex == ClothesSex.Universal);
                if (unisex != null)
                {
                    stds.Add(unisex.StandartsEnumType);
                }
            }

            var result = new List <SizePair> ();

            foreach (var sizeType in stds)
            {
                var lookupArray = GetSizeLookup(sizeType);
                if (lookupArray == null)
                {
                    continue;
                }

                int original = (int)sizeStd;
                foreach (var lookup in lookupArray)
                {
                    if (lookup.Use == SizeUse.СlothesOnly && place == SizeUsePlace.Human)
                    {
                        continue;
                    }
                    if (lookup.Use == SizeUse.HumanOnly && place == SizeUsePlace.Сlothes)
                    {
                        continue;
                    }

                    if (lookup.Appropriated.Any(x => x[original] == size))
                    {
                        AddSizePair(result, sizeType, lookup);
                    }

                    if (lookup.Names[original] == size)
                    {
                        foreach (var toAdd in lookup.Appropriated)
                        {
                            var wearsize = lookupArray.First(x => x.Names[original] == toAdd[original]);
                            AddSizePair(result, sizeType, wearsize);
                        }
                    }
                }
            }
            return(result);
        }
Example #3
0
        public static GrowthStandartWear[] GetGrowthStandart(СlothesType wearCategory, Sex sex, SizeUsePlace place)
        {
            var att = wearCategory.GetAttribute<NeedGrowthAttribute> ();
            if (att == null)
                return null;

            var list = new List<GrowthStandartWear>();
            list.Add(GetGrowthStandart (wearCategory, sex == Sex.F ? ClothesSex.Women : ClothesSex.Men).Value);
            if (place == SizeUsePlace.Сlothes)
                list.Add(GetGrowthStandart(wearCategory, ClothesSex.Universal).Value);
            return list.ToArray();
        }
Example #4
0
        public static List<SizePair> MatchSize(object sizeStd, string size, SizeUsePlace place)
        {
            var stdAtt = GetSizeStandartAttributeFromStd(sizeStd);
            var stds = new List<Type>();
            stds.Add(sizeStd.GetType());
            if(place == SizeUsePlace.Сlothes && stdAtt.Sex != ClothesSex.Universal)
            {
                var type = GetСlothesTypeFromStd(sizeStd);
                var unisex = GetStandartsForСlothes(type).FirstOrDefault(x => x.Sex == ClothesSex.Universal);
                if (unisex != null)
                    stds.Add(unisex.StandartsEnumType);
            }

            var result = new List<SizePair> ();

            foreach(var sizeType in stds)
            {
                var lookupArray = GetSizeLookup (sizeType);
                if (lookupArray == null)
                    continue;

                int original = (int)sizeStd;
                foreach(var lookup in lookupArray)
                {
                    if (lookup.Use == SizeUse.СlothesOnly && place == SizeUsePlace.Human)
                        continue;
                    if (lookup.Use == SizeUse.HumanOnly && place == SizeUsePlace.Сlothes)
                        continue;

                    if(lookup.Appropriated.Any(x => x[original] == size))
                    {
                        foreach (var std in Enum.GetValues(sizeType))
                        {
                            var newPiar = new SizePair (GetSizeStdCode (std), lookup.Names[(int)std]);

                            if (newPiar.Size == null)
                                continue;

                            if (!result.Any (pair => pair.StandardCode == newPiar.StandardCode && pair.Size == newPiar.Size))
                                result.Add (newPiar);
                        }
                    }
                }
            }
            return result;
        }
Example #5
0
 public static List<SizePair> MatchSize(string sizeStdCode, string size, SizeUsePlace place)
 {
     return MatchSize (SizeHelper.GetSizeStdEnum (sizeStdCode), size, place);
 }
Example #6
0
 public static List<SizePair> MatchSize(SizePair sizePair, SizeUsePlace place)
 {
     return MatchSize (sizePair.StandardCode, sizePair.Size, place);
 }
Example #7
0
 public static List<SizePair> MatchGrow(GrowthStandartWear[] stds, string grow, SizeUsePlace place)
 {
     var result = new List<SizePair>();
     foreach(var std in stds)
     {
         foreach(var lookupGrow in SizeHelper.GetWearGrowthLookup(std))
         {
             if (lookupGrow.Use == SizeUse.СlothesOnly && place == SizeUsePlace.Human)
                 continue;
             if (lookupGrow.Use == SizeUse.HumanOnly && place == SizeUsePlace.Сlothes)
                 continue;
             if (lookupGrow.Appropriated.Contains(grow))
                 result.Add(new SizePair(SizeHelper.GetSizeStdCode(std), lookupGrow.Name));
         }
     }
     return result;
 }
Example #8
0
 public static List <SizePair> MatchSize(string sizeStdCode, string size, SizeUsePlace place)
 {
     return(MatchSize(SizeHelper.GetSizeStdEnum(sizeStdCode), size, place));
 }
Example #9
0
 public static List <SizePair> MatchSize(SizePair sizePair, SizeUsePlace place)
 {
     return(MatchSize(sizePair.StandardCode, sizePair.Size, place));
 }