@@ -253,56 +253,6 @@ ClicksLabelSettings* ClicksLabelSettings::create(int labelIndex) {
253253 return nullptr ;
254254}
255255
256- void ClicksLabelSettings::openMenu (int labelIndex) {
257- create (labelIndex)->show ();
258- }
259-
260- void ClicksLabelSettings::updateOpacity (CCObject*) {
261- opacityLabel->setString ((" Opacity (" + std::to_string (static_cast <int >(opacitySlider->getThumb ()->getValue () * 100 )) + " %)" ).c_str ());
262- }
263-
264- void ClicksLabelSettings::updateSize (CCObject*) {
265- sizeLabel->setString ((" Size (" + std::to_string (static_cast <int >(sizeSlider->getThumb ()->getValue () * 500 )) + " %)" ).c_str ());
266- }
267-
268- void ClicksLabelSettings::updateOffsetX (CCObject*) {
269- offsetXLabel->setString ((" OffsetX (" + std::to_string (static_cast <int >((offsetXSlider->getThumb ()->getValue () * 400 .f ) - 200 .f )) + " u)" ).c_str ());
270- }
271-
272- void ClicksLabelSettings::updateOffsetY (CCObject*) {
273- offsetYLabel->setString ((" OffsetY (" + std::to_string (static_cast <int >((offsetYSlider->getThumb ()->getValue () * 400 .f ) - 200 .f )) + " u)" ).c_str ());
274- }
275-
276- void ClicksLabelSettings::switchPos (CCObject* obj) {
277- auto id = static_cast <CCNode*>(obj)->getID ();
278- auto & lb = Labels::get ();
279-
280- posIndex += (id == " right" ) ? 1 : -1 ;
281-
282- if (posIndex == -1 ) posIndex = 8 ;
283- else if (posIndex == 9 ) posIndex = 0 ;
284-
285- posLabel->setString (positions[posIndex].c_str ());
286- }
287-
288- void ClicksLabelSettings::switchFont (CCObject* obj) {
289- auto id = static_cast <CCNode*>(obj)->getID ();
290- auto & lb = Labels::get ();
291-
292- fontIndex += (id == " right" ) ? 1 : -1 ;
293-
294- if (fontIndex == 60 ) fontIndex = 0 ;
295- if (fontIndex == -1 ) fontIndex = 59 ;
296-
297- fontLabel->removeFromParentAndCleanup (true );
298-
299- auto winSize = cocos2d::CCDirector::sharedDirector ()->getWinSize ();
300-
301- fontLabel = CCLabelBMFont::create ((" Font " + std::to_string (fontIndex + 1 )).c_str (), Labels::getFont (fontIndex).c_str ());
302- fontLabel->setPosition (winSize / 2 + ccp (-90 , -35 ));
303- fontLabel->setScale (0 .455f );
304- m_mainLayer->addChild (fontLabel);
305- }
306256
307257void ClicksLabelSettings::saveSettings (CCObject*) {
308258 keyBackClicked ();
@@ -328,34 +278,12 @@ void ClicksLabelSettings::saveSettings(CCObject*) {
328278
329279 lb.labels [labelIndex].settings .color = colorSprite->getColor ();
330280
331- CCArray* children = CCDirector::sharedDirector ()->getRunningScene ()->getChildren ();
332- CCObject* child;
333- CCARRAY_FOREACH (children, child) {
334- CustomLabelsLayer* layer = dynamic_cast <CustomLabelsLayer*>(child);
335- if (layer) {
336- if (lb.labels .size () >= 5 ) {
337- auto listLayer = static_cast <CCNode*>(layer->getChildren ()->objectAtIndex (0 ))->getChildByID (" GJCommentListLayer" );
338- auto listView = static_cast <CCNode*>(static_cast <CCNode*>(listLayer)->getChildren ()->objectAtIndex (0 ));
339- auto tableView = static_cast <CCNode*>(listView->getChildren ()->objectAtIndex (0 ));
340- auto contentLayer = static_cast <CCLayer*>(tableView->getChildren ()->objectAtIndex (0 ));
341-
342- lb.previousScroll = contentLayer->getPositionY ();
343- }
344-
345- layer->refresh (lb.labels .size () >= 5 );
346- }
347- }
348-
281+
282+ refreshList ();
349283 Labels::addLabels ();
350284 Labels::save ();
351285}
352286
353- void ClicksLabelSettings::openColorPicker (CCObject*) {
354- auto popup = ColorPickPopup::create (colorSprite->getColor ());
355- popup->setColorTarget (colorSprite);
356- popup->show ();
357- }
358-
359287void ClicksLabelSettings::toggleCPSOnly (CCObject*) {
360288 showCPSOnly = !showCPSOnly;
361289 totalClicksOnlyToggle->toggle (false );
@@ -366,4 +294,8 @@ void ClicksLabelSettings::toggleTotalClicksOnly(CCObject*) {
366294 showTotalClicksOnly = !showTotalClicksOnly;
367295 cpsOnlyToggle->toggle (false );
368296 showCPSOnly = false ;
297+ }
298+
299+ void ClicksLabelSettings::openMenu (int labelIndex) {
300+ create (labelIndex)->show ();
369301}
0 commit comments