コード例 #1
0
ファイル: UndoManager.cs プロジェクト: lulzzz/Nucleus
 /// <summary>
 /// Add an undo state to the current stage (if one is active) or directly
 /// to the stack as a new stage (if one isn't).
 /// </summary>
 /// <param name="state"></param>
 /// <param name="clearRedo">If true, the redo stack will be invalidated</param>
 public void AddUndoState(UndoState state, bool clearRedo = true)
 {
     if (!Locked && Active)
     {
         if (state != null && state.IsValid)
         {
             if (ActiveStage != null)// && !ActiveStage.Contains(state))
             {
                 ActiveStage.Add(state);
                 if (!UndoStack.Contains(ActiveStage))
                 {
                     AddUndoStage(ActiveStage);
                 }
             }
             else
             {
                 UndoStage stage = new UndoStage();
                 stage.Add(state);
                 AddUndoStage(stage);
             }
         }
         if (clearRedo)
         {
             RedoStack.Clear();
         }
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: andreinitescu/cs_megaman
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveStage != null)
     {
         ActiveStage.Copy();
     }
 }
コード例 #3
0
#pragma warning restore CS0162

        private void ReportStageError(Exception e)
        {
            if (ActiveStage == null)
            {
                throw e;
            }

            var stage = Assembly.Stages[ActiveStage.StageId];

            if (Log.IsErrorEnabled)
            {
                Log.Error(e, $"Error in stage [{stage}]: {e.Message}");
            }

            ActiveStage.FailStage(e);

            // Abort chasing
            _chaseCounter = 0;
            if (_chasedPush != NoEvent)
            {
                Enqueue(_chasedPush);
                _chasedPush = NoEvent;
            }

            if (_chasedPull != NoEvent)
            {
                Enqueue(_chasedPull);
                _chasedPull = NoEvent;
            }
        }
コード例 #4
0
 /// <summary>
 /// Increases the track intensity by 1
 /// </summary>
 public void IncreaseIntensity()
 {
     if (!stage.Equals(ActiveStage.L3))
     {
         stage += 1;
     }
 }
コード例 #5
0
 /// <summary>
 /// Decreses the track intensity by 1
 /// </summary>
 public void DecreaseIntensity()
 {
     if (!stage.Equals(ActiveStage.L1))
     {
         stage -= 1;
     }
 }
コード例 #6
0
ファイル: HarvestEx.cs プロジェクト: yakoder/NRaas
        private bool DoHarvestEx()
        {
            Soil soil;

            Target.RemoveHarvestStateTimeoutAlarm();
            StandardEntry();
            BeginCommodityUpdates();
            StateMachineClient stateMachine = Target.GetStateMachine(Actor, out soil);

            mDummyIk = soil;
            bool hasHarvested = true;

            if (Actor.IsInActiveHousehold)
            {
                hasHarvested = false;
                foreach (SimDescription description in Actor.Household.SimDescriptions)
                {
                    Gardening skill = description.SkillManager.GetSkill <Gardening>(SkillNames.Gardening);
                    if ((skill != null) && skill.HasHarvested())
                    {
                        hasHarvested = true;
                        break;
                    }
                }
            }

            if (stateMachine != null)
            {
                stateMachine.RequestState("x", "Loop Harvest");
            }

            Plant.StartStagesForTendableInteraction(this);
            while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
            {
                if ((ActiveStage != null) && ActiveStage.IsComplete((InteractionInstance)this))
                {
                    Actor.AddExitReason(ExitReason.StageComplete);
                }
            }

            Plant.PauseTendGardenInteractionStage(Actor.CurrentInteraction);
            if (Actor.HasExitReason(ExitReason.StageComplete))
            {
                HarvestPlantEx.DoHarvest(Target, Actor, hasHarvested, mBurglarSituation);
            }

            if (stateMachine != null)
            {
                stateMachine.RequestState("x", "Exit Standing");
            }

            EndCommodityUpdates(true);
            StandardExit();
            Plant.UpdateTendGardenTimeSpent(this, new Plant.UpdateTendGardenTimeSpentDelegate(HarvestPlant.Harvest.SetHarvestTimeSpent));
            return(Actor.HasExitReason(ExitReason.StageComplete));
        }
