コード例 #1
0
ファイル: TheInteractions.cs プロジェクト: pepoluan/NRaas
        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);
        }