| 99 | } |
| 100 | |
| 101 | void DropDownLayer::showLayer(bool attachToScene, bool bounce) |
| 102 | { |
| 103 | const auto& winSize = Director::getInstance()->getWinSize(); |
| 104 | |
| 105 | this->runAction(FadeTo::create(0.5, 125)); |
| 106 | if (!bounce) this->_dropLayer->runAction(EaseInOut::create(MoveTo::create(0.5f, {this->getPositionX(), 0}), 2)); |
| 107 | else this->_dropLayer->runAction(EaseBounceOut::create(MoveTo::create(1.f, {this->getPositionX(), 0}))); |
| 108 | |
| 109 | if (attachToScene) |
| 110 | { |
| 111 | auto scene = Director::getInstance()->getRunningScene(); |
| 112 | scene->addChild(this, 100); |
| 113 | } |
| 114 | |
| 115 | GameToolbox::onKeyDown(true, this, [this](ax::EventKeyboard::KeyCode keyCode, ax::Event*) |
| 116 | { |
| 117 | if (keyCode == ax::EventKeyboard::KeyCode::KEY_ESCAPE) hideLayer(); |
| 118 | }); |
| 119 | } |
| 120 | |
| 121 | void DropDownLayer::hideLayer() |
| 122 | { |