예제 #1
0
 private void ItemsContainer_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     var objType = Type.GetType("AnimationGallery.AnimationUI." + ItemsContainer.SelectedItem, true);
     _currentAnimationCtrl = (IAnimation)Activator.CreateInstance(objType);
     ContentContainer.Content = _currentAnimationCtrl;
     _currentAnimationCtrl.BeignAnimation();
 }
예제 #2
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="animation">The animation.</param>
        public AnimationController(IAnimation animation)
        {
            RemoveWhenFinished = true;

            Animation = animation;
            Animation.Finished += AnimationOnFinished;
        }
예제 #3
0
		public IButton GetButton(string id, IAnimation idle, IAnimation hovered, IAnimation pushed, 
			float x, float y, string text = "", ITextConfig config = null, bool addToUi = true,
			float width = -1f, float height = -1f)
		{
			if (width == -1f && idle != null && idle.Frames.Count > 0)
			{
				width = idle.Frames[0].Sprite.Width;
			}
			if (height == -1f && idle != null && idle.Frames.Count > 0)
			{
				height = idle.Frames[0].Sprite.Height;
			}
			TypedParameter idParam = new TypedParameter (typeof(string), id);			
			IButton button = _resolver.Resolve <IButton>(idParam);
            button.LabelRenderSize = new AGS.API.SizeF(width, height);
            if (idle != null && idle.Frames.Count > 0) button.IdleAnimation = idle;
            if (hovered != null && hovered.Frames.Count > 0) button.HoverAnimation = hovered;
            if (pushed != null && pushed.Frames.Count > 0) button.PushedAnimation = pushed;

            button.StartAnimation(button.IdleAnimation);
			button.Tint =  Colors.White;
			button.X = x;
			button.Y = y;
			button.TextConfig = config;
			button.Text = text;

			if (addToUi)
				_gameState.UI.Add(button);

			return button;
		}
예제 #4
0
        public Waiting()
        {
            var waitingFrames = new IAnimationFrame[]
            {
                new AnimationFrame(new FrameInformation(118, 6, 32, 39), 500),
                new AnimationFrame(new FrameInformation(231, 6, 32, 39), 500)
            };

            var fallingAsleepFrames = new IAnimationFrame[]
            {
                new AnimationFrame(new FrameInformation(192, 6, 32, 39), 500),
                new AnimationFrame(new FrameInformation(271, 6, 32, 39), 500)
            };

            var sleepingFrame = new FrameInformation(81, 6, 31, 39);
            var wakeUpFrame = new FrameInformation(157, 6, 32, 39);

            _animation = new Animation(new IAnimationFrame[]
            {
                new LimitedAnimation(waitingFrames, 10),
                new LimitedAnimation(fallingAsleepFrames, 10),
                new AnimationFrame(sleepingFrame, 3000),
                new AnimationFrame(wakeUpFrame, 500)
            });
        }
예제 #5
0
		public static void RandomAnimationDelay(IAnimation animation)
		{
			foreach (var frame in animation.Frames)
			{
				frame.MinDelay = 5;
				frame.MaxDelay = 30;
			}
		}
예제 #6
0
 private void AnimationOnFinished(IAnimation animation)
 {
     if (RemoveWhenFinished)
     {
         Animation.Finished -= AnimationOnFinished;
         Detach();
     }
 }
예제 #7
0
 public void AddAnimation(IAnimation a)
 {
     this.animations.Add(a);
     if (this.animationThread != null)
     {
         a.Reset();
     }
 }
        public void Update(GameTime gameTime, Vector2 velocity)
        {
            _currentAnimation = velocity == Vector2.Zero
                                    ? DetermineStandingDirection(_currentAnimation)
                                    : DetermineWalkingDirection(velocity);

            _currentAnimation.Update(gameTime);
        }
예제 #9
0
 /// <summary>
 /// Given an IAnimation instance (passed from comm or world), build the animation
 /// type needed.
 /// </summary>
 /// <param name="anim"></param>
 /// <param name="id">localID of prim that looks up in RegionRenderInfo.renderPrimList</param>
 /// <returns></returns>
 public static AnimatBase CreateAnimation(IAnimation anim, uint id)
 {
     if (anim.DoStaticRotation) {
         // the only programmable animation we know how to do is fixed axis rotation
         return new AnimatFixedRotation(anim, id);
     }
     // default is an animation that will just exit when used
     return new AnimatBase(AnimatBase.AnimatTypeFixedRotation);
 }
