Exemple #1
0
        public static CASClothingRowEx Create(CASClothingRow row, bool allowMultiple)
        {
            if (row.mGridWindows == null)
            {
                return(null);
            }

            CASClothingRowEx rowEx = new CASClothingRowEx(row, allowMultiple);

            rowEx.UpdateSelectedStates(-1);

            for (int i = 0; i < row.mGridWindows.Length; i++)
            {
                if (row.mGridWindows[i] == null)
                {
                    continue;
                }

                row.mGridWindows[i].MouseDown -= row.OnClothingSelect;

                row.mGridWindows[i].MouseDown -= rowEx.OnClothingSelect;
                row.mGridWindows[i].MouseDown += rowEx.OnClothingSelect;
            }

            return(rowEx);
        }
Exemple #2
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();
            }
        }
Exemple #3
0
        public static CASClothingRowEx Create(CASClothingRow row, bool allowMultiple)
        {
            if (row.mGridWindows == null) return null;

            CASClothingRowEx rowEx = new CASClothingRowEx(row, allowMultiple);

            rowEx.UpdateSelectedStates(-1);

            for (int i = 0; i < row.mGridWindows.Length; i++)
            {
                if (row.mGridWindows[i] == null) continue;

                row.mGridWindows[i].MouseDown -= row.OnClothingSelect;

                row.mGridWindows[i].MouseDown -= rowEx.OnClothingSelect;
                row.mGridWindows[i].MouseDown += rowEx.OnClothingSelect;
            }

            return rowEx;
        }
        protected static void OnItemRowsChanged()
        {
            try
            {
                foreach (CASClothingRow row in sRows)
                {
                    if (sCompleted.ContainsKey(row))
                    {
                        continue;
                    }

                    CASClothingRowEx.Create(row, MasterController.Settings.mAllowMultipleAccessories);

                    sCompleted.Add(row, true);
                }

                sRows.Clear();
            }
            catch (Exception e)
            {
                Common.Exception("OnItemRowsChanged", e);
            }
        }
        public static bool AddGridItem(ItemGrid grid, object current, ResourceKey layoutKey, object context)
        {
            try
            {
                CASClothingCategory ths = CASClothingCategory.gSingleton;
                if (ths == null)
                {
                    return(false);
                }

                bool flag = false;
                if (current != null)
                {
                    if (current is List <CASParts.PartPreset> )
                    {
                        List <CASParts.PartPreset> parts = current as List <CASParts.PartPreset>;
                        if (parts.Count > 0)
                        {
                            CASClothingRow row = UIManager.LoadLayout(layoutKey).GetWindowByExportID(0x1) as CASClothingRow;
                            if (row == null)
                            {
                                return(false);
                            }

                            row.UseEp5AsBaseContent = ths.mIsEp5Base;
                            row.CASPart             = parts[0].mPart;
                            row.RowController       = ths;

                            ArrayList list = CASClothingRowEx.CreateGridItems(row, parts, true);

                            ths.mSortButton.Tag = ((bool)ths.mSortButton.Tag) | row.HasFilterableContent;

                            if (list.Count > 0x0)
                            {
                                sRows.Add(row);

                                grid.AddItem(new ItemGridCellItem(row, null));

                                flag = true;
                                if (row.SelectedItem == -1)
                                {
                                    return(flag);
                                }

                                if (ths.IsAccessoryType(row.CASPart.BodyType))
                                {
                                    if (CASClothingRowEx.IsWorn(row.CASPart))
                                    {
                                        if (row.CASPart.BodyType == ((BodyTypes)CASClothingCategory.sAccessoriesSelection))
                                        {
                                            grid.SelectedItem = grid.Count - 0x1;
                                            ths.mSelectedType = row.SelectedType;
                                            CASClothingCategory.sAccessoriesSelection = (int)row.CASPart.BodyType;
                                            ths.mCurrentPreset = row.Selection as CASPartPreset;
                                        }
                                    }
                                    else
                                    {
                                        grid.SelectedItem = grid.Count - 0x1;
                                        ths.mSelectedType = row.SelectedType;
                                        CASClothingCategory.sAccessoriesSelection = (int)row.CASPart.BodyType;
                                        ths.mCurrentPreset = row.Selection as CASPartPreset;
                                    }

                                    return(flag);
                                }

                                grid.SelectedItem  = grid.Count - 0x1;
                                ths.mSelectedType  = row.SelectedType;
                                ths.mCurrentPreset = row.Selection as CASPartPreset;
                            }
                        }

                        return(flag);
                    }
                    else
                    {
                        List <object> featured = current as List <object>;
                        if (featured == null)
                        {
                            return(flag);
                        }

                        CASClothingRow row = UIManager.LoadLayout(layoutKey).GetWindowByExportID(1) as CASClothingRow;
                        row.ObjectOfInterest = featured;
                        row.RowController    = ths;

                        ArrayList items = row.CreateGridItems(true);
                        ths.mSortButton.Tag = ((bool)ths.mSortButton.Tag) | row.HasFilterableContent;
                        if (items.Count > 0)
                        {
                            grid.AddItem(new ItemGridCellItem(row, null));
                        }
                        return(true);
                    }
                }

                ths.mContentTypeFilter.UpdateFilterButtonState();

                ths.UpdateButtons(ths.mSelectedType);
                if (CASClothingCategory.OnClothingGridFinishedPopulating != null)
                {
                    CASClothingCategory.OnClothingGridFinishedPopulating();
                }

                return(flag);
            }
            catch (Exception e)
            {
                Common.Exception("AddGridItem", e);
                return(false);
            }
        }