コード例 #1
0
ファイル: TimePortalTravelEx.cs プロジェクト: yakoder/NRaas
        public static bool PreTimeTravel1(InteractionInstance ths)
        {
            if (!UIUtils.IsOkayToStartModalDialog())
            {
                return(false);
            }

            Sim actor = ths.InstanceActor as Sim;

            TravelUtil.PlayerMadeTravelRequest = true;
            OpportunityNames guid = CheckOpportunities(actor);

            string prompt;

            if (GameUtils.IsFutureWorld())
            {
                prompt = TimePortal.LocalizeString("ConfirmReturn", new object[0x0]);
            }
            else if (guid != OpportunityNames.Undefined)
            {
                prompt = TimePortal.LocalizeString("ConfirmWarningTravel", new object[0x0]);
            }
            else
            {
                prompt = TimePortal.LocalizeString("ConfirmTravel", new object[0x0]);
            }
            if (!TwoButtonDialog.Show(prompt, Localization.LocalizeString("Ui/Caption/Global:Accept", new object[0x0]), Localization.LocalizeString("Ui/Caption/Global:Cancel", new object[0x0])))
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                return(false);
            }

            //Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Ui/Caption/HUD/DisasterSaveError:Traveling");
            ths.CancellableByPlayer = false;
            if ((guid != OpportunityNames.Undefined) && (actor.OpportunityManager != null))
            {
                actor.OpportunityManager.CancelOpportunity(guid);
            }

            if (actor.OpportunityManager != null)
            {
                if (actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler01))
                {
                    actor.OpportunityManager.CancelOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler01);
                }

                if (actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler02))
                {
                    actor.OpportunityManager.CancelOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler02);
                }

                if (GameUtils.IsFutureWorld() && actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid))
                {
                    actor.OpportunityManager.CancelOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid);
                }
            }

            return(true);
        }
コード例 #2
0
 public override string GetInteractionName(Sim actor, TimeMachine target, InteractionObjectPair iop)
 {
     if (GameUtils.IsFutureWorld())
     {
         return(TimePortal.LocalizeString("TravelHome", new object[0x0]));
     }
     return(TimePortal.LocalizeString("Travel", new object[0x0]));
 }
コード例 #3
0
 public override string GetInteractionName(Sim actor, AncientPortal target, InteractionObjectPair iop)
 {
     if (GameUtils.IsFutureWorld())
     {
         return(TimePortal.LocalizeString("TravelHome", new object[0x0]));
     }
     return(TimePortal.LocalizeString("TravelWith", new object[0x0]) + Localization.Ellipsis);
 }
コード例 #4
0
        public static bool PreTimeTravel1(InteractionInstance ths, ITravelWith travelWith, List <Sim> travelers)
        {
            Sim actor = ths.InstanceActor as Sim;

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

            if (GameUtils.IsFutureWorld())
            {
                foreach (Sim sim in actor.Household.Sims)
                {
                    if (sim != actor)
                    {
                        GreyedOutTooltipCallback callback = null;
                        if (TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(sim, true, ref callback))
                        {
                            Lazy.Add <List <Sim>, Sim>(ref travelers, sim);
                        }
                    }
                }
            }
            else
            {
                travelers.AddRange(ths.GetSelectedObjectsAsSims());
            }

            if (travelers.Count == 0)
            {
                return(false);
            }

            if ((actor.OpportunityManager != null) && actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler01))
            {
                return(false);
            }

            string portal;

            TravelUtil.PlayerMadeTravelRequest = true;
            Dictionary <Sim, OpportunityNames> dictionary = CheckOpportunities(actor, travelers);

            if (GameUtils.IsFutureWorld())
            {
                portal = TimePortal.LocalizeString("ConfirmReturnWith", new object[0x0]);
            }
            else if (dictionary.Count > 0x0)
            {
                portal = TimePortal.LocalizeString("ConfirmTravelWith", new object[0x0]) + TimePortal.LocalizeString("ConfirmWarningTravelWith", new object[0x0]);
            }
            else
            {
                portal = TimePortal.LocalizeString("ConfirmTravelWith", new object[0x0]);
            }

            if (!TwoButtonDialog.Show(portal, Localization.LocalizeString("Ui/Caption/Global:Accept", new object[0x0]), Localization.LocalizeString("Ui/Caption/Global:Cancel", new object[0x0])))
            {
                return(false);
            }

            ths.CancellableByPlayer = false;
            //Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Ui/Caption/HUD/DisasterSaveError:Traveling");
            if (dictionary.Count > 0x0)
            {
                foreach (Sim sim2 in dictionary.Keys)
                {
                    if (sim2.OpportunityManager != null)
                    {
                        sim2.OpportunityManager.CancelOpportunity(dictionary[sim2]);
                    }
                }
            }

            if ((GameUtils.IsFutureWorld() && (actor.OpportunityManager != null)) && actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid))
            {
                actor.OpportunityManager.CancelOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid);
            }

            foreach (Sim sim3 in travelers)
            {
                travelWith.AddFollower(sim3);
            }

            return(true);
        }