void RemoveSprite(SpriteAnimationState state, SpriteAnimationComponent component, SpriteTransform parentTransform, int parentHash) { SpriteTransform sprTransfrom = spriteRenderer.GetSpriteTransformByFullPathHash(component._fullPathHash + parentHash); if (sprTransfrom != null) { sprTransfrom.DetachState(state, component); if (sprTransfrom.attachStateComponent.Count <= 0) { if (sprTransfrom.prve != null) { sprTransfrom.prve.next = sprTransfrom.next; } if (sprTransfrom.next != null) { sprTransfrom.next.prve = sprTransfrom.prve; } if (sprTransfrom.parent != null && sprTransfrom.parent.firstChild == sprTransfrom) { sprTransfrom.parent.firstChild = sprTransfrom.next; } for (SpriteTransform child = sprTransfrom.firstChild; child != null; child = child.next) { child.parent = null; } { sprTransfrom.parent = null; sprTransfrom.next = null; sprTransfrom.prve = null; sprTransfrom.firstChild = null; sprTransfrom.lastChild = null; } if (stateRoot.Contains(sprTransfrom)) { stateRoot.Remove(sprTransfrom); } spriteRenderer.DetachSprite(sprTransfrom.id); } } for (int i = 0, e = component.children.Length; i < e; i++) { RemoveSprite(state, state.clip.subComponents[component.children[i]], sprTransfrom, 0); } }
void RemoveSprite(SpriteAnimationState state, SpriteAnimationComponent component, SpriteTransform parentTransform, int parentHash) { int searchHash = component._fullPathHash + parentHash; SpriteTransform sprTransfrom = spriteRenderer.GetSpriteTransformByFullPathHash(searchHash); for (int i = 0, e = component.children.Length; i < e; i++) { RemoveSprite(state, state.clip.subComponents[component.children[i]], sprTransfrom, parentHash); } if (sprTransfrom != null) { //if (sprTransfrom.lastRefClip != null) //{ // string name = state.name + "_" + sprTransfrom.lastRefClip.name; // SpriteAnimationState _state = this[name]; // if (_state != null) // { // if (_state.parentState != null) // _state.parentState.subClipState.Remove(_state); // Stop(_state); // } // sprTransfrom.lastRefClip = null; //} sprTransfrom.DetachState(state, component); if (sprTransfrom.attachStateComponent.Count <= 0) { if (sprTransfrom.prve != null) { sprTransfrom.prve.next = sprTransfrom.next; } if (sprTransfrom.next != null) { sprTransfrom.next.prve = sprTransfrom.prve; } if (sprTransfrom.parent != null && sprTransfrom.parent.firstChild == sprTransfrom) { sprTransfrom.parent.firstChild = sprTransfrom.next; } for (SpriteTransform child = sprTransfrom.firstChild; child != null; child = child.next) { child.parent = null; } { sprTransfrom.parent = null; sprTransfrom.next = null; sprTransfrom.prve = null; sprTransfrom.firstChild = null; sprTransfrom.lastChild = null; } if (stateRoot.Contains(sprTransfrom)) { stateRoot.Remove(sprTransfrom); } spriteRenderer.DetachSprite(sprTransfrom.id); } } }