예제 #1
0
        public static bool PayForLot(EditTownModel ths, UIBinInfo info, ulong lotId)
        {
            Lot lot = LotManager.GetLot(lotId);

            if (lot != null)
            {
                ExportBinContents contents = ths.FindExportBinContents(info.ContentId);
                if (contents != null)
                {
                    bool flag = contents.IsLoaded();
                    if (!flag)
                    {
                        ExportBinContentsEx.Import(contents, true);
                    }

                    Household household = contents.Household;
                    if (household != null)
                    {
                        return(BinCommonEx.PayForLot(household, lot, true, Mover.GetLotCost));
                    }

                    if (!flag)
                    {
                        ExportBinContentsEx.Flush(contents);
                    }
                }
                else if (info.LotId != ulong.MaxValue)
                {
                    LotContents contents2 = Bin.Singleton.FindLot(info.LotId);
                    if ((contents2 != null) && (contents2.Household != null))
                    {
                        Household household2 = contents2.Household.Household;
                        if (household2 != null)
                        {
                            return(BinCommonEx.PayForLot(household2, lot, true, Mover.GetLotCost));
                        }
                    }
                }
                else if (info.HouseholdId != ulong.MaxValue)
                {
                    Household household3 = Household.Find(info.HouseholdId);
                    if (household3 != null)
                    {
                        return(BinCommonEx.PayForLot(household3, lot, true, Mover.GetLotCost));
                    }
                }
            }
            return(false);
        }
예제 #2
0
        public override void Dispose()
        {
            foreach (ExportBinContents content in mLoaded.Keys)
            {
                try
                {
                    if (content.Household != null)
                    {
                        foreach (SimDescription sim in new List <SimDescription> (content.Household.AllSimDescriptions))
                        {
                            Manager.Deaths.CleansingKill(sim, true);
                        }

                        mStats.IncStat("SimFromBin Household Disposed");

                        content.Household.Destroy();
                        content.Household.Dispose();
                    }

                    if (content.mHouseholdContents != null)
                    {
                        ExportBinContentsEx.Flush(content);
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(content.HouseholdName, e);
                }
            }

            foreach (SimDescription sim in mDispose)
            {
                sim.Dispose();
            }

            mStats.IncStat("SimFromBin Clear");

            BinModel.Singleton.ClearExportBin();
        }
예제 #3
0
        public static PlaceResult PlaceFromExportBin(EditTownModel ths, UIBinInfo info, ulong lotId, PlaceAction action, bool showConfirmDialog)
        {
            try
            {
                PlaceResult contentFailure = PlaceResult.ContentFailure;
                Lot         lot            = LotManager.GetLot(lotId);
                if (lot == null)
                {
                    return(PlaceResult.InvalidLot);
                }

                ExportBinContents exportBinItem = ths.FindExportBinContents(info.ContentId);
                if (exportBinItem != null)
                {
                    ths.GetInWorldHouseholdBinInfoList();
                    ths.GetInWorldLotBinInfoList();
                    Sim newActiveSim = null;
                    if (lot.Household != null)
                    {
                        return(BinCommonEx.MergeHouseholdFromExportBin(exportBinItem, lot, showConfirmDialog, Mover.Settings.mAllowGreaterThanEight));
                    }

                    BinCommon.KickSimsOffLot(lot, true);
                    ProgressDialog.Show(Localization.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]));

                    try
                    {
                        try
                        {
                            contentFailure = BinCommonEx.PlaceFromExportBin(exportBinItem, lot, action, true, Mover.GetLotCost, ref newActiveSim);

                            ExportBinContentsEx.Flush(exportBinItem);

                            UIBinInfo item = BinCommon.CreateInWorldBinInfo(lot.Household, lot);
                            if (item != null)
                            {
                                if (info.HouseholdId != ulong.MaxValue)
                                {
                                    ths.mInWorldHouseholdBin.Add(item);
                                }
                                else
                                {
                                    ths.mInWorldLotBin.Add(item);
                                }
                            }
                        }
                        finally
                        {
                            ProgressDialog.Close();
                        }
                    }
                    catch (ExecutionEngineException)
                    { }
                }
                return(contentFailure);
            }
            catch (Exception e)
            {
                Common.Exception("PlaceFromExportBin", e);
                return(PlaceResult.ContentFailure);
            }
        }