bool WorldCup::init(){ if ( !CCLayer::init() ) { return false; } showYet = false; inUpdateData = false; oldOrNew = 0; lastRefreshTime = 0; inRefresh = false; lastUpdateIndex = 0; dict = CCDictionary::create(); dict->retain(); CCSize size = CCDirector::sharedDirector()->getVisibleSize(); CCLog("winSize %f %f", size.width, size.height); UILayer *lay = UILayer::create(); addChild(lay); //lay->setPosition(ccp(size.width/2, size.height/2)); //lay->setContentSize(size); //w = GUIReader::shareReader()->widgetFromJsonFile("gui/ballUI_1.json"); w = GUIReader::shareReader()->widgetFromJsonFile("gui/ballUI_1_0.json"); lay->addWidget(w); CCSize rs = w->getSize(); CCLog("rootSize %f %f", rs.width, rs.height); w->setSizeType(SIZE_ABSOLUTE); w->setSize(size); Button *conf = static_cast<Button*>(UIHelper::seekWidgetByName(w, "selfinfo")); conf->addTouchEventListener(this, toucheventselector(WorldCup::onConf)); /* */ /* Button *fri = static_cast<Button*>(UIHelper::seekWidgetByName(w, "Button_5")); fri->addTouchEventListener(this, toucheventselector(WorldCup::onFri)); */ lv = static_cast<UIListView*>(UIHelper::seekWidgetByName(w, "listView")); lv->addEventListenerListView(this, listvieweventselector(WorldCup::onListview)); lv->addEventListenerScrollView(this, scrollvieweventselector(WorldCup::onScroll)); UIPanel *pan = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "dayPanel")); pan->setEnabled(false); pc = pan->clone(); pc->setVisible(true); pc->setEnabled(true); pc->retain(); dlab = static_cast<UILabel*>(UIHelper::seekWidgetByName(pc, "date")); UIPanel *cupPanel = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "cupPanel")); cupPanel->setEnabled(false); //整个Panel 大小一样的 按钮 //Button *full = static_cast<Button*>(UIHelper::seekWidgetByName(cupPanel, "full")); //full->setVisible(false); cp = cupPanel->clone(); cp->setVisible(true); cp->setEnabled(true); cp->retain(); /* UIPanel *pan = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "dayPanel")); UIListView *lv = static_cast<UIListView*>(UIHelper::seekWidgetByName(w, "listView")); UIWidget *pc = pan->clone(); pc->setVisible(true); lv->pushBackCustomItem(pc); UIPanel *cupPanel = static_cast<UIPanel*>(UIHelper::seekWidgetByName(w, "cupPanel")); UIWidget *cp = cupPanel->clone(); cp->setVisible(true); lv->pushBackCustomItem(cp); lv->pushBackCustomItem(pc->clone()); lv->pushBackCustomItem(cp->clone()); lv->pushBackCustomItem(cp->clone()); lv->pushBackCustomItem(cp->clone()); */ scheduleUpdate(); return true; }