【shell】Linux命令文件分离之SeparatePackageTool.sh

echo "-----分离海外版本res资源开始-----"
rm -rf resFenli
mkdir resFenli
mkdir resFenli/font
mkdir resFenli/image
mkdir resFenli/image/ui
mkdir resFenli/language

mkdir resFenli/music
mkdir resFenli/particle
mkdir resFenli/particle/develop
mkdir resFenli/shader
mkdir resFenli/sound
mkdir resFenli/ui
mkdir resFenli/ui/common
mkdir resFenli/ui/develop
mkdir resFenli/ui/server

cp res/font/arts.ttf resFenli/font/arts.ttf
cp res/font/system.ttf resFenli/font/system.ttf


cp res/image/bg.plist resFenli/image/bg.plist

if [ -f "res/image/bg.png" ]; then
    cp res/image/bg.png resFenli/image/bg.png
fi    

if [ -f "res/image/bg.pkm" ]; then
    cp res/image/bg.pkm resFenli/image/bg.pkm
fi

cp res/image/loading.plist resFenli/image/loading.plist
cp res/image/loading.png resFenli/image/loading.png
cp res/image/text_icon.plist resFenli/image/text_icon.plist
cp res/image/text_icon.png resFenli/image/text_icon.png
cp res/image/prop_icon.plist resFenli/image/prop_icon.plist
cp res/image/prop_icon.png resFenli/image/prop_icon.png

cp res/image/ui/bottom_tips.png resFenli/image/ui/bottom_tips.png
cp res/image/ui/common2.plist resFenli/image/ui/common2.plist
cp res/image/ui/common2.png resFenli/image/ui/common2.png

cp -R res/language resFenli/

cp res/music/login_bgm.mp3 resFenli/music/login_bgm.mp3

cp res/particle/develop/logo.plist resFenli/particle/develop/logo.plist
cp res/particle/develop/logo.png resFenli/particle/develop/logo.png

#将res下整个shader文件夹放到resFenli下面
cp -R res/shader resFenli/

cp res/sound/ui_button_click.mp3 resFenli/sound/ui_button_click.mp3

cp -R res/ui/common resFenli/ui
cp -R res/ui/develop resFenli/ui
cp -R res/ui/server resFenli/ui
cp res/ui/new_loading.csb resFenli/ui/new_loading.csb
cp res/ui/new_update.csb resFenli/ui/new_update.csb

echo "-----删除原先res资源-----"

rm -rf res

echo "-----将临时文件resFenli重命名为res-----"

mv resFenli res

echo "-----分离海外版本res资源完成-----"
 

版本2:新增Android和IOS控制不同的包体积大小

read -p "输入平台(Android, IOS):" platform
while [ true ]; do
    if [ $platform = "Android" ]; then
        break
    elif [ $platform = "IOS" ]; then
        break
    else
        read -p "输入错误请重新输入平台(Android, IOS):" platform
    fi 
done

echo "-----分离海外版本res资源开始-----"
rm -rf resFenli
mkdir resFenli
mkdir resFenli/font
mkdir resFenli/image
mkdir resFenli/image/ui
mkdir resFenli/language

mkdir resFenli/music
mkdir resFenli/particle
mkdir resFenli/particle/develop
mkdir resFenli/shader
mkdir resFenli/sound
mkdir resFenli/ui
mkdir resFenli/ui/common
mkdir resFenli/ui/develop
mkdir resFenli/ui/server

cp -R res/font resFenli/

#拷贝cg动画和skip资源

cp overseaRes/skip.png resFenli/image/skip.png

cp -R overseaRes/video resFenli/


#
cp res/image/loading04.plist  resFenli/image/loading04.plist 
if [ -f "res/image/loading04.png" ]; then
    cp res/image/loading04.png resFenli/image/loading04.png
fi    

if [ -f "res/image/loading04.pvr.ccz" ]; then
    cp res/image/loading04.pvr.ccz resFenli/image/loading04.pvr.ccz
fi    


cp res/image/bg.plist resFenli/image/bg.plist
if [ -f "res/image/bg.png" ]; then
    cp res/image/bg.png resFenli/image/bg.png
fi    

if [ -f "res/image/bg.pkm" ]; then
    cp res/image/bg.pkm resFenli/image/bg.pkm
fi

if [ -f "res/image/bg.pvr.ccz" ]; then
    cp res/image/bg.pvr.ccz resFenli/image/bg.pvr.ccz
fi


cp res/image/loading.plist resFenli/image/loading.plist
if [ -f "res/image/loading.png" ]; then
    cp res/image/loading.png resFenli/image/loading.png
fi

if [ -f "res/image/loading.pvr.ccz" ]; then
    cp res/image/loading.pvr.ccz resFenli/image/loading.pvr.ccz
fi


cp res/image/text_icon.plist resFenli/image/text_icon.plist
if [ -f "res/image/text_icon.png" ]; then
    cp res/image/text_icon.png resFenli/image/text_icon.png
fi

if [ -f "res/image/text_icon.pvr.ccz" ]; then
    cp res/image/text_icon.pvr.ccz resFenli/image/text_icon.pvr.ccz
fi


cp res/image/prop_icon.plist resFenli/image/prop_icon.plist
if [ -f "res/image/prop_icon.pvr.ccz" ]; then
    cp res/image/prop_icon.pvr.ccz resFenli/image/prop_icon.pvr.ccz
fi

if [ -f "res/image/prop_icon.png" ]; then
    cp res/image/prop_icon.png resFenli/image/prop_icon.png
fi


cp res/image/ui/bottom_tips.png resFenli/image/ui/bottom_tips.png


cp res/image/ui/common2.plist resFenli/image/ui/common2.plist
cp res/image/ui/common2.png resFenli/image/ui/common2.png

cp -R res/language resFenli/

cp res/music/login_bgm.mp3 resFenli/music/login_bgm.mp3

cp res/particle/develop/logo.plist resFenli/particle/develop/logo.plist
cp res/particle/develop/logo.png resFenli/particle/develop/logo.png

#将res下整个shader文件夹放到resFenli下面
cp -R res/shader resFenli/

cp res/sound/ui_button_click.mp3 resFenli/sound/ui_button_click.mp3

cp -R res/ui/common resFenli/ui
cp -R res/ui/develop resFenli/ui
cp -R res/ui/server resFenli/ui
cp res/ui/new_loading.csb resFenli/ui/new_loading.csb
cp res/ui/new_update.csb resFenli/ui/new_update.csb


if [ $platform = "Android" ]; then
    echo "-----新增拷贝Android资源保持到100M左右-----"

    cp -R res/image resFenli/
    cp -R res/particle resFenli/
    rm -rf resFenli/image/sea
    rm -rf resFenli/image/ship

elif [ $platform = "IOS" ]; then
    echo "-----新增拷贝IOS资源保持包在85M左右-----"
    cp -R res/image resFenli/
    cp -R res/particle resFenli/

    rm -rf resFenli/image/sea
    rm -rf resFenli/image/ship

    rm -rf resFenli/image/battle
    rm -rf resFenli/image/ship_big
    rm -rf resFenli/image/ship_small
    rm -rf resFenli/image/weather
    # rm -rf resFenli/particle/buff   #不注释的话, 包再增加4.2M左右

else
    echo "有异常!"
    exit 0
fi

echo "------删除原先res资源-----"

rm -rf res

echo "-----将临时文件resFenli重命名为res-----"

mv resFenli res

echo "-----分离海外版本res资源完成-----"
 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值