bool BattleScene::init() { Layer::init(); currentLayer = this; Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB565); setCamera(); controlCamera(); setCameraMask(2); createBackground(); enableTouch(); initUILayer(); GameMaster::create(); MessageDispatchCenter::getInstance()->registerMessage(MessageType::BLOOD_MINUS, [](Actor * heroActor) { uiLayer->bloodDrop(heroActor); }); MessageDispatchCenter::getInstance()->registerMessage(MessageType::ANGRY_CHANGE, [](Actor * heroActor) { uiLayer->angryChange(heroActor); }); scheduleUpdate(); return true; }
//============================================================= //============================================================= void BWCombatLayer::onEnter() { CCCutTouchLayer::onEnter(); _pBgLayer = Layer::create(); _pBgLayer->setAnchorPoint(Point(0,0)); _pBgLayer->setPosition(Point(0,0)); addChild(_pBgLayer,COMBAT_BG_Z); initBgMapUI(); initUILayer(); initCter(); beginUpdate(); CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("game_bg3.mp3",true); }