void TscoreMeasure::shiftReleased(QList<TscoreNote*>& notesToOut, Tnote& newNote) { if (!notesToOut.isEmpty()) m_staff->shiftToMeasure(id() + 1, notesToOut); if (newNote.rhythm() != Trhythm::e_none) addNewNote(newNote); }
void GameScene::update(float dt) { auto UIComponent = (cocostudio::ComRender*) UINode->getComponent("gameSceneUI"); auto UILayer = (Layer*)UIComponent->getNode(); auto loadingBar = dynamic_cast<LoadingBar*>(UILayer->getChildByTag(GAMESCENE_LOADINGBAR)); auto labelLevel = dynamic_cast<Text*>(UILayer->getChildByTag(GAMESCENE_LABEL_LEVEL)); auto labelInfo = dynamic_cast<Text*>(UILayer->getChildByTag(GAMESCENE_LABEL_INFO)); int currPos = AudioEngine::getInstance()->getPosition(); int percent = currPos * 100 / AudioEngine::getInstance()->getLength(); loadingBar->setPercent(percent); while ((currPos + preloadTime + setting_lag >= noteline.time))//提前一些生成 { if (noteline.time == 0)break;//读到最后跳出 int arg1 = noteline.type; int arg2 = noteline.length; int arg3 = noteline.posX; int arg4 = noteline.posY; MapUtils::getNoteline();//读取下个音符 addNewNote(arg1, arg2, arg3, arg4); } if (!AudioEngine::getInstance()->isPlaying())//一首歌结束则切换到结算界面 { this->unscheduleUpdate(); auto scene = ClearScene::createScene(labelInfo->getString(), labelLevel->getString()); Director::getInstance()->replaceScene(TransitionCrossFade::create(2, scene)); } }