Exemplo n.º 1
0
	// Removes the sprite with the specified managed mesh from the manager.
	public void RemoveSprite(SpriteMesh_Managed sprite)
	{
		vertices[sprite.mv1] = Vector3.zero;
		vertices[sprite.mv2] = Vector3.zero;
		vertices[sprite.mv3] = Vector3.zero;
		vertices[sprite.mv4] = Vector3.zero;

		// Remove the sprite from the billboarded list
		// since that list should only contain active
		// sprites:
/*
		if (sprite.billboarded)
			activeBillboards.Remove(sprite);
		else
*/
			activeBlocks.Remove(sprite);

		// Reset the bone:
		if (gameObject != null)
			bones[sprite.index] = transform;

		// Clean the sprite's settings:
		sprite.Clear();
		sprite.sprite.spriteMesh = null;
		sprite.sprite = null;

		availableBlocks.Add(sprite);

		vertsChanged = true;
	}
Exemplo n.º 2
0
    public void RemoveChild(GameObject go)
    {
        IUIObject obj = (IUIObject)go.GetComponent("IUIObject");

        if (obj != null)
        {
            if (uiObjs.Rewind())
            {
                do
                {
                    if (uiObjs.Current.val == obj)
                    {
                        uiObjs.Remove(uiObjs.Current);
                        break;
                    }
                } while (uiObjs.MoveNext());
            }

            if (obj.Container == (IUIContainer)this)
            {
                obj.Container = null;
            }
        }
        else
        {
            UIPanelBase panel = (UIPanelBase)go.GetComponent(typeof(UIPanelBase));
            if (panel != null)
            {
                if (childPanels.Rewind())
                {
                    do
                    {
                        if (childPanels.Current.val == panel)
                        {
                            childPanels.Remove(childPanels.Current);
                            break;
                        }
                    } while (childPanels.MoveNext());
                }

                if (panel.Container == (IUIContainer)this)
                {
                    panel.Container = null;
                }
            }
        }

        RemoveSubject(go);
    }
Exemplo n.º 3
0
	/// <summary>
	/// Adds the specified sprite to the SpriteManager.
	/// </summary>
	/// <param name="go">Reference to the desired sprite.</param>
	/// <returns>A reference to the sprite's managed mesh.</returns>
	public SpriteMesh_Managed AddSprite(SpriteRoot sprite)
	{
		int spriteIndex;

		// See if the sprite is already added:
		if(sprite.manager == this && sprite.AddedToManager)
			return (SpriteMesh_Managed)sprite.spriteMesh;
/*
		if (ensureUnique)
			if (AlreadyAdded(sprite))
				return (SpriteMesh_Managed) sprite.spriteMesh;
*/

		// See if we're ready to add sprites yet,
		// and if not, add the sprite to our deferred
		// add queue:
		if(!initialized)
		{
			if (spriteAddQueue == null)
				spriteAddQueue = new List<SpriteRoot>();

			spriteAddQueue.Add(sprite);
			return null;
		}

		// Get an available sprite:
		if (availableBlocks.Empty)
			EnlargeArrays(allocBlockSize);	// If we're out of available sprites, allocate some more:

		// Use a sprite from the list of available blocks:
		spriteIndex = availableBlocks.Head.index;
		availableBlocks.Remove(availableBlocks.Head);	// Now that we're using this one, remove it from the available list

		// Assign the new sprite:
		SpriteMesh_Managed newSpritesMesh = sprites[spriteIndex];
		sprite.spriteMesh = newSpritesMesh;
		sprite.manager = this;
		sprite.AddedToManager = true;
		newSpritesMesh.drawLayer = sprite.drawLayer;

		// Associate the sprite's bone:
		bones[spriteIndex] = sprite.gameObject.transform;
//		meshRenderer.bones = bones;
		bindPoses[spriteIndex] = bones[spriteIndex].worldToLocalMatrix * sprite.transform.localToWorldMatrix;

/*
		// Save this to an active list now that it is in-use:
		if (billboarded)
		{
			newSprite.billboarded = true;
			activeBillboards.Add(newSprite);
		}
		else
*/
			activeBlocks.Add(newSpritesMesh);

		newSpritesMesh.Init();

		// Sort the draw layers:
		SortDrawingOrder();

		// Set our flags:
		vertCountChanged = true;
		vertsChanged = true;
		uvsChanged = true;

		return newSpritesMesh;
	}
Exemplo n.º 4
0
	// Helper method that removes a pointer listener from a list:
	protected void RemovePtrListener(EZLinkedList<EZLinkedListNode<PointerInfoDelegate>> list, PointerInfoDelegate del)
	{
		for (EZLinkedListIterator<EZLinkedListNode<PointerInfoDelegate>> i = list.Begin(); !i.Done; i.Next())
		{
			if (i.Current.val == del)
			{
				// Save it:
				EZLinkedListNode<PointerInfoDelegate> node = i.Current;

				// Remove it from the active list:
				list.Remove(i.Current);

				// Add it to our free pool:
				listenerPool.Add(node);

				// We're done.
				i.End();
				break;
			}
		}
	}