Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - storm33229

Pages: [1]
1
Support / Are there any issues with NGUI + 2D Toolkit together?
« on: May 02, 2013, 02:57:42 pm »
Before I start down this road, I want to make sure there aren't any issues, so... Are there any issues with NGUI + 2D Toolkit together? I am already accustomed to NGUI for... GUI... but I want to keep using 2D Toolkit for all of my non-GUI game elements. Will this be a problem?

2
Support / encapsulating the tk2dStaticSpriteBatcher commit behavior
« on: March 14, 2012, 12:36:19 am »
Here's a snippet from the editor script:

Code: [Select]
if (batcher.batchedSprites == null || batcher.batchedSprites.Length == 0)
{
if (GUILayout.Button("Commit"))
{
                batcher.Commit();
EditorUtility.SetDirty(target);
}
}

Then there's the actual code inside the tk2dStaticSpriteBatcher script:

Code: [Select]
    public void Commit()
    {
        List<tk2dSprite> sprites = new List<tk2dSprite>();
        tk2dSpriteCollectionData scd = null;

        for (int i = 0; i < this.transform.childCount; ++i)
        {
            Transform t = this.transform.GetChild(i);
            tk2dSprite s = t.GetComponent<tk2dSprite>();
            if (s)
            {
                if (scd == null) scd = s.collection;
                if (scd != s.collection)
                {
                    Debug.LogError("Error: Multiple sprite collections found");
                    return;
                }

                if (scd.allowMultipleAtlases)
                {
                    Debug.LogError("Error: Sprite collections with multiple atlases not allowed");
                    return;
                }

                sprites.Add(s);
            }
        }

        // sort sprites, smaller to larger z
        sprites.Sort((a, b) => b.transform.localPosition.z.CompareTo(a.transform.localPosition.z));

        if (sprites.Count == 0)
        {
            Debug.LogError("Error: No child sprite objects found");
            return;
        }

        this.spriteCollection = scd;
        this.batchedSprites = new tk2dBatchedSprite[sprites.Count];
        int currBatchedSprite = 0;
        foreach (var s in sprites)
        {
            tk2dBatchedSprite bs = new tk2dBatchedSprite();

            bs.name = s.gameObject.name;
            bs.color = s.color;
            bs.localScale = new Vector3(s.scale.x * s.transform.localScale.x, s.scale.y * s.transform.localScale.y, s.scale.z * s.transform.localScale.z);
            bs.position = s.transform.localPosition;
            bs.rotation = s.transform.localRotation;
            bs.spriteId = s.spriteId;
            bs.alwaysPixelPerfect = s.pixelPerfect;

            this.batchedSprites[currBatchedSprite++] = bs;

            GameObject.DestroyImmediate(s.gameObject);
        }

        this.Build();
    }

This was useful for me because at editor-time I was able to auto-batch my tile layers instead of clicking "Commit" for each one.

3
Support / tk2dCamera with my Tile map.
« on: March 11, 2012, 06:41:31 pm »
I have attached two images that depict the problem I am having. What I would like to do is:

Set my camera to (0, 0, -10) and have it draw from the top-left down and to the right, such that it draws x pixels to the right and y pixels to the down directions. Right now, if  I set both my objects and camera to (0, 0) nothing gets seen on the game window.

Let me know if you  need more info.

Pages: [1]