예제 #10
0
 public Projector(IScreener screen,IAnimation animation)
 {
     // Check if we don't have null value.
     if (screen == null || animation == null) return;
     _screen = screen;
     _animation = animation;
     _screen.setPadding(_animation.getPadding(_screen.getHostSize()));
      _wait = new ManualResetEvent(false);
 }
예제 #11
0
        public ClSprite(IAnimation p_animation, Vector2 p_posDépart, Vector2 p_vitesse, Texture2D p_images)
        {
            Animation = p_animation;

            Position = p_posDépart;
            Vitesse = p_vitesse;
            Images = p_images;

            CouleurPourDessin = Color.White;
        }
예제 #12
0
 public IDrawable CreateDrawable(string type, Box2D frame, IAnimation animation)
 {
     Texture tex;
     if (this.registeredTypes.TryGetValue(type, out tex))
     {
         IDrawable drawable = new AnimatedSprite(tex, frame, animation);
         drawables.Add(drawable);
         return drawable;
     }
     throw new Exception("Unregisterd type " + type.ToString());
 }
예제 #13
0
 public Stopping()
 {
     const int milliseconds = 50;
     IAnimationFrame[] frames =
     {
         new AnimationFrame(new FrameInformation(94, 106, 36, 37), milliseconds),
         new AnimationFrame(new FrameInformation(46, 106, 36, 37), milliseconds),
         new AnimationFrame(new FrameInformation(138, 106, 36, 37), 0)
     };
     _animation = new Animation(frames);
 }
예제 #14
0
 public ManualResetEvent Add(Control cntrl, IAnimation animation)
 {
     if (cntrl == null) return null;
     if (cntrl.IsDisposed) return null ;
     if (animation == null) return null ;
     if (Exits(cntrl)) return null;
     IScreener  cs = new ControlScreener  ( cntrl);
     IProjector  pj = new Projector( cs,  animation);
     this.Add( pj);
     return ((Projector)pj).Wait;
 }
        public GameSessionListWindow()
        {
            InitializeComponent();

            gameSessionList = new List<GameSession>();
            listBoxGameSessions.ItemsSource = gameSessionList;

            GameClient.Instance.GameSessionJoinEvent += OnGameSessionJoin;

            updateAnimation = new LoadingAnimation(canvasUpdate);
            connectAnimation = new LoadingAnimation(canvasConnect);
        }
예제 #16
0
 public Running()
 {
     const int milliseconds = 85;
     IAnimationFrame[] frames =
     {
         new AnimationFrame(new FrameInformation(103, 206, 32, 36), milliseconds),
         new AnimationFrame(new FrameInformation(60, 206, 32, 36), milliseconds),
         new AnimationFrame(new FrameInformation(462, 765, 32, 36), milliseconds),
         new AnimationFrame(new FrameInformation(16, 206, 32, 36), milliseconds)
     };
     _animation = new Animation(frames);
 }
예제 #17
0
        /// <summary>
        /// Adds the given animation.
        /// </summary>
        /// <param name="animation">The animation.</param>
        public void Add(IAnimation animation)
        {
            lock (this)
            {
                animation.Finished += AnimationOnFinished;
                _animationList.Add(animation);

                if (animation.State != AnimationState.Finished)
                {
                    _uncompletedAnimationCount++;
                }
            }
        }
예제 #18
0
        public void StartAnimation(IAnimation animation)
		{
			if (_scale.Width == 0f && animation.Frames.Count > 0) 
			{
				_scale.ResetBaseSize(animation.Frames [0].Sprite.Width, animation.Frames [0].Sprite.Height);
			}
			IAnimation currentAnimation = Animation;
			if (currentAnimation != null) 
			{
				currentAnimation.State.OnAnimationCompleted.TrySetResult (new AnimationCompletedEventArgs (false));
			}
			Animation = animation;
            OnAnimationStarted.Invoke(this, new AGSEventArgs());
		}
