예제 #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();
            }
        }
예제 #2
0
        private void AddSliderGridItem(CASFacialBlendPanel ths, ItemGrid grid, ResourceKey itemKey, FacialBlendData sliderData)
        {
            WindowBase windowByExportID = UIManager.LoadLayout(itemKey).GetWindowByExportID(0x1);

            if (windowByExportID != null)
            {
                string caption = StringTable.GetLocalizedString(sliderData.mLocalizationKey);

                int dataValue = (int)Math.Round((double)(sliderData.Value * 256f));

                Text childByID = windowByExportID.GetChildByID(0x2, true) as Text;
                if (childByID != null)
                {
                    childByID.Caption = GetTitle(caption, dataValue);
                }

                Slider slider = windowByExportID.GetChildByID(0x4, true) as Slider;
                if (slider != null)
                {
                    slider.SliderValueChange += OnSliderChanged;
                    slider.MouseUp           += OnSliderMouseUp;

                    mSlidersToText.Add(slider, new Pair <Text, string>(childByID, caption));

                    if (sliderData.mBidirectional)
                    {
                        slider.MinValue = -256 * NRaas.MasterController.Settings.mSliderMultiple;
                    }
                    else
                    {
                        slider.MinValue = 0x0;
                    }

                    slider.MaxValue = 256 * NRaas.MasterController.Settings.mSliderMultiple;

                    slider.Value = dataValue;
                    if (CASController.Singleton.DebugTooltips)
                    {
                        windowByExportID.TooltipText = StringTable.GetLocalizedString(sliderData.mLocalizationKey);
                    }

                    grid.AddItem(new ItemGridCellItem(windowByExportID, sliderData));
                    if (ths.mNumSliders < ths.mSliderData.Length)
                    {
                        ths.mSliderData[ths.mNumSliders].mSlider = slider;
                        ths.mSliderData[ths.mNumSliders].mData   = sliderData;
                        ths.mNumSliders++;
                    }
                }
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
파일: Old.cs 프로젝트: Robobeurre/NRaas
 private bool AddPartsGridItem(ItemGrid catalog, ResourceKey layoutKey, CASPart part, ResourceKeyContentCategory contentType)
 {
     WindowBase windowByExportID = UIManager.LoadLayout(layoutKey).GetWindowByExportID(0x1);
     if (windowByExportID == null)
     {
         return false;
     }
     if (part.Key != this.kInvalidCASPart.Key)
     {
         Window childByID = windowByExportID.GetChildByID(0x20, true) as Window;
         if (childByID != null)
         {
             ImageDrawable drawable = childByID.Drawable as ImageDrawable;
             if (drawable != null)
             {
                 ThumbnailKey key = new ThumbnailKey(part.Key, (int) CASUtils.PartDataGetPresetId(part.Key, 0x0), (uint) part.BodyType, (uint) part.AgeGenderSpecies, ThumbnailSize.Large);
                 drawable.Image = UIManager.GetCASThumbnailImage(key);
                 childByID.Invalidate();
             }
         }
         CustomContentIcon icon = windowByExportID.GetChildByID(0x23, true) as CustomContentIcon;
         if (UIUtils.IsContentTypeDisabled(contentType))
         {
             return false;
         }
         if (UIUtils.IsCustomFiltered(contentType))
         {
             this.mFilterButton.Enabled = true;
         }
         else if (this.mFilter)
         {
             return false;
         }
         icon.ContentType = contentType;
         windowByExportID.TooltipText = this.GetPartName(part);
         if (Responder.Instance.CASModel.ActiveWardrobeContains(part))
         {
             WindowBase base3 = windowByExportID.GetChildByID(0x29, true);
             if (base3 != null)
             {
                 base3.Visible = true;
             }
         }
     }
     catalog.AddItem(new ItemGridCellItem(windowByExportID, part));
     return true;
 }