| 34 | USING_NS_AX; |
| 35 | |
| 36 | void PopupLayer::show(Transitions transitions) |
| 37 | { |
| 38 | //robtops system to add to highest z |
| 39 | auto scene = Director::getInstance()->getRunningScene(); |
| 40 | int z = GameToolbox::getHighestChildZ(scene); |
| 41 | if(z <= 104) |
| 42 | z = 105; |
| 43 | else |
| 44 | z++; |
| 45 | |
| 46 | scene->addChild(this, z); |
| 47 | this->setOpacity(0); |
| 48 | |
| 49 | switch (transitions) |
| 50 | { |
| 51 | case kNone: |
| 52 | break; |
| 53 | default: |
| 54 | this->_mainLayer->setScale(0.1f); |
| 55 | this->_mainLayer->runAction(EaseElasticOut::create(ScaleTo::create(0.5f, 1.0f), 0.6f)); |
| 56 | } |
| 57 | this->runAction(FadeTo::create(0.14, 150)); |
| 58 | |
| 59 | GameToolbox::onKeyDown(true, this, [this](EventKeyboard::KeyCode code, Event*) |
| 60 | { |
| 61 | GameToolbox::log("key down popup: {}", static_cast<int>(code)); |
| 62 | switch(code) |
| 63 | { |
| 64 | case EventKeyboard::KeyCode::KEY_BACK: |
| 65 | close(); |
| 66 | default: |
| 67 | break; |
| 68 | } |
| 69 | }); |
| 70 | } |
| 71 | |
| 72 | bool PopupLayer::init() |
| 73 | { |
no test coverage detected