public static void OnGridPartsClick(ItemGrid sender, ItemGridCellClickEvent args) { try { CASMakeup ths = CASMakeup.gSingleton; if (ths == null) { return; } if (args.mTag is CASPart) { CASModelProxy cASModel = new CASModelProxy(Responder.Instance.CASModel); List <CASPart> wornParts = cASModel.GetWornParts(CASMakeup.sCategory); CASPart tag = (CASPart)args.mTag; if (tag.Key == ths.kInvalidCASPart.Key) { foreach (CASPart wornPart in wornParts) { cASModel.RequestRemoveCASPart(wornPart); } } else if (wornParts.Contains(tag)) { if (args.mButton == MouseKeys.kMouseRight) { cASModel.RequestRemoveCASPart(tag); } else { Color[] makeupColors = ths.GetMakeupColors(CASMakeup.sCategory); ths.SetMakeupColors(tag, makeupColors, false, false); } } else { cASModel.RequestAddCASPart(tag, false); ths.mCurrentPreset = new CASPartPreset(tag, null); } Audio.StartSound("ui_tertiary_button"); } } catch (Exception e) { Common.Exception("OnGridPartsClick", e); } }
public static void RemoveItem(CASMakeup ths, CASPart part) { ICASModel cASModel = new CASModelProxy(Responder.Instance.CASModel); cASModel.RequestRemoveCASPart(part); /* * foreach (CASPart part in cASModel.GetWornParts(partType)) * { * cASModel.RequestRemoveCASPart(part); * } */ ths.mCurrentPreset = null; ths.UpdateCostumePresetState(); 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"); }