コード例 #1
0
        public ChangeLotTypeDialogEx(LotType currentLotType, CommercialLotSubType currentCommercialSubType, ResidentialLotSubType currentResidentialSubType, Vector2 position, ModalDialog.PauseMode pauseMode, bool isHouseboatLot)
            : base(currentLotType, currentCommercialSubType, currentResidentialSubType, position, pauseMode, isHouseboatLot)
        {
            PopulateComboBox(currentLotType == LotType.Residential, isHouseboatLot);

            Button childByID = mModalDialogWindow.GetChildByID(3, true) as Button;
            childByID.Click -= OnLotTypeClick;
            childByID.Click += OnLotTypeClickEx;

            childByID = mModalDialogWindow.GetChildByID(2, true) as Button;
            childByID.Click -= OnLotTypeClick;
            childByID.Click += OnLotTypeClickEx;
        }
コード例 #2
0
        public ChangeLotTypeDialogEx(LotType currentLotType, CommercialLotSubType currentCommercialSubType, ResidentialLotSubType currentResidentialSubType, Vector2 position, ModalDialog.PauseMode pauseMode, bool isHouseboatLot)
            : base(currentLotType, currentCommercialSubType, currentResidentialSubType, position, pauseMode, isHouseboatLot)
        {
            PopulateComboBox(currentLotType == LotType.Residential, isHouseboatLot);

            Button childByID = mModalDialogWindow.GetChildByID(3, true) as Button;

            childByID.Click -= OnLotTypeClick;
            childByID.Click += OnLotTypeClickEx;

            childByID        = mModalDialogWindow.GetChildByID(2, true) as Button;
            childByID.Click -= OnLotTypeClick;
            childByID.Click += OnLotTypeClickEx;
        }
コード例 #3
0
            protected static string VenueName(CommercialLotSubType type)
            {
                if (type == CommercialLotSubType.kCommercialUndefined)
                {
                    return(null);
                }

                string result = (Responder.Instance.EditTownModel as EditTownModel).CommercialSubTypeLocalizedName(type);

                if (result == null)
                {
                    result = type.ToString();
                }

                return(result);
            }
コード例 #4
0
 public static new bool Show(ref LotType currentType, ref CommercialLotSubType currentCommercialSubType, ref ResidentialLotSubType currentResidentialSubType, ref string lotTypeName, Vector2 position, ModalDialog.PauseMode pauseMode, bool isHouseboatLot)
 {
     if (ModalDialog.EnableModalDialogs)
     {
         using (ChangeLotTypeDialogEx dialog = new ChangeLotTypeDialogEx(currentType, currentCommercialSubType, currentResidentialSubType, position, pauseMode, isHouseboatLot))
         {
             dialog.StartModal();
             currentType = dialog.mCurrentLotType;
             currentCommercialSubType  = dialog.mCurrentCommercialSubType;
             currentResidentialSubType = dialog.mCurrentResidentialSubType;
             lotTypeName = dialog.mLotTypeName;
             return(dialog.Result);
         }
     }
     return(false);
 }
コード例 #5
0
        public static Lot FindLotType(CommercialLotSubType type)
        {
            List<Lot> lots = new List<Lot>();

            foreach (Lot lot in LotManager.AllLots)
            {
                if (!lot.IsCommunityLot) continue;

                if (lot.CommercialLotSubType == type)
                {
                    lots.Add(lot);
                }
            }

            if (lots.Count == 0) return null;

            return RandomUtil.GetRandomObjectFromList(lots);
        }
コード例 #6
0
ファイル: ChooseCareerOption.cs プロジェクト: yakoder/NRaas
        public static Lot FindLotType(CommercialLotSubType type)
        {
            List <Lot> lots = new List <Lot>();

            foreach (Lot lot in LotManager.AllLots)
            {
                if (!lot.IsCommunityLot)
                {
                    continue;
                }

                if (lot.CommercialLotSubType == type)
                {
                    lots.Add(lot);
                }
            }

            if (lots.Count == 0)
            {
                return(null);
            }

            return(RandomUtil.GetRandomObjectFromList(lots));
        }