예제 #19
0
 public override void ConfigureInstance(IAnimation tween)
 {
     //Debug.Log("ConfigureInstance: " + tween);
     ResizeInstance m = (ResizeInstance)tween;
     m.WidthFrom = WidthFrom;
     m.WidthTo = WidthTo;
     m.HeightFrom = HeightFrom;
     m.HeightTo = HeightTo;
     m.WidthBy = WidthBy;
     m.HeightBy = HeightBy;
     m.Delay = Delay;
     m.Duration = Duration;
     m.Easer = Easer;
 }
 /// <summary>
 /// Create the animation. The passed animation block is expected
 /// to contain a defintion of a fixed rotation. If not, bad things will happen.
 /// </summary>
 /// <param name="anim">The IAnimation block with the info.</param>
 /// <param name="id">localID to lookup the prim in the RegionRenderInfo.renderPrimList</param>
 public AnimatFixedRotation(IAnimation anim, uint id)
     : base(AnimatBase.AnimatTypeFixedRotation)
 {
     m_infoID = id;
     if (anim.DoStaticRotation) {
         m_rotationsPerSecond = anim.StaticRotationRotPerSec;
         m_rotationAxis = anim.StaticRotationAxis;
     }
     else {
         // shouldn't get here
         m_rotationsPerSecond = 1;
         m_rotationAxis = OMV.Vector3.UnitX;
     }
 }
예제 #21
0
파일: Move.cs 프로젝트: groov0v/edriven-gui
 public override void ConfigureInstance(IAnimation tween)
 {
     //Debug.Log("ConfigureInstance: " + tween);
     MoveInstance m = (MoveInstance)tween;
     m.XFrom = XFrom;
     m.XTo = XTo;
     m.YFrom = YFrom;
     m.YTo = YTo;
     m.XBy = XBy;
     m.YBy = YBy;
     //m.Delay = Delay;
     //m.Duration = Duration;
     //m.Easer = Easer;
 }
예제 #22
0
 /// Resolve and animation if it's a member
 /// @param animation The animation to resolve
 /// @return True if there are no pending animations left
 public bool Resolve(IAnimation animation)
 {
     if (animation != null)
     {
         for (var i = 0; i < pending.Length; ++i)
         {
             if (pending[i] == animation)
             {
                 pending[i] = null;
                 count -= 1;
                 break;
             }
         }
     }
     return count == 0;
 }
예제 #23
0
        public Walking()
        {
            const int milliseconds = 125;

            IAnimationFrame[] frames =
            {
                new AnimationFrame(new FrameInformation(134, 152, 26, 40), milliseconds),
                new AnimationFrame(new FrameInformation(130, 607, 40, 39, MathHelper.PiOver2), milliseconds),
                new AnimationFrame(new FrameInformation(174, 152, 39, 40), milliseconds),
                new AnimationFrame(new FrameInformation(58, 675, 40, 26, MathHelper.PiOver2), milliseconds),
                new AnimationFrame(new FrameInformation(399, 474, 40, 28, MathHelper.PiOver2), milliseconds),
                new AnimationFrame(new FrameInformation(279, 152, 37, 40), milliseconds),
                new AnimationFrame(new FrameInformation(228, 152, 38, 40), milliseconds),
                new AnimationFrame(new FrameInformation(98, 152, 26, 40), milliseconds)
            };
            _animation = new Animation(frames);
        }
예제 #24
0
		private void runAnimation(IAnimation animation)
		{
			if (animation == null || animation.State.IsPaused)
				return;
			if (animation.State.TimeToNextFrame < 0)
				return;
			if (_gameState.Cutscene.IsSkipping && animation.Configuration.Loops > 0)
			{
				animation.State.TimeToNextFrame = 0;
				while (animation.NextFrame()) ;
			}
			else
			{
				animation.State.TimeToNextFrame--;
				if (animation.State.TimeToNextFrame < 0)
					animation.NextFrame();
			}
		}
        public BirdsEyeViewWalkingAnimationController(IAnimation standLeftAnimation,
                                          IAnimation standRightAnimation,
                                          IAnimation standUpAnimation,
                                          IAnimation standDownAnimation,
                                          IAnimation walkLeftAnimation,
                                          IAnimation walkRightAnimation,
                                          IAnimation walkUpAnimation,
                                          IAnimation walkDownAnimation)
        {
            _standLeftAnimation = standLeftAnimation;
            _standRightAnimation = standRightAnimation;
            _standUpAnimation = standUpAnimation;
            _standDownAnimation = standDownAnimation;

            _walkLeftAnimation = walkLeftAnimation;
            _walkRightAnimation = walkRightAnimation;
            _walkUpAnimation = walkUpAnimation;
            _walkDownAnimation = walkDownAnimation;

            _currentAnimation = _standDownAnimation;
        }
