public override bool Run() { try { ApartmentController.CleanupFamily(this.Target); string familyName = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilyName", new object[0]), CommonMethods.LocalizeString("EnterFamilyName", new object[0]), string.Empty); if (!string.IsNullOrEmpty(familyName)) { string familyFunds = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilyFunds", new object[0]), CommonMethods.LocalizeString("EnterFamilyFunds", new object[0]), "0"); if (!string.IsNullOrEmpty(familyFunds)) { string rent = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("Rent", new object[0]), CommonMethods.LocalizeString("EnterRent", new object[0]), "0"); if (!string.IsNullOrEmpty(rent)) { //Sims and pets List <SimDescription> residents = null; List <PhoneSimPicker.SimPickerInfo> homeles = CommonMethods.ShowHomelesSims(base.Actor, base.Target.LotCurrent, base.Target.Families); List <PhoneSimPicker.SimPickerInfo> list3 = DualPaneSimPicker.Show(homeles, new List <PhoneSimPicker.SimPickerInfo>(), CommonMethods.LocalizeString("Residents", new object[0]), CommonMethods.LocalizeString("AvailableSims", new object[0])); if (list3 != null) { residents = list3.ConvertAll <SimDescription>(new Converter <PhoneSimPicker.SimPickerInfo, SimDescription>(CommonDoor.LockDoor.SimPickerInfoToSimDescription)); } //Minor Pets List <MinorPet> minorPetList = new List <MinorPet>(); if (CommonMethods.ReturnMinorPets(this.Target).Count > 0) { List <ObjectPicker.RowInfo> homelessPets = CommonMethods.ReturnMinorPetsAsRowInfo(CommonMethods.ReturnHomelessPets(this.Target)); List <ObjectPicker.RowInfo> list4 = DualPanelMinorPets.Show(homelessPets, new List <ObjectPicker.RowInfo>(), CommonMethods.LocalizeString("ResidentPets", new object[0]), CommonMethods.LocalizeString("AvailableMinorPets", new object[0])); if (list4 != null) { foreach (var item in list4) { minorPetList.Add(item.Item as MinorPet); } } } //Create Family if (residents != null) { this.Target.Families.Add(ApartmentController.CreateFamily(familyName, familyFunds, rent, residents, minorPetList, Target.LotCurrent.Household)); } } } } } catch (Exception ex) { CommonMethods.PrintMessage("Create Family: " + ex.Message); } return(true); }
public override bool Run() { try { //Minor Pets List <ObjectPicker.RowInfo> allPets = CommonMethods.ReturnMinorPetsAsRowInfo(CommonMethods.ReturnMinorPets(this.Target)); List <ObjectPicker.RowInfo> homelessPets = new List <ObjectPicker.RowInfo>(); List <ObjectPicker.RowInfo> residentPets = DualPanelMinorPets.Show(allPets, homelessPets, CommonMethods.LocalizeString("Residents", new object[0]), CommonMethods.LocalizeString("AvailableSims", new object[0])); } catch (System.Exception ex) { CommonMethods.PrintMessage(ex.Message); } return(true); }
public override bool Run() { //Active Family if (base.SelectedObjects != null && base.SelectedObjects.Count > 0) { ApartmentFamily selectedFamily = base.SelectedObjects[0] as ApartmentFamily; try { if (selectedFamily != null) { if (selectedFamily.MinorPets == null) { selectedFamily.MinorPets = new List <MinorPet>(); } selectedFamily.FamilyName = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilName", new object[0]), CommonMethods.LocalizeString("EditFamilyName", new object[0]), selectedFamily.FamilyName); if (!string.IsNullOrEmpty(selectedFamily.FamilyName)) { string tmp = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilyFunds", new object[0]), CommonMethods.LocalizeString("EditFamilyFunds", new object[0]), selectedFamily.FamilyFunds.ToString()); if (!string.IsNullOrEmpty(tmp)) { int.TryParse(tmp, out selectedFamily.FamilyFunds); tmp = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("Rent", new object[0]), CommonMethods.LocalizeString("EditRent", new object[0]), selectedFamily.Rent.ToString()); if (!string.IsNullOrEmpty(tmp)) { int.TryParse(tmp, out selectedFamily.Rent); List <SimDescription> residents = new List <SimDescription>(); List <PhoneSimPicker.SimPickerInfo> homeles = CommonMethods.ShowHomelesSims(base.Actor, base.Target.LotCurrent, base.Target.Families); List <PhoneSimPicker.SimPickerInfo> currentResidents = CommonMethods.ShowResidentSims(base.Actor, selectedFamily.Residents); //Combine homeless and current, or current won't show up when removing. homeles.AddRange(currentResidents); List <PhoneSimPicker.SimPickerInfo> list3 = DualPaneSimPicker.Show(homeles, currentResidents, CommonMethods.LocalizeString("Residents", new object[0]), CommonMethods.LocalizeString("AvailableSims", new object[0])); if (list3 != null) { residents = list3.ConvertAll <SimDescription>(new Converter <PhoneSimPicker.SimPickerInfo, SimDescription>(CommonDoor.LockDoor.SimPickerInfoToSimDescription)); } //residents = CommonMethods.ShowSimSelector(Actor, Target.LotCurrent.Household, "Select Sims for Family: "); if (residents != null) { selectedFamily.Residents = residents; } //Minor Pets List <MinorPet> minorPetList = new List <MinorPet>(); if (CommonMethods.ReturnMinorPets(this.Target).Count > 0) { List <ObjectPicker.RowInfo> homelessPets = CommonMethods.ReturnMinorPetsAsRowInfo(CommonMethods.ReturnHomelessPets(this.Target)); List <ObjectPicker.RowInfo> currentPets = CommonMethods.ReturnMinorPetsAsRowInfo(selectedFamily.MinorPets); //Combine homeless and current, or current won't show up when removing. homelessPets.AddRange(currentPets); List <ObjectPicker.RowInfo> list4 = DualPanelMinorPets.Show(homelessPets, currentPets, CommonMethods.LocalizeString("ResidentPets", new object[0]), CommonMethods.LocalizeString("AvailableMinorPets", new object[0])); if (list4 != null) { foreach (var item in list4) { minorPetList.Add(item.Item as MinorPet); } selectedFamily.MinorPets = minorPetList; } } base.Target.StartUpOrSwitch(); } } } } } catch (System.Exception ex) { CommonMethods.PrintMessage(ex.Message); } } return(true); }