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原文链接:https://www.f2er.com/cocos2dx/343837.html