Exemplo n.º 1
0
 public TweenWorker(DisplayObject obj, TweenState endState,  int milliseconds)
 {
     this.target = obj;
     this.StartState = new TweenState(obj);
     this.EndState = endState;
     this.duration = milliseconds;
 }
Exemplo n.º 2
0
 public TweenWorker(DisplayObject obj, TweenState endState,  int milliseconds, EasingFormula easingFormula)
 {
     this.target = obj;
     this.StartState = new TweenState(obj);
     this.EndState = endState;
     this.duration = milliseconds;
     this.easingFormula = easingFormula;
 }
Exemplo n.º 3
0
 public override void RemoveChild(DisplayObject o)
 {
     base.RemoveChild(o);
     if (!(o is ParticleEffect))
     {
         throw new ArgumentException("Particle Groups can only contain ParticleEffects");
     }
     ((ParticleEffect)o).IsGroupMember = false;
 }
Exemplo n.º 4
0
        internal override void ObjectAddedToStage(DisplayObject o)
        {
            if (o is V2DSprite)
            {
                V2DSprite sp = (V2DSprite)o;
                sp.AddBodyInstanceToRuntime();
            }

            base.ObjectAddedToStage(o);
        }
Exemplo n.º 5
0
 public override void AddChild(DisplayObject o)
 {
     if (!isComplete)
     {
         base.AddChild(o);
         if (!(o is ParticleEffect))
         {
             throw new ArgumentException("Particle Groups can only contain ParticleEffects");
         }
         ((ParticleEffect)o).IsGroupMember = true;
     }
 }
Exemplo n.º 6
0
        public TweenState(DisplayObject obj)
        {
            this.Position = obj.Position;
            this.Rotation = obj.Rotation;
            this.Scale = obj.Scale;
            this.Alpha = obj.Alpha;

            if (obj is DisplayObjectContainer)
            {
                this.Frame = ((DisplayObjectContainer)obj).CurChildFrame;
            }
            else
            {
                this.Frame = 0;
            }
        }
Exemplo n.º 7
0
        internal override void ObjectRemovedFromStage(DisplayObject o)
        {
            base.ObjectRemovedFromStage(o);

            if (o is V2DScreen)
            {
                V2DScreen scr = (V2DScreen)o;
                scr.Deactivate();
            }
            //else if (o is V2DSprite)
            //{
            //    if (o.Parent != null)
            //    {
            //        V2DSprite sp = (V2DSprite)o;
            //        sp.RemoveBodyInstanceFromRuntime();
            //    }
            //}
        }
	    public virtual void AddChild(DisplayObject o)
        {
            o.Parent = this;
			children.Add(o);
			if (o.State.EndFrame > LastChildFrame)
            {
				LastChildFrame = o.State.EndFrame;
            }
            children.Sort(DisplayObject.CompareTo);

			o.SetScreen();

			if(o is DisplayObjectContainer)
			{
				((DisplayObjectContainer)o).EnsureInstancesCreated();
			}

            o.Added(EventArgs.Empty);
	    }
Exemplo n.º 9
0
 public override void DestroyElement(DisplayObject obj)
 {
     base.DestroyElement(obj);
     if (obj is StarParticleGroup)
     {
         this.starParticles = null;
     }
 }
Exemplo n.º 10
0
 public override void RemoveChild(DisplayObject obj)
 {
     base.RemoveChild(obj);
     if (obj is V2DSprite)
     {
         V2DSprite sp = (V2DSprite)obj;
         if (sp.body != null && screen is V2DScreen)
         {
             ((V2DScreen)screen).DestroyBody(sp.body);
             sp.body.SetUserData(null);
         }
     }
 }
Exemplo n.º 11
0
		/// <summary>
		/// Destroys element, any attached bodies, and children
		/// </summary>
		public virtual void DestroyElement(DisplayObject obj)
		{
            obj.DestroyView();
			this.RemoveInstance(obj);
		}
Exemplo n.º 12
0
        public virtual int GetChildIndex(DisplayObject o)
        {
		    return children.IndexOf(o);
        }
Exemplo n.º 13
0
 public void DestroyAfterUpdate(DisplayObject obj)
 {
     destructionList.Add(obj);
 }
Exemplo n.º 14
0
        public virtual void RemoveChild(DisplayObject o)
        {
		    children.Remove(o);
			if (o.State.EndFrame >= LastChildFrame)
            {
			    LastChildFrame = children.Count == 0 ? 0 : children.Max(ef => ef.State.EndFrame);
            }

            o.Removed(EventArgs.Empty);
			o.Parent = null;
        }
Exemplo n.º 15
0
 internal virtual void ObjectRemovedFromStage(DisplayObject o)
 {
 }
Exemplo n.º 16
0
 public virtual void SwapChildren(DisplayObject a, DisplayObject b)
 {
     int index0 = children.IndexOf(a);
     int index1 = children.IndexOf(b);
     SwapChildrenAt(index0, index1);
 }