コード例 #7
0
        public IPromise <T> Load <T>(ViewLink stageLink) where T : class, IStage
        {
            if (IsLoading.Value)
            {
                return(Promise <T> .Rejected(new InvalidOperationException("Already loading stage")));
            }

            isLoading.SetValue(true);
            Promise <T> promise = Promise <T> .Create();

            Promise loadPromise = Promise.Create();

            App.Core.MakeTransition(loadPromise, () =>
            {
                if (ActiveStageLink != null && ActiveStageLink.GetPath() != stageLink.GetPath())
                {
                    history.Push(ActiveStageLink);
                    ActiveStage.CloseStage(this);
                }

                void SetActive(ViewLink link, T stage)
                {
                    ActiveStage     = stage;
                    ActiveStageLink = link;
                    stage.OpenStage(this).Done(() =>
                    {
                        isLoading.SetValue(false);
                        loadPromise.Resolve();
                        promise.Resolve(stage);

                        if (loadedStages.ContainsKey(link) == false)
                        {
                            loadedStages.Add(link, stage);
                        }
                        OnStageLoaded(link);
                    });
                }

                if (loadedStages.ContainsKey(stageLink))
                {
                    T loaded = loadedStages[stageLink] as T;
                    SetActive(stageLink, loaded);
                }
                else
                {
                    App.Core.Views.CreateAsync <T>(stageLink).Done(stage =>
                    {
                        SetActive(stageLink, stage);
                    });
                }
            });

            return(promise);
        }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: andreinitescu/cs_megaman
 private void pasteBrushToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveStage != null)
     {
         var brush = ActiveStage.Paste();
         if (brushForm != null && brush != null)
         {
             brushForm.AddBrush(brush);
         }
     }
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: andreinitescu/cs_megaman
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveProject != null)
     {
         ActiveProject.Save();
         if (ActiveStage != null)
         {
             ActiveStage.Save();
         }
     }
 }
コード例 #10
0
ファイル: GraphInterpreter.cs プロジェクト: yfer/akka.net
        /// <summary>
        /// Executes pending events until the given limit is met. If there were remaining events, <see cref="IsSuspended"/> will return true.
        /// </summary>
        public int Execute(int eventLimit)
        {
            if (IsDebug)
            {
                Console.WriteLine($"{Name} ---------------- EXECUTE {QueueStatus()} (running={RunningStagesCount}, shutdown={ShutdownCounters()})");
            }
            var currentInterpreterHolder = CurrentInterpreter.Value;
            var previousInterpreter      = currentInterpreterHolder[0];

            currentInterpreterHolder[0] = this;
            var eventsRemaining = eventLimit;

            try
            {
                while (eventsRemaining > 0 && _queueTail != _queueHead)
                {
                    var connection = Dequeue();
                    try
                    {
                        ProcessEvent(connection);
                    }
                    catch (Exception e)
                    {
                        if (ActiveStage == null)
                        {
                            throw;
                        }

                        var stage = Assembly.Stages[ActiveStage.StageId];
                        if (Log.IsErrorEnabled)
                        {
                            Log.Error(e, $"Error in stage [{stage}]: {e.Message}");
                        }

                        ActiveStage.FailStage(e);
                    }
                    AfterStageHasRun(ActiveStage);
                    eventsRemaining--;
                }
            }
            finally
            {
                currentInterpreterHolder[0] = previousInterpreter;
            }
            if (IsDebug)
            {
                Console.WriteLine($"{Name} ---------------- {QueueStatus()} (running={RunningStagesCount}, shutdown={ShutdownCounters()})");
            }
            // TODO: deadlock detection
            return(eventsRemaining);
        }
コード例 #11
0
        public override bool Run()
        {
            Vector3 trySpot      = Hit.mPoint;
            Vector3 newTargetPos = trySpot;

            if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId))
            {
                return(false);
            }
            if (Actor.SkillManager.HasElement(EWCatFishingSkill.SkillNameID))
            {
                skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID);
            }
            else
            {
                skill = Actor.SkillManager.AddElement(EWCatFishingSkill.SkillNameID) as EWCatFishingSkill;
            }
            if (skill.OppFishercatCompleted)
            {
                skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateFishercat);
            }
            else
            {
                skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateNormal);
            }
            mFishingData = FishingSpot.GetFishingData(trySpot, Hit.mType);
            BeginCommodityUpdates();
            StartStages();
            mHasCatFisherTrait = false;
            bool flag = true;

            while (flag && !ActiveStage.IsComplete(this))
            {
                flag = LoopAnimation();
            }
            skill.StopSkillGain();
            EndCommodityUpdates(flag);
            return(flag);
        }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: andreinitescu/cs_megaman
        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveStage != null)
            {
                var brush = ActiveStage.Paste();
                if (brush != null)
                {
                    CurrentBrush    = brush;
                    currentToolType = ToolType.Brush;
                    AssembleTool();
                    foreach (ToolStripButton item in toolBar.Items)
                    {
                        item.Checked = false;
                    }
                    brushToolButton.Checked = true;
                    DrawJoins = false;
                    DrawTiles = true;

                    // this is a bad hack to get it to draw immediately
                    Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y + 1);
                    Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y - 1);
                }
            }
        }
