@@ -114,8 +114,13 @@ class $modify(MyPlayLayer, PlayLayer){
114114 schedule (schedule_selector (MyPlayLayer::setFPS), 1 );
115115
116116 if (CCLabelBMFont* debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID (" debug-text" ))) {
117- if (strcmp (debugText->getString (), " Ignore Damage" ) == 0 ){
118- debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID (" percentage-label" )); // hacky fix for wrong node IDs
117+ if (strcmp (debugText->getString (), " Ignore Damage" ) == 0 ){ // hacky fix for wrong node IDs
118+ if (CCNode* node = getChildByID (" percentage-label" )){
119+ debugText = typeinfo_cast<CCLabelBMFont*>(node);
120+ }
121+ else if (CCNode* node = getChildByID (" time-label" )){
122+ debugText = typeinfo_cast<CCLabelBMFont*>(node);
123+ }
119124 }
120125 debugText->setOpacity (0 );
121126 }
@@ -128,8 +133,13 @@ class $modify(MyPlayLayer, PlayLayer){
128133 m_fields->rightDebugNode ->removeAllChildren ();
129134
130135 if (CCLabelBMFont* debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID (" debug-text" ))) {
131- if (strcmp (debugText->getString (), " Ignore Damage" ) == 0 ){
132- debugText = typeinfo_cast<CCLabelBMFont*>(getChildByID (" percentage-label" )); // hacky fix for wrong node IDs
136+ if (strcmp (debugText->getString (), " Ignore Damage" ) == 0 ){ // hacky fix for wrong node IDs
137+ if (CCNode* node = getChildByID (" percentage-label" )){
138+ debugText = typeinfo_cast<CCLabelBMFont*>(node);
139+ }
140+ else if (CCNode* node = getChildByID (" time-label" )){
141+ debugText = typeinfo_cast<CCLabelBMFont*>(node);
142+ }
133143 }
134144
135145 if (!debugText->isVisible ()) return ;
0 commit comments