Ejemplo n.º 1
0
        public static bool Show(IMovingModel model)
        {
            if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
            {
                return(false);
            }

            if (ScreenGrabController.InProgress || VideoGrabHelper.InUse)
            {
                return(false);
            }

            UserToolUtils.OnClose();
            Sims3.Gameplay.UI.Responder.Instance.HudModel.CloseSecondaryInventory();
            PopupMenu.CloseOptions();
            Tutorialette.TriggerLesson(Lessons.Moving, null);
            List <IMapTagPickerInfo> mapTagPickerInfos = null;
            string titleText   = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseLocation", new object[0]);
            string confirmText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseConfirm", new object[0]);

            MoveDialogBase.Result running = MoveDialogBase.Result.Running;
            ulong         maxValue        = ulong.MaxValue;
            HouseboatSize houseboatSize   = HouseboatSize.None;

            if (!MoveDialog.Show(model))
            {
                return(false);
            }

            SceneMgrWindow sceneWindow = UIManager.GetSceneWindow();

            if (sceneWindow != null)
            {
                sceneWindow.StopForwardingAllEvents();
            }

            do
            {
                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    running = MoveDialog.RunWithPickedLot(maxValue, houseboatSize);
                    break;

                default:
                    running = MoveDialog.Run();
                    break;
                }

                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    if (mapTagPickerInfos == null)
                    {
                        mapTagPickerInfos = new List <IMapTagPickerInfo>();
                    }
                    else
                    {
                        mapTagPickerInfos.Clear();
                    }

                    bool isSource = model.SourceIsSelectedHousehold();
                    int  householdBuyingPowerFunds = model.GetHouseholdBuyingPowerFunds(isSource);
                    bool flag3 = true;
                    if (running == MoveDialogBase.Result.PortSelect)
                    {
                        flag3 = ChangeHouseboatDialog.Show(false, ref houseboatSize, true);
                    }

                    if (flag3)
                    {
                        foreach (Lot lot in LotManager.AllLots)
                        {
                            if ((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.IsApartmentLot || (lot.Household == null)))
                            {
                                if (running == MoveDialogBase.Result.PortSelect)
                                {
                                    if ((lot.CommercialLotSubType == CommercialLotSubType.kEP10_Port) && lot.IsUnoccupiedPortLot())
                                    {
                                        HouseboatInfo info = HouseboatUtils.GetInfo(houseboatSize);
                                        MovingToPortMapTagPickerLotInfo item = new MovingToPortMapTagPickerLotInfo(lot, MapTagType.PortLot, info.Price);
                                        mapTagPickerInfos.Add(item);
                                    }
                                }
                                else if (((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.ResidentialLotSubType != ResidentialLotSubType.kEP10_PrivateLot)) && ((lot.IsApartmentLot || (lot.Household == null)) && !UnchartedIslandMarker.DoesLotHaveUnchartedIslandMarker(lot)))
                                {
                                    if (lot.IsApartmentLot)
                                    {
                                        if ((running == MoveDialogBase.Result.HouseSelect) && ((lot.Household == null) || !model.HouseholdIsSource(lot.Household.HouseholdId)))
                                        {
                                            MapTagPickerLotInfo item = new MapTagPickerLotInfo(lot, MapTagType.Apartment);
                                            mapTagPickerInfos.Add(item);
                                        }
                                    }
                                    else if (World.LotIsEmpty(lot.LotId) && lot.IsLotEmptyFromObjects())
                                    {
                                        if (running != MoveDialogBase.Result.HouseSelect)
                                        {
                                            MapTagPickerLotInfo info;

                                            // Custom
                                            if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyLot);
                                            }
                                            else
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyLot);
                                            }

                                            mapTagPickerInfos.Add(info);
                                        }
                                    }
                                    else if (running != MoveDialogBase.Result.LotSelect)
                                    {
                                        MapTagPickerLotInfo info2;

                                        // Custom
                                        if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyHouse);
                                        }
                                        else
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyHouse);
                                        }
                                        mapTagPickerInfos.Add(info2);
                                    }
                                }
                            }
                        }
                    }
                    IMapTagPickerInfo info3 = null;

                    if (flag3)
                    {
                        bool flag4;
                        info3 = MapTagPickerDialog.Show(mapTagPickerInfos, titleText, confirmText, null, false, 0f, false, out flag4);
                    }
                    if (info3 != null)
                    {
                        maxValue = info3.LotId;
                    }
                    break;
                }
            }while ((running != MoveDialogBase.Result.Accepted) && (running != MoveDialogBase.Result.Cancelled));

            if (sceneWindow != null)
            {
                sceneWindow.StartForwardingEventsToGame();
            }

            MoveDialog.Shutdown();
            return(running == MoveDialogBase.Result.Accepted);
        }