예제 #26
0
 public void CleanMemoryFootprints()
 {
     if (_screen != null)
     {
         _screen.cleanMemoryFootprint();
         _screen = null;
     }
        if (_animation != null)
        {
        _animation.cleanMemoryFootprint();
        _animation = null;
        }
        if (_wait != null)
        {
        _wait  = null;
        }
        if (e != null)
        {
        e.Dispose();
        e = null;
        }
 }
 private IAnimation DetermineStandingDirection(IAnimation currentAnimation)
 {
     if (currentAnimation == _walkDownAnimation)
     {
         return _standDownAnimation;
     }
     else if (currentAnimation == _walkLeftAnimation)
     {
         return _standLeftAnimation;
     }
     else if (currentAnimation == _walkRightAnimation)
     {
         return _standRightAnimation;
     }
     else if (currentAnimation == _walkUpAnimation)
     {
         return _standUpAnimation;
     }
     else
     {
         return currentAnimation;
     }
 }
예제 #28
0
        public ClSpriteContrôlé(
            IAnimation p_animation, IClavier p_stratégieClavier, IManette p_stratégieManette,
            Vector2 p_posDépart, Vector2 p_vitesse, Texture2D p_images)
            : base(p_animation, p_posDépart, p_vitesse, p_images)
        {
            StratégieClavier = p_stratégieClavier;
            StratégieManette = p_stratégieManette;

            m_tailleImage = new Point(p_animation.Portion.Width, p_animation.Portion.Height);

            for (int i = 0; i < p_animation.NbTotalImages; ++i)
            {
                // On va chercher la position du bonhomme dans l'image.
                Rectangle tmp = new Rectangle(i % 4,
                                              (int)Math.Ceiling((double)(i / 4)),
                                              m_tailleImage.X, m_tailleImage.Y);

                DonnéeTexture.Add(new Color[m_tailleImage.X * m_tailleImage.Y]);

                p_images.GetData<Color>(0,
                                          tmp,
                                          DonnéeTexture[i], 0, m_tailleImage.X * m_tailleImage.Y);
            }
        }
 public static TNext ThenStart <TNext>(this IAnimation ani, TNext next)
     where TNext : IAnimation
 {
     ani.SetFollowing(() => next);
     return(next);
 }
 public static T MustBeUnique <T>(this T ani, ref IAnimation reference) where T : IAnimation
 {
     reference.ForceStopIfRunning();
     reference = ani;
     return(ani);
 }
 public static bool IsRunningWithLabel(this IAnimation ani, ulong label)
 {
     return(ani != null && !ani.IsFinished && (ani.Label & label) > 0);
 }
 public static bool IsRunningButIsNotLabeledAs(this IAnimation ani, ulong label)
 {
     return(ani != null && !ani.IsFinished && (ani.Label & label) == 0);
 }
예제 #33
0
 public static IAnimation Started(this IAnimation animation, Action onFinished)
 {
     animation.Start(onFinished);
     return(animation);
 }
 public static bool IsNotRunningWithLabel(this IAnimation ani, ulong label)
 {
     return(ani == null || ani.IsFinished || (ani.Label & label) == 0);
 }
 /// <summary>
 /// Displays the frame with the given zero-based frame index and plays the animation from that frame.
 /// </summary>
 /// <param name="animation">The animation that should seek the frame and start playing.</param>
 /// <param name="frameIndex">The zero-based index of the frame to display.</param>
 public static void GotoAndPlay(this IAnimation animation, int frameIndex)
 {
     animation.GotoFrame(frameIndex);
     animation.IsPlaying = true;
 }
