public static void OnHornColorGridClicked(ItemGrid sender, ItemGridCellClickEvent itemClicked) { try { CAPUnicorn ths = CAPUnicorn.gSingleton; if (ths == null) { return; } CASPartPreset tag = itemClicked.mTag as CASPartPreset; ths.mCurrentHornColorPreset = tag; // Custom Responder.Instance.CASModel.RequestRemoveCASPart(ths.GetWornHornPart()); Responder.Instance.CASModel.RequestAddCASPart(tag.mPart, false); Responder.Instance.CASModel.RequestCommitPresetToPart(tag.mPart, tag.mPresetString); CustomContentIcon childByID = itemClicked.mWin.GetChildByID(0x23, true) as CustomContentIcon; if (UIUtils.ExtractCustomContentType(childByID.ContentType) == ResourceKeyContentCategory.kInstalled) { ths.mHornColorDeleteButton.Enabled = false; } else { ths.mHornColorDeleteButton.Enabled = true; } Audio.StartSound("ui_tertiary_button"); } catch (Exception e) { Common.Exception("OnHornColorGridClicked", e); } }
public static void OnTypesGridItemClicked(WindowBase sender, ItemGridCellClickEvent itemClicked) { try { CASHair ths = CASHair.gSingleton; CASPartPreset part = itemClicked.mTag as CASPartPreset; if (part != null) { if (itemClicked.mButton == MouseKeys.kMouseLeft) { ths.mSavedPresetId = part.mPresetId; if (part.mPresetString != null) { if (part.mPart.Key != ths.GetWornPart().Key) { Responder.Instance.CASModel.RequestAddCASPart(part.mPart, part.mPresetString); } else { Responder.Instance.CASModel.RequestCommitPresetToPart(part.mPart, part.mPresetString); } } ths.mHairStylesGrid.SelectedItem = -1; ths.mDesignButton.Enabled = CASHair.PartIsHat(part.mPart); ths.mHairTypesGrid.RemoveTempItem(); ths.mSaveButton.Enabled = false; ObjectDesigner.SetCASPart(part.mPart.Key); if (UIUtils.GetCustomContentType(part.mPart.Key, part.mPresetId) == ResourceKeyContentCategory.kLocalUserCreated) { ths.mHatsDeleteButton.Enabled = true; ths.mHatsShareButton.Enabled = true; ths.mUndoOnDelete = true; } else { ths.mUndoOnDelete = false; ths.mHatsDeleteButton.Enabled = false; ths.mHatsShareButton.Enabled = false; } Audio.StartSound("ui_tertiary_button"); } else if (itemClicked.mButton == MouseKeys.kMouseRight) { CASBase.Blacklist(new CASParts.Wrapper(part.mPart), ((itemClicked.mModifiers & Modifiers.kModifierMaskControl) == Modifiers.kModifierMaskControl), PopulateTypesGrid); } } } catch (Exception e) { Common.Exception("OnTypesGridItemMouseDown", e); } }
protected void SelectItem(ICASRowController ths, CASPart part, CASPartPreset preset) { if (ths is CASClothingCategory) { CASClothingCategoryEx.SelectItem(ths as CASClothingCategory, part, preset, mAllowMultiple); } else if (ths is CASMakeup) { CASMakeupEx.SelectItem(ths as CASMakeup, part, preset, mAllowMultiple); } }
public static void SelectItem(CASMakeup ths, CASPart part, CASPartPreset preset, bool allowMultiple) { ICASModel cASModel = new CASModelProxy(Responder.Instance.CASModel); List <CASPart> wornParts = cASModel.GetWornParts(part.BodyType); bool flag = false; if ((part.Key == ths.kInvalidCASPart.Key) && (!allowMultiple)) { foreach (CASPart part2 in wornParts) { cASModel.RequestRemoveCASPart(part2); } } else if (!wornParts.Contains(part)) { flag = true; } if (preset != null) { ths.mCurrentPreset = preset; if (preset.mPresetString != null) { if (flag) { cASModel.RequestAddCASPart(part, preset.mPresetString); } else { cASModel.RequestCommitPresetToPart(part, preset.mPresetString); } } } else if (flag) { ths.mCurrentPreset = new CASPartPreset(part, null); cASModel.RequestAddCASPart(part, false); } ths.UpdateCostumePresetState(); Audio.StartSound("ui_tertiary_button"); }
public static void PopulateHornColors() { try { CAPUnicorn ths = CAPUnicorn.gSingleton; if (ths == null) { return; } CASPartPreset preset; ths.mHornColorsGrid.Clear(); List <CASPart> wornHornParts = new List <CASPart>(); CASPart wornPart = ths.GetWornHornPart(); CASLogic singleton = CASLogic.GetSingleton(); foreach (CASPart part in singleton.mCasParts) { if ((part.BodyType == BodyTypes.PetHorn) && (part.Species == CASAgeGenderFlags.Horse) && ((part.Age & singleton.Age) != CASAgeGenderFlags.None)) { wornHornParts.Add(part); } } CompositorUtil.GetPatternsFromCASPart(wornPart); ObjectDesigner.SetCASPart(wornPart.Key); ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("EyeColorPresetGridItem", 0x0); string designPreset = null; // Custom try { designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart); } catch { } foreach (CASPart wornHornPart in wornHornParts) { uint num = CASUtils.PartDataNumPresets(wornHornPart.Key); int i = 0; for (uint j = 0x0; j < num; j++) { preset = new CASPartPreset(wornHornPart, CASUtils.PartDataGetPresetId(wornHornPart.Key, j), CASUtils.PartDataGetPreset(wornHornPart.Key, j)); ths.AddHornPresetGridItem(ths.mHornColorsGrid, layoutKey, preset, wornHornPart, (uint)(j + 0x1)); if (CAPUnicorn.HornPresetCompare(designPreset, preset.mPresetString)) { ths.mCurrentHornColorPreset = preset; ths.mHornColorsGrid.SelectedItem = i; if (UIUtils.GetCustomContentType(wornHornPart.Key, preset.mPresetId) == ResourceKeyContentCategory.kInstalled) { ths.mHornColorDeleteButton.Enabled = false; } else { ths.mHornColorDeleteButton.Enabled = true; } } i++; } } if (ths.mHornColorsGrid.SelectedItem == -1) { ths.mHornColorDeleteButton.Enabled = false; } bool flag = ths.mHornColorsGrid.Count > (ths.mHornColorsGrid.VisibleRows * ths.mHornColorsGrid.VisibleColumns); Rect area = ths.mHornColorPanel.Area; area.Height = flag ? ths.mHornColorPanelHeightWithScrollbars : (ths.mHornColorPanelHeightWithScrollbars - 21f); ths.mHornColorPanel.Area = area; } catch (Exception e) { Common.Exception("PopulateHornColors", e); } }
private static void PopulateTypesGrid(CASHair ths) { if (ths == null) return; ICASModel cASModel = Responder.Instance.CASModel; Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) }; ths.mHairTypesGrid.Clear(); CASPart wornPart = ths.GetWornPart(); ResourceKey resKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0); bool isHat = false; bool flag = false; if (ths.mHairType == CASHair.HairType.Hat) { ths.mHatsShareButton.Enabled = false; ths.mHatsDeleteButton.Enabled = false; ths.mDesignButton.Enabled = CASHair.PartIsHat(wornPart); isHat = true; } bool shouldEnableCatalogProductFilter = false; List<object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat); ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter); if (!MasterController.Settings.mCompactHatCAS) { foreach (object obj2 in objectList) { IFeaturedStoreItem item = obj2 as IFeaturedStoreItem; if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000))) { WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (windowByExportID != null) { windowByExportID.Tag = item; windowByExportID.GetChildByID(0x23, true); Window childByID = windowByExportID.GetChildByID(0x20, true) as Window; if (childByID != null) { ImageDrawable drawable = childByID.Drawable as ImageDrawable; if (drawable != null) { drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey); childByID.Invalidate(); } } childByID = windowByExportID.GetChildByID(0x300, true) as Window; childByID.Tag = item; childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip; childByID.Visible = true; childByID = windowByExportID.GetChildByID(0x303, true) as Window; childByID.Visible = item.IsSale; Button button = windowByExportID.GetChildByID(0x301, true) as Button; button.Caption = item.PriceString; button.Tag = windowByExportID; button.Click += ths.OnBuyButtonClick; button.FocusAcquired += ths.OnBuyButtonFocusAcquired; button.FocusLost += ths.OnBuyButtonFocusLost; ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item)); } } } } foreach (CASPart part2 in ths.mPartsList) { bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2); uint num3 = CASUtils.PartDataNumPresets(part2.Key); ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key); if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key))) { ObjectDesigner.SetCASPart(part2.Key); string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId)); if (string.IsNullOrEmpty(designPreset)) { ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId); designPreset = Simulator.LoadXMLString(key2); } CASPartPreset preset = new CASPartPreset(part2, designPreset); string str2 = ""; string str3 = ""; if (wornPart.Key == preset.mPart.Key) { str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart); str3 = CASUtils.ReplaceHairColors(str2, colors); } if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue))) { ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset))) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; flag = true; } } if (ths.mHairType == CASHair.HairType.Hat) { if (MasterController.Settings.mCompactHatCAS) { num3 = 1; } for (int i = 0x0; i < num3; i++) { uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i); customContentType = UIUtils.GetCustomContentType(part2.Key, presetId); preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i)); if (preset.Valid) { bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors))) { ths.mSavedPresetId = preset.mPresetId; flag = true; if (flag4) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; if (ObjectDesigner.IsUserDesignPreset((uint)i)) { ths.mHatsShareButton.Enabled = true; ths.mHatsDeleteButton.Enabled = true; } } } } } } } } ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter; if (ths.mHairStylesGrid.Tag == null) { ths.mHairStylesGrid.Tag = false; } ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag; if (flag) { ths.mSaveButton.Enabled = false; } else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart)) { WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (win != null) { Window window2 = win.GetChildByID(0x20, true) as Window; if (window2 != null) { window2.Visible = false; } window2 = win.GetChildByID(0x24, true) as Window; if (window2 != null) { window2.Visible = true; } ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null)); } ths.mSaveButton.Enabled = true; } ths.mUndoOnDelete = false; ths.mContentTypeFilter.UpdateFilterButtonState(); }
private bool IsUsingTattooTemplatePreset(CASPart part, CASPartPreset preset) { return (CASUtils.GetTattooTemplateIndex(this.CurrentPreset.mPresetString, preset.mPresetString, true) != 0xffffffff); }
private void SelectItem(CASPart part, CASPartPreset preset) { this.mAcceptButton.Enabled = true; this.SelectItem(part, preset, !this.AdvancedMode); if (this.AdvancedMode) { this.AddUndoRedoStep(); } }
private bool AddCompositePartsGridItem(ResourceKey layoutKey, CASPartPreset preset, bool testValid) { WindowBase windowByExportID = UIManager.LoadLayout(layoutKey).GetWindowByExportID(0x1); if (windowByExportID == null) { return false; } CustomContentIcon childByID = windowByExportID.GetChildByID(0x23, true) as CustomContentIcon; childByID.ContentType = UIUtils.GetCustomContentType(preset.mPart.Key, preset.mPresetId); Window window = windowByExportID.GetChildByID(0x20, true) as Window; if (window != null) { ImageDrawable drawable = window.Drawable as ImageDrawable; if (drawable != null) { ThumbnailKey key = new ThumbnailKey(preset.mPart.Key, (preset.mPresetId != uint.MaxValue) ? ((int) preset.mPresetId) : 0xffffffff, (uint) preset.mPart.BodyType, (uint) preset.mPart.AgeGenderSpecies, ThumbnailSize.Large); drawable.Image = UIManager.GetCASThumbnailImage(key); window.Invalidate(); } } windowByExportID.TooltipText = this.GetPartName(preset.mPart); bool flag = true; if (testValid) { flag = this.TestPresetValidity(preset); if (!flag) { this.mInvalidIds.Add(preset.mPresetId); } } else { flag = !this.mInvalidIds.Contains(preset.mPresetId); } if (!flag) { return false; } Window window2 = windowByExportID.GetChildByID(0x2a, true) as Window; window2.Visible = true; this.mTattooGrid.AddItem(new ItemGridCellItem(windowByExportID, preset)); return true; }
private void PopulateTattooGrid(bool updateTemplates, bool forceTemp) { ItemGrid mTattooGrid = this.mTattooGrid; int length = 0x0; uint[] numArray = CASUtils.ExtractEnabledLayerIndices(this.CurrentPreset.mPresetString); if (numArray != null) { length = numArray.Length; } int num2 = 0x0; if (mTattooGrid.Count > 0x0) { num2 = mTattooGrid.GetFirstVisibleItem() + ((int) (mTattooGrid.VisibleColumns * (mTattooGrid.VisibleRows - 0x1))); } mTattooGrid.SelectedItem = 0xffffffff; mTattooGrid.Clear(); BodyTypes tattooTemplate = BodyTypes.TattooTemplate; CASPart[] visibleParts = this.GetVisibleParts(tattooTemplate); this.mFilterButton.Enabled = false; this.mDeleteButton.Enabled = false; this.mShareButton.Enabled = false; this.mSaveButton.Enabled = false; this.mColorPickerButton.Enabled = false; this.mColorPicker2Button.Enabled = false; this.mRemoveLayerButton.Enabled = false; ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0); int num3 = 0x0; this.ActiveTattooPartInUse(); int num4 = 0x0; if (updateTemplates) { this.ClearAllParts(); } foreach (CASPart part in visibleParts) { ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part.Key); ResourceKeyContentCategory category2 = UIUtils.ExtractCustomContentType(customContentType); if (this.AddPartsGridItem(this.mTattooGrid, layoutKey, part, customContentType)) { if (this.IsUsingTattooTemplate(part)) { if (updateTemplates) { this.SetPart(part, this.GetTattooTemplateUsageIndex(part) - 0x1); this.UpdateTemplatePart(part); } this.mTattooGrid.SelectedItem = num3; if (category2 == ResourceKeyContentCategory.kLocalUserCreated) { this.mDeleteButton.Enabled = true; this.mShareButton.Enabled = true; } if (num4 == 0x0) { this.PopulatePresetsGrid(part, this.mFilter); } num4++; } num3++; } else if (this.IsUsingTattooTemplate(part)) { if (updateTemplates) { this.SetPart(part, this.GetTattooTemplateUsageIndex(part) - 0x1); this.UpdateTemplatePart(part); } num4++; } } if ((this.mTattooGrid.SelectedItem == 0xffffffff) || (num4 > 0x1)) { if (num4 != 0x1) { this.mTattooGrid.SelectedItem = 0x0; } this.mTattooPresetsGrid.SelectedItem = 0xffffffff; this.mTattooPresetsGrid.Clear(); } if (num4 != length) { num4 = 0x0; this.mTattooGrid.SelectedItem = 0xffffffff; this.mTattooPresetsGrid.SelectedItem = 0xffffffff; this.mTattooPresetsGrid.Clear(); } string str = ""; string[] strArray = new string[0x5]; int index = 0x0; foreach (TattooTemplateData data in this.mTemplateParts) { if ((data.mPreset != null) && !(data.mTemplatePart.Key == ResourceKey.kInvalidResourceKey)) { strArray[index] = data.mPreset.mPresetString; index++; } } float[] originalReferenceDims = CASUtils.ExtractTattooDimensions(this.mCurrentPreset.mPresetString, true); float[] dimensions = this.TranslateTattooScale(this.mTattooLayerScaleData, originalReferenceDims, this.kStorageReferenceDimensions); str = CASUtils.InjectTattooDimensions(this.CurrentPreset.mPresetString, dimensions); CASPart defaultPart = this.GetDefaultPart(); ObjectDesigner.SetCASPart(defaultPart.Key); uint num6 = CASUtils.PartDataNumPresets(defaultPart.Key); bool testValid = false; if (this.mInvalidIds == null) { this.mInvalidIds = new List<uint>(); testValid = true; } for (int i = 0x1; i < num6; i++) { uint presetId = CASUtils.PartDataGetPresetId(defaultPart.Key, (uint) i); ResourceKeyContentCategory contentType = UIUtils.GetCustomContentType(defaultPart.Key, presetId); if (UIUtils.IsCustomFiltered(contentType)) { this.mFilterButton.Enabled = true; } CASPartPreset preset = new CASPartPreset(defaultPart, presetId, CASUtils.PartDataGetPreset(defaultPart.Key, (uint) i)); if (preset.Valid) { if (!this.mFilterButton.Selected || UIUtils.IsCustomFiltered(contentType)) { if (this.AddCompositePartsGridItem(layoutKey, preset, testValid)) { if (CASUtils.CompareCompositeTattooPresets(preset.mPresetString, str) && !this.AdvancedMode) { num4 = 0x1; this.mTattooGrid.SelectedItem = num3; if (ObjectDesigner.IsUserDesignPreset((uint) i)) { this.mShareButton.Enabled = true; this.mDeleteButton.Enabled = true; } } num3++; } } else if (CASUtils.CompareCompositeTattooPresets(preset.mPresetString, this.CurrentPreset.mPresetString)) { num4 = 0x1; } } } if ((((num4 > 0x1) || forceTemp) || this.mWasCustom) && !this.AdvancedMode) { this.mWasCustom = false; WindowBase windowByExportID = UIManager.LoadLayout(layoutKey).GetWindowByExportID(0x1); if (windowByExportID != null) { Window childByID = windowByExportID.GetChildByID(0x20, true) as Window; if (childByID != null) { childByID.Visible = false; } childByID = windowByExportID.GetChildByID(0x24, true) as Window; if (childByID != null) { childByID.Visible = true; } windowByExportID.IgnoreMouse = false; this.mTattooGrid.AddTempItem(new ItemGridCellItem(windowByExportID, null)); } this.mSaveButton.Enabled = true; } int count = mTattooGrid.Count; if (mTattooGrid.HasTempItem) { count++; } if (num2 >= count) { num2 = count - 0x1; } if (num2 > (mTattooGrid.VisibleRows * mTattooGrid.VisibleColumns)) { int selectedItem = mTattooGrid.SelectedItem; mTattooGrid.SelectedItem = num2; mTattooGrid.ShowSelectedItem(true); mTattooGrid.SelectedItem = selectedItem; } this.UpdateLayerEditButtons(); }
private void PopulatePresetsGrid(CASPart wornPart, bool filter) { this.mTattooPresetsGrid.Clear(); if (wornPart.Key != this.kInvalidCASPart.Key) { ObjectDesigner.SetCASPart(wornPart.Key); int num = 0x0; uint num2 = CASUtils.PartDataNumPresets(wornPart.Key); for (int i = 0x0; i < num2; i++) { string str = CASUtils.PartDataGetPreset(wornPart.Key, (uint) i); uint[] numArray = CASUtils.ExtractTattooColors(str, 0x1); Vector3[] colors = new Vector3[numArray.Length]; num = 0x0; foreach (uint num4 in numArray) { colors[num++] = CompositorUtil.ColorToVector3(new Color(num4)); } uint id = CASUtils.PartDataGetPresetId(wornPart.Key, (uint) i); ResourceKeyContentCategory customContentTypeFromKeyAndPresetIndex = UIUtils.GetCustomContentTypeFromKeyAndPresetIndex(wornPart.Key, (uint) i); if (!UIUtils.IsContentTypeDisabled(customContentTypeFromKeyAndPresetIndex)) { CASPartPreset preset = new CASPartPreset(this.GetCurrentTemplatePart(), id, str); this.AddPresetGridItem(preset, colors, customContentTypeFromKeyAndPresetIndex); num = 0x0; if (this.IsUsingTattooTemplatePreset(wornPart, preset)) { if (UIUtils.ExtractCustomContentType(customContentTypeFromKeyAndPresetIndex) == ResourceKeyContentCategory.kLocalUserCreated) { this.mDeleteButton.Enabled = true; } this.mTattooPresetsGrid.SelectedItem = i; } } } } }
// Methods public CASTattoo(uint winHandle) : base(winHandle) { this.mTunedScales = new Dictionary<TattooID, float>(); this.kInvalidCASPart = new CASPart(); this.mCurrentPreset = new CASPartPreset(); this.mNavButtons = new Dictionary<ControlIDs, Button>(); this.mLayerButtons = new Button[0x5]; this.mLayerThumbs = new Window[0x5]; this.kInvalidMousePos = new Vector2(-1f, -1f); this.mTargetSimAngleStopWatch = StopWatch.Create(StopWatch.TickStyles.Seconds); float[] numArray = new float[0x4]; numArray[0x2] = 1f; numArray[0x3] = 1f; this.kStorageReferenceDimensions = numArray; this.mUndoRedoQueue = new List<UndoRedoData>(); this.mTemplateParts = new TattooTemplateData[0x5]; Enum.GetValues(typeof(TattooID)); }
private void OnPartsGridSelect(ItemGrid sender, ItemGridCellClickEvent args) { this.mSaveButton.Enabled = false; if (args.mTag is CASPart) { sender.RemoveTempItem(); CASPart mTag = (CASPart) args.mTag; if (mTag.Key == this.kInvalidCASPart.Key) { this.ClearAllParts(); this.ClearTemplates(); this.CurrentPreset.mPresetId = 0x0; this.mDeleteButton.Enabled = false; this.mShareButton.Enabled = false; this.mTattooPresetsGrid.SelectedItem = 0xffffffff; this.mTattooPresetsGrid.Clear(); if (!this.AdvancedMode) { List<CASPart> wornParts = Responder.Instance.CASModel.GetWornParts(BodyTypes.Tattoo); if (((wornParts == null) || (wornParts.Count == 0x0)) || ((wornParts.Count == 0x1) && (wornParts[0x0].Key == this.mActiveTattooPart.Key))) { this.mRemoveAllButton.Enabled = false; } this.CurrentPreset.mPresetString = CASUtils.PartDataGetPreset(this.mActiveTattooPart.Key, 0x0); Responder.Instance.CASModel.RequestRemoveCASPart(this.mActiveTattooPart); } else { this.ActiveLayer = 0x0; this.SelectItem(this.mTemplateParts[this.ActiveLayer].mTemplatePart, null); } Audio.StartSound("ui_tertiary_button"); } else if (args.mWin.Enabled) { CASPartPreset preset = new CASPartPreset(mTag, CASUtils.PartDataGetPresetId(mTag.Key, 0x0), CASUtils.PartDataGetPreset(mTag.Key, 0x0)); this.CurrentPreset.mPresetId = 0x0; this.mScaleSlider.Value = (this.mScaleSlider.MaxValue - this.mScaleSlider.MinValue) * this.mTunedScales[this.mActiveTattooID]; this.UpdateScaleFromSlider(); if (!this.AdvancedMode) { this.ClearTemplates(); this.ClearAllParts(); this.mOpacitySlider.Value = (this.mOpacitySlider.MaxValue + this.mOpacitySlider.MinValue) / 0x2; } this.SetPart(mTag, this.ActiveLayer); this.SelectItem(mTag, preset); CustomContentIcon childByID = args.mWin.GetChildByID(0x23, true) as CustomContentIcon; if (childByID != null) { this.mDeleteButton.Enabled = childByID.Localuser; this.mShareButton.Enabled = this.mDeleteButton.Enabled; } this.PopulatePresetsGrid(mTag, this.mFilter); } else { for (int i = 0x0; i < 0x5L; i++) { if (this.mLayerButtons[i].Tag is CASPart) { CASPart tag = (CASPart) this.mLayerButtons[i].Tag; if (tag.Key == mTag.Key) { this.ActiveLayer = i; break; } } } } } else { CASPartPreset preset2 = args.mTag as CASPartPreset; if (preset2 != null) { ICASModel cASModel = Responder.Instance.CASModel; this.ClearTemplates(); this.ClearAllParts(); this.UpdateCurrentDataFromCompositePreset(preset2); this.UpdateModel(!this.AdvancedMode); this.mTattooPresetsGrid.SelectedItem = 0xffffffff; this.mTattooPresetsGrid.Clear(); this.mSaveButton.Enabled = false; CustomContentIcon icon2 = args.mWin.GetChildByID(0x23, true) as CustomContentIcon; if ((icon2 != null) && !this.AdvancedMode) { this.mDeleteButton.Enabled = icon2.Localuser; this.mShareButton.Enabled = this.mDeleteButton.Enabled; } if (this.AdvancedMode) { this.ActiveLayer = 0x0; this.AddUndoRedoStep(); } if (!this.AdvancedMode) { this.mRemoveAllButton.Enabled = true; } Audio.StartSound("ui_tertiary_button"); } } this.UpdateLayerEditButtons(); }
private void AddTemplatePart(CASPart part, CASPartPreset preset) { this.mTemplateParts[this.mActiveLayer].mTemplatePart = part; this.mTemplateParts[this.mActiveLayer].mPreset = preset; }
private int GetTattooTemplateUsageIndexInPreset(CASPart part, string preset) { if (part.Key == ResourceKey.kInvalidResourceKey) { return 0xffffffff; } CASPartPreset preset2 = new CASPartPreset(part, CASUtils.PartDataGetPresetId(part.Key, 0x0), CASUtils.PartDataGetPreset(part.Key, 0x0)); return CASUtils.GetTattooTemplateIndex(preset, preset2.mPresetString, false); }
private void SelectItem(CASPart part, CASPartPreset preset, bool commit) { ICASModel cASModel = Responder.Instance.CASModel; if (!this.PartInUse(part) && (preset != null)) { if (!this.AdvancedMode) { this.mRemoveAllButton.Enabled = true; } this.AddTemplatePart(part, preset); } else { this.UpdateTemplatePreset(part, preset); } this.UpdateModel(commit); Audio.StartSound("ui_tertiary_button"); }
public static void PopulateEyebrowGrid() { try { CASEyebrows ths = CASEyebrows.gSingleton; if (ths == null) { return; } ths.mEyebrowPresetsGrid.Clear(); CASPart wornPart = ths.GetWornPart(BodyTypes.Eyebrows); string designPreset = null; // Custom try { designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart); } catch { } ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0); int num = 0x0; foreach (CASPart part2 in Responder.Instance.CASModel.GetVisibleCASParts(BodyTypes.Eyebrows)) { ObjectDesigner.SetCASPart(part2.Key); CASPartPreset preset = null; uint num2 = CASUtils.PartDataNumPresets(part2.Key); for (uint i = 0x0; i < num2; i++) { preset = new CASPartPreset(part2, CASUtils.PartDataGetPresetId(part2.Key, i), CASUtils.PartDataGetPreset(part2.Key, i)); ths.AddPresetGridItem(ths.mEyebrowPresetsGrid, layoutKey, preset, part2, i + 0x1); if ((wornPart.Key == part2.Key) && (designPreset == preset.mPresetString)) { ths.mCurrentEyebrowPreset = preset; ths.mEyebrowPresetsGrid.SelectedItem = num; } num++; } if (num2 == 0x0) { preset = new CASPartPreset(part2, Responder.Instance.CASModel.GetDesignPreset(part2)); if (preset.Valid) { ths.AddPresetGridItem(ths.mEyebrowPresetsGrid, layoutKey, preset, part2, 0x0); if (wornPart.Key == part2.Key) { ths.mCurrentEyebrowPreset = preset; ths.mEyebrowPresetsGrid.SelectedItem = num; } num++; } } } } catch (Exception e) { Common.Exception("PopulateEyebrowGrid", e); } }
private void SetColors(Color[] colors) { uint[] numArray = new uint[colors.Length]; int num = 0x0; foreach (Color color in colors) { numArray[num++] = color.ARGB; } string presetStr = CASUtils.InjectTattooColors(this.GetCurrentTemplatePresetString(), numArray, 0x1); CASPartPreset preset = new CASPartPreset(this.GetCurrentTemplatePart(), presetStr); this.SelectItem(this.GetCurrentTemplatePart(), preset, false); }
public static void PopulateHornColors() { try { CAPUnicorn ths = CAPUnicorn.gSingleton; if (ths == null) return; CASPartPreset preset; ths.mHornColorsGrid.Clear(); List<CASPart> wornHornParts = new List<CASPart>(); CASPart wornPart = ths.GetWornHornPart(); CASLogic singleton = CASLogic.GetSingleton(); foreach (CASPart part in singleton.mCasParts) { if ((part.BodyType == BodyTypes.PetHorn) && (part.Species == CASAgeGenderFlags.Horse) && ((part.Age & singleton.Age) != CASAgeGenderFlags.None)) { wornHornParts.Add(part); } } CompositorUtil.GetPatternsFromCASPart(wornPart); ObjectDesigner.SetCASPart(wornPart.Key); ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("EyeColorPresetGridItem", 0x0); string designPreset = null; // Custom try { designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart); } catch { } foreach (CASPart wornHornPart in wornHornParts) { uint num = CASUtils.PartDataNumPresets(wornHornPart.Key); int i = 0; for (uint j = 0x0; j < num; j++) { preset = new CASPartPreset(wornHornPart, CASUtils.PartDataGetPresetId(wornHornPart.Key, j), CASUtils.PartDataGetPreset(wornHornPart.Key, j)); ths.AddHornPresetGridItem(ths.mHornColorsGrid, layoutKey, preset, wornHornPart, (uint)(j + 0x1)); if (CAPUnicorn.HornPresetCompare(designPreset, preset.mPresetString)) { ths.mCurrentHornColorPreset = preset; ths.mHornColorsGrid.SelectedItem = i; if (UIUtils.GetCustomContentType(wornHornPart.Key, preset.mPresetId) == ResourceKeyContentCategory.kInstalled) { ths.mHornColorDeleteButton.Enabled = false; } else { ths.mHornColorDeleteButton.Enabled = true; } } i++; } } if (ths.mHornColorsGrid.SelectedItem == -1) { ths.mHornColorDeleteButton.Enabled = false; } bool flag = ths.mHornColorsGrid.Count > (ths.mHornColorsGrid.VisibleRows * ths.mHornColorsGrid.VisibleColumns); Rect area = ths.mHornColorPanel.Area; area.Height = flag ? ths.mHornColorPanelHeightWithScrollbars : (ths.mHornColorPanelHeightWithScrollbars - 21f); ths.mHornColorPanel.Area = area; } catch (Exception e) { Common.Exception("PopulateHornColors", e); } }
private bool TestPresetValidity(CASPartPreset preset) { int num = 0x0; foreach (CASPart part in this.GetVisibleParts(BodyTypes.TattooTemplate)) { int tattooTemplateUsageIndexInPreset = this.GetTattooTemplateUsageIndexInPreset(part, preset.mPresetString); if ((tattooTemplateUsageIndexInPreset > 0x0) && (tattooTemplateUsageIndexInPreset <= 0x5L)) { num++; } } uint[] numArray = CASUtils.ExtractEnabledLayerIndices(preset.mPresetString); if (num != numArray.Length) { return false; } return true; }
public void OnClothingSelect(WindowBase sender, UIMouseEventArgs args) { try { CASParts.Wrapper part = null; CASClothingRow.ClothingThumbnail tag = sender.Tag as CASClothingRow.ClothingThumbnail; if (!mRow.mTempWindowValid || (tag.mIndex != (mRow.mItems.Count - 0x1))) { if (tag.mData is CASPart) { part = new CASParts.Wrapper((CASPart)tag.mData); if (args.MouseKey != MouseKeys.kMouseRight) { SelectItem(mRow.RowController, part.mPart, null); mRow.mSelectedItem = (part.mPart.Key.InstanceId != 0x0L) ? tag.mIndex : -1; } } else if (tag.mData is CASPartPreset) { CASPartPreset preset = (CASPartPreset)tag.mData; part = new CASParts.Wrapper(preset.mPart); if ((mRow.mRowController.IsAccessoryType(part.mPart.BodyType)) && ((tag.mState & CASClothingRow.WindowState.Active) != CASClothingRow.WindowState.Normal)) { if (args.MouseKey != MouseKeys.kMouseRight) { if (!mAllowMultiple) { mRow.RowController.RemoveItem(part.mPart.BodyType); } else { RemoveItem(mRow.RowController, part.mPart); } mRow.mSelectedItem = -1; } else { if (mRow.mRowController is CASClothingCategory) { (mRow.mRowController as CASClothingCategory).mCurrentPreset = preset; } else if (mRow.mRowController is CASMakeup) { (mRow.mRowController as CASMakeup).mCurrentPreset = preset; } } } else if (args.MouseKey != MouseKeys.kMouseRight) { SelectItem(mRow.RowController, preset.mPart, preset); mRow.mSelectedItem = tag.mIndex; } } else if ((args.MouseKey != MouseKeys.kMouseRight) && (!(tag.mData is IFeaturedStoreItem))) { mRow.RowController.RemoveItem(mRow.CASPart.BodyType); mRow.mSelectedItem = -1; } if (args.MouseKey != MouseKeys.kMouseRight) { mRow.ClearTempItem(); if (mRow.mObjectOfInterest is CASPart) { if (!mAllowMultiple) { mRow.mRowController.OnRowInItemSelected(mRow, mRow.CASPart.BodyType); } UpdateSelectedStates(tag.mIndex); } } } else if ((mRow.mRowController.IsAccessoryType(mRow.CASPart.BodyType)) && (IsWorn(mRow.CASPart))) { if (args.MouseKey != MouseKeys.kMouseRight) { if (!mAllowMultiple) { mRow.RowController.RemoveItem(mRow.CASPart.BodyType); } else { RemoveItem(mRow.RowController, mRow.CASPart); } mRow.mSelectedItem = -1; mRow.ClearTempItem(); if (!mAllowMultiple) { mRow.mRowController.OnRowInItemSelected(mRow, mRow.CASPart.BodyType); } UpdateSelectedStates(tag.mIndex); } } if (args.MouseKey == MouseKeys.kMouseRight) { bool remove = ((args.Modifiers & Modifiers.kModifierMaskControl) == Modifiers.kModifierMaskControl); CASBase.Blacklist(part, remove, null); if (remove) { bool compactCAS = false; if (mRow.mRowController.IsAccessoryType(mRow.CASPart.BodyType)) { compactCAS = MasterController.Settings.mCompactAccessoryCAS; } else { compactCAS = MasterController.Settings.mCompactClothingCAS; } if (!compactCAS) { for (int i = 0; i < mRow.mItems.Count; i++) { CASClothingRow.ClothingThumbnail thumbnail = mRow.mItems[i] as CASClothingRow.ClothingThumbnail; if (thumbnail != null) { if ((i + 1) < mRow.mGridWindows.Length) { mRow.mGridWindows[i + 1].Visible = false; } } } } else { CASClothingRow.ClothingThumbnail thumbnail = mRow.mItems[tag.mIndex] as CASClothingRow.ClothingThumbnail; if (thumbnail != null) { if ((tag.mIndex + 1) < mRow.mGridWindows.Length) { mRow.mGridWindows[tag.mIndex + 1].Visible = false; } } } } args.Handled = true; } } catch (Exception e) { Common.Exception("OnClothingSelect", e); } }
private void UpdateCurrentDataFromCompositePreset(CASPartPreset preset) { foreach (CASPart part in this.GetVisibleParts(BodyTypes.TattooTemplate)) { int tattooTemplateUsageIndexInPreset = this.GetTattooTemplateUsageIndexInPreset(part, preset.mPresetString); if ((tattooTemplateUsageIndexInPreset > 0x0) && (tattooTemplateUsageIndexInPreset <= 0x5L)) { int index = tattooTemplateUsageIndexInPreset - 0x1; this.mTemplateParts[index].mTemplatePart = part; this.SetPart(part, index); CASPartPreset preset2 = new CASPartPreset(part, CASUtils.PartDataGetPresetId(part.Key, 0x0), CASUtils.PartDataGetPreset(part.Key, 0x0)); this.mTemplateParts[index].mPreset = new CASPartPreset(part, CASUtils.ExtractTattooTemplate(preset2.mPresetString, preset.mPresetString, (uint) tattooTemplateUsageIndexInPreset)); } } float[] newReferenceDims = CASUtils.ExtractTattooDimensions(CASUtils.PartDataGetPreset(this.mActiveTattooPart.Key, 0x0), true); float[] originalDimensionData = CASUtils.ExtractTattooDimensions(preset.mPresetString, false); this.mTattooLayerScaleData = this.TranslateTattooScale(originalDimensionData, this.kStorageReferenceDimensions, newReferenceDims); this.mOpacitySlider.Value = (int) (this.GetFloatOpacityFromOpacityColor(CASUtils.ExtractTattooOpacity(preset.mPresetString)) * this.mOpacitySlider.MaxValue); }
private void UpdateTemplatePart(CASPart part) { int tattooTemplateUsageIndex = this.GetTattooTemplateUsageIndex(part); if ((tattooTemplateUsageIndex > 0x0) && (tattooTemplateUsageIndex <= 0x5L)) { int index = tattooTemplateUsageIndex - 0x1; this.mTemplateParts[index].mTemplatePart = part; CASPartPreset preset = new CASPartPreset(part, CASUtils.PartDataGetPresetId(part.Key, 0x0), CASUtils.PartDataGetPreset(part.Key, 0x0)); this.mTemplateParts[index].mPreset = new CASPartPreset(part, CASUtils.ExtractTattooTemplate(preset.mPresetString, this.CurrentPreset.mPresetString, (uint) tattooTemplateUsageIndex)); } }
private void UpdateTemplatePreset(CASPart part, CASPartPreset preset) { for (uint i = 0x0; i < 0x5; i++) { if (this.mTemplateParts[i].mTemplatePart.Key == part.Key) { this.mTemplateParts[i].mPreset = preset; if (preset == null) { this.mTemplateParts[i].mTemplatePart.Key = ResourceKey.kInvalidResourceKey; } return; } } }
private static void PopulateTypesGrid(CASHair ths) { if (ths == null) { return; } ICASModel cASModel = Responder.Instance.CASModel; Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) }; ths.mHairTypesGrid.Clear(); CASPart wornPart = ths.GetWornPart(); ResourceKey resKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0); bool isHat = false; bool flag = false; if (ths.mHairType == CASHair.HairType.Hat) { ths.mHatsShareButton.Enabled = false; ths.mHatsDeleteButton.Enabled = false; ths.mDesignButton.Enabled = CASHair.PartIsHat(wornPart); isHat = true; } bool shouldEnableCatalogProductFilter = false; List <object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat); ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter); if (!MasterController.Settings.mCompactHatCAS) { foreach (object obj2 in objectList) { IFeaturedStoreItem item = obj2 as IFeaturedStoreItem; if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000))) { WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (windowByExportID != null) { windowByExportID.Tag = item; windowByExportID.GetChildByID(0x23, true); Window childByID = windowByExportID.GetChildByID(0x20, true) as Window; if (childByID != null) { ImageDrawable drawable = childByID.Drawable as ImageDrawable; if (drawable != null) { drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey); childByID.Invalidate(); } } childByID = windowByExportID.GetChildByID(0x300, true) as Window; childByID.Tag = item; childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip; childByID.Visible = true; childByID = windowByExportID.GetChildByID(0x303, true) as Window; childByID.Visible = item.IsSale; Button button = windowByExportID.GetChildByID(0x301, true) as Button; button.Caption = item.PriceString; button.Tag = windowByExportID; button.Click += ths.OnBuyButtonClick; button.FocusAcquired += ths.OnBuyButtonFocusAcquired; button.FocusLost += ths.OnBuyButtonFocusLost; ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item)); } } } } foreach (CASPart part2 in ths.mPartsList) { bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2); uint num3 = CASUtils.PartDataNumPresets(part2.Key); ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key); if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key))) { ObjectDesigner.SetCASPart(part2.Key); string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId)); if (string.IsNullOrEmpty(designPreset)) { ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId); designPreset = Simulator.LoadXMLString(key2); } CASPartPreset preset = new CASPartPreset(part2, designPreset); string str2 = ""; string str3 = ""; if (wornPart.Key == preset.mPart.Key) { str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart); str3 = CASUtils.ReplaceHairColors(str2, colors); } if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue))) { ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset))) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; flag = true; } } if (ths.mHairType == CASHair.HairType.Hat) { if (MasterController.Settings.mCompactHatCAS) { num3 = 1; } for (int i = 0x0; i < num3; i++) { uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i); customContentType = UIUtils.GetCustomContentType(part2.Key, presetId); preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i)); if (preset.Valid) { bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors))) { ths.mSavedPresetId = preset.mPresetId; flag = true; if (flag4) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; if (ObjectDesigner.IsUserDesignPreset((uint)i)) { ths.mHatsShareButton.Enabled = true; ths.mHatsDeleteButton.Enabled = true; } } } } } } } } ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter; if (ths.mHairStylesGrid.Tag == null) { ths.mHairStylesGrid.Tag = false; } ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag; if (flag) { ths.mSaveButton.Enabled = false; } else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart)) { WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (win != null) { Window window2 = win.GetChildByID(0x20, true) as Window; if (window2 != null) { window2.Visible = false; } window2 = win.GetChildByID(0x24, true) as Window; if (window2 != null) { window2.Visible = true; } ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null)); } ths.mSaveButton.Enabled = true; } ths.mUndoOnDelete = false; ths.mContentTypeFilter.UpdateFilterButtonState(); }
private void AddPresetGridItem(CASPartPreset preset, Vector3[] colors, ResourceKeyContentCategory contentType) { WindowBase windowByExportID = UIManager.LoadLayout(ResourceKey.CreateUILayoutKey("CASTattooColorGridItem", 0x0)).GetWindowByExportID(0x1); if (windowByExportID != null) { WindowBase childByID = windowByExportID.GetChildByID(0x20, true); int length = colors.Length; for (int i = 0x0; i < 0x4; i++) { WindowBase base4 = childByID.GetChildByID((uint) (0x30 + i), false); if (i < length) { base4.Visible = true; Color color = CompositorUtil.Vector3ToColor(colors[i]); color.Alpha = 0xff; base4.ShadeColor = color; } else { base4.Visible = false; } } CustomContentIcon icon = windowByExportID.GetChildByID(0x23, true) as CustomContentIcon; icon.ContentType = contentType; this.mTattooPresetsGrid.AddItem(new ItemGridCellItem(windowByExportID, preset)); } }
public static void SelectItem(CASClothingCategory ths, CASPart part, CASPartPreset preset, bool allowMultiple) { ICASModel cASModel = Responder.Instance.CASModel; List <CASPart> wornParts = cASModel.GetWornParts(part.BodyType); bool flag = false; if (ths.IsAccessoryType(ths.mCurrentPart)) { if ((part.Key == ths.mInvalidCASPart.Key) && (!allowMultiple)) { ths.RemoveAllPartsOfType(ths.mCurrentPart); CASClothingCategory.sAccessoriesSelection = (int)ths.mCurrentPart; } else { flag = true; CASClothingCategory.sAccessoriesSelection = (int)part.BodyType; CASController.Singleton.SetAccessoryCam(part.BodyType, true); if (!allowMultiple) { if (part.BodyType == BodyTypes.Earrings) { ths.RemoveAllPartsOfType(BodyTypes.LeftEarring); ths.RemoveAllPartsOfType(BodyTypes.RightEarring); } else if ((part.BodyType == BodyTypes.LeftEarring) || (part.BodyType == BodyTypes.RightEarring)) { ths.RemoveAllPartsOfType(BodyTypes.Earrings); } } } } else if (!wornParts.Contains(part)) { flag = true; } if (preset != null) { ths.mCurrentPreset = preset; if (preset.mPresetString != null) { if (flag) { ths.mModel.RequestAddCASPart(part, preset.mPresetString); } else { ths.mModel.RequestCommitPresetToPart(part, preset.mPresetString); } } } else if (flag) { ths.mModel.RequestAddCASPart(part, false); CASSelectionGrid.SetSelectionIndex((uint)part.BodyType); } Audio.StartSound("ui_tertiary_button"); }
public static void SelectItem(CASMakeup ths, CASPart part, CASPartPreset preset, bool allowMultiple) { ICASModel cASModel = new CASModelProxy(Responder.Instance.CASModel); List<CASPart> wornParts = cASModel.GetWornParts(part.BodyType); bool flag = false; if ((part.Key == ths.kInvalidCASPart.Key) && (!allowMultiple)) { foreach (CASPart part2 in wornParts) { cASModel.RequestRemoveCASPart(part2); } } else if (!wornParts.Contains(part)) { flag = true; } if (preset != null) { ths.mCurrentPreset = preset; if (preset.mPresetString != null) { if (flag) { cASModel.RequestAddCASPart(part, preset.mPresetString); } else { cASModel.RequestCommitPresetToPart(part, preset.mPresetString); } } } else if (flag) { ths.mCurrentPreset = new CASPartPreset(part, null); cASModel.RequestAddCASPart(part, false); } ths.UpdateCostumePresetState(); Audio.StartSound("ui_tertiary_button"); }