123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- //
- // BulldogGameOverIconAdCell.cpp
- // BubbleShoot
- //
- // Created by 刘玉涛 on 17/9/1.
- //
- //
- #include "RUBulldogGameOverIconAdCell.h"
- #include "BulldogIconLayer.h"
- NS_RU_BEGIN
- BulldogGameOverIconAdCell * BulldogGameOverIconAdCell::Layer(){
- redream::NodeLoaderLibrary *lib = redream::NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
- lib->registerNodeLoader("BulldogGameOverIconAdCell", BulldogGameOverIconAdCellLoader::loader());
- redream::REDReader *reader = new(std::nothrow) redream::REDReader(lib);
- reader->autorelease();
- BulldogGameOverIconAdCell * node = (BulldogGameOverIconAdCell*)reader->readNodeGraphFromFile("BulldogGameOverIconAdCell.redream");
-
- return node;
- }
- bool BulldogGameOverIconAdCell::onAssignREDMemberVariable(Ref* pTarget, const char* pMemberVariableName, Node* pNode){
- RED_MEMBERVARIABLEASSIGNER_GLUE_WEAK(this, "nodeIconAd", cocos2d::Node*, BulldogGameOverIconAdCell::nodeIconAd);
-
- return false;
- }
- SEL_MenuHandler BulldogGameOverIconAdCell::onResolveREDCCMenuItemSelector(Ref * pTarget, const char* pSelectorName){return nullptr;}
- cocos2d::extension::Control::Handler BulldogGameOverIconAdCell::onResolveREDCCControlSelector(cocos2d::Ref * pTarget, const char* pSelectorName){
- return NULL;
- }
- void BulldogGameOverIconAdCell::setAnimationManager(redream::REDAnimationManager* mgr){
- CC_SAFE_RELEASE_NULL(this->amgr);
- this->amgr = mgr;
-
- amgr->setDelegate(this);
-
- CC_SAFE_RETAIN(this->amgr);
-
- }
- void BulldogGameOverIconAdCell::setContent(string ccbiPath){
- BulldogIconLayer* bulldogIconLayer = BulldogIconLayer::Layer(ccbiPath);
- if(bulldogIconLayer){
- setVisible(true);
- bulldogIconLayer->toParentLayer(nodeIconAd);
- // float scale = nodeIconAd->getContentSize().width/bulldogIconLayer->getContentSize().width;
- // bulldogIconLayer->setScale(scale);
- // bulldogIconLayer->setPosition(nodeIconAd->getContentSize()*0.5);
- // ->addChild(bulldogIconLayer);
- }
-
- }
- void BulldogGameOverIconAdCell::completedAnimationSequenceNamed(const char *name, int seqId,int tag){
- if(strcmp(name, "close") == 0){
- removeFromParent();
- }
- }
- void BulldogGameOverIconAdCell::onNodeLoaded(Node * pNode, redream::NodeLoader * pNodeLoader){
- }
- void BulldogGameOverIconAdCell::onDownloadClick(Ref * pSender,cocos2d::extension::Control::EventType pEvent){
-
- // RedAdLayerController::getInstance()->clickInterstitial();
-
- }
- void BulldogGameOverIconAdCell::onCloseClick(Ref * pSender,cocos2d::extension::Control::EventType pEvent){
- // btnClose->setEnabled(false);
- // amgr->runAnimationsForSequenceNamed("close");
- //
- // RedAdLayerController::getInstance()->closeInterstitial();
- // Sound::Shared()->resumeBackgroundMusic();
-
-
- }
- void BulldogGameOverIconAdCell::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
- {
- TableViewCell::draw(renderer, transform, flags);
- // draw bounding box
- // auto pos = getPosition();
- // auto size = Size(178, 200);
- // Vec2 vertices[4]={
- // Vec2(pos.x+1, pos.y+1),
- // Vec2(pos.x+size.width-1, pos.y+1),
- // Vec2(pos.x+size.width-1, pos.y+size.height-1),
- // Vec2(pos.x+1, pos.y+size.height-1),
- // };
- // DrawPrimitives::drawColor4B(0, 0, 255, 255);
- // DrawPrimitives::drawPoly(vertices, 4, true);
- }
- void BulldogGameOverIconAdCell::onExit() {
- Node::onExit();
- amgr->setDelegate(NULL);
- }
- void BulldogGameOverIconAdCell::onEnter(){
- Node::onEnter();
- Ref* obj = this->getUserObject();
- redream::REDAnimationManager * ret = dynamic_cast<redream::REDAnimationManager*>(obj);
- setAnimationManager(ret);
-
- }
- BulldogGameOverIconAdCell::~BulldogGameOverIconAdCell(){
- CC_SAFE_RELEASE_NULL(this->amgr);
-
- }
- BulldogGameOverIconAdCell::BulldogGameOverIconAdCell()
- :amgr(NULL)
- {
- amgr = NULL;
- }
- NS_RU_END
|