コード例 #13
0
        public override bool InRabbitHole()
        {
            try
            {
                ActiveStage.Start();

                SimDescription choice = null;

                if (mMaster)
                {
                    if (!AcceptCancelDialog.Show(Common.Localize("Rendezvous:Prompt", Actor.IsFemale, new object[] { KamaSimtra.Settings.mRendezvousCostPerLevel })))
                    {
                        return(false);
                    }

                    Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(Woohooer.Settings.AllowTeen(true));

                    List <SimDescription> choices = new List <SimDescription>();
                    for (int i = 1; i <= 10; i++)
                    {
                        List <SimDescription> fullList;
                        if (!potentials.TryGetValue(i, out fullList))
                        {
                            continue;
                        }

                        bool needFemale = false;

                        if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male))
                        {
                            if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                            {
                                if (RandomUtil.CoinFlip())
                                {
                                    needFemale = true;
                                }
                            }
                            else
                            {
                                needFemale = false;
                            }
                        }
                        else if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                        {
                            needFemale = true;
                        }
                        else
                        {
                            needFemale = !Actor.IsFemale;
                        }

                        List <SimDescription> randomList = new List <SimDescription>();

                        foreach (SimDescription sim in fullList)
                        {
                            if (sim.IsFemale != needFemale)
                            {
                                continue;
                            }

                            if (sim.Household == Actor.Household)
                            {
                                continue;
                            }

                            string reason;
                            GreyedOutTooltipCallback callback = null;
                            if (!CommonSocials.CanGetRomantic(Actor.SimDescription, sim, false, true, true, ref callback, out reason))
                            {
                                if (callback != null)
                                {
                                    Common.DebugNotify(sim.FullName + Common.NewLine + callback());
                                }
                                continue;
                            }

                            if (choices.Contains(sim))
                            {
                                continue;
                            }

                            randomList.Add(sim);
                        }

                        if (randomList.Count > 0)
                        {
                            choices.Add(RandomUtil.GetRandomObjectFromList(randomList));
                        }
                    }

                    if (choices.Count == 0)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoneAvailable", Actor.IsFemale));
                        return(false);
                    }

                    choice = new SimSelection(Common.Localize("Rendezvous:MenuName"), Actor.SimDescription, choices, SimSelection.Type.Rendezvous, -1000).SelectSingle();
                    if (choice == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoSelect", Actor.IsFemale));
                        return(false);
                    }

                    if (Instantiation.PerformOffLot(choice, Target.LotCurrent, null) == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    Rendezvous interaction = Singleton.CreateInstance(Target, choice.CreatedSim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Rendezvous;
                    interaction.mMaster = false;
                    interaction.LinkedInteractionInstance = this;

                    choice.CreatedSim.InteractionQueue.CancelAllInteractions();
                    if (!choice.CreatedSim.InteractionQueue.AddNext(interaction))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), WaitPeriodLoop, null))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!mBegin)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }
                    else
                    {
                        Actor.ClearExitReasons();

                        TimedStage stage = new TimedStage(GetInteractionName(), KamaSimtra.Settings.mRendezvousDuration, false, false, true);
                        Stages      = new List <Stage>(new Stage[] { stage });
                        ActiveStage = stage;
                        ActiveStage.Start();
                    }
                }
                else
                {
                    Rendezvous interaction = LinkedInteractionInstance as Rendezvous;
                    if (interaction == null)
                    {
                        return(false);
                    }

                    interaction.mBegin = true;
                }

                if (mMaster)
                {
                    if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, KamaSimtra.Settings.mRendezvousCostPerLevel * choice.SkillManager.GetSkillLevel(KamaSimtra.StaticGuid), true))
                    {
                        Common.Notify(Common.Localize("Rendezvous:CannotPay", Actor.IsFemale));
                        return(false);
                    }

                    Common.Notify(choice.CreatedSim, Common.Localize("Rendezvous:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice }));

                    KamaSimtra skill = KamaSimtra.EnsureSkill(Actor);
                    if (skill != null)
                    {
                        skill.RendezvousActive = true;
                    }
                }

                BeginCommodityUpdates();
                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                EndCommodityUpdates(succeeded);

                if (KamaSimtra.Settings.mRandomRendezvousMoodlet)
                {
                    Actor.BuffManager.AddElement(RandomUtil.GetRandomObjectFromList(sRandomBuffs), WoohooBuffs.sWoohooOrigin);
                }

                if (mMaster)
                {
                    CommonWoohoo.WoohooLocation location = CommonWoohoo.WoohooLocation.RabbitHole;

                    List <WoohooLocationControl> choices = CommonWoohoo.GetValidLocations(Actor.SimDescription);
                    if (choices.Count > 0)
                    {
                        location = RandomUtil.GetRandomObjectFromList(choices).Location;
                    }

                    CommonWoohoo.RunPostWoohoo(Actor, choice.CreatedSim, Target, CommonWoohoo.WoohooStyle.Safe, location, false);
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
コード例 #14
0
        public override bool Run()
        {
            try
            {
                if ((!Target.RouteToBarrelSlot(Actor) || ((Target.CurrentState != NectarMaker.NectarMakerState.FruitAddable) && (Target.CurrentState != NectarMaker.NectarMakerState.SquishingFruit))) || !Target.HasFruit)
                {
                    return(false);
                }
                Target.CurrentState = NectarMaker.NectarMakerState.SquishingFruit;
                Actor.SkillManager.AddElement(SkillNames.Nectar);
                foreach (GameObject obj2 in Inventories.QuickFind <GameObject>(Target.Inventory))
                {
                    Target.Inventory.SetInUse(obj2);
                }
                Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToSwim);
                StandardEntry();
                BeginCommodityUpdates();
                AcquireStateMachine("NectarMaker");
                SetActorAndEnter("x", Actor, "Enter Squish Grapes");
                SetActor("nectarMaker", Target);
                AnimateSim("Squish Grapes Loop");
                StartStages();
                bool flag = false;

                try
                {
                    flag = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));

                    if (flag)
                    {
                        Target.CurrentState = NectarMaker.NectarMakerState.SquishedFruit;
                        Target.UpdateVisualState();
                        NectarSkill skill = Actor.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                        if ((skill != null) && skill.IsFlavorfulFeet())
                        {
                            Target.mMultiplierFromFeet = NectarSkill.kFlavorfulFeetValueMultiplier;
                        }
                        if (skill != null)
                        {
                            skill.SquishGrapes();
                        }
                        Target.mSquishAmountRemaining = 1f;
                    }
                    else if (ActiveStage != null)
                    {
                        Target.mSquishAmountRemaining *= ActiveStage.TimeRemaining((InteractionInstance)this) / ActiveStage.TotalTime();
                    }
                    AnimateSim("Exit");
                }
                finally
                {
                    EndCommodityUpdates(true);
                    StandardExit();
                }

                Actor.SwitchToPreviousOutfitWithSpin();
                if ((this.mMakeStyleToPush != NectarMaker.MakeNectarStyle.None) && flag)
                {
                    Actor.InteractionQueue.PushAsContinuation(new MakeNectarEx.Definition(mMakeStyleToPush), Target, true);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
コード例 #15
0
        private new void LoopFunc(StateMachineClient smc, Interaction <Sim, Terrain> .LoopData ld)
        {
            try
            {
                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                EventTracker.SendEvent(new FishingLoopEvent(EventTypeId.kWentFishing, Actor, waterType, ld.mLifeTime));
                Actor.TryGroupTalk();
                //Actor.TrySinging();
                Fishing skill = Actor.SkillManager.GetSkill <Fishing>(SkillNames.Fishing);
                if (mShowTns && (ld.mLifeTime > kTimeToShowFishingTns))
                {
                    string str;
                    if (BaitInUse != null)
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishWithBait");
                    }
                    else
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishNoBait");
                    }
                    Actor.ShowTNSIfSelectable(str, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid);
                    if ((mLoopLengthForNextFish - ld.mLifeTime) < kTimeToCatchPostTns)
                    {
                        mLoopLengthForNextFish = ld.mLifeTime + kTimeToCatchPostTns;
                    }
                    mShowTns = false;
                }

                if (ld.mLifeTime > mLoopLengthForNextFish)
                {
                    mLoopLengthForNextFish += mFishingData.GetNextFishTimeLength(mIsAngler, skill.IsFisherman());
                    FishType none     = FishType.None;
                    string   baitUsed = null;
                    if (BaitInUse != null)
                    {
                        baitUsed = BaitInUse.Key;
                    }

                    if (!mShowTns)
                    {
                        none = mFishingData.GetFishCaught(Actor, baitUsed);
                    }

                    if ((mSittingInBoatPosture != null) && (none == FishType.Box))
                    {
                        none = FishType.None;
                    }

                    FishType type3 = none;
                    if (type3 == FishType.None)
                    {
                        bool flag = false;
                        if (Actor.TraitManager.HasElement(TraitNames.Clumsy))
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnimIfClumsy);
                        }
                        else
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnim);
                        }
                        if (!flag)
                        {
                            return;
                        }
                        AnimateSim("CatchNothing");
                    }
                    else if (type3 == FishType.Box)
                    {
                        int        num = 0x0;
                        WorldType  currentWorldType = GameUtils.GetCurrentWorldType();
                        WorldName  currentWorld     = GameUtils.GetCurrentWorld();
                        List <int> list             = new List <int>();
                        for (int i = 0x0; i < sBoxData.Count; i++)
                        {
                            BoxData data = sBoxData[i];
                            if (((data.AllowedWorldType == WorldType.Undefined) || (data.AllowedWorldType == currentWorldType)) && (((data.AllowedWorlds == null) || (data.AllowedWorlds.Count == 0x0)) || (data.AllowedWorlds.Contains(currentWorld) || data.AllowedWorlds.Contains(WorldName.Undefined))))
                            {
                                num += sBoxChances[i];
                                list.Add(i);
                            }
                        }
                        int chance = RandomUtil.GetInt(num - 0x1);
                        int num4   = 0x0;
                        foreach (int num5 in list)
                        {
                            num4 = num5;
                            if (chance < sBoxChances[num5])
                            {
                                break;
                            }
                            chance -= sBoxChances[num5];
                        }
                        IGameObject obj2 = GlobalFunctions.CreateObject(sBoxData[num4].ItemName, Vector3.OutOfWorld, 0x1, Vector3.UnitZ);
                        if (obj2 == null)
                        {
                            return;
                        }
                        bool happy = sBoxData[num4].Happy;
                        if (Actor.TraitManager.HasElement(TraitNames.Insane))
                        {
                            happy = !happy;
                        }
                        SetSplashAndDripEffects(EffectSize.Small);
                        if (happy)
                        {
                            AnimateSim("CatchBoxHappy");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        else
                        {
                            AnimateSim("CatchBoxSad");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:CaughtBox", new object[] { Actor, obj2 }), StyledNotification.NotificationStyle.kGameMessagePositive, obj2.ObjectId, Actor.ObjectId);
                    }
                    else
                    {
                        int    num6;
                        string str3;
                        Fish   actor = Fish.CreateFish(none, Actor, skill, BaitInUse, out num6, out str3);
                        actor.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory);
                        mNumberFishCaught++;
                        SetActor("fish", actor);
                        SetSplashAndDripEffects(actor.EffectSize);
                        PlayFishCatchAnimation(num6);
                        if (str3 != null)
                        {
                            Actor.ShowTNSIfSelectable(str3, StyledNotification.NotificationStyle.kGameMessagePositive, actor.ObjectId, Actor.ObjectId);
                        }

                        EventTracker.SendEvent(new CaughtFishEvent(EventTypeId.kCaughtFish, Actor, actor, baitUsed));
                        Actor.Inventory.TryToAdd(actor, false);
                        if ((BaitInUse != null) && RandomUtil.RandomChance(kPercentChanceBaitLost))
                        {
                            Actor.Inventory.SetNotInUse(BaitInUse);
                            Actor.Inventory.RemoveByForce(BaitInUse);
                            IFishBait baitInUse = BaitInUse;
                            BaitInUse = FindProperBait(new Fishing.BaitInfo(baitInUse));
                            if (BaitInUse == null)
                            {
                                ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(baitInUse.GetThoughtBalloonThumbnailKey());
                                bd.mCoolDown = ThoughtBalloonCooldown.Medium;
                                bd.LowAxis   = ThoughtBalloonAxis.kDislike;
                                Actor.ThoughtBalloonManager.ShowBalloon(bd);
                                Actor.InteractionQueue.FireQueueChanged();
                                string message = Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:NoMoreBait", new object[] { Actor, baitInUse.GetLocalizedName() });
                                Actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                            }
                            baitInUse.Destroy();
                        }
                    }

                    if (!ActiveStage.IsComplete((InteractionInstance)this))
                    {
                        mCurrentStateMachine.SetParameter("skillLevel", skill.GetSkillLevelParameterForJazzGraph());
                        AnimateSim("Fish");
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.DebugException(Actor, Target, e);
            }
        }
コード例 #16
0
 /// <summary>
 /// Resets the intensity
 /// </summary>
 public void ResetIntensity()
 {
     stage = ActiveStage.L1;
 }