public static void AddClothingItemAndPresets(CASClothingRow ths, List <CASParts.PartPreset> parts, bool allowTemp) { if (parts.Count == 1) { ths.AddClothingItemAndPresets(parts[0].mPart, allowTemp); } else { int orderIndex = 0x0; ths.mHasFilterableContent = false; for (int i = 0x0; i < parts.Count; i++) { CASParts.PartPreset preset = parts[i]; if (ths.AddPresetGridItem(preset, orderIndex, preset.mPresetId)) { if (IsWorn(preset.mPart)) { ths.mSelectedItem = orderIndex; } orderIndex++; } } } }
public static void AddClothingItemAndPresets(CASClothingRow ths, List<CASParts.PartPreset> parts, bool allowTemp) { if (parts.Count == 1) { ths.AddClothingItemAndPresets(parts[0].mPart, allowTemp); } else { int orderIndex = 0x0; ths.mHasFilterableContent = false; for (int i = 0x0; i < parts.Count; i++) { CASParts.PartPreset preset = parts[i]; if (ths.AddPresetGridItem(preset, orderIndex, preset.mPresetId)) { if (IsWorn(preset.mPart)) { ths.mSelectedItem = orderIndex; } orderIndex++; } } } }
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); }
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(); } }
public static ArrayList CreateGridItems(CASClothingRow ths, List <CASParts.PartPreset> parts, bool allowTemp) { ths.mItems.Clear(); ths.mTempWindow = null; ths.mTempWindowValid = false; AddClothingItemAndPresets(ths, parts, allowTemp); if (ths.mFeaturedStoreItemBorder != null) { ths.mFeaturedStoreItemBorder.Visible = !(ths.mObjectOfInterest is CASPart); } ths.mNumItems = ths.mItems.Count; return(ths.mItems); }
public static ArrayList CreateGridItems(CASClothingRow ths, List<CASParts.PartPreset> parts, bool allowTemp) { ths.mItems.Clear(); ths.mTempWindow = null; ths.mTempWindowValid = false; AddClothingItemAndPresets(ths, parts, allowTemp); if (ths.mFeaturedStoreItemBorder != null) { ths.mFeaturedStoreItemBorder.Visible = !(ths.mObjectOfInterest is CASPart); } ths.mNumItems = ths.mItems.Count; return ths.mItems; }
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; }
public static void OnUndoRedo() { try { CASClothingCategory ths = CASClothingCategory.gSingleton; if (ths == null) { return; } if (ths.mClothingTypesGrid == null) { return; } ths.mClothingTypesGrid.SelectedItem = -1; List <ItemGridCellItem> items = ths.mClothingTypesGrid.Items; int num = 0x0; if (ths.mCurrentFocusedRow != null) { ths.mCurrentFocusedRow.SetArrowGlow(false); } ths.mCurrentFocusedRow = null; int sAccessoriesSelection = CASClothingCategory.sAccessoriesSelection; foreach (ItemGridCellItem item in items) { CASClothingRow mWin = item.mWin as CASClothingRow; if (mWin != null) { if (mWin.SelectedItem != -1) { // Custom bool compactCAS = false; if (ths.mCurrentPart == BodyTypes.Accessories) { compactCAS = MasterController.Settings.mCompactAccessoryCAS; } else { compactCAS = MasterController.Settings.mCompactClothingCAS; } if (!compactCAS) { mWin.CreateGridItems(true); mWin.PopulateGrid(true); } if ((ths.mCurrentFocusedRow == null) || (((BodyTypes)sAccessoriesSelection) == mWin.CASPart.BodyType)) { if (ths.mCurrentFocusedRow != null) { ths.mCurrentFocusedRow.SetArrowGlow(false); } ths.mClothingTypesGrid.SelectedItem = num; ths.mCurrentFocusedRow = mWin; ths.mCurrentFocusedRow.SetArrowGlow(true); ths.UpdateButtons(mWin.SelectedType); if (ths.IsAccessoryType(mWin.CASPart.BodyType)) { CASClothingCategory.sAccessoriesSelection = (int)mWin.CASPart.BodyType; } ths.mCurrentPreset = mWin.Selection as CASPartPreset; } } num++; } } } catch (Exception e) { Common.Exception("OnUndoRedo", 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); } }
protected CASClothingRowEx(CASClothingRow row, bool allowMultiple) { mRow = row; mAllowMultiple = allowMultiple; }
private static void OnColorsSaved(Color[] colors) { try { CASMakeup ths = CASMakeup.gSingleton; if (ths == null) { return; } bool flag = false; bool flag2 = false; if (CASMakeup.sCategory != BodyTypes.CostumeMakeup) { foreach (ItemGridCellItem item in ths.mGridMakeupPresets.Items) { flag2 = true; ResourceKey mTag = (ResourceKey)item.mTag; ColorInfo info = ColorInfo.FromResourceKey(mTag); for (int i = 0x0; i < info.Colors.Length; i++) { Vector3 vector = CompositorUtil.ColorToVector3(colors[i]); Vector3 v = CompositorUtil.ColorToVector3(info.Colors[i]); if (!vector.IsSimilarTo(v)) { flag2 = false; break; } } if (flag2) { break; } } if (!flag2) { ColorInfo info2 = new ColorInfo(); info2.Usage = ColorInfo.PreferredUse.Makeup; switch (CASMakeup.sCategory) { case BodyTypes.FirstFace: info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupLipstick; break; case BodyTypes.EyeShadow: info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupEyeshadow; break; case BodyTypes.EyeLiner: info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupEyeliner; break; case BodyTypes.Blush: info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupBlush; break; } info2.Colors = colors; flag = info2.SaveMakeupPreset(info2.UsageSubCategory) != ResourceKey.kInvalidResourceKey; ths.PopulatePresetsGrid(CASMakeup.sCategory, ths.mCurrentPreset.mPart, ths.mButtonFilter.Selected); } } else { CASPart wornPart = ths.mCurrentPreset.mPart; ObjectDesigner.SetCASPart(wornPart.Key); Vector3[] makeupVectorColors = ths.GetMakeupVectorColors(wornPart); uint num = CASUtils.PartDataNumPresets(wornPart.Key); for (uint j = 0x0; j < num; j++) { KeyValuePair <string, Dictionary <string, Complate> > presetEntryFromPresetString = (KeyValuePair <string, Dictionary <string, Complate> >)SimBuilder.GetPresetEntryFromPresetString(CASUtils.PartDataGetPreset(wornPart.Key, j)); Vector3[] vectorArray2 = ths.GetMakeupVectorColors(presetEntryFromPresetString); flag2 = true; for (uint k = 0x0; k < vectorArray2.Length; k++) { if (!makeupVectorColors[k].IsSimilarTo(vectorArray2[k])) { flag2 = false; break; } } if (flag2) { break; } } if (!flag2) { uint index = ObjectDesigner.AddDesignPreset(Responder.Instance.CASModel.GetDesignPreset(wornPart)); flag = index != uint.MaxValue; CASClothingRow row = ths.FindRow(wornPart); if (row != null) { row.CreateGridItems(true); row.PopulateGrid(true); } ths.mButtonCostumeFilter.Tag = true; ths.mContentTypeFilter.UpdateFilterButtonState(); ThumbnailKey key = new ThumbnailKey(wornPart.Key, (int)CASUtils.PartDataGetPresetId(wornPart.Key, index), (uint)wornPart.BodyType, (uint)wornPart.AgeGenderSpecies, ThumbnailSize.Large); ThumbnailManager.InvalidateThumbnail(key); } } if (flag) { CASController.Singleton.ErrorMsg(CASErrorCode.SaveSuccess); } else if (flag2) { Simulator.AddObject(new OneShotFunctionTask(delegate { string messageText = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Hair:SaveDuplicate", new object[0x0]); SimpleMessageDialog.Show(null, messageText, ModalDialog.PauseMode.PauseTask, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close"); })); } else { CASController.Singleton.ErrorMsg(CASErrorCode.SaveFailed); } } catch (Exception e) { Common.Exception("OnColorsSaved", e); } }
private static void OnDialogClosed(bool accept, bool colorChanged, Color[] colors) { try { CASMakeup ths = CASMakeup.gSingleton; if (ths == null) { return; } if (CASMakeup.sCategory == BodyTypes.CostumeMakeup) { if (accept) { SetMakeupColors(ths, CASMakeup.sCategory, colors, true); List <ItemGridCellItem> items = ths.mGridCostumeParts.Items; int num = 0x0; foreach (ItemGridCellItem item in items) { CASClothingRow mWin = item.mWin as CASClothingRow; if (mWin != null) { mWin.ShowSelectedItem(false); if (mWin.SelectedItem != -1) { mWin.CreateGridItems(true); mWin.PopulateGrid(true); ths.mGridCostumeParts.SelectedItem = num; ths.mCurrentFocusedRow = mWin; ths.mCurrentFocusedRow.SetArrowGlow(true); ths.mCurrentPreset = mWin.Selection as CASPartPreset; ths.UpdateCostumePresetState(); } num++; } } } else if (colorChanged) { Responder.Instance.CASModel.RequestUndo(); Responder.Instance.CASModel.RequestClearRedoOperations(); } } else if (!accept) { if (colorChanged) { Responder.Instance.CASModel.RequestUndo(); Responder.Instance.CASModel.RequestClearRedoOperations(); } } else { SetMakeupColors(ths, CASMakeup.sCategory, colors, true); ths.mGridMakeupPresets.SelectedItem = -1; int index = 0x0; List <ItemGridCellItem> list2 = ths.mGridMakeupPresets.Items; Vector3[] vecColors = new Vector3[colors.Length]; foreach (Color color in colors) { vecColors[index] = CompositorUtil.ColorToVector3(color); index++; } index = 0x0; foreach (ItemGridCellItem item2 in list2) { ResourceKey mTag = (ResourceKey)item2.mTag; ColorInfo colorInfo = ColorInfo.FromResourceKey(mTag); if (CASMakeup.CompareColors(vecColors, colorInfo)) { ths.mGridMakeupPresets.SelectedItem = index; break; } index++; } ths.UpdatePresetState(); } } catch (Exception e) { Common.Exception("OnDialogClosed", e); } }
protected CASClothingRowEx(CASClothingRow row, bool allowMultiple) { mRow = row; mAllowMultiple = allowMultiple; }