コード例 #1
0
        public static void OnFinishMakeoverFreestyle(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                bool tookSemaphore = false;
                Styling.MakeoverOutcome makeoverOutcome = Styling.GetMakeoverOutcome(target, actor, true);
                bool forceFailureOutfit = makeoverOutcome == Styling.MakeoverOutcome.EpicFailure;
                bool flag3 = false;
                try
                {
                    if (forceFailureOutfit)
                    {
                        Styling.LoadMakeoverEpicFailureOutfitForCasOverride(target);
                    }
                    flag3 = GetMakeoverEx.DisplayCAS(target, actor, ref tookSemaphore, forceFailureOutfit);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    if (tookSemaphore)
                    {
                        GameStates.ReleaseInteractionStateChangeSemaphore();
                    }
                }

                if (CASChangeReporter.Instance.GetPropertyChanged(CASChangeReporter.ChangeFlags.Any))
                {
                    SkillLevel         customerReactionType = Styling.GetCustomerReactionType(target, actor, makeoverOutcome, false);
                    SkillLevel         stylerReactionType   = Styling.GetStylerReactionType(customerReactionType);
                    StateMachineClient client = StateMachineClient.Acquire(actor, "StylistActiveCareer");
                    client.SetActor("x", target);
                    client.SetActor("y", actor);
                    client.SetParameter("doClothesSpin", !flag3);
                    client.SetParameter("customerReactionType", customerReactionType);
                    client.SetParameter("stylistReactionType", stylerReactionType);
                    client.EnterState("x", "Enter");
                    client.EnterState("y", "Enter");
                    actor.LoopIdle();
                    client.RequestState("x", "Customer Reaction");
                    Styling.PostMakeover(target, actor, makeoverOutcome, false, customerReactionType, true, true, new Styling.OnMakeoverCompletedCallback(SocialCallback.OnMakeoverFreestyleCompleted));
                    client.RequestState(false, "x", "Exit");
                    client.RequestState("y", "Stylist Reaction");
                    client.RequestState("y", "Exit");
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
コード例 #2
0
ファイル: MakeoverSelfEx.cs プロジェクト: yakoder/NRaas
 public override bool Run()
 {
     try
     {
         if (!Actor.RouteToSlotAndCheckInUse(Target, StylingStation.kPlatformRoutingSlot))
         {
             return(false);
         }
         StandardEntry();
         Styling.PreMakeover(Actor, Actor);
         EnterStateMachine("StylingStation", "Enter", "x", "stylistStation");
         AddSynchronousOneShotScriptEventHandler(0x384, new SacsEventHandler(SnapSimToPlatform));
         AddSynchronousOneShotScriptEventHandler(0x385, new SacsEventHandler(SnapSimToGround));
         AnimateSim("Get On Platform");
         if (Actor.HasExitReason())
         {
             AnimateSim("Get Off Platform");
             AnimateSim("Exit");
             StandardExit();
             return(false);
         }
         BeginCommodityUpdates();
         AnimateSim("Customer Alone Loop");
         float duration  = Actor.IsNPC ? StylingStation.kNPCMakeoverDurationInMinutes : StylingStation.kMakeoverDurationInMinutes;
         bool  succeeded = DoTimedLoop(duration);
         if (succeeded)
         {
             Styling.MakeoverOutcome success = Styling.MakeoverOutcome.Success;
             bool isSelectable = Actor.IsSelectable;
             if (!isSelectable)
             {
                 Sim.SwitchOutfitHelper switchOutfitHelper = null;
                 Styling.LoadMakeoverOutfitForClothesSpin(Actor, false, Autonomous, ref switchOutfitHelper);
                 mSwitchOutfitHelper = switchOutfitHelper;
             }
             Animate("x", "Gussy Anims Done");
             if (!isSelectable && (mSwitchOutfitHelper != null))
             {
                 mSwitchOutfitHelper.Wait(true);
                 mSwitchOutfitHelper.AddScriptEventHandler(this);
             }
             if (isSelectable)
             {
                 bool tookSemaphore = mTookSemaphore;
                 isSelectable   = GetMakeoverEx.DisplayCAS(Actor, null, ref tookSemaphore, false);
                 mTookSemaphore = tookSemaphore;
             }
             SkillLevel expert = SkillLevel.expert;
             SetParameter("doClothesSpin", !isSelectable);
             SetParameter("customerReactionType", expert);
             Animate("x", "Customer Reaction");
             ReleaseSemaphore();
             Styling.PostMakeover(Actor, Actor, success, false, expert, isSelectable, isSelectable, null);
         }
         if (succeeded)
         {
             Actor.SkillManager.AddElement(SkillNames.Styling);
         }
         EndCommodityUpdates(succeeded);
         AnimateSim("Get Off Platform");
         AnimateSim("Exit");
         StandardExit();
         return(succeeded);
     }
     catch (ResetException)
     {
         throw;
     }
     catch (Exception e)
     {
         Common.Exception(Actor, Target, e);
         return(false);
     }
 }
コード例 #3
0
ファイル: GetMakeoverEx.cs プロジェクト: yakoder/NRaas
        /*
         * public void AddInteraction(Common.InteractionInjectorList interactions)
         * {
         *  interactions.Add<StylingStation, StylingStation.GetMakeover.Definition>(Singleton);
         * }
         */

        public override bool Run()
        {
            try
            {
                bool succeeded = false;
                if (Styler == null)
                {
                    return(false);
                }
                else if ((Actor.LotCurrent != Styler.LotCurrent) && !RouteActorToTargetLot())
                {
                    return(false);
                }
                else if (ShouldPushOtherHalf && !PushOtherHalf(StylingStation.GiveMakeover.Singleton, Actor, Styler, null))
                {
                    return(false);
                }
                else if (!Actor.RouteToSlot(Target, StylingStation.kPlatformRoutingSlot))
                {
                    return(false);
                }
                else if (!Styling.CanSimReceiveMakeover(Actor, Styler, Autonomous))
                {
                    return(false);
                }
                else if (Target.UseCount > 0x1)
                {
                    return(false);
                }
                else if (Target.UseCount == 0x1)
                {
                    if (!Target.IsActorUsingMe(Styler))
                    {
                        return(false);
                    }
                    if (Styler.InteractionQueue.GetHeadInteraction() != LinkedInteractionInstance)
                    {
                        return(false);
                    }
                }

                StandardEntry();
                Styling.PreMakeover(Actor, Styler);
                AddSynchronousOneShotScriptEventHandler(0x384, SnapSimToPlatform);
                AddSynchronousOneShotScriptEventHandler(0x385, SnapSimToGround);
                Animate("x", "Get On Platform");
                Actor.LoopIdle();
                if (!StartSync(true))
                {
                    Animate("x", "Get Off Platform");
                    Animate("x", "Exit");
                    StandardExit(true, false);
                    return(false);
                }
                BeginCommodityUpdates();
                AddPersistentScriptEventHandler(0x7a6a, DisplayThoughtBalloon);
                AddPersistentScriptEventHandler(0x7a69, DisplayThoughtBalloon);
                bool flag2 = false;
                int  num   = 0x0;
                do
                {
                    num++;
                    flag2 = false;
                    AnimateJoinSims("Customer and Stylist Loop");
                    float duration = (Styler.IsNPC && Actor.IsNPC) ? StylingStation.kNPCMakeoverDurationInMinutes : StylingStation.kMakeoverDurationInMinutes;
                    succeeded = DoTimedLoop(duration);
                    AnimateNoYield("y", "Stylist Idle");
                    StylingStation.GiveMakeover linkedInteractionInstance = LinkedInteractionInstance as StylingStation.GiveMakeover;
                    linkedInteractionInstance.DoStylistIdle = true;
                    if (succeeded)
                    {
                        bool enteringCAS = linkedInteractionInstance.SimInCAS != null;
                        Styling.MakeoverOutcome makeoverOutcome = Styling.GetMakeoverOutcome(Actor, Styler, enteringCAS);
                        bool epicMakeoverFailure = makeoverOutcome == Styling.MakeoverOutcome.EpicFailure;
                        if (!enteringCAS)
                        {
                            Sim.SwitchOutfitHelper switchOutfitHelper = null;
                            Styling.LoadMakeoverOutfitForClothesSpin(Actor, epicMakeoverFailure, Autonomous, ref switchOutfitHelper);
                            mSwitchOutfitHelper = switchOutfitHelper;
                        }
                        else if (epicMakeoverFailure)
                        {
                            Styling.LoadMakeoverEpicFailureOutfitForCasOverride(Actor);
                        }
                        Animate("x", "Gussy Anims Done");
                        if (!enteringCAS && (mSwitchOutfitHelper != null))
                        {
                            mSwitchOutfitHelper.Wait(true);
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                        }

                        if (enteringCAS)
                        {
                            bool tookSemaphore = mTookSemaphore;
                            enteringCAS    = DisplayCAS(linkedInteractionInstance.SimInCAS, Styler, ref tookSemaphore, epicMakeoverFailure);
                            mTookSemaphore = tookSemaphore;
                            ReleaseSemaphore();
                            succeeded = CASChangeReporter.Instance.GetPropertyChanged(CASChangeReporter.ChangeFlags.Any);
                        }

                        if (succeeded)
                        {
                            float[]    reactionWeightsBonus = Target.UpgradableComponent.LookGoodMirrors ? StylingStation.kUpgradeReactionWeightsBonus : null;
                            SkillLevel paramValue           = Styling.GetCustomerReactionType(Actor, Styler, makeoverOutcome, num >= 0x2, reactionWeightsBonus);
                            SetParameter("doClothesSpin", !enteringCAS);
                            SetParameter("customerReactionType", paramValue);
                            Animate("x", "Customer Reaction");
                            Styling.PostMakeover(Actor, Styler, makeoverOutcome, false, paramValue, enteringCAS, enteringCAS, OnMakeoverCompleted);
                            SkillLevel stylerReactionType = Styling.GetStylerReactionType(paramValue);
                            SetParameter("stylistReactionType", stylerReactionType);
                            AnimateNoYield("y", "Stylist Reaction");
                            (LinkedInteractionInstance as StylingStation.GiveMakeover).DoStylistIdle = true;
                            Actor.LoopIdle();
                            if (((Actor.IsNPC && Styler.IsNPC) && (paramValue == SkillLevel.poor)) && ((num <= 0x1) && Actor.HasNoExitReason()))
                            {
                                flag2 = true;
                            }
                        }
                        else
                        {
                            (LinkedInteractionInstance as StylingStation.GiveMakeover).MakeoverCancelled = true;
                        }
                    }
                }while (flag2);
                Animate("x", "Get Off Platform");
                AnimateNoYield("y", "Exit Stylist");
                Animate("x", "Exit");
                FinishLinkedInteraction(true);
                EndCommodityUpdates(succeeded);
                StandardExit(true, false);
                WaitForSyncComplete();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }