float GAFAsset::atlasScaleFromAtlasConfig(CCDictionary * anAtlasConfigDictionary) { if (!anAtlasConfigDictionary) { return 0; } CCNumber * scale = (CCNumber * )anAtlasConfigDictionary->objectForKey(kAtlasScaleKey); return scale->getDoubleValue(); }
void MainInnerLayer::onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader) { std::string text = ShowString("sun"); this->mlblName->setString(text.c_str()); this->mlblHealth->setZOrder(20); this->mlblPower->setZOrder(10); hpBar = MDProgressBar::create("x1.png","x2.png","x3.png",84,0.5); hpBar->setPosition(ccp(43, 361)); this->addChild(hpBar); expBar = MDProgressBar::create("t1.png","t2.png","t3.png",84,1.0); expBar->setPosition(ccp(201, 361)); this->addChild(expBar); CCDictionary *userInfo = GlobalData::getUserinfo(); if (userInfo!=NULL) { CCNumber* fraction = (CCNumber*)userInfo->objectForKey("fraction"); if(fraction->getIntValue()==FACTION_FAIRY) { m_sPlayerContainer->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(SPRITE_FACTION_FAIRY_CONTAINER)); } else if (fraction->getIntValue()==FACTION_BUDDHA) { m_sPlayerContainer->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(SPRITE_FACTION_BUDDHA_CONTAINER)); } else if (fraction->getIntValue()==FACTION_DEMON) { m_sPlayerContainer->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(SPRITE_FACTION_DEMON_CONTAINER)); } } mTableView->setDirection(kCCScrollViewDirectionHorizontal); mTableView->setVerticalFillOrder(kCCTableViewFillTopDown); mTableView->setDataSource(this); mTableView->setViewSize(CCSizeMake(266, 65)); mTableView->isPagingEnableX = true; mTableView->setBounceable(false); mTableView->setDelegate(this); mTableView->reloadData(); // if (m_sCharacter==NULL) { // m_sCharacter = CCSprite::createWithSpriteFrameName("character_sunwukong.png"); // m_sCharacter->setPosition(ccp(150,144)); // this->addChild(m_sCharacter); // // CCSize sSize = m_sCharacter->getContentSize(); // // this->glowEffect(ccp(sSize.width * 0.5,sSize.height * 0.5), CCSizeMake(5.0, 5.0f), ccc3(255, 230, 0), 1.0f, m_sCharacter); // } }
CCNumber* CCNumber::create(double num_double) { CCNumber *pRet = new CCNumber(); if(pRet && pRet->initWithNumber(num_double)) { pRet->autorelease(); return pRet; } else{ delete pRet; pRet = NULL; return pRet; } }
JNIEXPORT void JNICALL Java_cn_sharesdk_ShareSDKUtils_onJavaCallback (JNIEnv * env, jclass thiz, jstring resp) { CCJSONConverter* json = CCJSONConverter::sharedConverter(); const char* ccResp = env->GetStringUTFChars(resp, JNI_FALSE); CCLog("ccResp = %s", ccResp); CCDictionary* dic = json->dictionaryFrom(ccResp); env->ReleaseStringUTFChars(resp, ccResp); CCNumber* status = (CCNumber*) dic->objectForKey("status"); // Success = 1, Fail = 2, Cancel = 3 CCNumber* action = (CCNumber*) dic->objectForKey("action"); // 1 = ACTION_AUTHORIZING, 8 = ACTION_USER_INFOR,9 = ACTION_SHARE CCNumber* platform = (CCNumber*) dic->objectForKey("platform"); CCDictionary* res = (CCDictionary*) dic->objectForKey("res"); // TODO add codes here if(1 == status->getIntValue()){ callBackComplete(action->getIntValue(), platform->getIntValue(), res); }else if(2 == status->getIntValue()){ callBackError(action->getIntValue(), platform->getIntValue(), res); }else{ callBackCancel(action->getIntValue(), platform->getIntValue(), res); } dic->release(); }