示例#1
0
		public override void ConfigureInteraction()
		{
			base.ConfigureInteraction();
			if (mTotalObjectsToPlant > 1)
			{
				SimpleStage simpleStage = new SimpleStage(GetInteractionName(), 10f, GetCompletionFraction,
					showCompletionTime: false, selectable: false, visibleProgress: true);
				base.Stages = new List<Stage>(new Stage[1] {
				simpleStage
			});
			}
		}
示例#2
0
        public override bool Run()
        {
            try
            {
                if (!UIUtils.IsOkayToStartModalDialog())
                {
                    return false;
                }
                if (!Target.RouteToEasel(Actor))
                {
                    return false;
                }
                Actor.SkillManager.AddElement(SkillNames.Painting);
                StandardEntry();
                Actor.LookAtManager.DisableLookAts();

                bool succeeded = true;
                if (InteractionDefinition is Definition)
                {
                    succeeded = Target.StartPainting(Actor, mSize, Style, false);
                    if (succeeded)
                    {
                        SimpleStage stage = new SimpleStage(GetInteractionName(), Target.GetPaintTimeRemaining(Actor), new SimpleStage.CompletionTest(PaintingProgressTest), false, true, true);
                        Stages = new List<Stage>(new Stage[] { stage });
                    }
                }

                if (!succeeded)
                {
                    StandardExit();
                    Actor.AddExitReason(ExitReason.FailedToStart);
                    return false;
                }

                EnterStateMachine("Easel", "Enter", "x", "easel");
                SetParameter("Canvas", Target.CurrentCanvas.AnimationSize);
                SetActor("canvas", Target.CurrentCanvas);
                if (Actor.SimDescription.Child)
                {
                    mStool = GlobalFunctions.CreateObjectOutOfWorld("ChildStool") as GameObject;
                    SetActor("childstool", mStool);
                }

                AnimateSim("Loop Paint");
                PaintingSkill element = Actor.SkillManager.GetElement(SkillNames.Painting) as PaintingSkill;
                if (Actor.HasTrait(TraitNames.ExtraCreative) || ((element != null) && ((element.IsBrushmaster || element.IsProficientPainter) || element.IsMasterPainter)))
                {
                    mSparkleEffect = VisualEffect.Create("masterpiece");
                    mSparkleEffect.ParentTo(Actor, Sim.ContainmentSlots.RightHand);
                    mSparkleEffect.Start();
                }

                BeginCommodityUpdates();

                try
                {
                    StartStages();
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction<Sim, Easel>.InsideLoopFunction(LoopHandler), mCurrentStateMachine);
                }
                finally
                {
                    EndCommodityUpdates(succeeded);

                    if (Target.CurrentCanvas != null)
                    {
                        Target.StopPainting(Actor);
                    }
                }

                if (Target.IsPaintingComplete())
                {
                    if (Actor.HasTrait(TraitNames.Perfectionist))
                    {
                        Actor.PlayReaction(ReactionTypes.Mwah, ReactionSpeed.AfterInteraction);
                    }
                    EventTracker.SendEvent(EventTypeId.kFinishedPainting, Actor, Target.CurrentCanvas);
                }

                AnimateSim("Exit");
                StandardExit();
                return succeeded;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
示例#3
0
文件: PaintEx.cs 项目: yakoder/NRaas
        public override bool Run()
        {
            try
            {
                if (!UIUtils.IsOkayToStartModalDialog())
                {
                    return(false);
                }
                if (!Target.RouteToEasel(Actor))
                {
                    return(false);
                }
                Actor.SkillManager.AddElement(SkillNames.Painting);
                StandardEntry();
                Actor.LookAtManager.DisableLookAts();

                bool succeeded = true;
                if (InteractionDefinition is Definition)
                {
                    succeeded = Target.StartPainting(Actor, mSize, Style, false);
                    if (succeeded)
                    {
                        SimpleStage stage = new SimpleStage(GetInteractionName(), Target.GetPaintTimeRemaining(Actor), new SimpleStage.CompletionTest(PaintingProgressTest), false, true, true);
                        Stages = new List <Stage>(new Stage[] { stage });
                    }
                }

                if (!succeeded)
                {
                    StandardExit();
                    Actor.AddExitReason(ExitReason.FailedToStart);
                    return(false);
                }

                EnterStateMachine("Easel", "Enter", "x", "easel");
                SetParameter("Canvas", Target.CurrentCanvas.AnimationSize);
                SetActor("canvas", Target.CurrentCanvas);
                if (Actor.SimDescription.Child)
                {
                    mStool = GlobalFunctions.CreateObjectOutOfWorld("ChildStool") as GameObject;
                    SetActor("childstool", mStool);
                }

                AnimateSim("Loop Paint");
                PaintingSkill element = Actor.SkillManager.GetElement(SkillNames.Painting) as PaintingSkill;
                if (Actor.HasTrait(TraitNames.ExtraCreative) || ((element != null) && ((element.IsBrushmaster || element.IsProficientPainter) || element.IsMasterPainter)))
                {
                    mSparkleEffect = VisualEffect.Create("masterpiece");
                    mSparkleEffect.ParentTo(Actor, Sim.ContainmentSlots.RightHand);
                    mSparkleEffect.Start();
                }

                BeginCommodityUpdates();

                try
                {
                    StartStages();
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, Easel> .InsideLoopFunction(LoopHandler), mCurrentStateMachine);
                }
                finally
                {
                    EndCommodityUpdates(succeeded);

                    if (Target.CurrentCanvas != null)
                    {
                        Target.StopPainting(Actor);
                    }
                }

                if (Target.IsPaintingComplete())
                {
                    if (Actor.HasTrait(TraitNames.Perfectionist))
                    {
                        Actor.PlayReaction(ReactionTypes.Mwah, ReactionSpeed.AfterInteraction);
                    }
                    EventTracker.SendEvent(EventTypeId.kFinishedPainting, Actor, Target.CurrentCanvas);
                }

                AnimateSim("Exit");
                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }