Exemplo n.º 1
0
        private static void PopulatePartsGrid(CASMakeup ths, BodyTypes category)
        {
            if (category != BodyTypes.CostumeMakeup)
            {
                ItemGrid mGridMakeupParts = ths.mGridMakeupParts;
                mGridMakeupParts.Clear();
                CASPart       wornPart     = ths.GetWornPart(category);
                List <object> visibleParts = ths.GetVisibleParts(category);
                ResourceKey   layoutKey    = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0);
                foreach (object obj2 in visibleParts)
                {
                    CASPart part = (CASPart)obj2;
                    ths.AddPartsGridItem(mGridMakeupParts, layoutKey, part);
                    if (part.Key == wornPart.Key)
                    {
                        mGridMakeupParts.SelectedItem = mGridMakeupParts.Count - 0x1;
                    }
                }
                ths.mButtonColor.Enabled  = (mGridMakeupParts.SelectedItem != -1) && (mGridMakeupParts.SelectedItem != 0x0);
                ths.mButtonDelete.Enabled = ths.mButtonColor.Enabled;
            }
            else
            {
                ItemGrid mGridCostumeParts = ths.mGridCostumeParts;
                mGridCostumeParts.Clear();
                ths.mCurrentPreset     = null;
                ths.mCurrentFocusedRow = null;
                ths.mTempFocusedRow    = null;
                List <object> objectList = ths.GetVisibleParts(category);
                bool          shouldEnableCatalogProductFilter = false;
                CASPart       objectToNotRemove = ths.GetWornPart(category);
                ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter, objectToNotRemove);
                ths.mButtonCostumeFilter.Enabled = false;
                ths.mButtonCostumeFilter.Tag     = shouldEnableCatalogProductFilter;
                foreach (CASPart part4 in objectList)
                {
                    if (!(part4.Key == ths.kInvalidCASPart.Key))
                    {
                        CASClothingRow row = UIManager.LoadLayout(ResourceKey.CreateUILayoutKey("CASClothingRow", 0x0)).GetWindowByExportID(0x1) as CASClothingRow;
                        row.CASPart       = part4;
                        row.RowController = ths;
                        if (row.CreateGridItems(true).Count > 0x0)
                        {
                            mGridCostumeParts.AddItem(new ItemGridCellItem(row, null));
                            if (row.SelectedItem != -1)
                            {
                                ths.mCurrentPreset = row.Selection as CASPartPreset;
                            }
                        }

                        CASClothingRowEx.Create(row, MasterController.Settings.mAllowMultipleMakeup);
                    }
                }
                ths.mContentTypeFilter.UpdateFilterButtonState();
            }
        }
Exemplo n.º 2
0
        private bool PopulateSliderGrid(CASFacialBlendPanel ths, ItemGrid grid, FacialBlendRegions regionFilter, List <FacialBlendCategories> categoryFilter)
        {
            ResourceKey itemKey = ResourceKey.CreateUILayoutKey("CASBodySlider", 0x0);

            List <FacialBlendData> data = new List <FacialBlendData>();

            List <BlendUnit> list = new List <BlendUnit>(CASController.Singleton.BlendUnits);

            foreach (BlendUnit unit in list)
            {
                if ((unit.Region == regionFilter) && (categoryFilter.Contains(unit.Category)))
                {
                    FacialBlendData facialBlendData = ths.GetFacialBlendData(unit);
                    if (facialBlendData == null)
                    {
                        continue;
                    }

                    data.Add(facialBlendData);
                }
            }

            data.Sort(new Comparison <FacialBlendData>(OnBlendSort));

            foreach (FacialBlendData facialBlendData in data)
            {
                AddSliderGridItem(ths, grid, itemKey, facialBlendData);
            }

            grid.ForceCellTooltips = CASController.Singleton.DebugTooltips;
            if (grid.Count > grid.VisibleRows)
            {
                Window childByID = grid.GetChildByID(0x62ec8d0, false) as Window;
                if (childByID != null)
                {
                    childByID.Visible = true;
                }
            }

            if (grid.Count == 0x0)
            {
                grid.Clear();
            }
            return(true);
        }