public void CopyFrom(tk2dSpriteCollectionFont src) { active = src.active; bmFont = src.bmFont; texture = src.texture; dupeCaps = src.dupeCaps; flipTextureY = src.flipTextureY; charPadX = src.charPadX; data = src.data; editorData = src.editorData; }
public void CopyFrom(tk2dSpriteCollectionFont src) { active = src.active; bmFont = src.bmFont; texture = src.texture; dupeCaps = src.dupeCaps; flipTextureY = src.flipTextureY; charPadX = src.charPadX; data = src.data; editorData = src.editorData; materialId = src.materialId; gradientCount = src.gradientCount; gradientTexture = src.gradientTexture; useGradient = src.useGradient; }
public void CopyFrom(tk2dSpriteCollectionFont src) { this.active = src.active; this.bmFont = src.bmFont; this.texture = src.texture; this.dupeCaps = src.dupeCaps; this.flipTextureY = src.flipTextureY; this.charPadX = src.charPadX; this.data = src.data; this.editorData = src.editorData; this.materialId = src.materialId; this.gradientCount = src.gradientCount; this.gradientTexture = src.gradientTexture; this.useGradient = src.useGradient; }
public void CopyFrom(tk2dSpriteCollectionFont src) { active = src.active; bmFont = src.bmFont; texture = src.texture; dupeCaps = src.dupeCaps; flipTextureY = src.flipTextureY; charPadX = src.charPadX; data = src.data; editorData = src.editorData; materialId = src.materialId; gradientCount = src.gradientCount; gradientTexture = src.gradientTexture; useGradient = src.useGradient; }
public int FindOrCreateEmptyFontSlot() { for (int index = 0; index < fonts.Count; ++index) { if (!fonts[index].active) { fonts[index].active = true; return(index); } } var font = new tk2dSpriteCollectionFont(); font.active = true; fonts.Add(font); return(fonts.Count - 1); }
static void UpdateFontData(tk2dSpriteCollection gen, float scale, tk2dEditor.Atlas.Data[] packers, List<SpriteLut> spriteLuts, tk2dSpriteCollectionFont font, tk2dEditor.Font.Info fontInfo) { Dictionary<int, SpriteLut> glyphLut = new Dictionary<int, SpriteLut>(); List<SpriteLut> values = new List<SpriteLut>(); foreach (var k in glyphLut.Keys) values.Add(glyphLut[k]); foreach (var v in spriteLuts) glyphLut[v.charId] = v; int padAmount = GetPadAmount(gen, -1); foreach (var c in fontInfo.chars) { if (glyphLut.ContainsKey(c.id)) { var glyphSprite = glyphLut[c.id]; var atlasEntry = packers[0].FindEntryWithIndex(glyphSprite.atlasIndex); c.texOffsetX = glyphSprite.rx; if (font.flipTextureY) { // This is the offset from the bottom of the font c.texOffsetY = glyphSprite.ry; } else { // ry is offset from top, we want offset from bottom // height is the original glyph height before cropping, the remainder of which is // the offset from bottom c.texOffsetY = c.height - glyphSprite.rh - glyphSprite.ry; } c.texX = atlasEntry.x + padAmount; c.texY = atlasEntry.y + padAmount; c.texW = atlasEntry.w - padAmount * 2; c.texH = atlasEntry.h - padAmount * 2; c.texFlipped = atlasEntry.flipped; } else { var glyphSprite = glyphLut[-1]; var atlasEntry = packers[0].FindEntryWithIndex(glyphSprite.atlasIndex); c.texOffsetX = 0; c.texOffsetY = 0; c.texX = atlasEntry.x + 1; c.texY = atlasEntry.y + 1; c.texW = 0; c.texH = 0; c.texFlipped = false; } c.texOverride = true; } tk2dEditor.Font.Builder.BuildFont(fontInfo, font.data, scale, font.charPadX, font.dupeCaps, font.flipTextureY, font.gradientTexture, font.gradientCount); }
static void UpdateFontData(tk2dSpriteCollection gen, float scale, tk2dEditor.Atlas.Data[] packers, List<SpriteLut> spriteLuts, tk2dSpriteCollectionFont font, tk2dEditor.Font.Info fontInfo) { Dictionary<int, SpriteLut> glyphLut = new Dictionary<int, SpriteLut>(); List<SpriteLut> values = new List<SpriteLut>(); foreach (var k in glyphLut.Keys) values.Add(glyphLut[k]); foreach (var v in spriteLuts) glyphLut[v.charId] = v; int padAmount = GetPadAmount(gen, -1); foreach (var c in fontInfo.chars) { if (glyphLut.ContainsKey(c.id)) { var glyphSprite = glyphLut[c.id]; var atlasEntry = packers[0].FindEntryWithIndex(glyphSprite.atlasIndex); c.texOffsetX = glyphSprite.rx; c.texOffsetY = glyphSprite.ry; c.texX = atlasEntry.x + padAmount; c.texY = atlasEntry.y + padAmount; c.texW = atlasEntry.w - padAmount * 2; c.texH = atlasEntry.h - padAmount * 2; c.texFlipped = atlasEntry.flipped; } else { var glyphSprite = glyphLut[-1]; var atlasEntry = packers[0].FindEntryWithIndex(glyphSprite.atlasIndex); c.texOffsetX = 0; c.texOffsetY = 0; c.texX = atlasEntry.x + 1; c.texY = atlasEntry.y + 1; c.texW = 0; c.texH = 0; c.texFlipped = false; } c.texOverride = true; } tk2dEditor.Font.Builder.BuildFont(fontInfo, font.data, scale, font.charPadX, font.dupeCaps, false, null, 0); }
public void CopyFromSource() { textureParams = new List <tk2dSpriteCollectionDefinition>(obj.textureParams.Length); foreach (var v in obj.textureParams) { if (v == null) { textureParams.Add(null); } else { var t = new tk2dSpriteCollectionDefinition(); t.CopyFrom(v); textureParams.Add(t); } } textureRefs = new List <Texture2D>(obj.textureRefs.Length); foreach (var v in obj.textureRefs) { textureRefs.Add(v); } spriteSheets = new List <tk2dSpriteSheetSource>(); if (obj.spriteSheets != null) { foreach (var v in obj.spriteSheets) { if (v == null) { spriteSheets.Add(null); } else { var t = new tk2dSpriteSheetSource(); t.CopyFrom(v); spriteSheets.Add(t); } } } fonts = new List <tk2dSpriteCollectionFont>(); if (obj.fonts != null) { foreach (var v in obj.fonts) { if (v == null) { fonts.Add(null); } else { var t = new tk2dSpriteCollectionFont(); t.CopyFrom(v); fonts.Add(t); } } } UpgradeLegacySpriteSheets(); var target = this; var source = obj; target.maxTextureSize = source.maxTextureSize; target.forceTextureSize = source.forceTextureSize; target.forcedTextureWidth = source.forcedTextureWidth; target.forcedTextureHeight = source.forcedTextureHeight; target.textureCompression = source.textureCompression; target.atlasWidth = source.atlasWidth; target.atlasHeight = source.atlasHeight; target.forceSquareAtlas = source.forceSquareAtlas; target.atlasWastage = source.atlasWastage; target.allowMultipleAtlases = source.allowMultipleAtlases; target.spriteCollection = source.spriteCollection; target.premultipliedAlpha = source.premultipliedAlpha; CopyArray(ref target.altMaterials, source.altMaterials); CopyArray(ref target.atlasMaterials, source.atlasMaterials); CopyArray(ref target.atlasTextures, source.atlasTextures); target.useTk2dCamera = source.useTk2dCamera; target.targetHeight = source.targetHeight; target.targetOrthoSize = source.targetOrthoSize; target.pixelPerfectPointSampled = source.pixelPerfectPointSampled; target.physicsDepth = source.physicsDepth; target.disableTrimming = source.disableTrimming; target.normalGenerationMode = source.normalGenerationMode; target.padAmount = source.padAmount; target.autoUpdate = source.autoUpdate; target.editorDisplayScale = source.editorDisplayScale; }
// Update target platforms public static void UpdatePlatformSpriteCollection(tk2dSpriteCollection source, tk2dSpriteCollection target, string dataPath, bool root, float scale, string platformName) { tk2dEditor.SpriteCollectionEditor.SpriteCollectionProxy proxy = new tk2dEditor.SpriteCollectionEditor.SpriteCollectionProxy(source); // Restore old sprite collection proxy.spriteCollection = target.spriteCollection; proxy.atlasTextures = target.atlasTextures; proxy.atlasMaterials = target.atlasMaterials; proxy.altMaterials = target.altMaterials; // This must always be zero, as children cannot have nested platforms. // That would open the door to a lot of unnecessary insanity proxy.platforms = new List <tk2dSpriteCollectionPlatform>(); // Update atlas sizes proxy.atlasWidth = (int)(proxy.atlasWidth * scale); proxy.atlasHeight = (int)(proxy.atlasHeight * scale); proxy.maxTextureSize = (int)(proxy.maxTextureSize * scale); proxy.forcedTextureWidth = (int)(proxy.forcedTextureWidth * scale); proxy.forcedTextureHeight = (int)(proxy.forcedTextureHeight * scale); if (proxy.padAmount > 0) { proxy.padAmount = Mathf.Max((int)(proxy.padAmount * scale), 1); // min 1 pixel padding } proxy.globalScale = 1.0f / scale; // Don't bother changing stuff on the root object // The root object is the one that the sprite collection is defined on initially if (!root) { // Update textures foreach (tk2dSpriteCollectionDefinition param in proxy.textureParams) { if (param.texture == null) { continue; } string path = AssetDatabase.GetAssetPath(param.texture); string platformTexture = FindAssetForPlatform(platformName, path, textureExtensions); if (platformTexture.Length == 0) { LogNotFoundError(platformName, param.texture.name, "texture"); } else { Texture2D tex = AssetDatabase.LoadAssetAtPath(platformTexture, typeof(Texture2D)) as Texture2D; if (tex == null) { Debug.LogError("Unable to load platform specific texture '" + platformTexture + "'"); } else { param.texture = tex; } } // Handle spritesheets. Odd coordinates could cause issues if (param.extractRegion) { param.regionX = (int)(param.regionX * scale); param.regionY = (int)(param.regionY * scale); param.regionW = (int)(param.regionW * scale); param.regionH = (int)(param.regionH * scale); } if (param.anchor == tk2dSpriteCollectionDefinition.Anchor.Custom) { param.anchorX = (int)(param.anchorX * scale); param.anchorY = (int)(param.anchorY * scale); } if (param.customSpriteGeometry) { foreach (tk2dSpriteColliderIsland geom in param.geometryIslands) { for (int p = 0; p < geom.points.Length; ++p) { geom.points[p] *= scale; } } } else if (param.dice) { param.diceUnitX = (int)(param.diceUnitX * scale); param.diceUnitY = (int)(param.diceUnitY * scale); } if (param.colliderType == tk2dSpriteCollectionDefinition.ColliderType.Polygon) { foreach (tk2dSpriteColliderIsland geom in param.polyColliderIslands) { for (int p = 0; p < geom.points.Length; ++p) { geom.points[p] *= scale; } } } else if (param.colliderType == tk2dSpriteCollectionDefinition.ColliderType.BoxCustom) { param.boxColliderMax *= scale; param.boxColliderMin *= scale; } for (int i = 0; i < param.attachPoints.Count; ++i) { param.attachPoints[i].position = param.attachPoints[i].position * scale; } } } // We ALWAYS duplicate fonts if (target.fonts == null) { target.fonts = new tk2dSpriteCollectionFont[0]; } for (int i = 0; i < proxy.fonts.Count; ++i) { tk2dSpriteCollectionFont font = proxy.fonts[i]; if (!font.InUse || font.texture == null || font.data == null || font.editorData == null || font.bmFont == null) { continue; // not valid for some reason or other } bool needFontData = true; bool needFontEditorData = true; bool hasCorrespondingData = i < target.fonts.Length && target.fonts[i] != null; if (hasCorrespondingData) { tk2dSpriteCollectionFont targetFont = target.fonts[i]; if (targetFont.data != null) { font.data = targetFont.data; needFontData = false; } if (targetFont.editorData != null) { font.editorData = targetFont.editorData; needFontEditorData = false; } } string bmFontPath = AssetDatabase.GetAssetPath(font.bmFont); string texturePath = AssetDatabase.GetAssetPath(font.texture); if (!root) { // find platform specific versions bmFontPath = FindAssetForPlatform(platformName, bmFontPath, fontExtensions); texturePath = FindAssetForPlatform(platformName, texturePath, textureExtensions); if (bmFontPath.Length != 0 && texturePath.Length == 0) { // try to find a texture tk2dEditor.Font.Info fontInfo = tk2dEditor.Font.Builder.ParseBMFont(bmFontPath); if (fontInfo != null) { texturePath = System.IO.Path.GetDirectoryName(bmFontPath).Replace('\\', '/') + "/" + System.IO.Path.GetFileName(fontInfo.texturePaths[0]); } } if (bmFontPath.Length == 0) { LogNotFoundError(platformName, font.bmFont.name, "font"); } if (texturePath.Length == 0) { LogNotFoundError(platformName, font.texture.name, "texture"); } if (bmFontPath.Length == 0 || texturePath.Length == 0) { continue; // not found } // load the assets font.bmFont = AssetDatabase.LoadAssetAtPath(bmFontPath, typeof(UnityEngine.TextAsset)) as TextAsset; font.texture = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D)) as Texture2D; } string targetDir = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(target)); // create necessary assets if (needFontData) { string srcPath = AssetDatabase.GetAssetPath(font.data); string destPath = AssetDatabase.GenerateUniqueAssetPath(GetCopyAtTargetPath(platformName, targetDir, srcPath)); AssetDatabase.CopyAsset(srcPath, destPath); AssetDatabase.Refresh(); font.data = AssetDatabase.LoadAssetAtPath(destPath, typeof(tk2dFontData)) as tk2dFontData; } if (needFontEditorData) { string srcPath = AssetDatabase.GetAssetPath(font.editorData); string destPath = AssetDatabase.GenerateUniqueAssetPath(GetCopyAtTargetPath(platformName, targetDir, srcPath)); AssetDatabase.CopyAsset(srcPath, destPath); AssetDatabase.Refresh(); font.editorData = AssetDatabase.LoadAssetAtPath(destPath, typeof(tk2dFont)) as tk2dFont; } if (font.editorData.bmFont != font.bmFont || font.editorData.texture != font.texture || font.editorData.data != font.data) { font.editorData.bmFont = font.bmFont; font.editorData.texture = font.texture; font.editorData.data = font.data; tk2dUtil.SetDirty(font.editorData); } } proxy.CopyToTarget(target); }
public void CopyFromSource(bool copyBuilt) { this.obj.Upgrade(); // make sure its up to date textureParams = new List <tk2dSpriteCollectionDefinition>(obj.textureParams.Length); foreach (var v in obj.textureParams) { if (v == null) { textureParams.Add(null); } else { var t = new tk2dSpriteCollectionDefinition(); t.CopyFrom(v); textureParams.Add(t); } } spriteSheets = new List <tk2dSpriteSheetSource>(); if (obj.spriteSheets != null) { foreach (var v in obj.spriteSheets) { if (v == null) { spriteSheets.Add(null); } else { var t = new tk2dSpriteSheetSource(); t.CopyFrom(v); spriteSheets.Add(t); } } } fonts = new List <tk2dSpriteCollectionFont>(); if (obj.fonts != null) { foreach (var v in obj.fonts) { if (v == null) { fonts.Add(null); } else { var t = new tk2dSpriteCollectionFont(); t.CopyFrom(v); fonts.Add(t); } } } attachPointTestSprites.Clear(); foreach (var v in obj.attachPointTestSprites) { if (v.spriteCollection != null && v.spriteCollection.IsValidSpriteId(v.spriteId)) { tk2dSpriteCollection.AttachPointTestSprite ap = new tk2dSpriteCollection.AttachPointTestSprite(); ap.CopyFrom(v); attachPointTestSprites[v.attachPointName] = v; } } UpgradeLegacySpriteSheets(); var target = this; var source = obj; target.platforms = new List <tk2dSpriteCollectionPlatform>(); foreach (tk2dSpriteCollectionPlatform plat in source.platforms) { tk2dSpriteCollectionPlatform p = new tk2dSpriteCollectionPlatform(); p.CopyFrom(plat); target.platforms.Add(p); } if (target.platforms.Count == 0) { tk2dSpriteCollectionPlatform plat = new tk2dSpriteCollectionPlatform(); // add a null platform target.platforms.Add(plat); } target.assetName = source.assetName; target.loadable = source.loadable; target.atlasFormat = source.atlasFormat; target.maxTextureSize = source.maxTextureSize; target.forceTextureSize = source.forceTextureSize; target.forcedTextureWidth = source.forcedTextureWidth; target.forcedTextureHeight = source.forcedTextureHeight; target.textureCompression = source.textureCompression; target.atlasWidth = source.atlasWidth; target.atlasHeight = source.atlasHeight; target.forceSquareAtlas = source.forceSquareAtlas; target.atlasWastage = source.atlasWastage; target.allowMultipleAtlases = source.allowMultipleAtlases; target.disableRotation = source.disableRotation; target.removeDuplicates = source.removeDuplicates; target.allowSpannedDicing = source.allowSpannedDicing; target.premultipliedAlpha = source.premultipliedAlpha; target.sizeDef.CopyFrom(source.sizeDef); target.globalScale = source.globalScale; target.globalTextureRescale = source.globalTextureRescale; target.physicsDepth = source.physicsDepth; target.physicsEngine = source.physicsEngine; target.disableTrimming = source.disableTrimming; target.normalGenerationMode = source.normalGenerationMode; target.padAmount = source.padAmount; target.autoUpdate = source.autoUpdate; target.editorDisplayScale = source.editorDisplayScale; // Texture settings target.filterMode = source.filterMode; target.wrapMode = source.wrapMode; target.userDefinedTextureSettings = source.userDefinedTextureSettings; target.mipmapEnabled = source.mipmapEnabled; target.anisoLevel = source.anisoLevel; target.linkedSpriteCollections.Clear(); for (int i = 0; i < source.linkedSpriteCollections.Count; ++i) { tk2dLinkedSpriteCollection t = new tk2dLinkedSpriteCollection(); t.name = source.linkedSpriteCollections[i].name; t.spriteCollection = source.linkedSpriteCollections[i].spriteCollection; target.linkedSpriteCollections.Add(t); } if (copyBuilt) { CopyBuiltFromSource(source); } }
public void CopyFromSource() { textureParams = new List<tk2dSpriteCollectionDefinition>(obj.textureParams.Length); foreach (var v in obj.textureParams) { if (v == null) textureParams.Add(null); else { var t = new tk2dSpriteCollectionDefinition(); t.CopyFrom(v); textureParams.Add(t); } } textureRefs = new List<Texture2D>(obj.textureRefs.Length); foreach (var v in obj.textureRefs) textureRefs.Add(v); spriteSheets = new List<tk2dSpriteSheetSource>(); if (obj.spriteSheets != null) { foreach (var v in obj.spriteSheets) { if (v == null) spriteSheets.Add(null); else { var t = new tk2dSpriteSheetSource(); t.CopyFrom(v); spriteSheets.Add(t); } } } fonts = new List<tk2dSpriteCollectionFont>(); if (obj.fonts != null) { foreach (var v in obj.fonts) { if (v == null) fonts.Add(null); else { var t = new tk2dSpriteCollectionFont(); t.CopyFrom(v); fonts.Add(t); } } } UpgradeLegacySpriteSheets(); var target = this; var source = obj; target.maxTextureSize = source.maxTextureSize; target.textureCompression = source.textureCompression; target.atlasWidth = source.atlasWidth; target.atlasHeight = source.atlasHeight; target.forceSquareAtlas = source.forceSquareAtlas; target.atlasWastage = source.atlasWastage; target.allowMultipleAtlases = source.allowMultipleAtlases; target.spriteCollection = source.spriteCollection; target.premultipliedAlpha = source.premultipliedAlpha; target.atlasMaterials = source.atlasMaterials; target.atlasTextures = source.atlasTextures; target.useTk2dCamera = source.useTk2dCamera; target.targetHeight = source.targetHeight; target.targetOrthoSize = source.targetOrthoSize; target.pixelPerfectPointSampled = source.pixelPerfectPointSampled; target.physicsDepth = source.physicsDepth; target.disableTrimming = source.disableTrimming; target.normalGenerationMode = source.normalGenerationMode; target.padAmount = source.padAmount; target.autoUpdate = source.autoUpdate; }
public int FindOrCreateEmptyFontSlot() { for (int index = 0; index < fonts.Count; ++index) { if (!fonts[index].active) { fonts[index].active = true; return index; } } var font = new tk2dSpriteCollectionFont(); font.active = true; fonts.Add(font); return fonts.Count - 1; }
public void CopyFromSource() { this.obj.Upgrade(); // make sure its up to date textureParams = new List <tk2dSpriteCollectionDefinition>(obj.textureParams.Length); foreach (var v in obj.textureParams) { if (v == null) { textureParams.Add(null); } else { var t = new tk2dSpriteCollectionDefinition(); t.CopyFrom(v); textureParams.Add(t); } } spriteSheets = new List <tk2dSpriteSheetSource>(); if (obj.spriteSheets != null) { foreach (var v in obj.spriteSheets) { if (v == null) { spriteSheets.Add(null); } else { var t = new tk2dSpriteSheetSource(); t.CopyFrom(v); spriteSheets.Add(t); } } } fonts = new List <tk2dSpriteCollectionFont>(); if (obj.fonts != null) { foreach (var v in obj.fonts) { if (v == null) { fonts.Add(null); } else { var t = new tk2dSpriteCollectionFont(); t.CopyFrom(v); fonts.Add(t); } } } attachPointTestSprites.Clear(); foreach (var v in obj.attachPointTestSprites) { if (v.spriteCollection != null && v.spriteCollection.IsValidSpriteId(v.spriteId)) { tk2dSpriteCollection.AttachPointTestSprite ap = new tk2dSpriteCollection.AttachPointTestSprite(); ap.CopyFrom(v); attachPointTestSprites[v.attachPointName] = v; } } UpgradeLegacySpriteSheets(); var target = this; var source = obj; target.platforms = new List <tk2dSpriteCollectionPlatform>(); foreach (tk2dSpriteCollectionPlatform plat in source.platforms) { tk2dSpriteCollectionPlatform p = new tk2dSpriteCollectionPlatform(); p.CopyFrom(plat); target.platforms.Add(p); } if (target.platforms.Count == 0) { tk2dSpriteCollectionPlatform plat = new tk2dSpriteCollectionPlatform(); // add a null platform target.platforms.Add(plat); } target.enablePlatformScaleVertex = source.enablePlatformScaleVertex; target.assetName = source.assetName; target.loadable = source.loadable; target.atlasFormat = source.atlasFormat; target.maxTextureSize = source.maxTextureSize; target.forceTextureSize = source.forceTextureSize; target.forcedTextureWidth = source.forcedTextureWidth; target.forcedTextureHeight = source.forcedTextureHeight; target.freeSizeAtlas = source.freeSizeAtlas; target.amountOfPixelsToExtendFreeSize = source.amountOfPixelsToExtendFreeSize; target.forceA8 = source.forceA8; target.forceShader = source.forceShader; target.textureCompression = source.textureCompression; target.atlasWidth = source.atlasWidth; target.atlasHeight = source.atlasHeight; target.forceSquareAtlas = source.forceSquareAtlas; target.atlasWastage = source.atlasWastage; target.allowMultipleAtlases = source.allowMultipleAtlases; target.disableRotation = source.disableRotation; target.removeDuplicates = source.removeDuplicates; target.usePosterize = source.usePosterize; target.posterizeValue = source.posterizeValue; target.spriteCollection = source.spriteCollection; target.premultipliedAlpha = source.premultipliedAlpha; CopyArray(ref target.altMaterials, source.altMaterials); CopyArray(ref target.atlasMaterials, source.atlasMaterials); CopyArray(ref target.atlasTextures, source.atlasTextures); CopyArray(ref target.atlasTextureFiles, source.atlasTextureFiles); CopyArray(ref target.atlasTexturePaths, source.atlasTexturePaths); CopyArray(ref target.atlasWidthTexture, source.atlasWidthTexture); CopyArray(ref target.atlasHeightTexture, source.atlasHeightTexture); target.sizeDef.CopyFrom(source.sizeDef); target.globalScale = source.globalScale; target.globalTextureRescale = source.globalTextureRescale; target.physicsDepth = source.physicsDepth; target.physicsEngine = source.physicsEngine; target.disableTrimming = source.disableTrimming; target.normalGenerationMode = source.normalGenerationMode; target.padAmount = source.padAmount; target.innerPadAmount = source.innerPadAmount; target.autoUpdate = source.autoUpdate; target.editorDisplayScale = source.editorDisplayScale; // Texture settings target.filterMode = source.filterMode; target.wrapMode = source.wrapMode; target.userDefinedTextureSettings = source.userDefinedTextureSettings; target.mipmapEnabled = source.mipmapEnabled; target.asyncLoadEnabled = source.asyncLoadEnabled; target.anisoLevel = source.anisoLevel; target.forceA8 = source.forceA8; }
public void CopyFromSource() { this.obj.Upgrade(); // make sure its up to date textureParams = new List <tk2dSpriteCollectionDefinition>(obj.textureParams.Length); foreach (var v in obj.textureParams) { if (v == null) { textureParams.Add(null); } else { var t = new tk2dSpriteCollectionDefinition(); t.CopyFrom(v); textureParams.Add(t); } } spriteSheets = new List <tk2dSpriteSheetSource>(); if (obj.spriteSheets != null) { foreach (var v in obj.spriteSheets) { if (v == null) { spriteSheets.Add(null); } else { var t = new tk2dSpriteSheetSource(); t.CopyFrom(v); spriteSheets.Add(t); } } } fonts = new List <tk2dSpriteCollectionFont>(); if (obj.fonts != null) { foreach (var v in obj.fonts) { if (v == null) { fonts.Add(null); } else { var t = new tk2dSpriteCollectionFont(); t.CopyFrom(v); fonts.Add(t); } } } UpgradeLegacySpriteSheets(); var target = this; var source = obj; target.platforms = new List <tk2dSpriteCollectionPlatform>(); foreach (tk2dSpriteCollectionPlatform plat in source.platforms) { tk2dSpriteCollectionPlatform p = new tk2dSpriteCollectionPlatform(); p.CopyFrom(plat); target.platforms.Add(p); } if (target.platforms.Count == 0) { tk2dSpriteCollectionPlatform plat = new tk2dSpriteCollectionPlatform(); // add a null platform target.platforms.Add(plat); } target.assetName = source.assetName; target.loadable = source.loadable; target.maxTextureSize = source.maxTextureSize; target.forceTextureSize = source.forceTextureSize; target.forcedTextureWidth = source.forcedTextureWidth; target.forcedTextureHeight = source.forcedTextureHeight; target.textureCompression = source.textureCompression; target.atlasWidth = source.atlasWidth; target.atlasHeight = source.atlasHeight; target.forceSquareAtlas = source.forceSquareAtlas; target.atlasWastage = source.atlasWastage; target.allowMultipleAtlases = source.allowMultipleAtlases; target.spriteCollection = source.spriteCollection; target.premultipliedAlpha = source.premultipliedAlpha; CopyArray(ref target.altMaterials, source.altMaterials); CopyArray(ref target.atlasMaterials, source.atlasMaterials); CopyArray(ref target.atlasTextures, source.atlasTextures); target.useTk2dCamera = source.useTk2dCamera; target.targetHeight = source.targetHeight; target.targetOrthoSize = source.targetOrthoSize; target.globalScale = source.globalScale; target.physicsDepth = source.physicsDepth; target.disableTrimming = source.disableTrimming; target.normalGenerationMode = source.normalGenerationMode; target.padAmount = source.padAmount; target.autoUpdate = source.autoUpdate; target.editorDisplayScale = source.editorDisplayScale; // Texture settings target.filterMode = source.filterMode; target.wrapMode = source.wrapMode; target.userDefinedTextureSettings = source.userDefinedTextureSettings; target.mipmapEnabled = source.mipmapEnabled; target.anisoLevel = source.anisoLevel; }
public void CopyFrom(tk2dSpriteCollectionFont src) { active = src.active; bmFont = src.bmFont; texture = src.texture; dupeCaps = src.dupeCaps; flipTextureY = src.flipTextureY; charPadX = src.charPadX; data = src.data; editorData = src.editorData; }