Ejemplo n.º 1
0
        protected static List <CASParts.Wrapper> GetVisibleCASParts(CASLogic ths, BodyTypes bodyType, uint categories)
        {
            uint alteredCategories = categories;

            ths.AdjustAvailableCategoriesForCASMode(ref alteredCategories);

            SimBuilder builder = ths.mBuilder;

            CASAgeGenderFlags age     = builder.Age;
            CASAgeGenderFlags gender  = builder.Gender;
            CASAgeGenderFlags species = builder.Species;

            List <CASParts.Wrapper> list = new List <CASParts.Wrapper>();

            foreach (CASParts.Wrapper part in CASBase.HairParts)
            {
                InvalidPartBase.Reason reason = InvalidPartBooter.Allow(part, age, gender, species, false, (OutfitCategories)categories);
                if (reason != InvalidPartBase.Reason.None)
                {
                    continue;
                }

                if ((part.mPart.BodyType == bodyType) && OutfitUtils.PartMatchesSim(builder, alteredCategories, part.mPart))
                {
                    list.Add(part);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 // Externalized to Dresser
 public static bool Allow(CASPart part, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species, bool maternity, OutfitCategories category)
 {
     try
     {
         return(InvalidPartBooter.Allow(new CASParts.Wrapper(part), age, gender, species, maternity, category) == InvalidPartBase.Reason.None);
     }
     catch (Exception e)
     {
         Common.Exception("Allow", e);
         return(true);
     }
 }
Ejemplo n.º 3
0
        public override ArrayList GetVisibleCASParts(BodyTypes bodyType, uint categories)
        {
            try
            {
                List <CASParts.Wrapper> list = SubGetVisibleCASParts(bodyType, categories);
                //ArrayList list = base.GetVisibleCASParts(bodyType, categories);

                StackTrace trace = new StackTrace(false);

                int blackListCount = 0;

                CASClothingCategory clothingCategory = CASClothingCategory.gSingleton;
                if (clothingCategory != null)
                {
                    // Fix for an issue where this listing is never cleared by the Core
                    if (clothingCategory.PartPresetsList != null)
                    {
                        clothingCategory.PartPresetsList.Clear();
                    }
                }

                bool truncate = false;

                if (list.Count > 0)
                {
                    bool found = false;

                    foreach (StackFrame frame in trace.GetFrames())
                    {
                        if (frame.GetMethod().DeclaringType == sDelayedCategoryUpdate)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        foreach (StackFrame frame in trace.GetFrames())
                        {
                            if ((frame.GetMethod().DeclaringType == sCASClothingCategory) &&
                                (frame.GetMethod().ToString() == "Void HideUnusedIcons()"))
                            {
                                truncate = true;
                                break;
                            }
                            else if ((frame.GetMethod().DeclaringType == sCASClothingCategory) &&
                                     (frame.GetMethod().ToString() == "Void LoadParts()"))
                            {
                                truncate = true;

                                if ((clothingCategory != null) && (clothingCategory.mClothingTypesGrid != null))
                                {
                                    clothingCategory.mClothingTypesGrid.Clear();
                                }

                                CASClothingCategoryEx.DelayedCategoryUpdate.Perform();
                                break;
                            }
                        }

                        if (truncate)
                        {
                            List <CASParts.Wrapper> newList = new List <CASParts.Wrapper>();

                            newList.Add(list[0]);

                            list = newList;
                        }
                    }
                }

                if ((!truncate) && (InvalidPartBooter.HasInvalidParts))
                {
                    SimBuilder builder = CASLogic.Instance.mBuilder;

                    CASAgeGenderFlags age     = builder.Age;
                    CASAgeGenderFlags gender  = builder.Gender;
                    CASAgeGenderFlags species = builder.Species;

                    List <CASParts.Wrapper> newList = new List <CASParts.Wrapper>();

                    foreach (CASParts.Wrapper part in list)
                    {
                        InvalidPartBase.Reason reason = InvalidPartBooter.Allow(part, age, gender, species, false, (OutfitCategories)categories);
                        if (reason == InvalidPartBase.Reason.None)
                        {
                            newList.Add(part);
                        }
                        else
                        {
                            blackListCount++;
                        }
                    }

                    list.Clear();
                    list = newList;
                }

                ArrayList results = new ArrayList();

                foreach (CASParts.Wrapper part in list)
                {
                    results.Add(part.mPart);
                }

                return(results);
            }
            catch (Exception e)
            {
                Common.Exception("GetVisibleCASParts", e);

                return(new ArrayList());
            }
        }