Example #1
0
 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();
 }