Exemple #1
0
        public static void SplitHousehold(EditTownController ths, UIBinInfo from)
        {
            try
            {
                if (ths == null)
                {
                    return;
                }

                Household household = Household.Find(from.HouseholdId);
                if (household != null)
                {
                    IMovingModel model = new GameEntryMovingModelEx(household);
                    if (model != null)
                    {
                        EditTownSplitDialog.Show(model);
                        Simulator.AddObject(new OneShotFunctionWithParams(ths.SplitHouseholdsTask, from));
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("SplitHousehold", e);
            }
        }
Exemple #2
0
 public static void OnSplitClick(WindowBase w, UIButtonClickEventArgs eventArgs)
 {
     try
     {
         GameEntryMovingModelEx.SplitHousehold(EditTownController.Instance, EditTownInfoPanel.sInstance.mInfo);
     }
     catch (Exception e)
     {
         Common.Exception("OnSplitClick", e);
     }
 }
Exemple #3
0
 private new void OnSelection(UIBinInfo info)
 {
     if (((mFrom != null) && (mFrom != info)) && (info.HouseholdId != ulong.MaxValue))
     {
         mModel.CenterCamera(info.LotId);
         GameEntryMovingModelEx.MergeHouseholds(EditTownController.Instance, mFrom, info);
     }
     else
     {
         Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WarnCantMergeHouseholds), info));
     }
 }
Exemple #4
0
        public static void MergeHouseholds(EditTownController ths, UIBinInfo from, UIBinInfo to)
        {
            try
            {
                Household household = Household.Find(from.HouseholdId);
                if (household != null)
                {
                    IMovingModel model = new GameEntryMovingModelEx(household);
                    if (model != null)
                    {
                        model.SetTargetLot(to.LotId);
                        EditTownMergeDialog.Show(model);

                        Common.FunctionTask.Perform(ths.MergeHouseholdsTask);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("MergeHouseholds", e);
            }
        }
Exemple #5
0
        private new void OnSelection(UIBinInfo lotInfo)
        {
            if (lotInfo.HouseholdId == ulong.MaxValue)
            {
                if ((mInfo != null) && (mFrom != InfoSource.Unknown))
                {
                    LotValidity lotValidity = mModel.GetLotValidity(lotInfo.LotId);

                    // EA Standard does not distinguish between vacation and private lots, messing up [StoryProgression] rental systems
                    foreach (PropertyData data in RealEstateManager.AllPropertiesFromAllHouseholds())
                    {
                        if (data.PropertyType == RealEstatePropertyType.VacationHome)
                        {
                            continue;
                        }

                        if (data.LotId == lotInfo.LotId)
                        {
                            Simulator.AddObject(new OneShotFunctionWithParams(WarnLotGeneric, lotInfo));
                            return;
                        }
                    }

                    mModel.CenterCamera(lotInfo.LotId);
                    if (mInfo.LotId != ulong.MaxValue)
                    {
                        bool allow = false;
                        if (lotValidity == LotValidity.Valid)
                        {
                            allow = true;
                        }
                        else if ((Mover.Settings.mAllowGreaterThanEight) && (!mModel.LotContentsWillFit(mInfo, lotInfo.LotId)))
                        {
                            allow = true;
                        }

                        if (allow)
                        {
                            mPlacing = true;
                            EditTownController.Instance.ShowUI(false);
                            UIManager.DarkenBackground(true);
                            Sims3.UI.Responder.Instance.DisableQuit();
                            Simulator.AddObject(new OneShotFunctionWithParams(PlaceLotTask, lotInfo));
                        }
                        else if (!mModel.LotContentsWillFit(mInfo, lotInfo.LotId))
                        {
                            Simulator.AddObject(new OneShotFunctionWithParams(WarnTooBig, lotInfo));
                        }
                        else
                        {
                            Simulator.AddObject(new OneShotFunctionWithParams(WarnLotGeneric, lotInfo));
                        }
                    }
                    else if (mInfo.HouseholdId != ulong.MaxValue)
                    {
                        if (lotValidity == LotValidity.Unavailable)
                        {
                            if ((!Mover.Settings.mFreeRealEstate) && (mInfo.HouseholdFunds < lotInfo.LotWorth))
                            {
                                Simulator.AddObject(new OneShotFunctionWithParams(WarnInsufficientFunds, lotInfo));
                                return;
                            }
                        }

                        if (lotValidity != LotValidity.Invalid)
                        {
                            mPlacing = true;
                            Simulator.AddObject(new OneShotFunctionWithParams(ConfirmPurchaseTaskEx, lotInfo));
                            return;
                        }
                    }
                }
            }
            else if (mInfo.LotId == ulong.MaxValue)
            {
                if (mFrom == InfoSource.Clipboard)
                {
                    mModel.CenterCamera(lotInfo.LotId);
                    GameEntryMovingModelEx.MergeHouseholds(EditTownController.Instance, mInfo, lotInfo);
                }
                else
                {
                    mModel.CenterCamera(lotInfo.LotId);
                    Simulator.AddObject(new OneShotFunctionWithParams(PlaceHouseholdTaskEx, lotInfo));
                }
            }
        }
        public static void SplitHousehold(EditTownController ths, UIBinInfo from)
        {
            try
            {
                if (ths == null) return;

                Household household = Household.Find(from.HouseholdId);
                if (household != null)
                {
                    IMovingModel model = new GameEntryMovingModelEx(household);
                    if (model != null)
                    {
                        EditTownSplitDialog.Show(model);
                        Simulator.AddObject(new OneShotFunctionWithParams(ths.SplitHouseholdsTask, from));
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("SplitHousehold", e);
            }
        }
        public static void MergeHouseholds(EditTownController ths, UIBinInfo from, UIBinInfo to)
        {
            try
            {
               Household household = Household.Find(from.HouseholdId);
                if (household != null)
                {
                    IMovingModel model = new GameEntryMovingModelEx(household);
                    if (model != null)
                    {
                        model.SetTargetLot(to.LotId);
                        EditTownMergeDialog.Show(model);

                        Common.FunctionTask.Perform(ths.MergeHouseholdsTask);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("MergeHouseholds", e);
            }
        }