@@ -106,6 +106,8 @@ bool SongControlMenu::setup() {
106106 this ->b ->setColor ({0 , 0 , 0 });
107107 this ->b ->setOpacity (128 );
108108
109+ this ->schedule (schedule_selector (SongControlMenu::checkManagerFinished));
110+
109111 cocos2d::CCMenu* incrementDecrementMenu = cocos2d::CCMenu::create ();
110112 incrementDecrementMenu->setContentWidth (240 .f );
111113 Utils::addButton (" skip-bkwd" , menu_selector (SongControlMenu::onSkipBkwdButton), incrementDecrementMenu, this , true );
@@ -141,7 +143,6 @@ bool SongControlMenu::setup() {
141143 clippingNode->addChild (darkProgBar);
142144 this ->m_clipNode = clippingNode;
143145
144- this ->schedule (schedule_selector (SongControlMenu::checkManagerFinished));
145146 SongControlMenu::updateCurrentLabel ();
146147
147148 /*
@@ -232,47 +233,10 @@ void SongControlMenu::toggleButtonState(cocos2d::CCNode* playlistButton, const b
232233}
233234
234235void SongControlMenu::checkManagerFinished (float ) {
235- const bool finishedSongLengths = SongManager::get ().getFinishedCalculatingSongLengths ();
236- SongControlMenu::toggleButtonState (this ->m_openSongListMenu ->getChildByTag (20260105 ), finishedSongLengths);
237- if (finishedSongLengths) {
238- this ->m_smallLabel ->removeFromParent ();
239- this ->b ->addChildAtPosition (this ->m_smallLabel , geode::Anchor::Center, {0 .f , 3 .5f });
240- this ->b ->addChildAtPosition (this ->m_increDecreMenu , geode::Anchor::Center);
241- this ->b ->addChildAtPosition (this ->m_currTimeLb , geode::Anchor::BottomLeft, {27 .5f , 6 .f });
242- this ->b ->addChildAtPosition (this ->m_totlTimeLb , geode::Anchor::BottomRight, {-27 .5f , 6 .f });
243- this ->b ->addChildAtPosition (this ->m_clipNode , geode::Anchor::BottomLeft);
244- this ->m_currTimeLb ->setScale (.35f );
245- this ->m_totlTimeLb ->setScale (.35f );
246- SongControlMenu::checkDaSongPositions (0 .f );
247- this ->schedule (schedule_selector (SongControlMenu::checkDaSongPositions), 2 .f / 60 .f );
248- } else {
249- this ->m_smallLabel ->removeFromParent ();
250- this ->b ->addChildAtPosition (this ->m_smallLabel , geode::Anchor::Center);
251- this ->m_smallLabel ->removeFromParent ();
252- this ->m_increDecreMenu ->removeFromParent ();
253- this ->m_currTimeLb ->removeFromParent ();
254- this ->m_totlTimeLb ->removeFromParent ();
255- this ->m_clipNode ->removeFromParent ();
256- }
236+ SongControlMenu::toggleButtonState (this ->m_openSongListMenu ->getChildByTag (20260105 ), SongManager::get ().getFinishedCalculatingSongLengths ());
257237}
258238
259239void SongControlMenu::checkDaSongPositions (float ) {
260- SongManager& songManager = SongManager::get ();
261- if (!songManager.getFinishedCalculatingSongLengths ()) {
262- if (this ->m_currProgBar ) this ->m_currProgBar ->setVisible (false );
263- if (this ->m_darkProgBar ) this ->m_darkProgBar ->setVisible (false );
264- if (this ->m_currTimeLb ) {
265- this ->m_currTimeLb ->setString (" 0:00" );
266- this ->m_currTimeLb ->setVisible (false );
267- }
268- if (this ->m_totlTimeLb ) {
269- this ->m_totlTimeLb ->setString (" 0:00" );
270- this ->m_totlTimeLb ->setVisible (false );
271- }
272- this ->unschedule (schedule_selector (SongControlMenu::checkDaSongPositions));
273- return ;
274- }
275-
276240 if (this ->b ) {
277241 this ->b ->_bottomLeft ->setVisible (false );
278242 this ->b ->_bottomRight ->setVisible (false );
@@ -282,10 +246,8 @@ void SongControlMenu::checkDaSongPositions(float) {
282246
283247 if (!this ->m_currTimeLb || !this ->m_totlTimeLb || !this ->m_currProgBar || !this ->m_darkProgBar ) return ;
284248
285- this ->m_currProgBar ->setVisible (true );
286- this ->m_darkProgBar ->setVisible (true );
287- this ->m_currTimeLb ->setVisible (true );
288- this ->m_totlTimeLb ->setVisible (true );
249+ SongManager& songManager = SongManager::get ();
250+ if (!songManager.getFinishedCalculatingSongLengths ()) return ;
289251
290252 FMODAudioEngine* fmod = FMODAudioEngine::get ();
291253 const std::string& currSong = songManager.getCurrentSong ();
@@ -416,7 +378,15 @@ void SongControlMenu::updateCurrentLabel() {
416378 const std::string& currentSong = songManager.getCurrentSongDisplayName ();
417379 if (!this ->m_smallLabel || !this ->m_smallLabel ->getParent () || this ->m_smallLabel ->getParent () != this ->b ) {
418380 this ->m_smallLabel = cocos2d::CCLabelBMFont::create (currentSong.c_str (), " chatFont.fnt" );
419- this ->b ->addChildAtPosition (this ->m_smallLabel , geode::Anchor::Center);
381+ this ->b ->addChildAtPosition (this ->m_smallLabel , geode::Anchor::Center, {0 .f , 3 .5f });
382+ this ->b ->addChildAtPosition (this ->m_increDecreMenu , geode::Anchor::Center);
383+ this ->b ->addChildAtPosition (this ->m_currTimeLb , geode::Anchor::BottomLeft, {27 .5f , 6 .f });
384+ this ->b ->addChildAtPosition (this ->m_totlTimeLb , geode::Anchor::BottomRight, {-27 .5f , 6 .f });
385+ this ->b ->addChildAtPosition (this ->m_clipNode , geode::Anchor::BottomLeft);
386+ this ->m_currTimeLb ->setScale (.35f );
387+ this ->m_totlTimeLb ->setScale (.35f );
388+ SongControlMenu::checkDaSongPositions (0 .f );
389+ this ->schedule (schedule_selector (SongControlMenu::checkDaSongPositions), 2 .f / 60 .f );
420390 } else this ->m_smallLabel ->setString (currentSong.c_str (), " chatFont.fnt" );
421391 this ->m_smallLabel ->limitLabelWidth ((this ->b ->getContentWidth () - 20 .f ) * .85f , 1 .0f , .0001f );
422392 this ->m_smallLabel ->setBlendFunc ({GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA});
0 commit comments