コード例 #1
0
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;
}
コード例 #2
0
soomla::CCReward *soomla::CCSequenceReward::getLastGivenReward() {
    int idx = CCRewardStorage::getInstance()->getLastSeqIdxGiven(this);
    if (idx < 0) {
        return NULL;
    }
    return (CCReward *) getRewards()->getObjectAtIndex(idx);
}
コード例 #3
0
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;
}
コード例 #4
0
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;
}
コード例 #5
0
bool soomla::CCSequenceReward::hasMoreToGive() {
    return CCRewardStorage::getInstance()->getLastSeqIdxGiven(this) < getRewards()->count();
}