예제 #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Vector4Animation"/> class with the specified
 /// animations.
 /// </summary>
 /// <param name="x">The animation of the <see cref="Vector4.X"/> component.</param>
 /// <param name="y">The animation of the <see cref="Vector4.Y"/> component.</param>
 /// <param name="z">The animation of the <see cref="Vector4.Z"/> component.</param>
 /// <param name="w">The animation of the <see cref="Vector4.W"/> component.</param>
 public Vector4Animation(IAnimation <float> x, IAnimation <float> y, IAnimation <float> z, IAnimation <float> w)
 {
     X = x;
     Y = y;
     Z = z;
     W = w;
 }
예제 #37
0
 /// <summary>
 /// Called when an animation throws an exception during execution.
 /// </summary>
 /// <param name="animation">The failed animation.</param>
 /// <param name="ex">The exception thrown.</param>
 protected virtual AnimationFailedReaction OnAnimationFailed(IAnimation animation, Exception ex)
 {
     return(AnimationFailedReaction.ThrowException);
 }
예제 #38
0
 public static IAnimation <T> Animate <T>(this IAnimatable <T> parent,
                                          IAnimation <float> controller)
 {
     return(new DrivenAnimation <T>(controller, parent));
 }
예제 #39
0
 public static IAnimation <T> Drive <T>(this IAnimation <float> controller,
                                        IAnimatable <T> tween)
 {
     return(tween.Animate(controller));
 }
 public static TState GetState <TState>(this IAnimation a)
 {
     return((TState)((StateHolderAni)a).State);
 }
 public static ulong GetLabel(this IAnimation ani)
 {
     return(ani?.Label ?? (ulong)0);
 }
 public MarcoPlayer(Vector2 position, float scale = 1f)
     : base(position, scale)
 {
     currentLifeNumber = lives;
     animation         = new AnimationImpl(10, this, "Player/Run/Run", "Player/Shoot/Shoot", "Player/Idle/Idle", "Player/Jump/Jump");
 }
 /// <summary>
 /// Resumes playing the animation.
 /// </summary>
 /// <param name="animation">The animation to play.</param>
 public static void Play(this IAnimation animation) => animation.IsPlaying = true;
예제 #44
0
        public async Task <IRoom> LoadAsync(IGame game)
        {
            _game = game;
            _game.Events.OnSavedGameLoad.Subscribe(onSavedGameLoaded);
            _player = _game.State.Player;
            IGameFactory factory = game.Factory;

            _room = factory.Room.GetRoom("Dars Street", 20f, 490f, 190f, 10f);
            IObject    bg          = factory.Object.GetObject("Dars Street BG");
            IAnimation bgAnimation = await factory.Graphics.LoadAnimationFromFolderAsync(_baseFolder + "bg");

            bgAnimation.Frames[0].MinDelay = 1;
            bgAnimation.Frames[0].MaxDelay = 120;
            bg.StartAnimation(bgAnimation);
            _room.Background = bg;

            await factory.Room.GetAreaAsync(_baseFolder + "walkable1.png", _room, isWalkable : true);

            await factory.Room.GetAreaAsync(_baseFolder + "walkable2.png", _room, isWalkable : true);

            factory.Room.CreateScaleArea(_room.Areas[0], 0.35f, 0.75f);
            factory.Room.CreateZoomArea(_room.Areas[0], 1f, 1.2f);
            factory.Room.CreateScaleArea(_room.Areas[1], 0.10f, 0.35f);
            factory.Room.CreateZoomArea(_room.Areas[1], 1.2f, 1.8f);

            await factory.Room.GetAreaAsync(_baseFolder + "walkbehind1.png", _room, isWalkBehind : true);

            await factory.Room.GetAreaAsync(_baseFolder + "walkbehind2.png", _room, isWalkBehind : true);

            await factory.Room.GetAreaAsync(_baseFolder + "walkbehind3.png", _room, isWalkBehind : true);

            IObject buildingHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "buildingHotspot.png", "Building", _room);

            IObject doorHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "doorHotspot.png", "Door", _room);

            IObject windowHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "windowHotspot.png", "Window", _room);

            doorHotspot.Z   = buildingHotspot.Z - 1;
            windowHotspot.Z = buildingHotspot.Z - 1;
            windowHotspot.GetComponent <IHotspotComponent>().Interactions.OnInteract(AGSInteractions.LOOK).SubscribeToAsync(lookOnWindow);

            await factory.Object.GetHotspotAsync(_baseFolder + "aztecBuildingHotspot.png", "Aztec Building", _room);

            await factory.Object.GetHotspotAsync(_baseFolder + "carHotspot.png", "Car", _room);

            await factory.Object.GetHotspotAsync(_baseFolder + "fencesHotspot.png", "Fences", _room);

            await factory.Object.GetHotspotAsync(_baseFolder + "neonSignHotspot.png", "Neon Sign", _room);

            await factory.Object.GetHotspotAsync(_baseFolder + "skylineHotspot.png", "Skyline", _room);

            await factory.Object.GetHotspotAsync(_baseFolder + "trashcansHotspot.png", "Trashcans", _room);

            var sidewalkHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "sidewalkHotspot.png", "Sidewalk", _room);

            var roadHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "roadHotspot.png", "Road", _room);

            roadHotspot.Z     = 100f;
            sidewalkHotspot.Z = 320f;
            await addLampPosts(factory);

            subscribeEvents();

            return(_room);
        }
 /// <summary>
 /// Displays the frame with the given zero-based frame index and stops the animation at that frame.
 /// </summary>
 /// <param name="animation">The animation that should seek the frame and stop playing.</param>
 /// <param name="frameIndex">The zero-based index of the frame to display.</param>
 public static void GotoAndStop(this IAnimation animation, int frameIndex)
 {
     animation.GotoFrame(frameIndex);
     animation.IsPlaying = false;
 }
