总连接: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 "--------------------------------------------------------------"