Esempio n. 1
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Sim actorSim = parameters.mActor as Sim;

            SimSelection sims = SimSelection.Create(Name, actorSim.SimDescription);

            if (sims.IsEmpty)
            {
                Common.Notify(Common.Localize(GetTitlePrefix() + ":None"));
                return(OptionResult.Failure);
            }

            SimSelection.Results selection = sims.SelectMultiple();
            if ((selection == null) || (selection.Count == 0))
            {
                return(OptionResult.Failure);
            }

            foreach (SimDescription sim in selection)
            {
                sim.AssignedRole.RemoveSimFromRole();
            }

            return(OptionResult.SuccessRetain);
        }
Esempio n. 2
0
        public List <IMiniSimDescription> GetSelection(IMiniSimDescription me, string title, ICollection <SimSelection.ICriteria> criteria, int maxSelection, bool canApplyAll, out bool okayed)
        {
            okayed = false;

            bool         criteriaCanceled;
            SimSelection sims = SimSelection.Create(title, me, this, criteria, true, canApplyAll, out criteriaCanceled);

            if (sims.IsEmpty)
            {
                SimpleMessageDialog.Show(title, Common.Localize("SimSelection:NoChoices"));
                return(null);
            }

            okayed = true;

            List <IMiniSimDescription> results = new List <IMiniSimDescription>();

            if (sims.All.Count == 1)
            {
                results.AddRange(sims.All);
            }
            else
            {
                if ((ApplyAll) || ((AllSimsOnFilterCancel) && (criteriaCanceled)))
                {
                    if (!PerformApplyAll(title, sims.All, results))
                    {
                        okayed = false;
                    }

                    mAskedAndAnswered = true;
                }
                else
                {
                    SimSelection.Results choices = sims.SelectMultiple(maxSelection);

                    okayed = choices.mOkayed;
                    results.AddRange(choices);

                    if ((results.Count == 0) && (okayed) && (sims.All.Count > 1) && (maxSelection <= sims.All.Count))
                    {
                        if (!PerformApplyAll(title, sims.All, results))
                        {
                            okayed = false;
                        }
                    }

                    if ((canApplyAll) && (results.Count == sims.All.Count))
                    {
                        mAskedAndAnswered = true;
                        mApplyAll         = true;
                    }
                }
            }

            return(results);
        }
Esempio n. 3
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Sim actorSim = parameters.mActor as Sim;

            SimSelection sims = SimSelection.Create("", Name, actorSim.SimDescription);

            if (sims.IsEmpty)
            {
                return(OptionResult.Failure);
            }

            SimSelection.Results results = sims.SelectMultiple();
            foreach (SimDescription desc in results)
            {
                Tagger.Settings.mTaggedSims.Remove(desc.SimDescriptionId);
            }

            return(OptionResult.SuccessClose);
        }