public TweenWorker(DisplayObject obj, TweenState endState, int milliseconds) { this.target = obj; this.StartState = new TweenState(obj); this.EndState = endState; this.duration = milliseconds; }
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; }
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; }
internal override void ObjectAddedToStage(DisplayObject o) { if (o is V2DSprite) { V2DSprite sp = (V2DSprite)o; sp.AddBodyInstanceToRuntime(); } base.ObjectAddedToStage(o); }
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; } }
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; } }
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; } }
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); }
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; }
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); }
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); } } }
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); }
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); } }
public override void AddChild(DisplayObject o) { base.AddChild(o); }
public virtual bool Contains(DisplayObject o) { return children.Contains(o); }
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; }
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); }
public override void DestroyElement(DisplayObject obj) { base.DestroyElement(obj); if (obj is V2DSprite) { v2dScreen.DestroyBody(((V2DSprite)obj).body); } }
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; }