版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
{return0;intmaxNum=for(inti=0;i<lArr-{CCArray*cArray=((CCArray*)starArray->objectAtIndex(i));introwlength=cArray->count();if(rowlength>maxNum)maxNum=rowlength;}return}{pauseLayer=NULL;disY=0;disX=persent=mScore=levelTarget=levelNum=1;cdiCount=0;cdiAll =0;myCD=0;myCDper=0;isSeemClear=false;isCantouch=true;isTouch=false;yIsMove=false;isCanRemove=true;isAddLayer=true;gamedata->gnext y=false;surplusNum=0;removeSurplusCount=stageSize=CCDirector::sharedDirector()->getWinSize();floatwidthSize;floatwidthSize=stageSize.width;heightSize=stageSize.height;{floatt=widthSize;widthSize=heightSize;heightSize=t;}{disY=disX=fabs((widthSize-}gapX=gapY=99;stagger=gapY/2;startX=30+disX;startY=disY;col=row=starArray=newCCArray();selectedArray=newCCArray();checkArray=newCCArray();}{}void{}bool{CCTexture2D*starTexturebatchNode=CCSpriteBatchNode::createWithTexture(starTexture);mScorelevelNum=levelTarget=(levelNum-1)*2000 elseif(levelNum<14)levelTarget=(levelNum-
levelTarget=(levelNum- intdInt=for(intj={dInt (j-2)/3*}levelTarget=(levelNum-1)*2000+1000+dInt;CCLOG("levelTarget=%d",levelTarget);{}CCSprite*pauseBtnNormal=CCSprite::create("pauseBtnNormal.png");ScaleItem*pauseBtn= ItemSprite*pauseBtn =CC - - - ;
inthigttt=CCSprite*topsp=CCSprite::create("level Scale*topkBtn= CCSprite*topsp1=CCSprite::create("level Scale*topkBtn1 /*CCSprite*topsp2=CCSprite::create("level_shop.png");ScaleItem*topkBtn2= 2t=CC intmyCoin=useDefault->getIntegerForKey("MYDIAMOND",0);charcstr[64];mydiamond=new "fontsdiamond.png",19,24,'0'); sprintf(cstr,"%d",myCoin);intmyWeidou=useDefault->getIntegerForKey("MYWEBEAN");charwdstr[64];myweidou=new ","fonts_diamond.png",19,24,'0'); sprintf(wdstr,"%d",myWeidou);oldNum=myCoin;inthig =100;int =-int =/*CCSprite*pugong=CCSprite::create("pugong.png"); CCSprite*pugong=CCSprite::create("pugong.png");pugongProgress1= (1,mmemitter1 memitter1- memitter1-memitter1-//starBlast0= memitter1 //memitter1- chars1str[16];s1Btn= if(gamedata->petdata.skills1==0)chars2s2Btn= if(gamedata->petdata.skills2==0)chars3s3Btn= if(gamedata->petdata.skills3==0)charsr1str[16];sr1Btn= if(useDefault->getIntegerForKey("SKILL1")==0)charsr2sr2Btn= if(useDefault->getIntegerForKey("SKILL2")==0)charsr3sr3Btn= if(useDefault->getIntegerForKey("SKILL3")==0)charstrbzBtn= Skill CCSprite*petsk= CCSprite*petsk2= CCSprite*petsk3= CCSprite*petsk4= CCSprite*petsk5= CCSprite*petsk6= CCSprite*petsk7= ;isTimeOver=true;isRunTime=true;fRunTime=mytime=new ","fonts_time.png",36,40,'.'); charcScore[20];return}voidGameLayer::runTimeVoice(float{ }voidGameLayer::runTime(float{{if(fRunTime<={{isTimeOver=}}if(fRunTime<={fRunTime=
}{}
fRunTime=fRunTime-char}}voidGameLayer::healthBarLogic(MYTYPEtype,int{switch{caseecurHP=ecurHP-iattack;mcurHP=m_curHP-iattack;caseecurHP=e_curHP-iattack;casemcurHP=m_curHP-iattack;casePET//mcurHP=mcurHP+mcurHP=mcurHP+(mcurHP*0.15);{m_curHP=m_totalHp-}caseENEMY//ecurHP=ecurHP+ecurHP=ecurHP+(ecurHP*0.15);{e_curHP=e_totalHp-}}healthProgress2->setPercentage(((float)ecurHP/(float)etotalHp)*100);*/ rogressTo::create(0.3f,100*mcurHP/mtotalHp),CCCallFunc::create(this,callfuncselector(GameLayer::addOverLayer)),NULL)); rogressTo::create(0.3f,100*ecurHP/etotalHp),CCCallFunc::create(this,c}void{floatovertime=if(e_curHP<=0&&{ isAddLayer={}
{}
petshadow2->setVisible(false);}if(m_curHP<=0if(m_curHP<=0&&{ isAddLayer=this->unschedule(scheduleselector(GameLayer::EnemyAttack));{}
{}
petshadow->setVisible(false);}}獲取本 數(shù)據(jù)函數(shù)接voidGameLayer::getJsonData(constchar{CSJson::Readerreader;CSJson::Valueroot;CSJson::Valuedatas;if(reader.parse(data,root)){}}void{petpet=newcharstr[16]= pet->runAction(CCMoveBy::create(0.01,(-eate(0.5,(250,0)),CCCallFunc::create(this,callfunc_selector(GameLayer::onTenemy=newrole();charstr_e[16]={0};{}{}
enemy->initWithFile(strenemy->initWithFile(str petshadow=CCSprite::create("pet petshadow2petshadow2=CCSprite::create("petpetshadow2- xue1=xue1= {CCSprite*gamexingxing2=CCSprite::create("game_xingxing2.png");gamexingxing2->setPosition( }intpetTpyeNum=gamedata->petdata.type;for(inti=0;i<petTpyeNum;i++){CCSprite*gamexingxing1=CCSprite::create("game_xingxing1.png");gamexingxing1->setPosition( }CCLabelAtlas*myLV1=newCCLabelAtlas();charmyLVstr[16];sprintf(myLVstr,"-./%d",gamedata-myLV1->initWithString(myLVstr,"fonts_dengji.png",17,25,'-'); charstrCCSprite*hp1=CCSprite::create("xuetiao2.png");healthProgress1=rogressTimer::create(hp1); (1,0)); CCSprite*xue3 //CCSprite*xuecao2= dxue1=CCSprite::create("xuetiao1.png"); for(int{CCSprite*gamexingxing2=CCSprite::create("game_xingxing2.png");gamexingxing2->setPosition( }intenemyTpyeNum=gamedata->enemydata.type;for(inti=0;i<enemyTpyeNum;i++){CCSprite*gamexingxing1=CCSprite::create("game_xingxing1.png");gamexingxing1->setPosition( }CCLabelAtlas*myLV2=newCCLabelAtlas();charmyLV2_str[16];sprintf(myLV2sprintf(myLV2str,"-./%d",gamedata- CCSprite*hp2=CCSprite::create("xuetiao2.png");healthProgress2=rogressTimer::create(hp2); (1,0)); CCSprite*dxue3 mcurHP =gamedata->petdata.hp;mtotalHp=gamedata->petdata.hp;ecurHP =gamedata->enemydata.hp;e_totalHp=gamedata->enemydata.hp;{randtype1=rand()%5;CCLOG("========randtype1%d",randtype1);}while(randtype1==gamedata->petdata.skills1-{randtype2=}while(randtype2==gamedata->petdata.skills1-1||randtype2==randtype1);{randtype3=}while(randtype3==gamedata->petdata.skills1-1||randtype3==gamedata->petdata.skills2-1||randtype3==randtype1);}voidGameLayer::update(float{{petshadow->setPosition( }{petshadow2->setPosition((enemy->getPositionX(),enemy->getPosition } CCLOG("pugongProgress1->getContentSize().x%f",pugongProgress1->ge{ition())%f",starBlast0->getParent()->convertToWorldSpace(starBlast0->getPmemitter1->setPosition(starBlast0->convertToWorldSpace(starBlast0->g}敵 {}voidGameLayer::s1Callback(CCObject*{}voidGameLayer::s2Callback(CCObject*{pet->attackRole(PETFAR);}voidGameLayer::s3Callback(CCObject*{pet->attackRole(PETNEAR);}寵物技 函voidGameLayer::petSkill(inttype,bool{CCLOG("type%d",type);if(type==0){}{
{intif(type==1||type=={}{}
iattack=gamedata-iattack=gamedata-if(type=={}{}
if(type==1||type=={}if(type==3||type=={}if(type=={ -}if(type=={}}{intif(type==1||type=={}{}
iattack=gamedata-iattack=gamedata-if(type=={}{}
if(type==1||type=={}if(type==3||type=={}if(type=={ }if(type=={,ENEMY}}}switchswitch{casecasecasecasecase }if(type==5||type=={}{}
}voidGameLayer::beHit(float{ }{}{}{}{ gamedata->g_icatch=rand()%100;{}{
this->scheduleOnce(scheduleselector(GameLayer::fightOver),2.5f);this->schedule(schedule}}void{isCantouch=false;}void{ isCantouch=true;this->schedule(scheduleselector(GameLayer::EnemyAttack),}voidGameLayer::fightOver(float{this->unschedule(scheduleselector(GameLayer::EnemyAttack));if(fRunTime<={ }}voidGameLayer::fightWjmsWin(float{fRunTime=120;this->schedule(scheduleselector(GameLayer::EnemyAttack),isRunTime=true;isAddLayer=true; (-callfuncselector(GameLayer::onTouch)),NULL));mcurHP =gamedata->petdata.hp;mtotalHp=gamedata->petdata.hp;ecurHP =gamedata->enemydata.hp;e_totalHp=gamedata->enemydata.hp;petshadow2->setVisible(true);if(gamedata->g_ilevel=={ }if(gamedata->g_ilevel=={ }if(gamedata->g_ilevel=={ }//enemy=newrole();charstr_e[16]={0};{}{}
}voidGameLayer::fightWjmsLost(float{}{petshadow2->setVisible(false);CatchLayer*CatchLayer=CatchLayer::create();}{{WinLayer*WinLayer=WinLayer::create();}{LostLayer*LostLayer=LostLayer::create();}voidGameLayer::heroSkill(int {switch{case0case1if(gamedata->petdata.skills2=={}{
switch{casecasecase}}-case2://同色消除isSeemCleartrue;for(inti=0;i<starArray-{for{Star*star=}}-case3://延長10fRunTime=fRunTime+case4{isCantouch=false;}case}case case6://3個技能CD{-}casecase}}void { #if(CC TFORM== TFORM#elif(CC TFORM== {//pauseLayer= //isTouch=/*CCDirector*pDirector=CCDirector::sharedDirector();CCScene*pScene=LevelScene::scene();CCTransitionFade*transtion= isRunTime=false;PauseLayer*PauseLayer=PauseLayer::create();}//CCDirector*pDirector=//CCScene*pScene=//////CCTransitionFade*transtion= }voidGameLayer::overPause(CCObject{ isRunTime=this->schedule(scheduleselector(GameLayer::EnemyAttack),}void NextCallback(CCObject*{#if(CC TFORM== TFORM#elif(CCTARGET TFORM==CC_ = -CCNode*node1=this->getChildByTag(kBonus);CCNode*node2=this->getChildByTag(kBonusTTF);CCNode*node3=this->getChildByTag(kBlockRemaing);CCNode*node4=this->getChildByTag(kBrTTF);}voidvoid{SaveCallback(CCObject* CCDirector*pDirector=CCSceneCCScene*pSceneCCTransitionFade*transtion= voidGameLayer::getCardNumber(float{}voidvoid{/*CCSprite*sprite CCAnimation*animation=CCAction*action=}voidvoid{char
ointpoint,intCCSprite*sprite=CCSprite::createWithSpriteFrameName(name);CCAnimation*animation=CCAction*action CCSprite*msprite=CCSprite::create();msprite->setPosition(point);articleSystemQuad*memitter=memitter->setPosition( CCLOG("starType%d",type);memitter->setStartColor(setMyParticleColor(type));articleSystemQuad*memitter1=memitter1-memitter1->setStartColor(setMyParticleColor(type));floatdelaytime={msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,s1Btn->ge}elseif(type==gamedata->petdata.skills2-{msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,s2Btn->ge}elseif(type==gamedata->petdata.skills3-{msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,s3Btn->ge}{msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,(pugon}/*if(gamedata->petdata.skills2==0&&gamedata->petdata.skills3=={if(type==randtype1||type== {msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,(pugon}}elseif(gamedata->petdata.skills3=={if(type==randtype1 type==randtype3{msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,(pugon}}elseif(type!=gamedata->petdata.skills1-1&&typegamedata->petdata.skills2-1&&type!=gamedata->petdata.skills3-{msprite->runAction(CCSequence::create(CCMoveTo::create(0.4,(pugon} CD函void{} CD函void{myCD=myCD+cdCur;myCD=if(myCDper==if(myCDper=={myCD=myCDper}CCLOG("myCD%d",100*myCD/cdTotal);myCDper=100*myCD/cdTotal;CCActionInterval*action_progress_to= memitter1->runAction(CCMoveTo::create(1.0f,(-pugongProgress1->g3f),action_progress_to,}{ccColor4Fswitch{ccColor4Fswitch{case0c4=case1c4=case2c4=case3c4=case4c4 }return}CCAnimation*GameLayer::animationWithSingleFrames(constchar*name,intcount,floatdelay){CCSpriteFrameCache*cache=CCArray*animFrames=newcharfor(intk=0;k<count;{sprintf(str,"%s%04d.png",name,CCSpriteFrame*frame=cache->spriteFrameByName(str);}CCAnimation*animation=CCAnimation::createWithSpriteFrames(animFrames,delay);return} Android返回鍵void{#if(CC TFORM== TFORM#elif(CC TFORM== CCLOG("GameMain::keyBackClicked");{pauseLayer=PauseLayer::create(); }{}}
isTouch=CCDirector*pDirector=CCDirector::sharedDirector();CCScene*pScene= CCTransitionFade*transtion=CCTransitionFade::create(1,pScene); Android菜單鍵 Android菜單鍵void{}{isCantouch=boolboolGameLayer::ccTouchBegan(CCTouch*pTouch,CCEvent{{ointlocation=pTouch-intdX;int//CCLOG("locationX=%f,locationY=%f",location.x,location.y);dX=(location.x-startX)/gapX;dY=(dX%2)?(location.y-startY-80)/gapY:(location.y-Star*star=getStarInArray(dX,dY);returnbooltoRemove=checkInSelectedArray(dX,dY);{}{}
//intremoveCount=selectedArray-//mScore+=//char Target=(levelNum- return{ resultCount={intremoveCount=selectedArray->count();mScore+=removeCount*removeCount*5;charcScore[20];//levelzTarget=(levelNum-1)*2000 for(inti=0;i<starArray-{for{Star*star=}}}isSeemClear=/*isCantouch=}{}
}{ resultCount={//intremoveCount=selectedArray-//mScore+=//char Target=(levelNum- }{}}}
return}{isCanRemove=}{ointlocation;{}
isCanRemove=location intdX;intdX=(location.x-dY=(dX%2)?(location.y-startY-80)/gapY:(location.y-Star*star=getStarInArray(dX,dY);booltoRemove=checkInSelectedArray(dX,dY);{}{}
//intremoveCount=selectedArray-//mScore+=//char Target=(levelNum- intresultCount=checkOn(dX,dY,false,false);{}{}
//intremoveCount=selectedArray-//mScore+=//char Target=(levelNum- }voidGameLayer::runScoreProgress(unsignedintscore,unsignedint{CCLOG("persent=%f",persent);persent=rogressTo*to }bool{boolfor(inti=0;i<starArray-{for(intj=0;j<((CCArray*)starArray->objectAtIndex(i))-{intnCount=for(intk=0;k<checkArray-{Star*star=(Star*)checkArray->objectAtIndex(k);}if(nCount>1)return}}return}intGameLayer::checkOn(inti,intj,boolisChecked,bool{returnStar*starL=NULL;Star*starR=NULL;Star*starT=NULL;Star*starB=NULL;Star*starLT=NULL;Star*starRT=NULL;Star*starLB=NULL;Star*starRB=intcount=Star*star=getStarInArray(i,j);returnstar->isChecked=true;{}{}
nowType=star-{starL=getStarInArray(i-1,j);{if(starL->type==nowType&&!starL-{}}}
{starB=getStarInArray(i,j-1);{if(starB->type==nowType&&!starB-{}}
}{starR=getStarInArray(i+1,j);{if(starR->type==nowType&&!starR-{}}
}{starT=getStarInArray(i,j+1);{if(starT->type==nowType&&!starT-{}}}{{starLT=getStarInArray(i-1,j+1);{if(starLT->type==nowType&&!starLT-{}}}if(i<starArray->count()-1&&{starRT=getStarInArray(i+1,j+1);{if(starRT->type==nowType&&!starRT-{}}}}{if(i>0&&{starLB=getStarInArray(i-1,j-1);{if(starLB->type==nowType&&!starLB-{}}}if(i<starArray->count()-1&&{starRB=getStarInArray(i+1,j-1);{if(starRB->type==nowType&&!starRB-{}}}}return}boolGameLayer::checkInSelectedArray(inti,int{returnfalse;Star*star=for(intk=0;k<selectedArray-{{return}}return}{{{for(inti=0;i<selectedArray-{Star*star=(Star*)selectedArray-star->isChecked=}/*isCantouch=}/*isCantouch=/}{{ charconstchar*rewardStringunsignedintstarNum=CCScaleTo*scaleTo=CCAction*actionfor(intstarI={Star*starCCMoveBy*moveBy=CCActionInterval*action//star->isChecked=}}}void{//intrCount=//CCSprite*praise= praise=//else praise=//else praise=//if(praise!= CCActionInterval*scaleTo= CCAction*action= cdiCount=0; =popangNum=0;floatstarNum=0;CCDelayTime*for(intstarI={Star*star={starType=star-delayTime=CCDelayTime::create(starNum*0.05f);CCSpawn*spawnAction=CCAction*action= }}isCantouch=cdcdiAll=cd s1Btn->setCDTime(gamedata->petdata.skills1,starType,6,cdiAll);s2Btn->setCDTime(gamedata->petdata.skills2,starType,9,cdiAll);//CCLOG("cd_all{{ } {}
{}
for(intstarI={//Star*star}/*floatdelayTime=0;delayTime=}voidGameLayer::moveXPos(float{for(inti=0;i<starArray-{for(intj=0;j<((CCArray*)starArray->objectAtIndex(i))-{Star*star=getStarInArray(i,j);}}}void y1(float{}void y2(float{}void y3(float{}voidvoid{/*CCLayerColor*overLayer=CCLayerColor::create(ccc4(0,0,0,210));CCSprite*goSprite= CCMoveTo*moveTo= CCAction*overToShowScore=CCSequence::create(#if(CC TFORM== TFORM#elif(CC TFORM== }void{/*CCLayerColor*goSprite= -ScoreLayer*scoreLayer=ScoreLayer::create();charscoreCS[20];unsignedintmaxScore=if(mScore>maxScore)maxScore= /*const strings.xml").cstr())->valueForKey("input_name"); }void{}{ankstrings.xml").cstr());//CCControlButton* }void{ for(inti=0;i<starArray-{{Star*star=getStarInArray(i,j);CCDelayTime*delayTime;delayTime=CCDelayTime::create(4*0.5f);CCSpawn*spawnAction=CCAction*action= }}//intnoStar//for(inti=0;i<starArray- Star*star= CCDelayTime*delayTime delayTime= delayTime= CCSpawn*spawnAction= CCAction*action }voidGameLayer::removeStar(CCNode*{}{Star*star=}{Star*star=charchar //if(removeSurplusCount== addScore=2000-//addScore=addScore<=0?//char//CCLabelTTF*bonusTTF=(CCLabelTTF*)this-//CCSpriteBatchNode*batchNode=//for(inti= CCSprite*sprite= CCJumpBy*jumpBy 00-100),CCRANDOM01()*200+200,1); CCAction*action= }void{CCSprite*sprite=(CCSprite*)this-CCLayer*targetLayerCCLayer*targetLayer=//CCSprite*targetBar CCLabelAtlas*lvTTf= CCLabelAtlas*targetTTf= ; CCScaleTo*scaleTo=CCAction*action= intdInt=for(intj={dInt (j-2)/3*}levelTarget=(levelNum-1)*2000+1000+dInt;charlevelStr[10];charcScore[20];persent=(float)mScore/levelTarget;persent=for(inti=0;i<col;i++){CCArray*array=newCCArray();for(intj=0;j<row;j++){Star*box }{box- }box->type=theType;{CCMoveTo*moveTo= }{
CCMoveTo*moveTo } }}{}}void yEffect(CCNode*pTarget,void*{ void{yIsMove=intremoveXIndex=0;intstartX=0;for(inti=0;i<starArray-{{if(removeXIndex==0)}}{for(inti=0;i<starArray-{for(intj{Star*star=getStarInArray(i,j);{}}}}boolcanClear=checkCanClear();{surplusNum=unsignedintaddScore=for(inti=0;i<starArray-{}if(surplusNum<addScore=2000-surplusNum*surplusNum*20;removeSurplusCount=0;mScore+=addScore;charcScore[20];//CCSprite*Bonus= //CCLabelTTF*bonusTTF=CCLabelTTF::create("2000","TimesNew //CCSprite*blockRemaing //CCLabelTTF*brTTF=CCLabelTTF::create("0","TimesNew if(mScore>={#if(CC TFORM== TFORM#elif(CCTARGET TFORM==CC }{
action1=CCBlink::create(2,5);for(inti=0;i<starArray->count();i++){for(intj={Star*star=}}intaddScore=2000-surplusNum*surplusNum*20;addScore=addScore<=0?0:addScore;charcScore[20];CCAction*action=}{isTouch=false}}}voidvoid{/*CCSprite*passSprite CCScaleTo*scaleTo=CCScaleTo::create(0.8f,1);CCAction*scaleAction=;CCSprite*nextBtnNormal=CCSprite*nextBtnSelected= ItemSprite*nextBtn CCSprite*saveBtnNormal=CCSprite*saveBtnSelected= ItemSprite*saveBtn =CC - - - intintmoveNum=voidGameLayer::starToMoveY(Star*star,inti,intj{ ointpointyIsMove=true;CCDelayTime*delayTime=CCDelayTime::create(0.1f);CCActionInterval*moveTo=CCMoveTo::create(0.1f,point);CCMoveBy*moveBy=CCMoveBy::create(0.05f, CCActionInterval*action=}voidGameLayer::starToMoveX(Star*star,inti,intj{ointpoint CCActionInterval*moveTo=CCMoveTo::create(0.1f,point);CCMoveBy*moveBy=CCMoveBy::create(0.05f, CCAction*action=}void{{isTouch=true}}voidGameLayer::onExit(){}Star*GameLayer::getStarInArray(inti,int{returnNULL;CCArray*sArray=(CCArray*)starArray->objectAtIndex(i);if(j<sArray->count()){Star*star=(Star*)sArray->objectAtIndex(j);returnstar;}return}CCRect{CCRectrect;intnum;num=rand()%5;{caserect=start0Rect;theType=0;caserect=start1Rect;theType=1;caserect=start2Rect;theType=2;caserect=start3Rect;theType=3;caserect=start4Rect;theType=4;}//if(gamedata->petdata.skills2==0&&gamedata->petdata.skills3== num case case rect= theType= case rect= theType= //elseif(gamedata->petdata.skills3=={case{casecasecaserect=theType=caserect=theType=} num={caserect=theType=caserect=theType=case2:rect=theType=caserect=theType=caserect=theType= return}CCRectGameLayer::getRectType(int{CCRect{caserect=start0Rect;caserect=start1Rect;caserect=start2Rect;caserect=start3Rect;caserect=start4Rect;}return}intGameLayer::getTheType(int{switch{casetheType=0;casetheType=1;casetheType=2;casetheType=3;casetheType=4;}return}void{for(inti=0;i<col{CCArray*array=(CCArray*)starArray->objectAtIndex(i);if(!array){array=new}for(intj=0;j<row{if(j>=array->count()){Star*box=box->type=ointpoint CCMoveTo*moveTo= }}}}voidGameLayer::addGameScore(int{}
gamedata->g_myScore=gamedata-{charstr[16]=sprintf(str,CCDictionary*pDic;stringjson;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");json=pDic->valueForKey(str)->m_sString;std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"/petdata.xml";pDic=json=pDic->valueForKey(str)-}return;CSJson::Readerreader;CSJson::Valueroot;return;for(int{}}{charstr[16]=sprintf(str,"pet%d",pettype);stringif(CC TFORM== TFORMfilePath=path+}unsignedchar*pBuffer=NULL;unsignedlongbufferSize=0;pBuffer=CCFileUtils::sharedFileUtils()->getFileData(filePath.c_str(),"r+",pBuffer[bufferSize-1]=tinyxml2::XML*pDoc=newtinyxml2::XML();if(pBuffer){pDoc-} e=pDoc->Roo //跟節(jié)點(diǎn)的第一個字節(jié)點(diǎn)XMLElement*lis e=roo XMLElement*dic e=lis //dict下面的子節(jié)點(diǎn) e=lis } tinyxml2::XMLElement*listChildNode= e- listChildNode= e-}dice=dice-}}void{charstr[16]=sprintf(str, gamedata->gCCDictionary*pDic=CCDictionary::createWithContentsOfFile("enemydata.xml");stringjson=pDic->valueForKey(str)->m_sString;return;CSJson::Readerreader;CSJson::Valueroot;returnfor(int{}}voidGameData::savePetExp(int{CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];body[0]["exp"]=gamedata->g_petExp;stringjStr= charstr[16]= sprintf(str, CCDictionary*pDic= CCDictionary*pDic= std::stringpath=CCFileUtils::sharedFileUtils()- std::stringdoc=path+ charstr[16]=sprintf(str,"pet%d",pettype);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"petdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}voidGameData::saveDefault(int{/*CCDictionary*pDic=CCDictionary::create();std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"/petdata.xml";CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];stringjStr= charstr[16]= sprintf(str, CCDictionary*pDic= CCDictionary*pDic= std::stringdoc=path+ charstr[16]=sprintf(str,"pet%d",pettype);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"petdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}{/*CCDictionary*pDic=CCDictionary::create();std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"/petdata.xml";stringpetname=gamedata->;intpetpicture=gamedata->petdata.picture,pettype=gamedata->petdata.type,petlevel=gamedata->petdata.level,pethp=gamedata->petdata.hp,petap=gamedata->petdata.ap,petmp=gamedata->petdata.mp,petexp=gamedata->petdata.exp,petskills1=gamedata->petdata.skills1,petskills2=gamedata->petdata.skills2,petskills3=gamedata-CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];switch{casePETpetname=data;casePETpetpicture=atoi(data.c_str());casePETpettype=atoi(data.c_str());casePETpetlevel=atoi(data.c_str());casePETpethp=atoi(data.c_str());casePETpetap=atoi(data.c_str());casePETpetmp=atoi(data.c_str());casePETpetexp=atoi(data.c_str());casePETpetskills1=atoi(data.c_str());casePETpetskills2=atoi(data.c_str());casePETpetskills3=atoi(data.c_str());}body[0]["name"]=petname;body[0]["picture"]=petpicture;body[0]["type"]=pettype;body[0]["level"]=petlevel;body[0]["hp"]=pethp;body[0]["ap"]=petbody[0]["mp"]=petbody[0]["exp"]=petexp;body[0]["skills1"]=petskills1;body[0]["skills2"]=petskills2;stringjStr= charstr[16]= sprintf(str, CCDictionary*pDic= CCDictionary*pDic= std::stringdoc=path+ charstr[16]=sprintf(str,"pet%d",pettype);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"petdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}{/*CCDictionary*pDic=CCDictionary::create();std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"/petdata.xml";pDic->writeToFile(doc.cstr());*/stringpetname=gamedata->;intpetpicture=gamedata->petdata.picture,pettype=gamedata->petdata.type,petlevel=gamedata->petdata.level,pethp=gamedata->petdata.hp,petap=gamedata->petdata.ap,petmp=gamedata->petdata.mp,petexp=gamedata->petdata.exp,petskills1=gamedata->petdata.skills1,petskills2=gamedata->petdata.skills2,petskills3=gamedata-CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];switch{casePETpetpicture=data;casePETpettype=data;casePETpetlevel=data;casePETpethp=data;casePETpetap=data;casePETpetmp=data;casePETpetexp=data;casePETpetskills1=data;casePETpetskills2=data;casePETskills3:pet_skills3=data;}body[0]["name"]=petname;body[0]["picture"]=petpicture;body[0]["type"]=pettype;body[0]["level"]=petlevel;body[0]["hp"]=pethp;body[0]["ap"]=petbody[0]["mp"]=petbody[0]["exp"]=petexp;body[0]["skills1"]=petskills1;body[0]["skills2"]=petskills2;stringjStr= charstr[16]= sprintf(str, CCDictionary*pDic= CCDictionary*pDic= std::stringdoc=path+ charstr[16]=sprintf(str,"pet%d",pettype);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"petdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}{CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];stringjStr= charstr[16]= sprintf(str, CCDictionary*pDic= CCDictionary*pDic= std::stringpath=CCFileUtils::sharedFileUtils()- std::stringdoc=path+ charstr[16]=sprintf(str,"pet%d",pettype);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("petdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"petdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}{charstr[16]={0};sprintf(str,"item%d",type);CCDictionary*pDic;stringjson;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("itemdata.xml");json=pDic->valueForKey(str)->m_sString;std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"/itemdata.xml";pDic=json=pDic->valueForKey(str)-}return;CSJson::Readerreader;CSJson::Valueroot;return;for(int{}}{CSJson::FastWriterwirter;CSJson::Valueroot;CSJson::Valuebody[1];stringjStr=charstr[16]=sprintf(str,"item%d",itemtpye);CCDictionary*pDic;if(CC TFORM== TFORMpDic=CCDictionary::createWithContentsOfFile("itemdata.xml");std::stringpath=CCFileUtils::sharedFileUtils()->getWritablePath();std::stringdoc=path+"itemdata.xml";pDic=CCDictionary::createWithContentsOfFile(_doc.c_str());}}{charstr[16]=sprintf(str,stringif(CC TFORM== TFORMfilePath=path+}unsignedchar*pBuffer=NULL;unsignedlongbufferSize=0;pBuffer=CCFileUtils::sharedFileUtils()->getFileData(filePath.c_str(),"r+",pBuffer[bufferSize-1]=tinyxml2::XML*pDoc=newtinyxml2::XML();if(pBuffer){pDoc-} e=pDoc->Roo //跟節(jié)點(diǎn)的第一個字節(jié)點(diǎn)XMLElement*lis e=roo XMLElement*dic e=lis //dict下面的子節(jié)點(diǎn) e=lis } tinyxml2::XMLElement*listChildNode= e- listChildNode=dic pDoc-}dice=dice-}}void{s=CCDirector::sharedDirector()-jinengNum= = =isEmpty1=true;isEmpty2=true;isEmpty3=isCanShengji=gamedata->gijineng1=0;gamedata->gijineng2=0;gamedata->g_ijineng3=useDefault->getIntegerForKey("SKILL1",gamedata->gijineng1);useDefault->getIntegerForKey("SKILL2",gamedata->gijineng2);CCSprite*jspz_jnlb=jspzjnlb->setPosition((s.width/2,s.height/2+90));CCSprite*jspzbg=CCSprite::create("config/jspzbg.png");jspzbg->setP
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度洗浴中心員工福利保障與激勵合同4篇
- 2024秀嶼區(qū)文印中心綜合性承包經(jīng)營管理合同3篇
- 2024聘用駕駛員安全保障及應(yīng)急處理服務(wù)合同3篇
- 2025年度智能穿戴設(shè)備打膠密封服務(wù)合同4篇
- 2025年度智能船舶租賃合作協(xié)議模板4篇
- 2025年度玻璃纖維復(fù)合材料研發(fā)與市場拓展承包合同3篇
- 2024年租賃合同:設(shè)備租賃與維護(hù)條款
- 2025年度文化傳播公司員工辭退合同范本4篇
- 2025年度幼兒園食堂承包運(yùn)營管理合同范本3篇
- 2025年度智慧城市建設(shè)戰(zhàn)略合作框架協(xié)議范本4篇
- 農(nóng)民工工資表格
- 【寒假預(yù)習(xí)】專題04 閱讀理解 20篇 集訓(xùn)-2025年人教版(PEP)六年級英語下冊寒假提前學(xué)(含答案)
- 2024年突發(fā)事件新聞發(fā)布與輿論引導(dǎo)合同
- 地方政府信訪人員穩(wěn)控實(shí)施方案
- 小紅書推廣合同范例
- 商業(yè)咨詢報告范文模板
- 2024年智能監(jiān)獄安防監(jiān)控工程合同3篇
- 幼兒園籃球課培訓(xùn)
- AQ 6111-2023個體防護(hù)裝備安全管理規(guī)范知識培訓(xùn)
- 老干工作業(yè)務(wù)培訓(xùn)
- 基底節(jié)腦出血護(hù)理查房
評論
0/150
提交評論