Esempio 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;
 }
Esempio 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;
 }
Esempio 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;
 }
Esempio n. 4
0
        internal override void ObjectAddedToStage(DisplayObject o)
        {
            if (o is V2DSprite)
            {
                V2DSprite sp = (V2DSprite)o;
                sp.AddBodyInstanceToRuntime();
            }

            base.ObjectAddedToStage(o);
        }
Esempio 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;
     }
 }
Esempio 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;
            }
        }
Esempio 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);
	    }
 public override void DestroyElement(DisplayObject obj)
 {
     base.DestroyElement(obj);
     if (obj is StarParticleGroup)
     {
         this.starParticles = null;
     }
 }
Esempio 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);
         }
     }
 }
		/// <summary>
		/// Destroys element, any attached bodies, and children
		/// </summary>
		public virtual void DestroyElement(DisplayObject obj)
		{
            obj.DestroyView();
			this.RemoveInstance(obj);
		}
        public virtual int GetChildIndex(DisplayObject o)
        {
		    return children.IndexOf(o);
        }
Esempio n. 13
0
 public void DestroyAfterUpdate(DisplayObject obj)
 {
     destructionList.Add(obj);
 }
        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;
        }
Esempio n. 15
0
 internal virtual void ObjectRemovedFromStage(DisplayObject o)
 {
 }
 public virtual void SwapChildren(DisplayObject a, DisplayObject b)
 {
     int index0 = children.IndexOf(a);
     int index1 = children.IndexOf(b);
     SwapChildrenAt(index0, index1);
 }
Esempio 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);
         }
     }
 }
Esempio n. 18
0
 internal virtual void ObjectRemovedFromStage(DisplayObject o)
 {
 }
Esempio n. 19
0
 internal virtual void ObjectAddedToStage(DisplayObject o)
 {
     o.AddedToStage(EventArgs.Empty);
 }
		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);
 }
Esempio n. 22
0
 internal virtual void ObjectAddedToStage(DisplayObject o)
 {
     o.AddedToStage(EventArgs.Empty);
 }
 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);
     }
 }
Esempio n. 24
0
 public override void AddChild(DisplayObject o)
 {
     base.AddChild(o);
 }
        public virtual bool Contains(DisplayObject o)
	    {
		    return children.Contains(o);
	    }
Esempio 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;
 }
Esempio 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);
        }
Esempio n. 29
0
 public override void DestroyElement(DisplayObject obj)
 {
     base.DestroyElement(obj);
     if (obj is V2DSprite)
     {
         v2dScreen.DestroyBody(((V2DSprite)obj).body);
     }
 }
Esempio 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;
 }
		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;
		}