Ejemplo n.º 2
0
        public static MoveValidity BaseIsLotValid(IMovingModel model, Dictionary<ISimDescription, bool> sourceSimList, Dictionary<ISimDescription, bool> targetSimList, Household household, bool isSource, ref string reason)
        {
            Dictionary<ISimDescription, bool> simList;

            if (isSource)
            {
                simList = sourceSimList;
            }
            else
            {
                simList = targetSimList;
            }

            if (!Mover.Settings.mAllowGreaterThanEight)
            {
                if (CountSimsIncludingPregnancy(simList, true) > 0x8)
                {
                    if (simList.Count > 0x8)
                    {
                        reason = Common.LocalizeEAString("Ui/Caption/MovingDialog:TooManySims");
                    }
                    else
                    {
                        reason = Common.LocalizeEAString("Ui/Caption/MovingDialog:TooManySims_Pregnant");
                    }
                    return MoveValidity.None;
                }
            }

            // Keep as GameStates
            if (((GameStates.IsOnVacation) && isSource) && ((simList.Count < 0x1) && household.IsActive))
            {
                reason = Common.LocalizeEAString("Ui/Caption/MovingDialog/EP01:CantSplitEveryone");
                return MoveValidity.None;
            }

            if (!Mover.Settings.mAllowNoAdult)
            {
                bool flag = false;
                bool flag2 = false;

                foreach (KeyValuePair<ISimDescription, bool> pair in simList)
                {
                    CASAgeGenderFlags age = pair.Key.Age;
                    if (age <= CASAgeGenderFlags.Teen)
                    {
                        flag = true;
                    }

                    if (age >= CASAgeGenderFlags.YoungAdult)
                    {
                        flag2 = true;
                    }
                }
                if (flag && !flag2)
                {
                    reason = Common.LocalizeEAString("Ui/Caption/MovingDialog:AdultRequired");
                    return MoveValidity.None;
                }
            }

            if ((simList.Count >= 0x1) && string.IsNullOrEmpty(model.GetHouseholdName(isSource)))
            {
                reason = Common.LocalizeEAString("Ui/Caption/MovingDialog:MustHaveHouseholdName");
                return MoveValidity.None;
            }
            return MoveValidity.All;
        }
