示例#1
0
        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);
        }
示例#2
0
        public override bool Run()
        {
            Definition interactionDefinition = base.InteractionDefinition as Definition;

            if (interactionDefinition.LockType != CommonDoor.tLock.OwnerList)
            {
                // eh, probably need to mash these into one interaction...
                if ((uint)interactionDefinition.LockType == 7)
                {
                    new InteractionOptionList <IDoorOption, GameObject> .AllList(GoHere.Localize("DoorOptions:MenuName"), false).Perform(new GameHitParameters <GameObject>(this.Actor, this.Target, GameObjectHit.NoHit));
                }
                else
                {
                    base.Target.SetLockTypeAndOwner(interactionDefinition.LockType, base.Actor.SimDescription);

                    GoHere.Settings.ClearActiveDoorFilters(base.Target.ObjectId);
                }
            }
            else
            {
                List <PhoneSimPicker.SimPickerInfo> collection = new List <PhoneSimPicker.SimPickerInfo>();
                foreach (Sim sim in LotManager.Actors)
                {
                    SimDescription description = sim.SimDescription;
                    if (!description.IsHorse && !description.IsDeer && !description.IsRaccoon)
                    {
                        PhoneSimPicker.SimPickerInfo item = CreateSimPickerInfo(base.Actor.SimDescription, description);
                        collection.Add(item);
                    }
                }
                List <PhoneSimPicker.SimPickerInfo> alreadySelectedSim = new List <PhoneSimPicker.SimPickerInfo>();
                switch (base.Target.LockType)
                {
                case CommonDoor.tLock.SelectedActor:
                    foreach (PhoneSimPicker.SimPickerInfo info3 in collection)
                    {
                        if (info3.SimDescription == base.Target.mLockOwner)
                        {
                            alreadySelectedSim.Add(info3);
                        }
                    }
                    break;

                case CommonDoor.tLock.SelectedHousehold:
                    foreach (PhoneSimPicker.SimPickerInfo info4 in collection)
                    {
                        if ((info4.SimDescription as SimDescription).Household == base.Target.mLockOwner.Household)
                        {
                            alreadySelectedSim.Add(info4);
                        }
                    }
                    break;

                case CommonDoor.tLock.Anybody:
                    alreadySelectedSim.AddRange(collection);
                    break;

                case CommonDoor.tLock.Pets:
                    foreach (PhoneSimPicker.SimPickerInfo info2 in collection)
                    {
                        if ((info2.SimDescription as SimDescription).IsPet)
                        {
                            alreadySelectedSim.Add(info2);
                        }
                    }
                    break;

                case CommonDoor.tLock.OwnerList:
                    foreach (PhoneSimPicker.SimPickerInfo info5 in collection)
                    {
                        if (base.Target.mOwnerList.Contains((info5.SimDescription as SimDescription).SimDescriptionId))
                        {
                            alreadySelectedSim.Add(info5);
                        }
                    }
                    break;
                }
                List <PhoneSimPicker.SimPickerInfo> list3 = DualPaneSimPicker.Show(collection, alreadySelectedSim, Localization.LocalizeString("Gameplay/Abstracts/Doors/Locking:CanOpen", new object[0]), Localization.LocalizeString("Gameplay/Abstracts/Doors/Locking:CannotOpen", new object[0]));
                if (list3 != null)
                {
                    base.Target.SetLockTypeOwnerList(list3.ConvertAll <SimDescription>(new Converter <PhoneSimPicker.SimPickerInfo, SimDescription>(CommonDoor.LockDoor.SimPickerInfoToSimDescription)));
                    GoHere.Settings.ClearActiveDoorFilters(base.Target.ObjectId);
                }
            }
            return(true);
        }
示例#3
0
        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);
        }