private void HandleEachTileAsCollectionOfImages(XElement _element)
        {
            eachTileMetaList = new List <ITU_TsxEachTileMeta>();
            var allTileElList = _element.Elements("tile");

            foreach (var xTileNode in allTileElList)
            {
                var subTileID = Convert.ToInt32(xTileNode.Attribute("id").Value);
                var tileMeta  = new ITU_TsxEachTileMeta();
                tileMeta.tilesetName = name;
                tileMeta.gid         = firstGid + subTileID;
                tileMeta.subTileID   = subTileID;
                tileMeta.isImageCollectionAndNotRender = true;
                eachTileMetaList.Add(tileMeta);

                //Tileset可能还会有其他绑定数据,不能认为只要有tile节点则一定会有properties
                if (xTileNode.Element("properties") != null)
                {
                    tileMeta.property.Deserialize(xTileNode.Element("properties"));
                }
            }

            if (eachTileMetaList.Count == 0)
            {
                Debug.LogWarning(string.Format("ITU find empty tileset {0} [Collecion of Image]", name));
            }
        }
        private void HandleEachTileAsNormalTiset(XElement _element)
        {
            eachTileMetaList = new List <ITU_TsxEachTileMeta>();
            for (var i = 0; i < tileCount; i++)
            {
                var tileMeta = new ITU_TsxEachTileMeta();
                tileMeta.tilesetName = name;

                tileMeta.gid       = firstGid + i;
                tileMeta.subTileID = i;

                tileMeta.isImageCollectionAndNotRender = false;

                var gridX = i % columns;
                var gridY = Mathf.FloorToInt(i / columns);

                //Tiled坐标系转到Unity坐标系. 两个坐标系是相反的,Tiled左上到右下,Unity左下到右上 所以uv的v要用1减
                tileMeta.uv_p0 = new Vector2((float)(gridX * tileWidth + margin + gridX * spacing) / imgWidth, 1 - (float)(gridY * tileHeight + margin + gridY * spacing) / imgHeight);
                tileMeta.uv_p3 = new Vector2((float)((gridX + 1) * tileWidth + margin + gridX * spacing) / imgWidth,
                                             1 - (float)((gridY + 1) * tileHeight + margin + gridY * spacing) / imgHeight);
                tileMeta.uv_p1 = new Vector2(tileMeta.uv_p3.x, tileMeta.uv_p0.y);
                tileMeta.uv_p2 = new Vector2(tileMeta.uv_p0.x, tileMeta.uv_p3.y);

                tileMeta.tileWidthInPixel  = tileWidth;
                tileMeta.tileHeightInPixel = tileHeight;

                eachTileMetaList.Add(tileMeta);
            }

            var allTileElList = _element.Elements("tile");

            if (allTileElList != null)
            {
                foreach (var xTileNode in allTileElList)
                {
                    //Tileset可能还会有其他绑定数据,不能认为只要有tile节点则一定会有properties
                    if (xTileNode.Element("properties") != null)
                    {
                        var subTileID = Convert.ToInt32(xTileNode.Attribute("id").Value);
                        var tileMeta  = eachTileMetaList.Find(x => x.subTileID == subTileID);
                        if (tileMeta == null)
                        {
                            Debug.LogError(string.Format("ITU try to handle properties but can't find id {0} in current tileset [NormalTilest]", subTileID));
                        }
                        else
                        {
                            tileMeta.property.Deserialize(xTileNode.Element("properties"));
                        }
                    }
                }
            }
        }