Ejemplo n.º 3
0
        public static bool Show(IMovingModel model)
        {
            if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
            {
                return false;
            }

            if (ScreenGrabController.InProgress || VideoGrabHelper.InUse)
            {
                return false;
            }

            UserToolUtils.OnClose();
            Sims3.Gameplay.UI.Responder.Instance.HudModel.CloseSecondaryInventory();
            PopupMenu.CloseOptions();
            Tutorialette.TriggerLesson(Lessons.Moving, null);
            List<IMapTagPickerInfo> mapTagPickerInfos = null;
            string titleText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseLocation", new object[0]);
            string confirmText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseConfirm", new object[0]);
            MoveDialogBase.Result running = MoveDialogBase.Result.Running;
            ulong maxValue = ulong.MaxValue;
            HouseboatSize houseboatSize = HouseboatSize.None;
            if (!MoveDialog.Show(model))
            {
                return false;
            }

            SceneMgrWindow sceneWindow = UIManager.GetSceneWindow();
            if (sceneWindow != null)
            {
                sceneWindow.StopForwardingAllEvents();
            }

            do
            {
                switch (running)
                {
                    case MoveDialogBase.Result.LotSelect:
                    case MoveDialogBase.Result.HouseSelect:
                    case MoveDialogBase.Result.LotAndHouseSelect:
                    case MoveDialogBase.Result.PortSelect:
                        running = MoveDialog.RunWithPickedLot(maxValue, houseboatSize);
                        break;

                    default:
                        running = MoveDialog.Run();
                        break;
                }

                switch (running)
                {
                    case MoveDialogBase.Result.LotSelect:
                    case MoveDialogBase.Result.HouseSelect:
                    case MoveDialogBase.Result.LotAndHouseSelect:
                    case MoveDialogBase.Result.PortSelect:
                        if (mapTagPickerInfos == null)
                        {
                            mapTagPickerInfos = new List<IMapTagPickerInfo>();
                        }
                        else
                        {
                            mapTagPickerInfos.Clear();
                        }

                        bool isSource = model.SourceIsSelectedHousehold();
                        int householdBuyingPowerFunds = model.GetHouseholdBuyingPowerFunds(isSource);
                        bool flag3 = true;
                        if (running == MoveDialogBase.Result.PortSelect)
                        {
                            flag3 = ChangeHouseboatDialog.Show(false, ref houseboatSize, true);
                        }

                        if (flag3)
                        {
                            foreach (Lot lot in LotManager.AllLots)
                            {
                                if ((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.IsApartmentLot || (lot.Household == null)))
                                {
                                    if (running == MoveDialogBase.Result.PortSelect)
                                    {
                                        if ((lot.CommercialLotSubType == CommercialLotSubType.kEP10_Port) && lot.IsUnoccupiedPortLot())
                                        {
                                            HouseboatInfo info = HouseboatUtils.GetInfo(houseboatSize);
                                            MovingToPortMapTagPickerLotInfo item = new MovingToPortMapTagPickerLotInfo(lot, MapTagType.PortLot, info.Price);
                                            mapTagPickerInfos.Add(item);
                                        }
                                    }
                                    else if (((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.ResidentialLotSubType != ResidentialLotSubType.kEP10_PrivateLot)) && ((lot.IsApartmentLot || (lot.Household == null)) && !UnchartedIslandMarker.DoesLotHaveUnchartedIslandMarker(lot)))
                                    {
                                        if (lot.IsApartmentLot)
                                        {
                                            if ((running == MoveDialogBase.Result.HouseSelect) && ((lot.Household == null) || !model.HouseholdIsSource(lot.Household.HouseholdId)))
                                            {
                                                MapTagPickerLotInfo item = new MapTagPickerLotInfo(lot, MapTagType.Apartment);
                                                mapTagPickerInfos.Add(item);
                                            }
                                        }
                                        else if (World.LotIsEmpty(lot.LotId) && lot.IsLotEmptyFromObjects())
                                        {
                                            if (running != MoveDialogBase.Result.HouseSelect)
                                            {
                                                MapTagPickerLotInfo info;

                                                // Custom
                                                if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                                {
                                                    info = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyLot);
                                                }
                                                else
                                                {
                                                    info = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyLot);
                                                }

                                                mapTagPickerInfos.Add(info);
                                            }
                                        }
                                        else if (running != MoveDialogBase.Result.LotSelect)
                                        {
                                            MapTagPickerLotInfo info2;

                                            // Custom
                                            if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                            {
                                                info2 = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyHouse);
                                            }
                                            else
                                            {
                                                info2 = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyHouse);
                                            }
                                            mapTagPickerInfos.Add(info2);
                                        }
                                    }
                                }
                            }
                        }
                        IMapTagPickerInfo info3 = null;

                        if (flag3)
                        {
                            bool flag4;
                            info3 = MapTagPickerDialog.Show(mapTagPickerInfos, titleText, confirmText, null, false, 0f, false, out flag4);
                        }
                        if (info3 != null)
                        {
                            maxValue = info3.LotId;
                        }
                        break;
                }
            }
            while ((running != MoveDialogBase.Result.Accepted) && (running != MoveDialogBase.Result.Cancelled));

            if (sceneWindow != null)
            {
                sceneWindow.StartForwardingEventsToGame();
            }

            MoveDialog.Shutdown();
            return (running == MoveDialogBase.Result.Accepted);
        }