コード例 #1
0
    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);
    }
コード例 #2
0
    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);
        }
    }