private void CreateTileset(XElement xTileset)
        {
            Assert.IsNull(this.Tileset);

            var icon = SuperIcons.GetTsxIcon();

            Tileset = ScriptableObject.CreateInstance <SuperTileset>();
            Tileset.m_IsInternal = false;
            SuperImportContext.AddObjectToAsset("_TilesetScriptObject", Tileset, icon);
            SuperImportContext.SetMainObject(this.Tileset);

            var loader = new TilesetLoader(this.Tileset, this, m_UseSpriteAtlas, (int)m_AtlasWidth, (int)m_AtlasHeight);

            loader.LoadFromXml(xTileset);
        }
示例#2
0
        private void PushAtlasTexture()
        {
            string textureName = string.Format("Atlas_{0}_{1}", m_TilesetScript.name, m_AtlasTextures.Count + 1);

            // Create the texture with a starter color that stands out
            m_CurrentAtlas            = new Texture2D(m_AtlasWidth, m_AtlasHeight, TextureFormat.ARGB32, false);
            m_CurrentAtlas.wrapMode   = TextureWrapMode.Clamp;
            m_CurrentAtlas.filterMode = FilterMode.Point;
            m_CurrentAtlas.name       = textureName;
            m_CurrentAtlas.SetPixels(Enumerable.Repeat(NamedColors.DeepPink, m_AtlasWidth * m_AtlasHeight).ToArray());

            // Add the texture to our import context and our list of textures
            var icon = SuperIcons.GetTsxIcon();

            m_TiledAssetImporter.SuperImportContext.AddObjectToAsset(textureName, m_CurrentAtlas, icon);
            m_AtlasTextures.Add(m_CurrentAtlas);

            // Start a new packer to go along with our atlas
            m_CurrentPacker = new Packer(m_AtlasWidth, m_AtlasHeight, false);
        }