Exemplo n.º 1
0
//试听控制
void PlayRunLayer::auditionControll(int type){
    switch (type) {
        case AUDITION_PAUSE:
            testSectionLayer->pause();
            testSectionLayer->stopAllActions();
            break;
        case AUDITION_RESUME:
            testSectionLayer->resume();
            testSectionLayer->runAction(getMoveActionIterval()); //移动试听音符界面
            break;
        default:
            break;
    }
}
Exemplo n.º 2
0
bool PlayRunLayer::init4Finger(const cocos2d::Color4B &&color, MusicModel *musicModel,float height){
    //画面大小
    Size visibleSize = Director::getInstance()->getVisibleSize();
    
    gameConfig = new PlayConfig(visibleSize.width, height, musicModel);
    poptGlobal->gni->setConfig(gameConfig);
    bool result =  init(color);
    //组装界面
    this->loadFrame();
    //正式层
    sectionLayer = loadSectionLayer(true);
    this->addChild(sectionLayer,2);
    //试听层
    testSectionLayer = loadSectionLayer(false);
    this->addChild(testSectionLayer);
    
    //加载音乐
    map<int,SectionInfo*> sections = gameConfig->musicModel->getSections();
    int size =  (int)sections.size();
    for (int i=1; i<size+1; i++) {
        SectionInfo* sectionInfo = sections[i];
        map<int,BeatInfo*> beats = sectionInfo->beats;
        for (int b=0; b<beats.size(); b++) {
            BeatInfo* beatInfo =  beats.at(b+1);
            string type = beatInfo->chordType;
            string chordFileName = "audio/chord/"+type+"_clean.caf";
            CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(chordFileName.c_str());
        }
        map<int,TonicInfo*> tonics = sectionInfo->tonics;
        for (int t=1; t<tonics.size()+1; t++) {
            TonicInfo* toincInfo = tonics[t];
            string note4Str = toincInfo->note;
            if(!note4Str.empty() && note4Str !="0" ){
                string scaleFileName ="audio/scale/"+note4Str+".mp3";
                CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(scaleFileName.c_str());
            }
        }
    }
    //开始移动正式音符界面
    auto beginMove = getMoveActionIterval();
    sectionLayer->runAction(beginMove);
    
    return result;
}
Exemplo n.º 3
0
bool PlayRunLayer::init4Finger(const cocos2d::Color4B &&color, MusicModel *musicModel,float height){
    //画面大小
    Size visibleSize = Director::getInstance()->getVisibleSize();
    
    gameConfig = new PlayConfig(visibleSize.width, height, musicModel);
    poptGlobal->gni->setConfig(gameConfig);
    bool result =  init(color);
    //组装界面
    this->loadFrame();
    //正式层
    sectionLayer = loadSectionLayer(true);
    this->addChild(sectionLayer,2);
    //试听层
    testSectionLayer = loadSectionLayer(false);
    this->addChild(testSectionLayer);
    
    //加载音乐
    map<int,MeasureInfo*> measures = gameConfig->musicModel->getMeasures();
    int size =  (int)measures.size();
    for (int i=1; i<size+1; i++) {
        MeasureInfo* measureInfo = measures[i];
        map<int,BeatInfo*> beats = measureInfo->beats;
        for (int b=0; b<beats.size(); b++) {
            BeatInfo* beatInfo =  beats.at(b+1);
            if(beatInfo->chordInfo!=nullptr) {
                string type = beatInfo->chordInfo->chordType;
                string chordFileName = "audio/chord/"+type+"_clean.caf";
                CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(chordFileName.c_str());
            }
        }
    }
    //开始移动正式音符界面
    auto beginMove = getMoveActionIterval();
    sectionLayer->runAction(beginMove);
    
    return result;
}