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); } }
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); } }