예제 #46
0
    public void PlayAutomatically_BeforeSet_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
    {
        IAnimation animation = ComparativeTestFixture.Instantiate(type);

        Assert.AreEqual(true, animation.playAutomatically);
    }
예제 #47
0
        public new string GetCurrentSubItem()
        {
            IAnimation currAnim = CurrentAnimation;

            return((currAnim != null) ? currAnim.Name : string.Empty);
        }
예제 #48
0
 public AnimationCompletedEventArgs Animate(IAnimation animation)
 {
     return(_animationContainer.Animate(animation));
 }
예제 #49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Vector2FAnimation"/> class with the specified
 /// animations.
 /// </summary>
 /// <param name="x">The animation of the <see cref="Vector2F.X"/> component.</param>
 /// <param name="y">The animation of the <see cref="Vector2F.Y"/> component.</param>
 public Vector2FAnimation(IAnimation <float> x, IAnimation <float> y)
 {
     X = x;
     Y = y;
 }
 public static IAnimation AsUniqueOfFor <TAni>(this IAnimation ani, object id) where TAni : IAnimation
 {
     ani.UniquenessId = fun.GetUniquenessIdFor <TAni>(id);
     return(ani);
 }
예제 #51
0
 public static IAnimation Started(this IAnimation animation)
 {
     animation.Start();
     return(animation);
 }
 public static IAnimation AsUniqueOf <TAni>(this IAnimation ani) where TAni : IAnimation
 {
     ani.UniquenessId = fun.GetUniquenessId <TAni>();
     return(ani);
 }
        //TODO:enable

        /*
         * public static TAni Register<TAni>(this TAni ani, IAnimatedHumanoid om, HumanoidPart part) where TAni : IAnimation
         * {
         *  if (part == HumanoidPart.EntireBody) om.AniEntireBody = ani;
         *  if (part == HumanoidPart.Face) om.AniFace = ani;
         *  if (part == HumanoidPart.BothEyelids) om.AniBlink = ani;
         *  if (part == HumanoidPart.Spine) om.AniSpine = ani;
         *  if (part == HumanoidPart.Head) om.AniHead = ani;
         *  if (part == HumanoidPart.ArmL) om.AniArmL = ani;
         *  if (part == HumanoidPart.ArmR) om.AniArmR = ani;
         *  if (part == HumanoidPart.LegL) om.AniLegL = ani;
         *  if (part == HumanoidPart.LegR) om.AniLegR = ani;
         *  if (part == HumanoidPart.Torso) om.AniTorso = ani;
         *  if (part == HumanoidPart.HandL) om.AniHandL = ani;
         *  if (part == HumanoidPart.HandR) om.AniHandR = ani;
         *  if (part == HumanoidPart.BreastL) om.AniBreastL = ani;
         *  if (part == HumanoidPart.BreastR) om.AniBreastR = ani;
         *  if (part == HumanoidPart.BottomL) om.AniBottomL = ani;
         *  if (part == HumanoidPart.BottomR) om.AniBottomR = ani;
         *  return ani;
         * }
         */
        public static bool HasLabel(this IAnimation ani, ulong label)
        {
            return(ani != null && (ani.Label & label) > 0);
        }
 /// <summary>
 /// Restarts the animation.
 /// </summary>
 /// <param name="animation">The animation to restart.</param>
 public static void Restart(this IAnimation animation) => animation.GotoAndPlay(0);
