Esempio n. 1
0
        public Flip(CardControl control) : base(control)
        {
            Control.Style.RegisterBinding(this);

            m_track = new Animation.LinearTrack(0.3f);
            m_track.Elapsed += w => UpdateMatrix(Flipped ? w : 1 - w);
        }
Esempio n. 2
0
        public LocationAnimation(CardControl control) : base(control)
        {
            Control.Style.RegisterBinding(this);

            m_locationTrack = new Animation.CurveTrack(GameApp.Service<Services.ResourceManager>().Acquire<Curve>("Curves/CardMove"));
            m_locationTrack.Elapsed += w =>
            {
                m_locationTransform = Matrix.Lerp(m_locationSrcTransform, m_locationDstTransform, w);
                m_cardSummoned.EffectInstances.ForEach(fx => fx.IsEmitting = m_playToBattlefield && w != 1.0f);
            };

            NextLocation = m_lastLocation = new LocationParameter { m_zone = null, m_numCards = 0, m_thisIndex = -1, m_focusIndex = -1 };

            m_cardSummoned = new Particle.ParticleSystemInstance(GameApp.Service<Services.ResourceManager>().Acquire<Particle.ParticleSystem>("Particles/CardSummoned"));
            m_cardSummoned.LocalFrameProvider = this;

            m_cardActivated = new Particle.ParticleSystemInstance(GameApp.Service<Services.ResourceManager>().Acquire<Particle.ParticleSystem>("Particles/CardActivated"));
            m_cardActivated.LocalFrameProvider = this;
            m_activateEffectTimer = new Animation.LinearTrack(0.4f);
            m_activateEffectTimer.Elapsed += w =>
            {
                m_cardActivated.EffectInstances.ForEach(fx => fx.IsEmitting = m_lastActivated && w != 1.0f);
            };
            m_activateEffectTimer.Play();
        }
Esempio n. 3
0
        public ToneAnimation(CardControl control) : base(control)
        {
            m_saturateTrack = new Animation.LinearTrack(0.5f);
            m_saturateTrack.Elapsed += w => Control.Saturate = w;
            m_saturateTrack.PlayFrom(m_saturateTrack.Duration);
            m_saturateTrack.Stop();

            m_brightnessTrack = new Animation.LinearTrack(0.5f);
            m_brightnessTrack.Elapsed += w => Control.Brightness = w * 0.5f + 0.5f;
            m_brightnessTrack.PlayFrom(m_brightnessTrack.Duration);
            m_brightnessTrack.Stop();
        }
Esempio n. 4
0
			public MenuPage(UI.Page page)
			{
				if (page == null)
				{
					throw new ArgumentNullException("page");
				}

				Page = page;
				Items = new List<UI.MenuItem>();

				foreach (var idChild in Page.Style.ChildIds)
				{
					var menuItem = idChild.Value.Target as UI.MenuItem;
					if (menuItem != null)
					{
						Items.Add(menuItem);
						string menuId = idChild.Key;
						menuItem.MouseButton1Up += (s, e) => OnMenuItemClicked(menuItem, menuId);
					}
				}

				var curve = GameApp.Service<ResourceManager>().Acquire<XnaCurve>("Curves/CardMove");

				m_enterAnimation = new Animation.CurveTrack(curve);
				m_enterAnimation.Elapsed += weight =>
				{
					foreach (var menuItem in Items)
					{
						menuItem.Transform *= MatrixHelper.Translate(0, 50 * (1 - weight));
                        var clr = menuItem.Label.TextColor;
                        clr.A = (byte)(weight * 255);
						menuItem.Label.TextColor = clr;
					}
				};

				m_leaveAnimation = new Animation.CurveTrack(curve);
				m_leaveAnimation.Elapsed += weight =>
				{
					foreach (var menuItem in Items)
					{
						menuItem.Transform *= MatrixHelper.Translate(0, 50 * weight);
                        var clr = menuItem.Label.TextColor;
                        clr.A = (byte)(255 - weight * 255);
						menuItem.Label.TextColor = clr;
					}

					if (!m_leaveAnimation.IsPlaying)
					{
						Page.Dispatcher = null;
					}
				};
			}
Esempio n. 5
0
        public Highlight(CardControl control) : base(control)
        {
            Control.Style.RegisterBinding(this);

            m_quadHighlight = new Graphics.TexturedQuad(GameApp.Service<Resources>().CardHighlight);
            m_quadHighlight.BlendState = new BlendState { ColorSourceBlend = Blend.SourceAlpha, ColorDestinationBlend = Blend.One };

            m_borderBlinkTrack = new Animation.CurveTrack(GameApp.Service<Resources>().CardFloat);
            m_borderBlinkTrack.Loop = true;
            m_borderBlinkTrack.Play();

            m_enlargeTrack = new Animation.CurveTrack(GameApp.Service<Resources>().CardEnlarge);
        }
Esempio n. 6
0
        public Image(Animation animation, string tag, int frameIndex)
        {
            Texture      = animation.Texture;
            SourceRegion = animation.SourceRegion;
            Animation.Track track = animation[tag];
            ClippingRegion = track.FramesRegions[frameIndex];
            Origin         = track.FramesDestinations[frameIndex].Position;

            if (!animation.DestinationRegion.IsEmpty)
            {
                DestinationRegion = animation.DestinationRegion;
            }
        }
Esempio n. 7
0
		public RotationAnimation(CardControl control) : base(control)
		{
			Control.Style.RegisterBinding(this);

			m_rotationTrack = new Animation.CurveTrack(GameApp.Service<Services.ResourceManager>().Acquire<Curve>("Curves/CardSelected"));
			m_rotationTrack.Elapsed += w =>
			{
				w = m_lastRotated ? w : 1 - w;
				var halfWidth = Control.Region.Width * 0.5f;
				var halfHeight = Control.Region.Height * 0.5f;
				m_rotationTransform = MatrixHelper.Translate(-halfWidth, -halfHeight)
									* MatrixHelper.RotateZ(MathUtils.PI * 0.5f * w)
									* MatrixHelper.Translate(halfWidth, halfHeight);
			};
		}
        public SelectorLocationAnimation(CardControl control, IWindow window)
            : base(control)
        {
            if (window == null)
            {
                throw new ArgumentNullException("locationResolver");
            }

            m_window = window;

            m_locationTrack = new Animation.CurveTrack(GameApp.Service<Services.ResourceManager>().Acquire<Curve>("Curves/CardMove"));
            m_locationTrack.Elapsed += w =>
            {
                m_locationTransform = Matrix.Lerp(m_locationSrcTransform, m_locationDstTransform, w);
            };

            Control.Style.RegisterBinding(this);
        }
Esempio n. 9
0
        public SelectorHighlight(CardControl control, IControlUI ui)
            : base(control)
        {
            m_ui = ui;

            m_quadHighlight = new Graphics.TexturedQuad(GameApp.Service<Highlight.Resources>().CardHighlight);
            m_quadHighlight.BlendState = new BlendState
            {
                ColorSourceBlend = Blend.SourceAlpha,
                ColorDestinationBlend = Blend.One,
                AlphaBlendFunction = BlendFunction.Max,
                AlphaSourceBlend = Blend.One,
                AlphaDestinationBlend = Blend.One
            };

            m_borderBlinkTrack = new Animation.CurveTrack(GameApp.Service<Highlight.Resources>().CardFloat);
            m_borderBlinkTrack.Loop = true;
            m_borderBlinkTrack.Play();
        }