示例#1
0
bool CaboutPage::init(){
    const float wReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().x();
    const float hReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().y();
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    string resoStr=numberToStr(wReso)+"x"+numberToStr(hReso);
    //--quad_aboutPage_backGround
    {
        m_quad_aboutPage_backGround=new Ckey();
        m_quad_aboutPage_backGround->autorelease();
        //
        string imagePathShort="singleCellGameResource/data/global/tex/pageTexs/aboutPageTex/backGround_";
        imagePathShort+=resoStr+".png";
        Cc3dTexture* ptex=Cc3dTextureCache::sharedTextureCache()->addImage(imagePathShort,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
        const float texW=ptex->getWidth();
        const float texH=ptex->getHeight();
        float bx=0;
        float by=0;
        m_quad_aboutPage_backGround->genAndInit(bx, bx+width, by, by+height,0,wReso/texW,1-hReso/texH,1);
        m_quad_aboutPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_aboutPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptex);
        m_quad_aboutPage_backGround->setKeyUpColor(1, 1, 1, 1);
        m_quad_aboutPage_backGround->useKeyUpColor();
        m_quad_aboutPage_backGround->setCamera(camera2D);
        m_quad_aboutPage_backGround->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        //
        m_quad_aboutPage_backGround->reSetLeftDownCorner(0, 0);
        m_quad_aboutPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_aboutPage_backGround);
    }
    //----backKey
    {
        m_backKey=new Ckey();
        m_backKey->autorelease();
        //
        Cc3dTexture* ptexture=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_back.png");
        float c[2]={0,0};
        m_backKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_backKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_backKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_backKey->setKeyUpColor(1, 1, 1, 1);
        m_backKey->useKeyUpColor();
        m_backKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptexture);
        m_backKey->setCamera(camera2D);
        m_backKey->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_backKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_backKey->setPassUnifoCallback(passUnifoCallback_noLight);
        //
        float center[2]={30,30};
        m_backKey->reSetCenter(center[0], center[1]);
        m_backKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_backKey);
    }
    //----switchPage
    Cc3dALSource*pALSource_switchPage=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/switchPage.wav","switchPage");
    this->addALSource(pALSource_switchPage);
    return true;
}
示例#2
0
string valueToStr(float value,int nPrecision){//float to string
    if(value==floorf(value)){
        return numberToStr(value);
    }
    if(value==0)return string("0");
    //
    int sig;
    if(value==0){
        sig=0;
    }else if(value>0){
        sig=1;
    }else{
        sig=-1;
    }
    float abs=fabsf(value);
    int A=floor(abs);
    int B=floor((abs-A)*nPow(10,nPrecision)) ;
    string Astr=numberToStr(A);
    string Bstr=numberToStr(B);
    string zerosStr;
    int makeUpZeroCount=nPrecision-(int)Bstr.size();
    assert(makeUpZeroCount>=0);
    for(int i=0;i<makeUpZeroCount;i++) zerosStr+="0";
    string valueStr;
    if(sig<0) valueStr+="-";
    valueStr += Astr+"."+zerosStr+Bstr;
    return valueStr;
}
示例#3
0
void loadInfo_mesh(Cc3dMesh*mesh,const string&modelClipPathShort,float scale,Cc3dVector4 offsetVec){//输入模型文件夹短路径名--abc
    if(modelClipPathShort.empty()==false)assert(modelClipPathShort[(int)modelClipPathShort.size()-1]!='/');
  //  mesh->modelClipPathShort=modelClipPathShort;
    //----加载各mesh_normByFace
    if(Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh")){
        int i=0;
        while (1) {
            bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh/mesh"+numberToStr(i)+".ysm");
            if(pathExists==false)break;
            Cc3dSubMesh *subMesh=new Cc3dSubMesh();
            subMesh->autorelease();
            
            string meshFilePathShort=modelClipPathShort+"/mesh/mesh"+numberToStr(i)+".ysm";
            string texClipPathShort=modelClipPathShort+"/tex";
            loadInfo_subMesh(subMesh,meshFilePathShort,texClipPathShort,scale,offsetVec);
            mesh->addSubMesh(subMesh);
            i++;
        }
        
    }
    //----加载各mesh_normByVertex
    if(Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh_normByVertex")){
        int i=0;
        while (1) {
            bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh_normByVertex/mesh"+numberToStr(i)+"_normByVertex.ysm");
            if(pathExists==false)break;
            Cc3dSubMesh *subMesh=new Cc3dSubMesh();
            subMesh->autorelease();
            string meshFilePathShort=modelClipPathShort+"/mesh_normByVertex/mesh"+numberToStr(i)+"_normByVertex.ysm";
            string texClipPathShort=modelClipPathShort+"/tex";
            loadInfo_subMesh(subMesh, meshFilePathShort,texClipPathShort,scale,offsetVec );
            mesh->addSubMesh(subMesh);
            reCalNorms_precise_normByVertex(subMesh->getSubMeshData());
            i++;
        }
    }
    //----加载mesh_bossAndCBLoc
    if(Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh_bossAndCBLoc")){
        int i=0;
        while (1) {
            bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(modelClipPathShort+"/mesh_bossAndCBLoc/mesh"+numberToStr(i)+"_bossAndCBLoc.ysm");
            if(pathExists==false)break;
            Cc3dSubMesh *subMesh=new Cc3dSubMesh();
            subMesh->autorelease();
            string meshFilePathShort=modelClipPathShort+"/mesh_bossAndCBLoc/mesh"+numberToStr(i)+"_bossAndCBLoc.ysm";
            string texClipPathShort=modelClipPathShort+"/tex";
            loadInfo_subMesh(subMesh, meshFilePathShort,texClipPathShort,scale,offsetVec);
            mesh->addSubMesh(subMesh);
            reCalNorms_precise_normByVertex(subMesh->getSubMeshData());
            i++;
        }
    }
    
    
}
CbossCell*makeCellTemplate(int cellID){//必须加static
    //判断文件是否存在
    string clipName="cell";
    clipName+=numberToStr(cellID);
    bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist("data/global/model/cellModelLibrary/"+clipName);
    if(pathExists==false)return NULL;
    //制作模板
    CbossCell*pcellTemp=new CbossCell();
    pcellTemp->autorelease();
    //生成pcellTemp->pModelBaseList
    for(int i=0;i<CELLPARTCOUNT;i++){
        Cc3dModel*pmodel=new Cc3dModel();
        pmodel->autorelease();
        pcellTemp->addModel(pmodel);
    }
    
    string modelClipPath="data/global/model/cellModelLibrary/";
    modelClipPath+="cell";
    modelClipPath+=numberToStr(cellID);
    pcellTemp->loadConfigAndMeshes(modelClipPath+"/config.txt",modelClipPath);
    //提交各model数据
    {
        pcellTemp->submitModels(GL_STATIC_DRAW);
    }
    //判断是否飞行,如果飞行,则为其创建一个虚拟ship
    if(pcellTemp->get_isFly()){
        Cship*pship=new Cship();
        pship->autorelease();
        pcellTemp->set_ship(pship);//将ship添加到pcellTemp
        //pship的Rc和Rc_small等参数取与pcellTemp相同
        pship->setRc(pcellTemp->getRc());
        pship->seatPos_local.init(0,0,0,1);
        pship->set_Rc_small(pcellTemp->Rc_small);
        pship->set_H_sinkInWater(pcellTemp->H_sinkInWater);
        pship->initiativeAttack=pcellTemp->initiativeAttack;
        //pship的一些与速度有关的参数要比默认缩小些
        pship->v_pushForward_value/=3;
        pship->v_pushBack_value/=3;
        pship->v_pushUp_value/=3;
        pship->v_pushDown_value/=3;
        pship->a_vyPushDec/=3;
        pship->a_vPushForwardDec/=3;
    }
    //声音
 //   pcellTemp->pALSource_boss_scream=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("data/global/audio/boss_scream.wav");
 //   pcellTemp->pALSource_boss_och=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("data/global/audio/boss_och.wav");
    Cc3dALSource*pALSource_boss_scream=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("data/global/audio/boss_scream.wav","boss_scream");
    Cc3dALSource*pALSource_boss_och=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("data/global/audio/boss_och.wav","boss_och");
    pcellTemp->addALSource(pALSource_boss_scream);
    pcellTemp->addALSource(pALSource_boss_och);
    return pcellTemp;
}
void CuserConfig::writeToConfigFileInDocuments(const string&filePath)
//将设置写回文件--abc
{
    string filePathFull=Cc3dDocuments::sharedDocuments()->getDocumentsPath()+"/"+filePath;
    //------------------获得绝对路径--abc
    //打开文件--abc
    FILE   *fp=NULL;
    fp=fopen(filePathFull.c_str(),"w+");
    if(fp==NULL){
        cout<<"Open "<<filePathFull<<" with w+ failed!"<<endl;
        perror("error");
        assert(false);
    }else{
        cout<<"Open "<<filePathFull<<" with w+ succ"<<endl;
    }
    //将submesh输出到文件--abc
    //注意一定要每输出一个字段就输出一个空格--abc
    {
        //输出项数--abc
        int n=(int)unLockList.size();
        fprintf(fp,"%d ",n);//一定要有空格--abc
        //输出各项--abc
        for(int i=0;i<n;i++){
            string title="level";
            title+=numberToStr(i);
            fprintf(fp, "%s ",title.c_str());//一定要有空格--abc
            fprintf(fp,"%d ",(int)unLockList[i]);
            fprintf(fp,"%d ",(int)starNumberList[i]);
        }
    }
    //关闭文件--abc
    fclose(fp);
    
    
}
bool CstartPage::init(){
    const float wReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().x();
    const float hReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().y();
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    string resoStr=numberToStr(wReso)+"x"+numberToStr(hReso);
	//cout<<"resoStr:"<<resoStr<<endl;
    //--quad_startPage_backGround
    {
        m_quad_startPage_backGround=new Ckey();
        m_quad_startPage_backGround->autorelease();
        //
        string imagePathShort="singleCellGameResource/data/global/tex/pageTexs/startPageTex/backGround_";
        imagePathShort+=resoStr+".png";
        Cc3dTexture* ptex=Cc3dTextureCache::sharedTextureCache()->addImage(imagePathShort,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
        const float texW=ptex->getWidth();
        const float texH=ptex->getHeight();
        float bx=0;
        float by=0;
        m_quad_startPage_backGround->genAndInit(bx, bx+width, by, by+height,0,wReso/texW,1-hReso/texH,1);
        m_quad_startPage_backGround->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_startPage_backGround->getModelList()[0]->getMeshByIndex(0)->setTexture(ptex);
        m_quad_startPage_backGround->setKeyUpColor(1, 1, 1, 1);
        m_quad_startPage_backGround->useKeyUpColor();
        m_quad_startPage_backGround->setCamera(camera2D);
        m_quad_startPage_backGround->getModelList()[0]->setIsWriteDepthBuffer(false);
        m_quad_startPage_backGround->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_startPage_backGround->setPassUnifoCallback(passUnifoCallback_noLight);
        //
        m_quad_startPage_backGround->reSetLeftDownCorner(0, 0);
        m_quad_startPage_backGround->getModelList()[0]->getMeshByIndex(0)->submit(GL_STREAM_DRAW);
        //
        addChild(m_quad_startPage_backGround);
    }
    //----startMusic
    Cc3dALSource*pALSource_startMusic=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/startMusic.wav","startMusic");
    this->addALSource(pALSource_startMusic);
    pALSource_startMusic->setIsLooping(true);
    //----switchPage
    Cc3dALSource*pALSource_switchPage=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/switchPage.wav","switchPage");
    this->addALSource(pALSource_switchPage);
    
    
    //----开始播放
    this->getALSourceByName("startMusic")->play();
    return true;
}
Cship*makeShipTemplate(int shipID){//必须加static
    //判断文件是否存在
    string clipName="ship";
    clipName+=numberToStr(shipID);
    bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(string("data/global/model/shipModelLibrary/")+clipName);
    if(pathExists==false)return NULL;
    //制作模板
    Cship*pship=new Cship();
    pship->autorelease();
    Cc3dModel*pmodel=new Cc3dModel();
    pmodel->autorelease();
    pship->addModel(pmodel);
    //必须先load config再load model
    string shipClipName="ship";
    shipClipName+=numberToStr(shipID);
    pship->loadConfig("data/global/model/shipModelLibrary/"+shipClipName+"/config.txt");
    loadInfo_model(pmodel, "data/global/model/shipModelLibrary/"+shipClipName,pship->modelScale);
    int nMesh=(int)pmodel->getMeshCount();
    for(int j=0;j<nMesh;j++){
        Cc3dMesh*pmesh=pmodel->getMeshByIndex(j);
        pmesh->getIndexVBO()->genBuffers();
        pmesh->submit(GL_STATIC_DRAW);
    }
    pmodel->setDiffuseRGB(0.8, 0.8, 0.8);
    pmodel->setAmbient(0.5, 0.5, 0.5);
    //alSource
    if(pship->fileName_engineSound!="null"){
        string filePathShort_engineSound="data/global/audio/shipEngineSound/";
        filePathShort_engineSound+=pship->fileName_engineSound;
     //   pship->pALSource_shipEngineSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(filePathShort_engineSound);//模板是永久的
     //   pship->pALSource_shipEngineSound->setIsLooping(true);
        Cc3dALSource*pALSource_shipEngineSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(filePathShort_engineSound,"shipEngineSound");//模板是永久的
        pALSource_shipEngineSound->setIsLooping(true);
        pship->addALSource(pALSource_shipEngineSound);
        
        
    }
    if(pship->fileName_collisionSound!="null"){
        string filePathShort_collisionSound="data/global/audio/shipCollisionSound/";
        filePathShort_collisionSound+=pship->fileName_collisionSound;
     //   pship->pALSource_ship_collision=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(filePathShort_collisionSound);
        Cc3dALSource*source=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(filePathShort_collisionSound,"ship_collision");
        pship->addALSource(source);
    }
    return pship;
}
CshotBall*makeShotBallTemplate(int shotBallID,bool isReuseALSource){//必须加static
    //判断文件是否存在
    string clipName="shotBall";
    clipName+=numberToStr(shotBallID);
    bool pathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist("data/global/model/shotBallLibrary/"+clipName);
    if(pathExists==false)return NULL;
    //制作模板
    CshotBall*pballTemp=new CshotBall();
    pballTemp->autorelease();
    pballTemp->init();
    {
        string clipPathShort="data/global/model/shotBallLibrary/shotBall";
        clipPathShort+=numberToStr(shotBallID);
        pballTemp->loadConfig(clipPathShort+"/config.txt");//先读config再loadModel
        //加载模型
        loadInfo_model(pballTemp->getModel(), clipPathShort,pballTemp->modelScale);
        //加载音效
        if(pballTemp->fileName_launchSound!="null"){
            string audioClipPath="data/global/audio/shotBallLaunchSound/";
            //pballTemp->pALSource_launchSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(audioClipPath+pballTemp->fileName_launchSound);//模板是永久的
            Cc3dALSource*pALSource_launchSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(audioClipPath+pballTemp->fileName_launchSound,"launchSound",isReuseALSource);//模板是永久的
            pballTemp->addALSource(pALSource_launchSound);
        }
        if(pballTemp->fileName_collisionWithSolidSound!="null"){
            string audioClipPath="data/global/audio/shotBallCollisionWithSolidSound/";
            //pballTemp->pALSource_collisionWithSolidSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(audioClipPath+pballTemp->fileName_collisionWithSolidSound);
            Cc3dALSource*pALSource_collisionWithSolidSound=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource(audioClipPath+pballTemp->fileName_collisionWithSolidSound,"collisionWithSolidSound",isReuseALSource);
            assert(pALSource_collisionWithSolidSound);
            pballTemp->addALSource(pALSource_collisionWithSolidSound);
        }
        //创建indexVBO并提交数据
        int nMesh=(int)pballTemp->getModel()->getMeshCount();
        for(int j=0;j<nMesh;j++){
            Cc3dMesh*pmesh=pballTemp->getModel()->getMeshByIndex(j);
            pmesh->getIndexVBO()->genBuffers();
            pmesh->submit(GL_STATIC_DRAW);
        }
        pballTemp->set_typeID(shotBallID);
    }
    return pballTemp;
}
示例#9
0
bool CviewingTipPage::init(){
    int level=(( CplayingPage*)Cc3dSceneManager::sharedSceneManager()->getRoot()->getChildByName("playingPage"))->getLevel();
    string levelStr=numberToStr(level);
    string rootPath="singleCellGameResource/data/levels/level_"+levelStr+"/";
    //
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    //--quad_tipTex
    {
        Cc3dTexture*texture=Cc3dTextureCache::sharedTextureCache()->addImage(rootPath+"/tipTex/tipTex.png",GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
        m_quad_tipTex=new Ckey();
        m_quad_tipTex->autorelease();
        //
        float bx=0;
        float by=0;
        float w=texture->getWidth()/Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getPixelDensity();
        float h=texture->getHeight()/Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getPixelDensity();
        m_quad_tipTex->genAndInit(bx, bx+w, by, by+h,0,1,0,1);//不考虑分辨率--abc
        m_quad_tipTex->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_tipTex->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(texture);
        m_quad_tipTex->setKeyUpColor(1, 1, 1, 1);
        m_quad_tipTex->useKeyUpColor();
        m_quad_tipTex->setCamera(camera2D);
        m_quad_tipTex->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_tipTex->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_tipTex->setPassUnifoCallback(passUnifoCallback_noLight);
        m_quad_tipTex->setVisitDrawOrder(10000);
        //
        m_quad_tipTex->reSetCenter(width/2,height/2);
        m_quad_tipTex->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_tipTex);
    }
    //----switchPage
    Cc3dALSource*pALSource_switchPage=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/switchPage.wav","switchPage");
    this->addALSource(pALSource_switchPage);
    return true;
}
bool CloadingPage::init(){
    const float wReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().x();
    const float hReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().y();
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    string resoStr=numberToStr(wReso)+"x"+numberToStr(hReso);
    //--quad_loadingPage_backGround
    {
        m_quad_loadingPage_backGround=new Ckey();
        m_quad_loadingPage_backGround->autorelease();
		m_quad_loadingPage_backGround->init();
        //
        string imagePathShort="singleCellGameResource/data/global/tex/pageTexs/loadingPageTex/backGround_";
        imagePathShort+=resoStr+".png";
        Cc3dTexture* ptex=Cc3dTextureCache::sharedTextureCache()->addImage(imagePathShort,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
        const float texW=ptex->getWidth();
        const float texH=ptex->getHeight();
        float bx=0;
        float by=0;
        m_quad_loadingPage_backGround->genAndInit(bx, bx+width, by, by+height,0,wReso/texW,1-hReso/texH,1);
        m_quad_loadingPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_loadingPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptex);
        m_quad_loadingPage_backGround->setKeyUpColor(1, 1, 1, 1);
        m_quad_loadingPage_backGround->useKeyUpColor();
        m_quad_loadingPage_backGround->setCamera(camera2D);
        m_quad_loadingPage_backGround->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_loadingPage_backGround->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_loadingPage_backGround->setPassUnifoCallback(passUnifoCallback_noLight);
        //
        m_quad_loadingPage_backGround->reSetLeftDownCorner(0, 0);
        m_quad_loadingPage_backGround->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_loadingPage_backGround);
    }

    //--quad_loading
    {
        m_quad_loading=new Ckey();
        m_quad_loading->autorelease();
		m_quad_loading->init();
        //
        Cc3dTexture* ptexture_quad_loading=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/pageTexs/loadingPageTex/quad_loading.png");
        float bx=0;
        float by=0;
        float w=200;
        float h=50;
        m_quad_loading->genAndInit(bx, bx+w, by, by+h,0,1,0,1);
        m_quad_loading->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_loading->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptexture_quad_loading);
        m_quad_loading->setKeyUpColor(1, 1, 1, 1);
        m_quad_loading->useKeyUpColor();
        m_quad_loading->setCamera(camera2D);
        m_quad_loading->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_loading->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_loading->setPassUnifoCallback(passUnifoCallback_noLight);
        //
        float _bx=60;
        float _by=40;
        m_quad_loading->reSetLeftDownCorner(_bx, _by);
        m_quad_loading->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_loading);
    }
    return true;
}
bool ChomePage::init(){
  
    const float wReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().x();
    const float hReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().y();
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    string resoStr=numberToStr(wReso)+"x"+numberToStr(hReso);
    
    
    //--quad_homePage_backGround
    {
        m_quad_homePage_backGround=new Ckey();
        m_quad_homePage_backGround->autorelease();
        
        string imagePathShort="singleCellGameResource/data/global/tex/pageTexs/homePageTex/backGround_";
        imagePathShort+=resoStr+".png";
        Cc3dTexture* ptex=Cc3dTextureCache::sharedTextureCache()->addImage(imagePathShort,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
        const float texW=ptex->getWidth();
        const float texH=ptex->getHeight();
        float bx=0;
        float by=0;
        m_quad_homePage_backGround->genAndInit(bx, bx+width, by, by+height,0,wReso/texW,1-hReso/texH,1);
        m_quad_homePage_backGround->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_homePage_backGround->getModelList()[0]->getMeshByIndex(0)->setTexture(ptex);
        m_quad_homePage_backGround->setKeyUpColor(1, 1, 1, 1);
        m_quad_homePage_backGround->useKeyUpColor();
        m_quad_homePage_backGround->setCamera(camera2D);
        m_quad_homePage_backGround->getModelList()[0]->setIsWriteDepthBuffer(false);
        m_quad_homePage_backGround->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_homePage_backGround->setPassUnifoCallback(passUnifoCallback_noLight);
        
        m_quad_homePage_backGround->reSetLeftDownCorner(0, 0);
        m_quad_homePage_backGround->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
        addChild(m_quad_homePage_backGround);
    }
    //--debugKey
    {
        m_debugKey=new Ckey();
        m_debugKey->autorelease();
        //
        float c[2]={0,0};
        m_debugKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_debugKey->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_debugKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_debugKey->setKeyUpColor(1, 1, 1, 1);
        m_debugKey->useKeyUpColor();
        m_debugKey->getModelList()[0]->getMeshByIndex(0)->setTexture(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_debug.png"));
        m_debugKey->setCamera(camera2D);
        m_debugKey->getModelList()[0]->setIsWriteDepthBuffer(false);
        m_debugKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_debugKey->setPassUnifoCallback(passUnifoCallback_noLight);
        //
        float center[2]={width-r_key,0+r_key};
        m_debugKey->reSetCenter(center[0], center[1]);
        m_debugKey->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_debugKey);
    }

    //----backKey
    {
        m_backKey=new Ckey();
        m_backKey->autorelease();
        
        Cc3dTexture* ptexture=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_back.png");
        float c[2]={0,0};
        m_backKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_backKey->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_backKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_backKey->setKeyUpColor(1, 1, 1, 1);
        m_backKey->useKeyUpColor();
        m_backKey->getModelList()[0]->getMeshByIndex(0)->setTexture(ptexture);
        m_backKey->setCamera(camera2D);
        m_backKey->getModelList()[0]->setIsWriteDepthBuffer(false);
        m_backKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_backKey->setPassUnifoCallback(passUnifoCallback_noLight);
        
        float center[2]={160,30};
        m_backKey->reSetCenter(center[0], center[1]);
        m_backKey->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
        addChild(m_backKey);
    }
    //----m_gameKeyList和m_gameKeyList_lock和m_gameKeyList_star
    {
        //----gameKeyList和gameKeyList_lock和gameKeyList_star
        //m_gameKeyList
        {
            //生成gameKeyTexClip
            Cmolecule gameKeyTexClip;//临时对象
            gameKeyTexClip.loadFrameTexList("singleCellGameResource/data/global/tex/pageTexs/homePageTex/gameKey/");
            
            //制作各texture的相应按钮
            int nGameKey=(int)gameKeyTexClip.getFrameTexList().size();
            
            m_levelCount=nGameKey;
            
            for(int i=0;i<nGameKey;i++){
                Ckey*key=new Ckey();
                key->autorelease();
                float c[2]={0,0};
                float r=35;
                key->genAndInit(c[0]-r,c[0]+r,c[1]-r,c[1]+r, 0,1,0,1);
                key->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
                key->setKeyDownColor(0.7, 0.7, 0.7, 1);
                key->setKeyUpColor(1, 1, 1, 1);
                key->useKeyUpColor();
                key->getModelList()[0]->getMeshByIndex(0)->setTexture(gameKeyTexClip.getFrameTexList()[i]);
                key->setCamera(camera2D);
                key->getModelList()[0]->setIsWriteDepthBuffer(false);
                key->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
                key->setPassUnifoCallback(passUnifoCallback_noLight);
                addChild(key);
                m_gameKeyList.push_back(key);
            }
            //判断各key对应的关卡文件夹是否存在,设置为grey并使用keyDownColor
            for(int i=0;i<nGameKey;i++){
                Ckey*key=m_gameKeyList[i];
                int level=i+1;//关卡号
                string curLevelClip="level_";
                curLevelClip+=numberToStr(level);//注:直接写"level_"+numberToStr(level)不报错,但得到错误结果
                bool rootPathExists=Cc3dFileUtils::sharedFileUtils()->getIsFileOrClipExist(string("singleCellGameResource/data/levels/")+curLevelClip);
                if(rootPathExists==false){
                    key->set_isGrey(true);
                    key->useKeyDownColor();
                }
            }
            //定位
            {
                int nKey=(int)m_gameKeyList.size();
                //按每行四个进行排列,排满为止
                int nCol=4;//按钮列数
                int nRow=ceil((float)nKey/nCol);//按钮行数
                for(int i=0;i<nRow;i++){
                    for(int j=0;j<nCol;j++){
                        int I=j+i*nCol;
                        if(I>=nKey)continue;//如果已超出范围,跳过
                        Ckey*key=m_gameKeyList[I];
                        const float marginH=110;
                        float c[2]={width/nCol*(j+0.5),(height-marginH)-(height-marginH)/nRow*(i+0.5)+marginH/2};
                        key->reSetCenter(c[0], c[1]);
                        key->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
                    }
                }
            }

        }
        //gameKeyList_lock
        {
            Cc3dTexture* ptexture_lockKey=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/pageTexs/homePageTex/lockKey.png");
            int nKey=(int)m_gameKeyList.size();//与gameKeyList元素数保持一致
            for(int i=0;i<nKey;i++){
                Ckey*key=new Ckey();
                key->autorelease();
                float c[2]={0,0};
                float r=45;
                key->genAndInit(c[0]-r,c[0]+r,c[1]-r,c[1]+r, 0,1,0,1);
                key->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
                key->setKeyDownColor(0.7, 0.7, 0.7, 1);
                key->setKeyUpColor(1, 1, 1, 1);
                key->useKeyUpColor();
                key->getModelList()[0]->getMeshByIndex(0)->setTexture(ptexture_lockKey);
                key->setCamera(camera2D);
                key->getModelList()[0]->setIsWriteDepthBuffer(false);
                key->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
                key->setPassUnifoCallback(passUnifoCallback_noLight);
                addChild(key);
                m_gameKeyList_lock.push_back(key);
            }
            //定位
            {
                int nKey_lock=(int)m_gameKeyList_lock.size();
                for(int i=0;i<nKey_lock;i++){
                    Ckey*key_lock=m_gameKeyList_lock[i];
                    Ckey*key=m_gameKeyList[i];
                    float c[2]={key->getCenterX(),key->getCenterY()};
                    key_lock->reSetCenter(c[0], c[1]);
                    key_lock->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
                }
            }
            //可见性
            {
                int nKey=(int)m_gameKeyList_lock.size();
                for(int i=0;i<nKey;i++){
                    Ckey*key=m_gameKeyList_lock[i];
                    if(CuserConfig::sharedUserConfig()->unLockList[i]==false&&CgameSettings::sharedGameSettings()->getUnlockAll()==false){
                        key->setIsVisible(true);
                    }else{
                        key->setIsVisible(false);
                    }
                }
            }

        }
        //gameKeyList_star
        {
            m_tex_quad_starList.push_back(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_star0.png"));
            m_tex_quad_starList[(int)m_tex_quad_starList.size()-1]->retain();
            m_tex_quad_starList.push_back(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_star1.png"));
            m_tex_quad_starList[(int)m_tex_quad_starList.size()-1]->retain();
            m_tex_quad_starList.push_back(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_star2.png"));
            m_tex_quad_starList[(int)m_tex_quad_starList.size()-1]->retain();
            m_tex_quad_starList.push_back(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_star3.png"));
            m_tex_quad_starList[(int)m_tex_quad_starList.size()-1]->retain();
            int nKey=(int)m_gameKeyList.size();//与gameKeyList元素数保持一致
            for(int i=0;i<nKey;i++){
                Ckey*key=new Ckey();
                key->autorelease();
                float c[2]={0,0};
                float r=45;
                key->genAndInit(c[0]-r,c[0]+r,c[1]-r/4,c[1]+r/4, 0,1,0,1);
                key->getModelList()[0]->getMeshByIndex(0)->getIndexVBO()->genBuffers();
                key->setKeyDownColor(0.7, 0.7, 0.7, 1);
                key->setKeyUpColor(1, 1, 1, 1);
                key->useKeyUpColor();
                key->getModelList()[0]->getMeshByIndex(0)->setTexture(m_tex_quad_starList[CuserConfig::sharedUserConfig()->starNumberList[i]]);
                key->setCamera(camera2D);
                key->getModelList()[0]->setIsWriteDepthBuffer(false);
                key->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
                key->setPassUnifoCallback(passUnifoCallback_noLight);
                addChild(key);
                m_gameKeyList_star.push_back(key);
            }
            //定位
            {
                int nKey_star=(int)m_gameKeyList_star.size();
                for(int i=0;i<nKey_star;i++){
                    Ckey*key_star=m_gameKeyList_star[i];
                    Ckey*key=m_gameKeyList[i];
                    float c[2]={key->getCenterX(),key->getCenterY()};
                    key_star->reSetCenter(c[0], c[1]-45);
                    key_star->getModelList()[0]->getMeshByIndex(0)->submit(GL_STATIC_DRAW);
                }
            }
            //可见性
            {
                int nKey=(int)m_gameKeyList_star.size();
                for(int i=0;i<nKey;i++){
                    Ckey*key=m_gameKeyList_star[i];
                    if(CuserConfig::sharedUserConfig()->unLockList[i]==true||CgameSettings::sharedGameSettings()->getUnlockAll()==true){
                        key->setIsVisible(true);
                    }else{
                        key->setIsVisible(false);
                    }
                }
            }
        }
        
    }
    //----switchPage
    Cc3dALSource*pALSource_switchPage=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/switchPage.wav","switchPage");
    this->addALSource(pALSource_switchPage);
    return true;

}
void CuserConfig::copyConfigFileToDocuments(const string&configFilePathShort){
    //------------------获得绝对路径--abc
    string pathName=Cc3dFileUtils::sharedFileUtils()->getFullPath(configFilePathShort);
    //打开文件--abc
    FILE  *fp=NULL;
    fp=fopen(pathName.c_str(),"r");
    if(fp==NULL)
    {
        cout<<"Open "<<pathName<<" failed!"<<endl;
        assert(false);
    }
    //----提取文件信息到临时变量--abc
    vector<int> t_unLockList;
    vector<int> t_starNumberList;
    {
        char buffer[1024]={0};
        //提取项目数--abc
        int n;
        fscanf(fp, "%d",&n);
        t_unLockList.resize(n);
        t_starNumberList.resize(n);
        //提取n个项目--abc
        for(int i=0;i<n;i++){
            //--title
            fscanf(fp, "%s",buffer);
            //--unlock
            int isUnlocked;
            fscanf(fp, "%d",&isUnlocked);
            t_unLockList[i]=isUnlocked;
            //--starNumber
            int starNumber;
            fscanf(fp, "%d",&starNumber);
            t_starNumberList[i]=starNumber;
            
        }
    }
    //关闭文件--abc
    fclose(fp);
    //----将临时变量写入到Documents/下的同名文件中--abc
    {
        //提取configFilePathShort的最后一级(文件名)
        string clipPath,fileName;
        vector<string>rs=splitStrInTwoByLastBar(configFilePathShort);
        clipPath=rs[0];
        fileName=rs[1];
        //将fileName写入到Documents
        string pathName=Cc3dDocuments::sharedDocuments()->getDocumentsPath()+"/"+fileName;
        //打开文件--abc
        FILE   *fp=NULL;
        fp=fopen(pathName.c_str(),"w+");
        if(fp==NULL){
            cout<<"Open "<<pathName<<" with w+ failed!"<<endl;
            perror("error");
            assert(false);
        }else{
            cout<<"Open "<<pathName<<" with w+ succ"<<endl;
        }
        //将临时变量输出到文件--abc
        //注意一定要每输出一个字段就输出一个空格--abc
        {
            //输出项数--abc
            int n=(int)t_unLockList.size();
            fprintf(fp,"%d ",n);//一定要有空格--abc
            //输出各项--abc
            for(int i=0;i<n;i++){
                string title="level";
                title+=numberToStr(i);
                fprintf(fp, "%s ",title.c_str());//一定要有空格--abc
                fprintf(fp,"%d ",(int)t_unLockList[i]);
                fprintf(fp,"%d ",(int)t_starNumberList[i]);
            }
        }
        //关闭文件--abc
        fclose(fp);
    }
}
bool CsuccedPage::init(int nStar,int nEnemyKilled,int nCoinEaten){
    const float wReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().x();
    const float hReso=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getResolutionSize().y();
    const float width=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().x();
    const float height=Cc3dDeviceAndOSInfo::sharedDeviceAndOSInfo()->getScreenSize().y();
    string resoStr=numberToStr(wReso)+"x"+numberToStr(hReso);
    const float keyMovUp=height-480;
    //----创建数字纹理和符号纹理--abc
    {
        for(int i=0;i<10;i++){
            string texPath="singleCellGameResource/data/global/tex/numberAndSymbolTex/"+numberToStr(i)+".png";
            Cc3dTexture* ptex=Cc3dTextureCache::sharedTextureCache()->addImage(texPath);
            m_numberTexList.push_back(ptex);
            ptex->retain();
        }
        m_dotTex=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/numberAndSymbolTex/dot.png");
        m_dotTex->retain();
    }
    //--quad_succeed
    {
        m_quad_succeed=new Ckey();
        m_quad_succeed->autorelease();
		m_quad_succeed->init();
        //
        Cc3dTexture* ptexture_quad_succeed=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_succeed.png");
        float bx=0;
        float by=0;
        float w=220;
        float h=55;
        m_quad_succeed->genAndInit(bx, bx+w, by, by+h,0,1,0,1);
        m_quad_succeed->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_succeed->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptexture_quad_succeed);
        m_quad_succeed->setKeyUpColor(1, 1, 1, 1);
        m_quad_succeed->useKeyUpColor();
        m_quad_succeed->setCamera(camera2D);
        m_quad_succeed->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_succeed->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_succeed->setPassUnifoCallback(passUnifoCallback_noLight);
        m_quad_succeed->setVisitDrawOrder(10000);
        //
        float _bx=52;
        float _by=380;
        m_quad_succeed->reSetLeftDownCorner(_bx, _by+keyMovUp);
        m_quad_succeed->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_succeed);
        
    }
    //--quad_star
    {
        m_quad_star=new Ckey();
        m_quad_star->autorelease();
		m_quad_star->init();
        //
        float bx=0;
        float by=0;
        float w=200;
        float h=50;
        m_quad_star->genAndInit(bx, bx+w, by, by+h,0,1,0,1);
        m_quad_star->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_star->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(Cc3dTextureCache::sharedTextureCache()->addImage(string("singleCellGameResource/data/global/tex/quads/quad_star")+numberToStr(nStar)+".png"));
        m_quad_star->setKeyUpColor(1, 1, 1, 1);
        m_quad_star->useKeyUpColor();
        m_quad_star->setCamera(camera2D);
        m_quad_star->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_star->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_star->setPassUnifoCallback(passUnifoCallback_noLight);
        m_quad_star->setVisitDrawOrder(10000);
        //
        float _bx=60;
        float _by=265;
        m_quad_star->reSetLeftDownCorner(_bx, _by+keyMovUp);
        m_quad_star->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_star);
    }
    
    //--nextLevelKey
    {
        m_nextLevelKey=new Ckey();
        m_nextLevelKey->autorelease();
		m_nextLevelKey->init();
        //
        Cc3dTexture* ptexture=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_nextLevel.png");
        float c[2]={0,0};
        m_nextLevelKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_nextLevelKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_nextLevelKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_nextLevelKey->setKeyUpColor(1, 1, 1, 1);
        m_nextLevelKey->useKeyUpColor();
        m_nextLevelKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptexture);
        m_nextLevelKey->setCamera(camera2D);
        m_nextLevelKey->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_nextLevelKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_nextLevelKey->setPassUnifoCallback(passUnifoCallback_noLight);
        m_nextLevelKey->setVisitDrawOrder(10000);
        //
        Cc3dVector4 center;
        if(CgameState::sharedGameState()->getCurrentLevel()==CuserConfig::sharedUserConfig()->get_levelCount()){
            center.init(160, 340+10+keyMovUp, 0,1);
        }else{
            center.init(223, 340+10+keyMovUp, 0,1);
        }
        m_nextLevelKey->reSetCenter(center.x(), center.y());
        m_nextLevelKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_nextLevelKey);
    }
    //--homeKey
    {
        m_homeKey=new Ckey();
        m_homeKey->autorelease();
        //
        float c[2]={0,0};
        m_homeKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_homeKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_homeKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_homeKey->setKeyUpColor(1, 1, 1, 1);
        m_homeKey->useKeyUpColor();
        m_homeKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_home.png"));
        m_homeKey->setCamera(camera2D);
        m_homeKey->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_homeKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_homeKey->setPassUnifoCallback(passUnifoCallback_noLight);
        m_homeKey->setVisitDrawOrder(10000);
        m_homeKey->setIsVisible(CgameState::sharedGameState()->getCurrentLevel()!=CuserConfig::sharedUserConfig()->get_levelCount());
        //
        float _c[2]={95,340+10+keyMovUp};
        m_homeKey->reSetCenter(_c[0], _c[1]);
        m_homeKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_homeKey);
    }
    //--restartKey
    {
        m_restartKey=new Ckey();
        m_restartKey->autorelease();
		m_restartKey->init();
        //
        float c[2]={0,0};
        m_restartKey->genAndInit(c[0]-r_key,c[0]+r_key,c[1]-r_key,c[1]+r_key, 0,1,0,1);
        m_restartKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_restartKey->setKeyDownColor(0.7, 0.7, 0.7, 1);
        m_restartKey->setKeyUpColor(1, 1, 1, 1);
        m_restartKey->useKeyUpColor();
        m_restartKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/keys/key_restart.png"));
        m_restartKey->setCamera(camera2D);
        m_restartKey->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_restartKey->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_restartKey->setPassUnifoCallback(passUnifoCallback_noLight);
        m_restartKey->setVisitDrawOrder(10000);
        m_restartKey->setIsVisible(CgameState::sharedGameState()->getCurrentLevel()!=CuserConfig::sharedUserConfig()->get_levelCount());
        //
        float _c[2]={160,340+10+keyMovUp};
        m_restartKey->reSetCenter(_c[0],_c[1]);
        m_restartKey->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_restartKey);
    }
    //----quad_coin
    {
        m_quad_coin=new Ckey();
        m_quad_coin->autorelease();
		m_quad_coin->init();
        //
        Cc3dTexture* ptex_quad_coin=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_coin.png");
        m_quad_coin->genAndInit(0, 30, 0, 30,0,1,0,1);
        m_quad_coin->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_coin->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptex_quad_coin);
        m_quad_coin->setKeyUpColor(1, 1, 1, 1);
        m_quad_coin->useKeyUpColor();
        m_quad_coin->setCamera(camera2D);
        m_quad_coin->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_coin->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_coin->setPassUnifoCallback(passUnifoCallback_noLight);
        m_quad_coin->setVisitDrawOrder(10000);
        //quad_coin
        float bx=100;
        float by=165-60;
        m_quad_coin->reSetLeftDownCorner(bx, by);
        m_quad_coin->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_coin);
    
    }
    //----quad_nCoinPositivePlaceList
    {
        //提取nCoin各位数字--abc
        int _nCoinEaten=nCoinEaten;
        vector<int> numberList;
        for(int i=0;i<nCoinPositivePlaceCount;i++){
            int number=_nCoinEaten%10;
            _nCoinEaten/=10;
            numberList.push_back(number);
        }
        for(int i=0;i<nCoinPositivePlaceCount;i++){//反序--abc
            if(i>=nCoinPositivePlaceCount/2)break;
            int temp=numberList[i];
            numberList[i]=numberList[nCoinPositivePlaceCount-i-1];
            numberList[nCoinPositivePlaceCount-i-1]=temp;
        }
       
        int nPositivePlace=nCoinPositivePlaceCount;
        for(int i=0;i<nPositivePlace;i++){
            
            Ckey*quad=new Ckey();//quad_nCoinPositivePlaceList[i];
            quad->genAndInit(0, 26, 0, 26,0,1,0,1);
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(m_numberTexList[numberList[i]]);
            quad->setKeyUpColor(1, 1, 1, 0.8);
            quad->useKeyUpColor();
            quad->setCamera(camera2D);
            quad->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
            quad->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
            quad->setPassUnifoCallback(passUnifoCallback_noLight);
            quad->setVisitDrawOrder(10000);
            addChild(quad);
            m_quad_nCoinPositivePlaceList.push_back(quad);
            
        }

        //quad_nCoinPostivePlaceList
        float _bx=100+10;
        float _by=165-60;
        for(int i=0;i<nPositivePlace;i++){
            Ckey*quad=m_quad_nCoinPositivePlaceList[i];
            _bx+=20;
            quad->reSetLeftDownCorner(_bx, _by);
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        }
    }
    //----quad_killEnemy
    {
        m_quad_killEnemy=new Ckey();
        m_quad_killEnemy->autorelease();
		m_quad_killEnemy->init();
        //
        Cc3dTexture* ptex_quad_killEnemy=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_killEnemy.png");
        m_quad_killEnemy->genAndInit(0, 30, 0, 30,0,1,0,1);
        m_quad_killEnemy->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
        m_quad_killEnemy->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(ptex_quad_killEnemy);
        m_quad_killEnemy->setKeyUpColor(1, 1, 1, 1);
        m_quad_killEnemy->useKeyUpColor();
        m_quad_killEnemy->setCamera(camera2D);
        m_quad_killEnemy->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
        m_quad_killEnemy->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
        m_quad_killEnemy->setPassUnifoCallback(passUnifoCallback_noLight);
        m_quad_killEnemy->setVisitDrawOrder(10000);
        //
        float bx=100;
        float by=130-60;
        m_quad_killEnemy->reSetLeftDownCorner(bx, by);
        m_quad_killEnemy->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        //
        addChild(m_quad_killEnemy);
        
    }
    //----quad_nKillEnemyPostivePlaceList
    {
        //提取nBoss各位数字--abc
        int _nEnemyKilled=nEnemyKilled;
        vector<int> numberList;
        for(int i=0;i<nCoinPositivePlaceCount;i++){
            int number=_nEnemyKilled%10;
            _nEnemyKilled/=10;
            numberList.push_back(number);
        }
        for(int i=0;i<nCoinPositivePlaceCount;i++){//反序--abc
            if(i>=nCoinPositivePlaceCount/2)break;
            int temp=numberList[i];
            numberList[i]=numberList[nCoinPositivePlaceCount-i-1];
            numberList[nCoinPositivePlaceCount-i-1]=temp;
        }

        
        int nPositivePlace=nKillEnemyPostivePlaceCount;
        for(int i=0;i<nPositivePlace;i++){
            Ckey*quad=new Ckey();//quad_nKillEnemyPositivePlaceList[i];
            quad->genAndInit(0, 26, 0, 26,0,1,0,1);
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(m_numberTexList[numberList[i]]);
            quad->setKeyUpColor(1, 1, 1, 0.8);
            quad->useKeyUpColor();
            quad->setCamera(camera2D);
            quad->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
            quad->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
            quad->setPassUnifoCallback(passUnifoCallback_noLight);
            quad->setVisitDrawOrder(10000);
            addChild(quad);
            m_quad_nKillEnemyPositivePlaceList.push_back(quad);
        }
        //
        float _bx=100+10;
        float _by=130-60;
        for(int i=0;i<nPositivePlace;i++){
            Ckey*quad=m_quad_nKillEnemyPositivePlaceList[i];
            _bx+=20;
            quad->reSetLeftDownCorner(_bx, _by);
            quad->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        }
    }
    
    //----quad_keyList
    {
        m_tex_quad_key_blackWhite=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_geneCube_blackWhite.png");
        m_tex_quad_key_blackWhite->retain();
        m_tex_quad_key_colored=Cc3dTextureCache::sharedTextureCache()->addImage("singleCellGameResource/data/global/tex/quads/quad_geneCube.png");
        m_tex_quad_key_colored->retain();
        int nKey=1;
        for(int i=0;i<nKey;i++){
            Ckey*quad_key=new Ckey();//quad_keyList[i];
            quad_key->genAndInit(0, 30, 0, 30,0,1,0,1);
            quad_key->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->getIndexVBO()->genBuffers();
            quad_key->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(m_tex_quad_key_blackWhite);
            quad_key->setKeyUpColor(1, 1, 1, 1);
            quad_key->useKeyUpColor();
            quad_key->setCamera(camera2D);
            quad_key->getModel()->getMeshList()[0]->setIsWriteDepthBuffer(false);
            quad_key->setProgram(Cc3dProgramCache::sharedProgramCache()->getProgramByName("shaderNoLight"));
            quad_key->setPassUnifoCallback(passUnifoCallback_noLight);
            quad_key->setVisitDrawOrder(10000);
            addChild(quad_key);
            m_quad_keyList.push_back(quad_key);
        }

        
        //在quad_keyList中先前nkey个quad_key进行绘制--abc
        float by=145;
        float xBeginMin=100;
        float xEndMax=500;
        //在xbeginMin和xEndMax区间内画nKey个quad_key
        //为此重新设定各quad_key的大小--abc
        float keyWidth=minf((xEndMax-xBeginMin)/nKey,50);
        float keyHeight=keyWidth;
        for(int i=0;i<nKey;i++){
            Ckey*quad_key=m_quad_keyList[i];
            quad_key->reSetWidth(keyWidth);
            quad_key->reSetHeight(keyHeight);
        }
        //重设各quad_key的位置(通过左下角)
        for(int i=0;i<nKey;i++){
            Ckey*quad_key=m_quad_keyList[i];
            quad_key->reSetLeftDownCorner(xBeginMin+keyWidth*i, by);
        }
        //将各quad_key纹理都设置为彩色--abc
        for(int i=0;i<nKey;i++){
            Ckey*quad_key=m_quad_keyList[i];
            quad_key->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->setTexture(m_tex_quad_key_colored);
        }
        //提交--abc
        for(int i=0;i<nKey;i++){
            Ckey*quad_key=m_quad_keyList[i];
            quad_key->getModel()->getMeshList()[0]->getSubMeshByIndex(0)->submit(GL_STATIC_DRAW);
        }
        
    }
    //----switchPage
    Cc3dALSource*pALSource_switchPage=Cc3dAudioCache::sharedAudioCache()->createBufferAndSource("singleCellGameResource/data/global/audio/switchPage.wav","switchPage");
    this->addALSource(pALSource_switchPage);
    return true;
}