コード例 #7
0
ファイル: EditTownControllerEx.cs プロジェクト: yakoder/NRaas
        public static void ChangeLotTypeTask(object obj)
        {
            try
            {
                EditTownController ths = EditTownController.Instance;

                UIBinInfo info = obj as UIBinInfo;
                if ((info != null) && (info.LotId != ulong.MaxValue))
                {
                    ths.mModel.SetCurrentSelection(null, InfoSource.Unknown);
                    ILocalizationModel    localizationModel     = Sims3.UI.Responder.Instance.LocalizationModel;
                    LotType               lotType               = info.LotType;
                    CommercialLotSubType  commercialLotSubType  = info.CommercialLotSubType;
                    ResidentialLotSubType residentialLotSubType = info.ResidentialLotSubType;
                    string lotTypeName = "";

                    if (ChangeLotTypeDialogEx.Show(ref lotType, ref commercialLotSubType, ref residentialLotSubType, ref lotTypeName, info.IsHouseboatLot))
                    {
                        if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP1_BaseCamp)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string titleText   = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                            string messageText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown/EP01:BaseCampExists");
                            SimpleMessageDialog.Show(titleText, messageText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP11_BaseCampFuture)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string str4 = localizationModel.LocalizeString("Ui/Caption/Global:Failed", new object[0]);
                            string str5 = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown/EP11:BaseCampFutureExists", new object[0]);
                            SimpleMessageDialog.Show(str4, str5, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (EditTownModelEx.ChangeLotType(info.LotId, false, lotType, commercialLotSubType, residentialLotSubType))
                        {
                            EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                        }
                        else
                        {
                            string promptText = string.Empty;
                            if (commercialLotSubType == CommercialLotSubType.kEP10_Resort)
                            {
                                promptText = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown:LotTypeResortFailed", new object[] { info.LotAddress });
                            }
                            else
                            {
                                promptText = localizationModel.LocalizeString((lotType == LotType.Commercial) ? "Ui/Caption/GameEntry/EditTown:LotTypeCommunityFailed" : "Ui/Caption/GameEntry/EditTown:LotTypeResidentialFailed", new object[] { info.LotAddress });
                            }

                            if (AcceptCancelDialog.Show(promptText))
                            {
                                if (EditTownModelEx.ChangeLotType(info.LotId, true, lotType, commercialLotSubType, residentialLotSubType))
                                {
                                    EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                                    EditTownMaptagController.Instance.ResetMaptags();
                                }
                                else
                                {
                                    string str5 = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                                    promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:LotTypeChangeFailed");
                                    SimpleMessageDialog.Show(str5, promptText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ChangeLotTypeTask", e);
            }
        }
コード例 #8
0
        private static bool ChangeLotTypeHelper(Lot lot, bool deleteInvalidObjects, LotType newType, CommercialLotSubType commercialSubType, ResidentialLotSubType residentialSubType)
        {
            List <GameObject> objects = null;

            if (newType == LotType.Commercial)
            {
                // Custom
                //objects = lot.GetObjects<GameObject>(new Predicate<GameObject>(EditTownModel.IsNotValidCommunityLotObject));

                if (commercialSubType == CommercialLotSubType.kEP10_Resort)
                {
                    foreach (RabbitHole hole in lot.GetObjects <RabbitHole>(new Predicate <RabbitHole>(EditTownModel.IsInvestable)))
                    {
                        objects.Add(hole);
                    }

                    if (lot.ResortManager == null)
                    {
                        lot.ResortManager = new ResortManager(lot);
                    }
                }
            }
            else
            {
                // Custom
                //objects = lot.GetObjects<GameObject>(new Predicate<GameObject>(EditTownModel.IsNotValidResidentialLotObject));
            }

            if ((objects != null) && (objects.Count > 0))
            {
                if (!deleteInvalidObjects)
                {
                    return(false);
                }

                foreach (GameObject obj2 in objects)
                {
                    int  num  = 0;
                    bool flag = false;
                    while (obj2.ActorsUsingMe.Count > num)
                    {
                        Sim sim = obj2.ActorsUsingMe[num];
                        if (sim != null)
                        {
                            sim.SetObjectToReset();
                            sim.InteractionQueue.PurgeInteractions(obj2);
                            flag = true;
                        }
                        num++;
                    }
                    if (flag)
                    {
                        SpeedTrap.Sleep(0);
                    }
                    lot.RemoveObjectFromLot(obj2.ObjectId, true);
                    obj2.Destroy();
                }

                ThumbnailKey key = new ThumbnailKey(new ResourceKey(lot.LotId, 0x436fee4c, 0), ThumbnailSize.Large);
                ThumbnailManager.InvalidateThumbnail(key);
                EditTownModel.UpdateDirtyLotThumbnailsTask(true);
            }

            if (lot.CommercialLotSubType == CommercialLotSubType.kEP10_Resort)
            {
                foreach (IResortBuffetTable table in lot.GetObjects <IResortBuffetTable>())
                {
                    table.ClearTable();
                }
            }

            if (GameStates.IsEditTownState)
            {
                BinCommon.KickSimsOffLot(lot, true);
            }

            return(true);
        }
コード例 #9
0
        public static bool ChangeLotType(ulong lotId, bool deleteInvalidObjects, LotType newType, CommercialLotSubType commercialSubType, ResidentialLotSubType residentialSubType)
        {
            EditTownModel ths = EditTownController.Instance.mModel as EditTownModel;

            Lot lot = LotManager.GetLot(lotId);

            if (lot == null)
            {
                return(false);
            }
            if (newType == LotType.Residential)
            {
                commercialSubType = CommercialLotSubType.kCommercialUndefined;
            }
            else
            {
                residentialSubType = ResidentialLotSubType.kResidentialUndefined;
            }

            if ((newType != LotType.Residential) && (commercialSubType == CommercialLotSubType.kCommercialUndefined))
            {
                return(false);
            }

            if (!ChangeLotTypeHelper(lot, deleteInvalidObjects, newType, commercialSubType, residentialSubType))
            {
                return(false);
            }

            ths.GetInWorldCommunityLotBinInfoList();
            ths.GetInWorldLotBinInfoList();
            lot.LotType = newType;
            lot.CommercialLotSubType  = commercialSubType;
            lot.ResidentialLotSubType = residentialSubType;
            if (lot.IsCommunityLot)
            {
                UIBinInfo item  = ths.FindLotBinInfo(lotId);
                bool      flag2 = true;
                if (item == null)
                {
                    flag2 = false;
                    item  = ths.FindCommunityLotBinInfo(lotId);
                }
                if (item != null)
                {
                    item.LotTypeFilter         = 0x8;
                    item.LotType               = newType;
                    item.CommercialLotSubType  = commercialSubType;
                    item.ResidentialLotSubType = residentialSubType;
                    if (flag2)
                    {
                        ths.mInWorldLotBin.Remove(item);
                        ths.mInWorldCommunityLotBin.Add(item);
                    }
                }
            }
            else
            {
                UIBinInfo info2 = ths.FindCommunityLotBinInfo(lotId);
                bool      flag3 = true;
                if (info2 == null)
                {
                    flag3 = false;
                    info2 = ths.FindLotBinInfo(lotId);
                }
                if (info2 != null)
                {
                    if (World.LotIsEmpty(lotId) && lot.IsLotEmptyFromObjects())
                    {
                        info2.LotTypeFilter = 0x2;
                    }
                    else
                    {
                        info2.LotTypeFilter = 0x4;
                    }
                    info2.LotType = newType;
                    info2.CommercialLotSubType  = commercialSubType;
                    info2.ResidentialLotSubType = residentialSubType;
                    if (flag3)
                    {
                        ths.mInWorldCommunityLotBin.Remove(info2);
                        ths.mInWorldLotBin.Add(info2);
                    }
                }
            }

            SpeedTrap.Sleep();
            lot.EnsureLotObjects();

            try
            {
                Sims3.Gameplay.Services.Services.ClearServicesForLot(lot);
            }
            catch (Exception e)
            {
                Common.Exception(lot, e);
            }

            Occupation.ValidateJobConsistencyWithLotType(lot);
            lot.UpdateCachedValues();
            return(true);
        }
コード例 #10
0
 public static new bool Show(ref LotType currentType, ref CommercialLotSubType currentCommercialSubType, ref ResidentialLotSubType currentResidentialSubType, ref string lotTypeName, Vector2 position, ModalDialog.PauseMode pauseMode, bool isHouseboatLot)
 {
     if (ModalDialog.EnableModalDialogs)
     {
         using (ChangeLotTypeDialogEx dialog = new ChangeLotTypeDialogEx(currentType, currentCommercialSubType, currentResidentialSubType, position, pauseMode, isHouseboatLot))
         {
             dialog.StartModal();
             currentType = dialog.mCurrentLotType;
             currentCommercialSubType = dialog.mCurrentCommercialSubType;
             currentResidentialSubType = dialog.mCurrentResidentialSubType;
             lotTypeName = dialog.mLotTypeName;
             return dialog.Result;
         }
     }
     return false;
 }
コード例 #11
0
 public static new bool Show(ref LotType currentType, ref CommercialLotSubType currentCommercialSubType, ref ResidentialLotSubType currentResidentialSubType, ref string lotTypeName, bool isHouseboatLot)
 {
     return Show(ref currentType, ref currentCommercialSubType, ref currentResidentialSubType, ref lotTypeName, new Vector2(-1f, -1f), ModalDialog.PauseMode.PauseSimulator, isHouseboatLot);
 }
コード例 #12
0
ファイル: EditTownModelEx.cs プロジェクト: Robobeurre/NRaas
        private static bool ChangeLotTypeHelper(Lot lot, bool deleteInvalidObjects, LotType newType, CommercialLotSubType commercialSubType, ResidentialLotSubType residentialSubType)
        {
            List<GameObject> objects = null;

            if (newType == LotType.Commercial)
            {
                // Custom
                //objects = lot.GetObjects<GameObject>(new Predicate<GameObject>(EditTownModel.IsNotValidCommunityLotObject));

                if (commercialSubType == CommercialLotSubType.kEP10_Resort)
                {
                    foreach (RabbitHole hole in lot.GetObjects<RabbitHole>(new Predicate<RabbitHole>(EditTownModel.IsInvestable)))
                    {
                        objects.Add(hole);
                    }

                    if (lot.ResortManager == null)
                    {
                        lot.ResortManager = new ResortManager(lot);
                    }
                }
            }
            else
            {
                // Custom
                //objects = lot.GetObjects<GameObject>(new Predicate<GameObject>(EditTownModel.IsNotValidResidentialLotObject));
            }

            if ((objects != null) && (objects.Count > 0))
            {
                if (!deleteInvalidObjects)
                {
                    return false;
                }

                foreach (GameObject obj2 in objects)
                {
                    int num = 0;
                    bool flag = false;
                    while (obj2.ActorsUsingMe.Count > num)
                    {
                        Sim sim = obj2.ActorsUsingMe[num];
                        if (sim != null)
                        {
                            sim.SetObjectToReset();
                            sim.InteractionQueue.PurgeInteractions(obj2);
                            flag = true;
                        }
                        num++;
                    }
                    if (flag)
                    {
                        SpeedTrap.Sleep(0);
                    }
                    lot.RemoveObjectFromLot(obj2.ObjectId, true);
                    obj2.Destroy();
                }

                ThumbnailKey key = new ThumbnailKey(new ResourceKey(lot.LotId, 0x436fee4c, 0), ThumbnailSize.Large);
                ThumbnailManager.InvalidateThumbnail(key);
                EditTownModel.UpdateDirtyLotThumbnailsTask(true);
            }

            if (lot.CommercialLotSubType == CommercialLotSubType.kEP10_Resort)
            {
                foreach (IResortBuffetTable table in lot.GetObjects<IResortBuffetTable>())
                {
                    table.ClearTable();
                }
            }

            if (GameStates.IsEditTownState)
            {
                BinCommon.KickSimsOffLot(lot, true);
            }

            return true;
        }
コード例 #13
0
ファイル: EditTownModelEx.cs プロジェクト: Robobeurre/NRaas
        public static bool ChangeLotType(ulong lotId, bool deleteInvalidObjects, LotType newType, CommercialLotSubType commercialSubType, ResidentialLotSubType residentialSubType)
        {
            EditTownModel ths = EditTownController.Instance.mModel as EditTownModel;

            Lot lot = LotManager.GetLot(lotId);
            if (lot == null)
            {
                return false;
            }
            if (newType == LotType.Residential)
            {
                commercialSubType = CommercialLotSubType.kCommercialUndefined;
            }
            else
            {
                residentialSubType = ResidentialLotSubType.kResidentialUndefined;
            }

            if ((newType != LotType.Residential) && (commercialSubType == CommercialLotSubType.kCommercialUndefined))
            {
                return false;
            }

            if (!ChangeLotTypeHelper(lot, deleteInvalidObjects, newType, commercialSubType, residentialSubType))
            {
                return false;
            }

            ths.GetInWorldCommunityLotBinInfoList();
            ths.GetInWorldLotBinInfoList();
            lot.LotType = newType;
            lot.CommercialLotSubType = commercialSubType;
            lot.ResidentialLotSubType = residentialSubType;
            if (lot.IsCommunityLot)
            {
                UIBinInfo item = ths.FindLotBinInfo(lotId);
                bool flag2 = true;
                if (item == null)
                {
                    flag2 = false;
                    item = ths.FindCommunityLotBinInfo(lotId);
                }
                if (item != null)
                {
                    item.LotTypeFilter = 0x8;
                    item.LotType = newType;
                    item.CommercialLotSubType = commercialSubType;
                    item.ResidentialLotSubType = residentialSubType;
                    if (flag2)
                    {
                        ths.mInWorldLotBin.Remove(item);
                        ths.mInWorldCommunityLotBin.Add(item);
                    }
                }
            }
            else
            {
                UIBinInfo info2 = ths.FindCommunityLotBinInfo(lotId);
                bool flag3 = true;
                if (info2 == null)
                {
                    flag3 = false;
                    info2 = ths.FindLotBinInfo(lotId);
                }
                if (info2 != null)
                {
                    if (World.LotIsEmpty(lotId) && lot.IsLotEmptyFromObjects())
                    {
                        info2.LotTypeFilter = 0x2;
                    }
                    else
                    {
                        info2.LotTypeFilter = 0x4;
                    }
                    info2.LotType = newType;
                    info2.CommercialLotSubType = commercialSubType;
                    info2.ResidentialLotSubType = residentialSubType;
                    if (flag3)
                    {
                        ths.mInWorldCommunityLotBin.Remove(info2);
                        ths.mInWorldLotBin.Add(info2);
                    }
                }
            }

            SpeedTrap.Sleep();
            lot.EnsureLotObjects();

            try
            {
                Sims3.Gameplay.Services.Services.ClearServicesForLot(lot);
            }
            catch (Exception e)
            {
                Common.Exception(lot, e);
            }

            Occupation.ValidateJobConsistencyWithLotType(lot);
            lot.UpdateCachedValues();
            return true;
        }
コード例 #14
0
 public static new bool Show(ref LotType currentType, ref CommercialLotSubType currentCommercialSubType, ref ResidentialLotSubType currentResidentialSubType, ref string lotTypeName, bool isHouseboatLot)
 {
     return(Show(ref currentType, ref currentCommercialSubType, ref currentResidentialSubType, ref lotTypeName, new Vector2(-1f, -1f), ModalDialog.PauseMode.PauseSimulator, isHouseboatLot));
 }