diff --git a/src/Client/AndroidBall.cpp b/src/Client/AndroidBall.cpp index 2c3dc0b..323e9de 100644 --- a/src/Client/AndroidBall.cpp +++ b/src/Client/AndroidBall.cpp @@ -249,7 +249,8 @@ void AndroidBall::UpdateVisible(bool i) AndroidBall::~AndroidBall() { - instance = nullptr; + if (instance == this) + instance = nullptr; } float AndroidBall::clampf(float v, float min, float max) @@ -331,38 +332,42 @@ class $modify (AppDelegate) return; // fixes texture ldr if (auto ball = newScene->getChildByType(0)) - ball->removeFromParent(); - - newScene->addChild(AndroidBall::create()); - - if (auto shop = newScene->getChildByType(0)) { - cocos::handleTouchPriority(shop); + AndroidBall::instance = ball; + + return; } + + auto ball = AndroidBall::create(); + + newScene->addChild(ball); } }; void QOLModTouchDispatcher::touches(CCSet* touches, CCEvent* event, unsigned int type) { - bool thIgn; + bool sendToGame = true; if (AndroidUI::instance) return CCTouchDispatcher::touches(touches, event, type); - if (AndroidBall::get()) + if (touches) { - auto t = as(touches->anyObject()); + if (auto ball = AndroidBall::get()) + { + auto t = as(touches->anyObject()); - if (type == ccTouchType::CCTOUCHBEGAN) - thIgn = AndroidBall::get()->_ccTouchBegan(t, event); + if (type == ccTouchType::CCTOUCHBEGAN) + sendToGame = !ball->_ccTouchBegan(t, event); - if (type == ccTouchType::CCTOUCHMOVED) - thIgn = AndroidBall::get()->_ccTouchMoved(t, event); + if (type == ccTouchType::CCTOUCHMOVED) + sendToGame = !ball->_ccTouchMoved(t, event); - if (type == ccTouchType::CCTOUCHENDED) - thIgn = AndroidBall::get()->_ccTouchEnded(t, event); + if (type == ccTouchType::CCTOUCHENDED) + sendToGame = !ball->_ccTouchEnded(t, event); + } } - if (!thIgn) + if (sendToGame) CCTouchDispatcher::touches(touches, event, type); } \ No newline at end of file diff --git a/src/Client/AndroidUI.cpp b/src/Client/AndroidUI.cpp index 5335dea..430c947 100644 --- a/src/Client/AndroidUI.cpp +++ b/src/Client/AndroidUI.cpp @@ -451,7 +451,11 @@ void AndroidUI::goToPage(int p, bool transition) void AndroidUI::onClose(CCObject* sender) { - this->removeFromParent(); + log::info("CLOSEDS ETHLOSDFS"); + + FLAlertLayer::create("ADSSYFHSDFDS", "ADASD", "OK")->show(); + + // this->removeFromParent(); } CCAction* AndroidUI::getEnterAction(CCNode* panel)