コード例 #1
0
        private static bool ShowRequiredItemsDialogTask(CASPuck ths)
        {
            int       currentPreviewSim = ths.CurrentPreviewSim;
            ICASModel cASModel          = Sims3.UI.Responder.Instance.CASModel;

            cASModel.OnSimUpdated -= ths.OnSimUpdated;
            cASModel.OnSimUpdated += ths.OnSimUpdatedRequiredItems;

            ths.mSimUpdated = false;
            //cASModel.RequestUpdateCurrentSim(true);
            CASLogic.CASOperationStack.Instance.Push(new UpdateCurrentSimOperationEx(true));
            while (!ths.mSimUpdated)
            {
                SpeedTrap.Sleep();
            }

            cASModel.OnSimUpdated -= ths.OnSimUpdatedRequiredItems;
            cASModel.OnSimUpdated += ths.OnSimUpdated;

            /*
             * if (IsPetOnlyHousehold())
             * {
             *  if (!AcceptCancelDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Family:PetOnlyHousehold", new object[0x0])))
             *  {
             *      return false;
             *  }
             * }
             * else */if (!IsHouseholdValid())
            {
                SimpleMessageDialog.Show(null, Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Family:InvalidHousehold", new object[0x0]), ModalDialog.PauseMode.PauseSimulator);
                return(false);
            }

            cASModel.OnSimPreviewChange -= ths.OnSimPreviewChange;
            cASModel.OnSimPreviewChange += ths.OnSimPreviewChangeRequiredItems;
            ths.mInputBlocker.Visible    = true;
            cASModel.RequestClearStack();

            cASModel.OnUndoRedoStackChanged -= ths.OnUndoRedoStackChanged;
            ths.mUndoButton.Enabled          = false;
            ths.mRedoButton.Enabled          = false;
            bool flag  = true;
            int  index = 0x0;

            foreach (ISimDescription description in cASModel.GetSimsInHousehold())
            {
                if (CASRequiredItemsDialog.ShouldShow(description))
                {
                    ths.mSimPreviewChanged = false;
                    cASModel.RequestSetPreviewSim(index);
                    ths.SelectSimButton(index);
                    while (!ths.mSimPreviewChanged || cASModel.IsProcessing())
                    {
                        SpeedTrap.Sleep();
                    }

                    CASController.Singleton.SetFullbodyCam(true);

                    ths.UiBusy = false;
                    if (!CASRequiredItemsDialog.Show())
                    {
                        flag = false;
                    }
                    ths.UiBusy = true;
                }

                if (description.TeenOrBelow)
                {
                    description.SimLifetimeWish = 0x0;
                }
                index++;
            }

            ths.mInputBlocker.Visible        = false;
            cASModel.OnSimPreviewChange     -= ths.OnSimPreviewChangeRequiredItems;
            cASModel.OnSimPreviewChange     += ths.OnSimPreviewChange;
            cASModel.OnUndoRedoStackChanged += ths.OnUndoRedoStackChanged;

            cASModel.RequestSetPreviewSim(currentPreviewSim);
            ths.SelectSimButton(currentPreviewSim);
            if (!flag)
            {
                string str;
                if (GameUtils.IsInstalled(ProductVersion.EP5))
                {
                    str = Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/CAS/Puck:RequiredItemsMissingEP5", new object[0x0]);
                }
                else
                {
                    str = Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/CAS/Puck:RequiredItemsMissing", new object[0x0]);
                }

                SimpleMessageDialog.Show(null, str, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
            }

            return(flag);
        }