예제 #55
0
        public ICheckBox GetCheckBox(string id, IAnimation notChecked, IAnimation notCheckedHovered, IAnimation @checked, IAnimation checkedHovered, 
            float x, float y, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
        {
            if (width == -1f && notChecked != null && notChecked.Frames.Count > 0)
            {
                width = notChecked.Frames[0].Sprite.Width;
            }
            if (height == -1f && notChecked != null && notChecked.Frames.Count > 0)
            {
                height = notChecked.Frames[0].Sprite.Height;
            }
            TypedParameter idParam = new TypedParameter(typeof(string), id);            
            ICheckBox checkbox = _resolver.Resolve<ICheckBox>(idParam);
            checkbox.TextConfig = config;
            checkbox.Text = text;
            if (!isCheckButton)
            {
                checkbox.SkinTags.Add(AGSSkin.CheckBoxTag);
                checkbox.Skin.Apply(checkbox);
            }
            checkbox.LabelRenderSize = new AGS.API.SizeF(width, height);
            if (notChecked != null) checkbox.NotCheckedAnimation = notChecked;
            if (notCheckedHovered != null) checkbox.HoverNotCheckedAnimation = notCheckedHovered;
            if (@checked != null) checkbox.CheckedAnimation = @checked;
            if (checkedHovered != null) checkbox.HoverCheckedAnimation = checkedHovered;
            
            checkbox.StartAnimation(checkbox.NotCheckedAnimation);
            checkbox.Tint = Colors.White;
            checkbox.X = x;
            checkbox.Y = y;
            
            if (addToUi)
                _gameState.UI.Add(checkbox);

            return checkbox;
        }
 /// <summary>
 /// Stops playing the animation.
 /// </summary>
 /// <param name="animation">The animation to stop playing.</param>
 public static void Stop(this IAnimation animation) => animation.IsPlaying = false;
예제 #57
0
 public void StartAnimation(IAnimation animation)
 {
     _animationContainer.StartAnimation(animation);
 }
예제 #58
0
 public ICheckBox GetCheckBox(string id, IAnimation notChecked, IAnimation notCheckedHovered, IAnimation @checked, IAnimation checkedHovered,
                              float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
 {
     return(GetCheckBox(id, new ButtonAnimation(notChecked), new ButtonAnimation(notCheckedHovered),
                        new ButtonAnimation(@checked), new ButtonAnimation(checkedHovered), x, y, parent,
                        text, config, addToUi, width, height, isCheckButton));
 }
예제 #59
0
 private void StoryBoardPlay(IAnimation animation)
 {
     if (this.animation != null)
     {
         this.animation.Cancel();
     }
     this.animation = animation;
     sb.CancelAsyncAnimate();
     sb.Clear();
     sb.AddAnimations(this.animation,
         // hack? implement it better?
         new CommitStoryboardAnimation(){
             StartsAt = 400,
             Duration = 500,
             CommitAction = () => { this.IsPanoramaAnimating = false; }
         }
     );
     sb.BeginAnimate();
 }
예제 #60
0
 public DrivenAnimation(IAnimation <float> controller, IAnimatable <T> tween)
 {
     _controller = controller;
     _tween      = tween;
 }