public Font FindFontByName(Font.Name name) { DLink current = poActiveHead; while (current != null) { if (((Font)current).name == name) { return((Font)current); } current = current.pNext; } return(null); }
protected void BaseRemove(DLink pNode) { Debug.Assert(pNode != null); // Remove from Active... delegate it to DLink Manager.RemoveNode(ref this.pActiveHead, pNode); // wash it before returning to reserve list this.DerivedWashNode(pNode); // add it to the reserve list Manager.PushFront(ref this.pReserveHead, pNode); // stats update this.mNumActive--; this.mNumReserved++; }
override protected bool DerivedCompareNode(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); Image pDataA = (Image)pLinkA; Image pDataB = (Image)pLinkB; bool status = false; if (pDataA.name == pDataB.name) { status = true; } return(status); }
protected DLink BaseFind(DLink pNodeTarget) { DLink pLink = this.pActiveHead; // Walk active list while (pLink != null) { if (DerivedCompareNode(pLink, pNodeTarget)) { // found it break; } pLink = pLink.pNext; } return(pLink); }
public static Image Find(Image.Name name) { DLink ptr = pMan.poActive; while (ptr != null) { if (((Image)ptr).GetName() == name) { return((Image)ptr); } ptr = ptr.pNext; } return(null); }
public override void Print() { Debug.WriteLine("Composite GO: {0} ({1})", this.GetName(), this.GetHashCode()); DLink pSafety = this.poHead; DLink pNode = pSafety; while (pNode != null) { Component pComp = (Component)pNode; pComp.Print(); pNode = pNode.pNext; } }
public override void Move(float xDelta, float yDelta) { DLink pNode = this.pHead; while (pNode != null) { // Get component Component pComponent = (Component)pNode; // Move component pComponent.Move(xDelta, yDelta); // Increment pointer along list pNode = pNode.GetNext(); } }
public Texture FindTextureByName(Texture.Name tName) { DLink current = poActiveHead; while (current != null) { if (((Texture)current).name == tName) { return((Texture)current); } current = current.pNext; } return(null); }
public void checkPlayerCollision(Player player) { DLink temp = pActive; while (temp != null) { if (((ProjectileDataNode)temp).getProjectile().getStatus() == Status.Active) { if (player.getCollisionComponent().checkCollision(player.getCollisionComponent(), ((ProjectileDataNode)temp).getProjectile().getCollisionComponent())) { ((ProjectileDataNode)temp).getProjectile().notifyHit(); player.notifyHit(); } } temp = temp.pNext; } }
override protected bool derivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SoundEngine pDataA = (SoundEngine)pLinkA; SoundEngine pDataB = (SoundEngine)pLinkB; bool status = false; if (pDataA.name == pDataB.name) { status = true; } return(status); }
public static void RemoveNode(ref DLink pHead, DLink pNode) { Debug.Assert(pNode != null); if (pNode.pPrev != null) { pNode.pPrev.pNext = pNode.pNext; } else { pHead = pNode.pNext; } if (pNode.pNext != null) { pNode.pNext.pPrev = pNode.pPrev; } }
protected override bool DerivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); ShieldNode pDataA = (ShieldNode)pLinkA; ShieldNode pDataB = (ShieldNode)pLinkB; Boolean status = false; if (pDataA.index == pDataB.index) { status = true; } return(status); }
//---------------------------------------------------------------------- // Concstructor //---------------------------------------------------------------------- protected Manager(int InitialNodesInReserve = 5, int deltaRate = 2) { //Check for valid inputs Debug.Assert(InitialNodesInReserve >= 0); Debug.Assert(deltaRate > 0); // init this.poHeadActive = null; this.poHeadReserve = null; this.mNumActiveNodes = 0; this.mNumReserveNodes = 0; this.mNumTotalNodes = 0; this.growthRate = deltaRate; // fill with empty nodes this.privFillReservePool(InitialNodesInReserve); }
protected override bool DerivedCompare(DLink pDLink1, DLink pDLink2) { Debug.Assert(pDLink1 != null); Debug.Assert(pDLink2 != null); Font pFData1 = (Font)pDLink1; Font pFData2 = (Font)pDLink2; Boolean status = false; if (pFData1.name == pFData2.name) { status = true; } return(status); }
protected override bool DerivedCompare(DLink pDLink1, DLink pDLink2) { Debug.Assert(pDLink1 != null); Debug.Assert(pDLink2 != null); Image pINode1 = (Image)pDLink1; Image pINode2 = (Image)pDLink2; Boolean status = false; if (pINode1.GetName() == pINode2.GetName()) { status = true; } return(status); }
protected void baseRemove(DLink pNode) { Debug.Assert(pNode != null); // Don't do the work here... delegate it Manager.privRemoveNode(ref this.poActive, pNode); // wash it before returning to reserve list this.derivedWash(pNode); // add it to the return list Manager.privAddToFront(ref this.poReserve, pNode); // stats update this.mNumActive--; this.mNumReserved++; }
//---------------------------------------------------------------------- // Private methods - helpers //---------------------------------------------------------------------- private void privFillReservedPool(int count) { // doesn't make sense if its not at least 1 Debug.Assert(count >= 1); this.mTotalNumNodes += count; this.mNumReserved += count; // Preload the reserve for (int i = 0; i < count; i++) { DLink pNode = this.derivedCreateNode(); Debug.Assert(pNode != null); Manager.privAddToEnd(ref this.poReserve, pNode); } }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- protected override bool DerivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SBNode pDataA = (SBNode)pLinkA; SBNode pDataB = (SBNode)pLinkB; Boolean status = false; if (pDataA.GetSpriteBase() == pDataB.GetSpriteBase()) { status = true; } return(status); }
//---------------------------------------------------------------------- // Helper Methods //---------------------------------------------------------------------- private void privFillReservePool(int val) { Debug.Assert(val > 0); DLink current = this.poHeadReserve; for (int i = 0; i < val; i++) { DLink pLink = this.derivedCreateNode(); Debug.Assert(pLink != null); DLink.AddToFront(ref this.poHeadReserve, pLink); } // update counters this.mNumReserveNodes += val; this.mNumTotalNodes += val; }
public static DLink RemoveNode(ref DLink pHead, ref DLink pTail, DLink pNode) { // protection Debug.Assert(pNode != null); // Might have bug //tried to diagram and change, but added more issues //check again later // 4 different conditions... if (pNode.pPrev != null) { // middle or last node pNode.pPrev.pNext = pNode.pNext; if (pNode == pTail) { pTail = pNode.pPrev; } } else { // first pHead = pNode.pNext; if (pNode == pTail) { // Only one node pTail = pNode.pNext; } else { // Only first not the last // do nothing more } } if (pNode.pNext != null) { // middle node pNode.pNext.pPrev = pNode.pPrev; } pNode.Clear(); return(pNode); }
public void setPos(float x, float y) { DLink temp = pActive; if (temp != null) { float offsetX = ((LetterDataNode)temp).getSprite().getWidth(); float offsetY = ((LetterDataNode)temp).getSprite().getHeight(); float i = 0; while (temp != null) { ((LetterDataNode)temp).setPos(x + (i * offsetX), y); i++; temp = temp.pNext; } } }
override protected Boolean derivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SpriteBatch pDataA = (SpriteBatch)pLinkA; SpriteBatch pDataB = (SpriteBatch)pLinkB; Boolean status = false; if (pDataA.name == pDataB.name) { status = true; } return(status); }
override protected Boolean derivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); TimeEvent pDataA = (TimeEvent)pLinkA; TimeEvent pDataB = (TimeEvent)pLinkB; Boolean status = false; if (pDataA.GetName() == pDataB.GetName()) { status = true; } return(status); }
/// <summary> /// Moves a node from active to reserve and cleans list references for node /// </summary> /// <param name="pNode"></param> protected void BaseRemove(DLink pNode) { Debug.Assert(pNode != null); // Update list pointers to remove pNode from list DLink.RemoveFromList(ref pActive, pNode); // Remove list references in removed node pNode.ClearLinks(); // Return pNode to pReserve list DLink.AddToFront(ref pReserve, pNode); // stats update this.activeNodeNum--; this.reserveNodeNum++; }
private void RemoveFromList(DLink source, DLink pNode) { if (pNode.pDPrev == null) { // Remove first node in source List source = source.pDNext; source.pDPrev = null; } else if (pNode.pDNext == null) { // Remove last node in source list pNode.pDPrev.pDNext = null; } else { // Remove node somewhere in the middle pNode.pDPrev.pDNext = pNode.pDNext; pNode.pDNext.pDPrev = pNode.pDPrev; } }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- protected override bool DerivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); ProxySprite pDataA = (ProxySprite)pLinkA; ProxySprite pDataB = (ProxySprite)pLinkB; Boolean status = false; if (pDataA.GetName() == pDataB.GetName()) { status = true; } return status; }
public void checkUFOCollision(Alien alien) { DLink temp = pActive; while (temp != null) { if (((ProjectileDataNode)temp).getProjectile().getStatus() == Status.Active) { if (alien.getCollisionComponent().checkCollision(alien.getCollisionComponent(), ((ProjectileDataNode)temp).getProjectile().getCollisionComponent())) { ((ProjectileDataNode)temp).getProjectile().notifyHit(); alien.notifyHit(); } } temp = temp.pNext; } }
//---------------------------------------------------------------------- // Private methods //---------------------------------------------------------------------- private void fillNodesToReservedList(int numNode) { int numAddedNode = 0; DLink currNode = null; while (numAddedNode < numNode) { // create a specific node currNode = this.derivedCreateNode(); Debug.Assert(currNode != null); DLink.AddToFront(ref pReserved, currNode); this.mNumReserved++; this.mTotalNumNodes++; numAddedNode++; } }
// Currently necessary for Detach() since GameObject.Name is not unique private Boolean HashCodeCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); GameObjectRef pDataA = (GameObjectRef)pLinkA; GameObjectRef pDataB = (GameObjectRef)pLinkB; Boolean status = false; if (pDataA.GetGameObject().GetHashCode() == pDataB.GetGameObject().GetHashCode()) { status = true; } return(status); }
//---------------------------------------------------------------------- // Override abstract methods //---------------------------------------------------------------------- protected override bool derivedCompare(DLink pNodeA, DLink pNodeB) { Debug.Assert(pNodeA != null); Debug.Assert(pNodeB != null); CollisionPair pDataA = (CollisionPair)pNodeA; CollisionPair pDataB = (CollisionPair)pNodeB; Boolean status = false; if (pDataA.getName() == pDataB.getName()) { status = true; } return(status); }