Exemplo n.º 17
0
 public override void DestroyElement(DisplayObject obj)
 {
     base.DestroyElement(obj);
     if (obj is SmuckPlayer)
     {
         SmuckPlayer p = (SmuckPlayer)obj;
         p.LivingState = LivingState.Dead;
         if (p.roundScore >= pointsToWinRound && p.skipDeathMarker)
         {
             isLevelOver = true;
         }
         else if(!p.skipDeathMarker)
         {
             CreateDeadIcon(p, DeadIconType.Death);
         }
     }
 }
Exemplo n.º 18
0
 internal virtual void ObjectRemovedFromStage(DisplayObject o)
 {
 }
Exemplo n.º 19
0
 internal virtual void ObjectAddedToStage(DisplayObject o)
 {
     o.AddedToStage(EventArgs.Empty);
 }
Exemplo n.º 20
0
		protected virtual void DrawChild(DisplayObject d, SpriteBatch batch)
		{
			d.Draw(batch);
		}
 protected override void DrawChild(DDW.Display.DisplayObject d, SpriteBatch batch)
 {
     base.DrawChild(d, batch);
 }
Exemplo n.º 22
0
 internal virtual void ObjectAddedToStage(DisplayObject o)
 {
     o.AddedToStage(EventArgs.Empty);
 }
Exemplo n.º 23
0
 public virtual void SetChildIndex(int index, DisplayObject o)
 {
     int curIndex = GetChildIndex(o);
     if (curIndex != -1 && curIndex != index && index > 0 && index < children.Count)
     {
         children.RemoveAt(curIndex);
         children.Insert(index, o);
     }
 }
Exemplo n.º 24
0
 public override void AddChild(DisplayObject o)
 {
     base.AddChild(o);
 }
Exemplo n.º 25
0
        public virtual bool Contains(DisplayObject o)
	    {
		    return children.Contains(o);
	    }
Exemplo n.º 26
0
 public virtual DisplayObject Clone()
 {
     DisplayObject result = new DisplayObject();
     result.texture = texture;
     result.instanceDefinition = instanceDefinition;
     result.State.Origin = State.Origin;
     result.sourceRectangle = sourceRectangle;
     result.State.Position = State.Position;
     result.State.Rotation = State.Rotation;
     result.State.Scale = State.Scale;
     result.color = color;
     result.depth = depth;
     result.spriteEffects = spriteEffects;
     result.State.Alpha = State.Alpha;
     result.visible = visible;
     result.transforms = (V2DTransform[])transforms.Clone();
     result.parent = parent;
     result.stage = stage;
     result.id = idCounter++;
     return result;
 }
 void tw_TweenComplete(DisplayObject sender, TweenWorker worker)
 {
     sender.tweenWorker = null;
     sender.DestroyAfterUpdate();
     tw = null;
 }
Exemplo n.º 28
0
        protected override void DrawChild(DisplayObject d, SpriteBatch batch)
        {
            shaderEffect = shaderMap.ContainsKey(d.DepthGroup) ? shaderMap[d.DepthGroup] : defaultShader;

            if (shaderEffect != lastShader)
            {
                //if (lastShader != null)
                //{
                //    lastShader.End(batch);
                //}

                batch.End();

                lastShader = shaderEffect;
                if (shaderEffect != null)
                {
                    shaderEffect.Begin(batch);
                    shaderEffect = null;
                }
                else
                {
                    batch.Begin(
                         SpriteSortMode.Deferred,
                         BlendState.AlphaBlend, //BlendState.NonPremultiplied,
                         null, //SamplerState.AnisotropicClamp,
                         null, //DepthStencilState.None,
                         null, //RasterizerState.CullNone,
                         null,
                         Stage.SpriteBatchMatrix);
                }
            }

            base.DrawChild(d, batch);
        }
Exemplo n.º 29
0
 public override void DestroyElement(DisplayObject obj)
 {
     base.DestroyElement(obj);
     if (obj is V2DSprite)
     {
         v2dScreen.DestroyBody(((V2DSprite)obj).body);
     }
 }
Exemplo n.º 30
0
 public static int CompareTo(DisplayObject a, DisplayObject b)
 {
     int result = a.DepthGroup.CompareTo(b.DepthGroup);
     if (result == 0)
     {
         result = a.Depth.CompareTo(b.Depth);
     }
     return result;
 }
Exemplo n.º 31
0
		public virtual bool RemoveInstance(DisplayObject obj)
		{
			bool result = false;
			if (this.children.Contains(obj))
			{
				this.RemoveChild(obj);
				result = true;
			}
			else 
			{
				for (int i = 0; i < children.Count; i++)
				{
					if (children[i] is DisplayObjectContainer)
					{
						DisplayObjectContainer doc = (DisplayObjectContainer)children[i];
						if (doc.RemoveInstance(obj))
						{
							result = true;
							break;							
						}
					}
				}
			}
			return result;
		}