Esempio n. 1
0
        public static Lot PromptForLot()
        {
            Lot baseCampLot = LotManager.GetBaseCampLot();

            if (!UIUtils.IsOkayToStartModalDialog(false, true))
            {
                return(null);
            }

            List <IMapTagPickerInfo> mapTagPickerInfos = new List <IMapTagPickerInfo>();

            mapTagPickerInfos.Add(new MapTagPickerLotInfo(baseCampLot, MapTagType.BaseCamp));
            Dictionary <ulong, bool> dictionary = new Dictionary <ulong, bool>();

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

                if (lot.IsWorldLot)
                {
                    continue;
                }

                if (lot.Household != null)
                {
                    continue;
                }

                if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                {
                    continue;
                }

                Lot.LotMetrics metrics = new Lot.LotMetrics();
                lot.GetLotMetrics(ref metrics);
                if (metrics.FridgeCount == 0)
                {
                    continue;
                }

                if ((lot != null) && !dictionary.ContainsKey(lot.LotId))
                {
                    dictionary[lot.LotId] = true;
                    mapTagPickerInfos.Add(new MapTagPickerLotInfo(lot, MapTagType.AvailableHousehold));
                }
            }

            GameUtils.EnableSceneDraw(true);
            LoadingScreenController.Unload();
            while (LoadingScreenController.Instance != null)
            {
                SpeedTrap.Sleep(0);
            }

            IMapTagPickerInfo info = MapTagPickerDialog.Show(mapTagPickerInfos, TravelUtil.LocalizeString("ChooseHomeLot", new object[0]), TravelUtil.LocalizeString("Accept", new object[0]), false);

            if (info == null)
            {
                return(null);
            }

            return(LotManager.GetLot(info.LotId));
        }