bool soomla::CCSequenceReward::forceNextRewardToGive(soomla::CCReward *reward) { for (unsigned int i = 0; i < getRewards()->count(); i++) { if (reward->equals(getRewards()->getObjectAtIndex(i))) { CCRewardStorage::getInstance()->setLastSeqIdxGiven(this, i - 1); return true; } } return false; }
soomla::CCReward *soomla::CCSequenceReward::getLastGivenReward() { int idx = CCRewardStorage::getInstance()->getLastSeqIdxGiven(this); if (idx < 0) { return NULL; } return (CCReward *) getRewards()->getObjectAtIndex(idx); }
bool soomla::CCSequenceReward::giveInner() { int idx = CCRewardStorage::getInstance()->getLastSeqIdxGiven(this); if (idx >= getRewards()->count()) { return false; // all rewards in the sequence were given } CCRewardStorage::getInstance()->setLastSeqIdxGiven(this, (unsigned int) ++idx); return true; }
cocos2d::__Dictionary *soomla::CCAggregateReward::toDictionary() { cocos2d::__Dictionary *dict = CCReward::toDictionary(); cocos2d::__Array *dictArray = this->getDictArrayFromDomains(this->getDictArrayFromDomains(getRewards())); if (dictArray != nullptr) { dict->setObject(dictArray, CCCoreConsts::JSON_REWARDS); } return dict; }
bool soomla::CCSequenceReward::hasMoreToGive() { return CCRewardStorage::getInstance()->getLastSeqIdxGiven(this) < getRewards()->count(); }