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 void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows) { NumSelectableRows = 1; headers = new List <ObjectPicker.HeaderInfo>(); listObjs = new List <ObjectPicker.TabInfo>(); headers.Add(new ObjectPicker.HeaderInfo("Ui/Caption/ObjectPicker:ObjectName", "Ui/Tooltip/ObjectPicker:Name", 250)); headers.Add(new ObjectPicker.HeaderInfo(CommonMethods.LocalizeString("FamilyFunds", new object[0]), CommonMethods.LocalizeString("FamilyFnds", new object[0]))); headers.Add(new ObjectPicker.HeaderInfo(CommonMethods.LocalizeString("IsActive", new object[0]), CommonMethods.LocalizeString("IsActive", new object[0]))); List <ObjectPicker.RowInfo> rowInfo = new List <ObjectPicker.RowInfo>(); Sim actor = parameters.Actor as Sim; Controller c = parameters.Target as Controller; if (actor != null && c != null) { try { //Clean the families first ApartmentController.CleanupFamily(c); //Select one family member for the list foreach (ApartmentFamily family in c.Families) { if (family.Residents != null && family.Residents.Count > 0 && !family.IsActive) { List <ObjectPicker.ColumnInfo> columnInfo = new List <ObjectPicker.ColumnInfo>(); columnInfo.Add(new ObjectPicker.TextColumn(family.FamilyName)); columnInfo.Add(new ObjectPicker.TextColumn(family.FamilyFunds.ToString())); columnInfo.Add(new ObjectPicker.TextColumn(family.IsActive.ToString())); ObjectPicker.RowInfo info = new ObjectPicker.RowInfo(family, columnInfo); rowInfo.Add(info); } } listObjs.Add(new ObjectPicker.TabInfo("all", "", rowInfo)); } catch (System.Exception ex) { CommonMethods.PrintMessage(ex.Message); } } }