cocos2dx 资源加密

总连接:http://cn.cocos2d-x.org/tutorial/show?id=2740

2dx的资源加密:http://cn.cocos2d-x.org/tutorial/show?id=2739 (代码加密)

tp打包加密:http://www.bubuko.com/infodetail-464835.html


tp批量打包的脚本编写:http://www.cnblogs.com/flyFreeZn/p/3587770.html



#!/bin/sh

#TOOL_NAME="TexturePacker.sh"
echo "--------------------------------------------------------------"
echo "Input the target directory path......"
read target_dir

echo "Target directory path:" $target_dir

echo "Finding directory and files..."

echo "Delete all exsit files(*.plist/*.ccz) in directory \"" $target_dir "\" ..."
find "$target_dir" -name "*.plist"  | xargs rm -f
find "$target_dir" -name "*.ccz"  | xargs rm -f



#生成的文件统一放入一个文件夹--$newDirectory flag=1
#生成的文件放在各自的文件夹--$newDirectory flag=0
flag=1

newDirectory="TPResult"
if [ $flag == 1 ]; then
    mkdir "$target_dir"/"$newDirectory"
else
    rm -rf "$target_dir"/"$newDirectory"
fi

totalCount=0
directoryCount=0
picFile="*.png"

filelist=
resultPath=

#处理目标文件夹中各个子文件夹中图片资源
function texturePackerWork() {
    if [ 1 == 1 ]; then

        filelist=`ls $1`
        echo "---$1---"
        for file in $filelist; do
            let "totalCount++"
            echo "---------" "$file" 
            if [ -d "$1"/"$file" ]; then
                
                let "directoryCount++"
                tempPath=$file

                echo $directoryCount ":Deal with file(.png) in  directory \"" $1/$file "\" ..."
                if [ $flag == 1 ]; then
                    resultPath="$target_dir"/"$newDirectory"
                else
                    resultPath="$1"/"$file"
                fi

                if ls $1/$file/$picFile >/dev/null 2>&1; then
                
                    pnglist=`ls $1/$file | grep .png`
                    for png in $pnglist; do
                  
                        TexturePacker  --smart-update \
                        --format cocos2d \
                        --data  "$resultPath"/`basename $png .png`.plist \
                        --sheet "$resultPath"/`basename $png .png`.pvr.ccz \
                        --dither-fs-alpha \
                        --premultiply-alpha \
                        --opt RGBA8888 \
                        --allow-free-size \
                        "$1"/"$file"/"$png"
                     
                    done
                fi

                texturePackerWork "$1"/"$file"

                echo "work down!"
            
            fi
        done
    fi
    return 0
}

#处理目标文件夹中散落的图片资源
function texturePackerOtherFiles() {
    if ls $target_dir/$picFile >/dev/null 2>&1; then

        echo "Deal with files in" $target_dir "..."
        tempPath=$target_dir

        if [ $flag == 1 ]; then
            resultPath="$target_dir"/"$newDirectory"
        else
            resultPath="$target_dir"
        fi

        pnglist=`ls $target_dir | grep .png`
        for png in $pnglist; do

            TexturePacker  --smart-update \
            --format cocos2d \
            --data  "$resultPath"/`basename $png .png`.plist \
            --sheet "$resultPath"/`basename $png .png`.pvr.ccz \
            --dither-fs-alpha \
            --premultiply-alpha \
            --opt RGBA8888 \
            --allow-free-size \
            "$target_dir"/$png
        
        done
    fi
    return 0
}

#打开目标文件夹
function openResultDirectory() {
    if [ $flag == 1 ]; then
        open "$target_dir"/"$newDirectory"
    else
        open "$target_dir"
    fi
}

texturePackerWork $target_dir
texturePackerOtherFiles
openResultDirectory

echo "Find files:" $totalCount
echo "Deal with directory:" $directoryCount

echo "All work finish down!"
echo "--------------------------------------------------------------"


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值