public bool PreViewAtlas(out Texture2D outTex) {//预览Atlas bool bRet = false; outTex = null; if (m_Project == null) { return(false); } if (m_Project.GetAllSprites().Count != 0) {//存在纹理资源 //预览 UIAtlasOperateUtility.GetInstance().MakeCurrentAtlasTexture(m_Project, out outTex); bRet = true; } else {//不存在 //设定失败类型为小图不存在 m_Project.ProjectFailedType = PROJECT_ERROR_TYPE.PROJECT_ERROR_NONE_IMAGE; bRet = false; } return(bRet); }
public bool MakeAtlas() {//生成Atlas bool bRet = true; //Texture2D atlasTexture = null; if (m_Project == null) { m_Project.ProjectFailedType = PROJECT_ERROR_TYPE.PROJECT_ERROR_NONE_PROJECT; bRet = false; } else { if ((m_Project.AtlasSavePath != null) && (m_Project.AtlasSavePath.Contains("Assets/"))) {//Atlas输出路径合法 //string outputPath = m_Project.AtlasSavePath + m_Project.Name + ".prefab"; AtlasItemInfo atlasItem = new AtlasItemInfo(); atlasItem.Project = m_Project; ////生成Atalas //UIAtlasOperateUtility.GetInstance().MakeCurrentAtlasTexture(m_Project, out atlasTexture); //atlasItem.AtlasTextureBak = atlasItem.AtlasTexture = atlasTexture; //m_Project.MakeAtlasTexture(tex, textures); //生成prefab UIAtlasOperateUtility.GetInstance().MakeCurrentAtlasPrefab(atlasItem); UIAtlasOperateUtility.GetInstance().MakeCurrentAtlasPng(atlasItem); //m_Project.MakeAtlasPrefab(outputPath); bRet = true; } else {//Atlas输出路径不合法 bRet = false; m_Project.ProjectFailedType = PROJECT_ERROR_TYPE.PROJECT_ERROR_ATLASOUTPU_PATH; } } if (onMakeAtlasCommand != null) { onMakeAtlasCommand(bRet); } return(bRet); }
public void ZoomSpriteImage(string path, float scaleFactor) {//小图缩放比例变更 if (m_Project == null) { return; } AtlasItemInfo atlasItem = new AtlasItemInfo(); atlasItem.Project = m_Project; //UIAtlasTempTextureManager.GetInstance().ZoomTexture(path, scaleFactor); UIAtlasOperateUtility.GetInstance().ZoomSpriteFromProject(path, scaleFactor, ref atlasItem); m_Project.SetSpriteImageZoom(path, scaleFactor); if (onSpriteZoomChangedCommand != null) { onSpriteZoomChangedCommand(path); } }