cocos2.x升级到3.x的脚本

sed.sh

if [ $# -lt 2 ]; then

    echo "Usage: $0 {替换的内容} {替换后的内容}";
    exit;

fi

foreachd()
{
    i=0;
    for file in $1/*;  do  
        if [ -d $file ]; then
            foreachd $file;
        elif [ -f $file ]; then
            echo $file;
            if [[ $file == *png ]]; then 
                $i=`expr $i + 1`;
                echo "$i";
                mv $file $2$i.png;
            fi  
        fi  
    done
}


#foreachd $1 $2;



find . -name "*.cpp" -exec sed -i -e "s/$1/$2/g" {} \;
find . -name "*-e" -exec rm {} \;

find . -name "*.h" -exec sed -i -e "s/$1/$2/g" {} \;
find . -name "*-e" -exec rm {} \;



执行命令(注意一定要在Class目录执行,避免替换引擎本身的代码


./sed.sh CCLabelTTF LabelTTF
./sed.sh CCLabelTTF LabelTTF
./sed.sh CCSize Size
./sed.sh CCAnimate Animate
./sed.sh sharedNotificationCenter getInstance
./sed.sh CCLabelBMFont LabelBMFont
./sed.sh ccYELLOW Color3B::YELLOW
./sed.sh Scale9Sprite ui::Scale9Sprite
./sed.sh spriteFrameByName getSpriteFrameByName
./sed.sh setFlipY setFlippedY
./sed.sh ccc4 Color4B
./sed.sh CCControlButton ControlButton
./sed.sh ccTouchBegan TouchBegan
./sed.sh StringUtils StringUtil
./sed.sh CCScale9Sprite CCScale9Sprite
./sed.sh CCScrollView ScrollView
./sed.sh CCControlEventTouchUpInside Control::EventType::TOUCH_UP_INSIDE
./sed.sh CCTouch Touch
./sed.sh CCEvent Event
./sed.sh CCSpriteFrameCache SpriteFrameCache
./sed.sh sharedSpriteFrameCache getInstance
./sed.sh CCTextureCache TextureCache
./sed.sh sharedTextureCache getInstance
./sed.sh ccTouch Touch
./sed.sh CCStringMake String             
./sed.sh (ccp( (Point(
./sed.sh CCSprite Sprite
./sed.sh CCNode Node
./sed.sh CCLayer Layer
./sed.sh CCObject Ref
./sed.sh CCTouch Touch
./sed.sh CCEvent Event
./sed.sh CCControlStateNormal Control::State::NORMAL
./sed.sh CCControlStateHighlighted Control::State::HIGH_LIGHTED
./sed.sh CCControlStateDisabled Control::State::DISABLED
./sed.sh CCControlEventTouchDown Control::EventType::TOUCH_DOWN
./sed.sh CCAction Action
./sed.sh ccp Point
./sed.sh CCSequence Sequence
./sed.sh CCMoveBy MoveBy
./sed.sh CCEaseOut EaseOut
./sed.sh CCPoint Point
./sed.sh CCCallFuncN CallFuncN
./sed.sh PointAdd ccpAdd
./sed.sh PointSub ccpSub
./sed.sh PointSub ccpSub
./sed.sh CCDirector::sharedDirector Director::getInstance
./sed.sh CCScene Scene


./sed.sh kCCProgressTimerTypeBar ProgressTimer::Type::BAR
./sed.sh CCRepeatForever RepeatForever
./sed.sh CCString __String

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...