示例#1
0
void NewsScene::createListView()
{
//    CCSize size = CCSize(750, 400);
    CCSize size = CCDirector::sharedDirector()->getWinSize();
  
    CCLayerColor * fundo =  CCLayerColor::create(ccc4(255, 255, 255, 255), size.width, size.height);
    fundo->setAnchorPoint(ccp(0,0));
    fundo->setPosition(ccp(0, 0));
    this->addChild(fundo,10);
//    CCLayerColor * header =  CCLayerColor::create(ccc4(200, 200, 200, 255), size.width, 80);
//    header->setAnchorPoint(ccp(0,0));
//    header->setPosition(ccp(0, size.height -80));
//    fundo->addChild(header);
    
    CCSprite *sprHeader;
    sprHeader = CCSprite::create("Header_Blue.png");
    
    sprHeader->setAnchorPoint(ccp(0,0));
    sprHeader->setScale(1);
    sprHeader->setPosition(ccp(0, size.height -90));
    this->addChild(sprHeader,100);
    CCSprite *sprTitle;
    sprTitle = CCSprite::create("tit_informacoes.png");
    
    sprTitle->setAnchorPoint(ccp(0,0));
    sprTitle->setScale(1);
    sprTitle->setPosition(ccp(110, size.height -50));
    this->addChild(sprTitle,101);
    
    CCMenu* menu = CCMenu::create();
    
    CCSprite *spriteDefault = CCSprite::create("Seta1.png");
    CCSprite *spriteSelected = CCSprite::create("Seta2.png");
    CCMenuItemSprite *item = CCMenuItemSprite::create(spriteDefault, spriteSelected, this,  menu_selector(NewsScene::btnBack));
    item->setAnchorPoint(ccp(0, 0));
    item->setPosition(ccp(0, size.height -90));
    menu->addChild(item, 0, 100);
    menu->setPosition(ccp(10,30));
    menu->setAnchorPoint(ccp(0,0));
    this->addChild(menu,102);
    
    list = CCListView::create(CCListViewModeVertical);
    list = cocos2d::extension::CCListView::create(CCListViewModeVertical);
    list->setDelegate(this);
    list->setContentSize(CCSize(size.width, size.height-70));
    list->setAnchorPoint(ccp(0,0));
    list->setPosition(ccp(0, 0));
    list->setColor(ccc3(50, 50, 50));
    list->setSeparatorStyle(CCListViewCellSeparatorStyleNone);
    
    fundo->addChild(list);
    this->loading = new AnimatedSprite("loader_einstein1.png");
	this->loading->addAnimation(AnimatedSprite::animationWithFile("loader_einstein", 24, 0.030f), "anim");//frame_count
    
    this->addChild(this->loading,999);
    this->loading->runAnimation("anim",true, true);
	this->loading->setAnchorPoint(ccp(0.5f, 0.5f));
	this->loading->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 - 30));
    this->loading->setVisible(true);
}
void ParkingViewScene::LoadParkingId()
{
    CCNode* node = this->getChildByTag(250);
    char s[20] ;

    sprintf(s, "%d.png", this->wayPointID);
    
    CCSprite *sprtEstabelecimento = CCSprite::create(s);
    if( sprtEstabelecimento == 0)
        sprtEstabelecimento = CCSprite::create("ModeloWayPointFoto.png");
    
    sprtEstabelecimento->setAnchorPoint(ccp(0,0));
    sprtEstabelecimento->setPosition(ccp(0,217));
    node->addChild(sprtEstabelecimento);

    
    //Waypoints do estacionamentos sao referidos como retirada de veiculos, de acordo
    //com o id, aqui o texto é alterado.
    switch(wayPointID)
    {
        case 19:
            insertLabel(ccc3(72, 72, 72), ccp(20, 180), true, "Bloco A1", node, 16);
            break;
        case 51:
            insertLabel(ccc3(72, 72, 72), ccp(20, 180), true, "Bloco B", node, 16);
            break;
        case 89:
            insertLabel(ccc3(72, 72, 72), ccp(20, 180), true, "Bloco D/E", node, 16);
            break;
    }
 

    //Cria um label ( aqui vira descricao do estacionamento)
    insertLabel(ccc3(72, 72, 72), ccp(20, 160), false, "Auditorio Moise Safra", node, 12);
    
    CCSprite *btnHorarioSelected = CCSprite::create("btnShowRotaEstacionmanto.png"); // botao pressionado
    CCSprite *btnHorarioUnSelected = CCSprite::create("btnShowRotaEstacionmanto.png");//botao nao pressionado
    CCMenuItemSprite *itembtnHorario = CCMenuItemSprite::create(btnHorarioSelected, btnHorarioUnSelected, btnHorarioSelected, menu_selector(ParkingViewScene::btnRotaCallBack));
	itembtnHorario->setAnchorPoint(ccp(0, 0));
    itembtnHorario->setPosition(ccp(40, 0));
    
    CCMenu* options = CCMenu::create();
    options->addChild(itembtnHorario,0,wayPointID);
    options->setPosition(ccp(230, 171) );
    node->addChild(options);
    
    CCSprite *sprtFundoEstabelecimento = CCSprite::create("SombraMagica.png");
    sprtFundoEstabelecimento->setAnchorPoint(ccp(0,0));
    sprtFundoEstabelecimento->setPosition(ccp(72, 200));
    node->addChild(sprtFundoEstabelecimento);
}
void AlertViewScene::showMessageParking(CCNode* parent, SEL_MenuHandler callbackFunction  ,int wayPoint)
{
    int basePosition = 50;
    
    float heigth = CCDirector::sharedDirector()->getWinSize().height;
    if (heigth >480) {
        basePosition = 100;//4inch
    }
    
    if( AlertViewScene::isActive ==  true)
        return;
    
    AlertViewScene::isActive = true;
    //Layer - Container with all elements of Alert
    CCLayerColor *node = CCLayerColor::create(ccc4(0,0,0,255));
    node->setContentSize(CCDirector::sharedDirector()->getWinSize());
    node->setOpacity(200);
    node->setAnchorPoint(ccp(0,0));
    node->setPosition(ccp(0,0));

    
    //Fundo do Popup
    CCSprite *sprBackground = CCSprite::create("popup.png");
    sprBackground->setAnchorPoint(ccp(0,0));
    sprBackground->setScale(1);
    sprBackground->setPosition(ccp( 25,basePosition+100));
    node->addChild(sprBackground);

    //Close Button of frame
    CCSprite *btnClose = CCSprite::create("fechar_btn.png");
    CCSprite *btnClosePress = CCSprite::create("fechar_press.png");

    CCSprite *Icone = CCSprite::create("icone_estacionamento.png");
    Icone->setPosition(ccp(45,basePosition+225));
    node->addChild(Icone);
    
    CCMenuItemSprite *itembtnClose = CCMenuItemSprite::create(btnClose, btnClosePress, node, callbackFunction);
	itembtnClose->setAnchorPoint(ccp(0, 0));
	itembtnClose->setPosition(ccp(280,basePosition+303));
    
    //Button Rota para o local
    CCSprite *btnSelect = CCSprite::create("ok_btn.png");
    CCSprite *btnUnselect = CCSprite::create("ok_press.png");
    
    CCMenuItemSprite *itembtnRota = CCMenuItemSprite::create( btnSelect,btnUnselect, node,callbackFunction);
	itembtnRota->setAnchorPoint(ccp(0, 0));
	itembtnRota->setPosition(ccp(115,basePosition+150));
    //Button Rota para o local
    CCMenu* options = CCMenu::create();
    options->addChild(itembtnClose,0,44);
    options->addChild(itembtnRota,0,wayPoint);
    options->setPosition(ccp(0, -20));
    node->addChild(options,3,Global::TAG_Child_Layer);
    
    //Title of Alert
    CCLabelTTF *labelTitle;
    labelTitle = CCLabelTTF::create("Alerta", "LucidaGrandeBold", 16);
    labelTitle->setPosition(ccp(35, basePosition+260));
    labelTitle->setAnchorPoint(ccp(0,0));
    labelTitle->setColor(ccc3(55, 55, 55));
    node->addChild(labelTitle);
    
    
    //sub-Title of Alert
    CCLabelTTF *labelSubTitle;
    labelSubTitle = CCLabelTTF::create("Atenção", "LucidaGrandeBold", 11);
    labelSubTitle->setPosition(ccp(60, basePosition+225));
    labelSubTitle->setAnchorPoint(ccp(0,0));
    labelSubTitle->setColor(ccc3(55, 55, 55));
    node->addChild(labelSubTitle);

    //Description of Alert
    CCLabelTTF *labelDescription;
    labelDescription = CCLabelTTF::create("       Ao entrar por este bloco você só poderá retirar", "Lucida Grande", 10);
    labelDescription->setPosition(ccp(40, basePosition+210));
    labelDescription->setAnchorPoint(ccp(0,0));
    labelDescription->setColor(ccc3(55, 55, 55));
    node->addChild(labelDescription);
    
    //Description of Alert
    CCLabelTTF *labelDescription2;
    labelDescription2 = CCLabelTTF::create("seu veículo neste mesmo bloco.", "Lucida Grande", 10);
    labelDescription2->setPosition(ccp(35, basePosition+200));
    labelDescription2->setAnchorPoint(ccp(0,0));
    labelDescription2->setColor(ccc3(55, 55, 55));
    node->addChild(labelDescription2);


    parent->addChild(node,10,Global::TAG_Alert_Layer);
}
void AlertViewScene::showMessageParkingOption(CCNode* sender, SEL_MenuHandler entering,SEL_MenuHandler outing,SEL_MenuHandler quiting)
{
    
    if( AlertViewScene::isActive ==  true)
        return;
    AlertViewScene::isActive = true;
    
    CCSprite *sprBackground = CCSprite::create("bg_parking_4inch.png");
    sprBackground->setAnchorPoint(ccp(0,0));
    //sprBackground->setScale(1);
    sprBackground->setPosition(ccp(0,0));
    
    
    //Backgroud Alert
    CCSprite *sprBackground2 = CCSprite::create("popup.png");
    sprBackground2->setAnchorPoint(ccp(0,0));
    //sprBackground2->setScale(1);
    sprBackground2->setPosition(ccp(25,200));
    
    //Layer - Container with all elements of Alert
    CCLayerColor *node = CCLayerColor::create(ccc4(0,0,0,200));
  //  node->setContentSize(CCDirector::sharedDirector()->getWinSize());
    //node->addChild(sprBackground,1);
    node->addChild(sprBackground2,22);
    //node->setOpacity(200);
    node->setAnchorPoint(ccp(0,0));
    node->setPosition(ccp(0,0));

    //Close Button of frame
    CCSprite *btnClose = CCSprite::create("fechar_btn.png");
    CCSprite *btnClosePress = CCSprite::create("fechar_press.png");
    
    CCSprite *Icone = CCSprite::create("icon_car.png");
    Icone->setPosition(ccp(45,325));
    node->addChild(Icone,23);
    
    CCMenuItemSprite *itembtnClose = CCMenuItemSprite::create(btnClose, btnClosePress, node, quiting);
	itembtnClose->setAnchorPoint(ccp(0, 0));
	itembtnClose->setPosition(ccp(280,380));
    
    
    
    //Button Rota para o local
    CCSprite *imgEntering = CCSprite::create("button_entering.png");
    CCSprite *imgEnteringPress = CCSprite::create("button_entering_press.png");
    
    
    CCMenuItemSprite *btnEntering = CCMenuItemSprite::create( imgEnteringPress,imgEntering, node,entering);
	btnEntering->setAnchorPoint(ccp(0, 0));
	btnEntering->setPosition(ccp(70,250));
    
    CCSprite *imgOuting = CCSprite::create("button_outing.png");
    CCSprite *imgOutingPress = CCSprite::create("button_outing_press.png");
    
    CCMenuItemSprite *btnOuting = CCMenuItemSprite::create( imgOutingPress,imgOuting, node,outing);
	btnOuting->setAnchorPoint(ccp(0, 0));
	btnOuting->setPosition(ccp(170,250));

    
    CCMenu* options = CCMenu::create();
    options->addChild(itembtnClose,0,44);
    options->addChild(btnEntering,15,84);
    options->addChild(btnOuting,16,84);
    options->setPosition(ccp(0, 0));
    node->addChild(options,24,Global::TAG_Child_Layer);
    
    
    //Title of Alert
    CCLabelTTF *labelTitle;
    labelTitle = CCLabelTTF::create("Você está:", "LucidaGrandeBold", 16);
    labelTitle->setPosition(ccp(35, 360));
    labelTitle->setAnchorPoint(ccp(0,0));
    labelTitle->setColor(ccc3(55, 55, 55));
    node->addChild(labelTitle,25);
    
    
    
    //Description of Alert
    CCLabelTTF *labelDescription;
    labelDescription = CCLabelTTF::create("       Você está saindo ou entrando?", "Lucida Grande", 12);
    labelDescription->setPosition(ccp(40, 320));
    labelDescription->setAnchorPoint(ccp(0,0));
    labelDescription->setColor(ccc3(55, 55, 55));
    node->addChild(labelDescription,26);
//
// 
//
//    
//   // ((CCLayerColor*)sender)->setOpacity(30);
//    CCDirector::sharedDirector()->getRunningScene()->addChild(node,10,Global::TAG_Alert_Layer);


        sender->addChild(node, 30, Global::TAG_Alert_Layer);
    
  
}
void AlertViewScene::showMessageRota(CCNode* sender, SEL_MenuHandler callbackFunction ,int wayPoint)
{
    if( AlertViewScene::isActive ==  true)
        return;
    AlertViewScene::isActive = true;

    //Backgroud Alert
    CCSprite *sprBackground = CCSprite::create("popup.png");
    sprBackground->setAnchorPoint(ccp(0,0));
    sprBackground->setScale(1);
    sprBackground->setPosition(ccp(25,100));
    
    //Layer - Container with all elements of Alert
    CCLayerColor *node = CCLayerColor::create(ccc4(0,0,0,255));
    node->setContentSize(CCDirector::sharedDirector()->getWinSize());
    node->addChild(sprBackground);
    node->setOpacity(200);
    node->setAnchorPoint(ccp(0,0));
    node->setPosition(ccp(0,0));

    //Close Button of frame
    CCSprite *btnClose = CCSprite::create("fechar_btn.png");
    CCSprite *btnClosePress = CCSprite::create("fechar_press.png");

    CCSprite *Icone = CCSprite::create("icone_horario.png");
    Icone->setPosition(ccp(45,225));
    node->addChild(Icone);
    
    CCMenuItemSprite *itembtnClose = CCMenuItemSprite::create(btnClose, btnClosePress, node, menu_selector(AlertViewScene::btnCloseAlert));
	itembtnClose->setAnchorPoint(ccp(0, 0));
	itembtnClose->setPosition(ccp(280,303));
    
    //Button Rota para o local
    CCSprite *btnSelect = CCSprite::create("Rota_btn.png");
    CCSprite *btnUnselect = CCSprite::create("Rota_press.png");
    
    CCMenuItemSprite *itembtnRota = CCMenuItemSprite::create( btnSelect,btnUnselect, node,callbackFunction);
	itembtnRota->setAnchorPoint(ccp(0, 0));
	itembtnRota->setPosition(ccp(80,150));
    //Button Rota para o local
    CCMenu* options = CCMenu::create();
    options->addChild(itembtnClose,0,44);
    options->addChild(itembtnRota,0,wayPoint);
    options->setPosition(ccp(0, -20));
    node->addChild(options,3,Global::TAG_Child_Layer);

    //Title of Alert
    CCLabelTTF *labelTitle;
    labelTitle = CCLabelTTF::create(IFixedMenu::LoadWayPointName(wayPoint), "LucidaGrandeBold", 16);
    labelTitle->setPosition(ccp(35, 260));
    labelTitle->setAnchorPoint(ccp(0,0));
    labelTitle->setColor(ccc3(55, 55, 55));
    node->addChild(labelTitle);
    
    CCLabelTTF *labelSubTitle;
    labelSubTitle = CCLabelTTF::create("Horário de funcionamento", "LucidaGrandeBold", 11);
    labelSubTitle->setPosition(ccp(60, 225));
    labelSubTitle->setAnchorPoint(ccp(0,0));
    labelSubTitle->setColor(ccc3(55, 55, 55));
    node->addChild(labelSubTitle);
    
    //Description of Alert
    CCLabelTTF *labelDescription;
    labelDescription = CCLabelTTF::create("Estamos abertos todos os dias das 9h as 24h*", "Lucida Grande", 10);
    labelDescription->setPosition(ccp(60, 210));
    labelDescription->setAnchorPoint(ccp(0,0));
    labelDescription->setColor(ccc3(55, 55, 55));
    node->addChild(labelDescription);
    
    ((CCLayerColor*)sender)->setOpacity(30);
    CCDirector::sharedDirector()->getRunningScene()->addChild(node,10,Global::TAG_Alert_Layer);
}