Esempio n. 1
0
void shop::initBag(){
    CSJson::Reader reader;
    CSJson::Value root;
    if (reader.parse(GameData::shareGameData()->bagData, root)) {
        bool result=root["result"].asBool();
        if (result) {
            CSJson::Value data;
            data=root["data"];
            for (int i=0; i<data.size(); i++) {
                CCLog("%d",data[i].asInt());
                if (i<12) {
                    buySkill[i]=data[i].asInt();
                    arrTag=i;
                    UIButton * btn= dynamic_cast<UIButton *>(layer->getWidgetByTag(9+i));
                    btn->addPushDownEvent(this, coco_pushselector(shop::touchBeganEvent0));
                    btn->addMoveEvent(this, coco_moveselector(shop::touchMovedEvent0));
                    btn->addReleaseEvent(this, coco_moveselector(shop::touchEndedEvent0));
                    
                    char name[20]="";
                    sprintf(name, "skill-%02d.png",i+1);
                    btn->loadTextures(name, name, name);
                    btn->setVisible(true);
                }
            }
        }
    }
}
Esempio n. 2
0
void PlayScene::TakeOff() {
  UIButton* btn = NULL;
  btn = (UIButton *)ui_layer_->getWidgetByName(btn_name[sub_stage_id_]);

  if (btn) {
    btn->setTouchEnable(true);
    btn->addTouchEventListener(this, toucheventselector(PlayScene::onBtnClothes));
    btn->addMoveEvent(this, coco_moveselector(PlayScene::onBtnMoveClothes));
    TakeOffAction(btn);
  }
  CCLOG("%s error sub_stage_id_:%d\n", __FUNCTION__, sub_stage_id_);
  return;
}