Пример #1
0
bool Vandal::init(cocos2d::ValueMap map)
{
    _frameName = map.at("frame").asString();
    _position = Vec2(map.at("x").asInt(), (1136 - map.at("y").asInt())) / 2;
    
    return true;
}
Пример #2
0
bool CrazyScratch::init( UnitNode* owner, const cocos2d::ValueMap& data, const cocos2d::ValueMap& params ) {
    if( !SkillNode::init( owner ) ) {
        return false;
    }
    
    int level = data.at( "level" ).asInt();
    _damage = data.at( "damage" ).asValueVector().at( level - 1 ).asFloat();
    _duration = data.at( "duration" ).asFloat();
    _interval = data.at( "interval" ).asFloat();
    _elapse = _interval;
    _range = data.at( "range" ).asFloat();
    _count = data.at( "count" ).asInt();
    _origin_pos = _owner->getPosition();
    _last_pos = _origin_pos;
    
    Point dir = _owner->getUnitDirection();
    if( dir.y > 0 ) {
        _skeleton = ArmatureManager::getInstance()->createArmature( "characters/kyle/kyle_b" );
    }
    else {
        _skeleton = ArmatureManager::getInstance()->createArmature( "characters/kyle/kyle_f" );
    }
    if( dir.x > 0 ) {
        _skeleton->getSkeleton()->flipX = 1;
    }
    else {
        _skeleton->getSkeleton()->flipX = 0;
    }
    
    _owner->getBattleLayer()->addToEffectLayer( _skeleton, _last_pos, _owner->getBattleLayer()->zorderForPositionOnObjectLayer( _last_pos ) );
    _skeleton->setAnimation( 0, "Cast_1", true );
    _skeleton->setBlendFunc( BlendFunc::ADDITIVE );
    return true;
}
Пример #3
0
bool ShadowAssault::init( UnitNode* owner, const cocos2d::ValueMap& data, const cocos2d::ValueMap& params ) {
    if( !SkillNode::init( owner ) ) {
        return false;
    }
    int level = data.at( "level" ).asInt();
    _damage = data.at( "damage" ).asValueVector().at( level - 1 ).asFloat();
    
    return true;
}
 void GameBuyStoreMannager::buyPropsWithTokens(cocos2d::ValueMap data)
 {
     if (data.at(STORE_COST_KEY).asInt() <= UserDataManager::getInstance()->getPropsNumbleWithKey(data.at(STORE_COST_TYPE_KEY).asString()))
     {
         for (auto var : data.at(ITEM_PROPS_DATA_KEY).asValueMap())
         {
             UserDataManager::getInstance()->addPropsNumbleWithKey(var.first, var.second.asInt());
         }
         UserDataManager::getInstance()->cutPropsNumbleWithKey(data.at(STORE_COST_TYPE_KEY).asString(), data.at(STORE_COST_KEY).asInt());
     }
 }
Пример #5
0
bool DreadLord::init( UnitNode* owner, const cocos2d::ValueMap& data, const cocos2d::ValueMap& params ) {
    if( !SkillNode::init( owner ) ) {
        return false;
    }
    
    int level = data.at( "level" ).asInt();
    _extra_atk = data.at( "atk" ).asValueVector().at( level - 1 ).asFloat();
    _extra_dod = data.at( "dod" ).asValueVector().at( level - 1 ).asFloat();
    _duration = data.at( "duration" ).asFloat();
    _elapse = 0;
    
    return true;
}
Пример #6
0
void Coin::config( const cocos2d::ValueMap& cfg )
{
	int coin = cfg.at("coin").asInt();
	m_coin = coin;
	initWithFile( cstr("coin%d.png", coin) );
	MapObj::config(cfg);
}
 void GameBuyStoreMannager::buyProps(cocos2d::ValueMap data)
 {
     this->setBuyPropsKeyAndNumble(data);
     int target = data.at(TARGET_ID_KEY).asInt();
     GameJNIHelper::getInstance()->payWithTargetID(target);
     //this->setCurrentPropsTarget(target);
     cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(EVENT_BUY_PROPS_PAY_SUCCESS);
 }
Пример #8
0
void ShopDialogEntry::setItemInfo(cocos2d::ValueMap itemInfo)
{
    _itemInfo = itemInfo;
    
    int intType = _itemInfo.at("type").asInt();
    std::string type = intType == 1 ? "Sprayer" : "Brush";
    
    _labelName->setString(_itemInfo.at("name").asString());
    _labelType->setString(type);
    _labelPrice->setString(StringUtils::format("%d", _itemInfo.at("price").asInt()));
    
    std::string itemPrefix = intType == 1 ? "equipments/spray-%d.png" : "equipments/brush-%d.png";
    _spriteItem->setSpriteFrame(StringUtils::format(itemPrefix.c_str(), itemInfo.at("id").asInt()));
}
Пример #9
0
bool BonesRain::init( UnitNode* owner, const cocos2d::ValueMap& data, const cocos2d::ValueMap& params ) {
    if( !SkillNode::init( owner ) ) {
        return false;
    }
    
    int level = data.at( "level" ).asInt();
    _damage = data.at( "damage" ).asValueVector().at( level - 1 ).asFloat();
    _radius = data.at( "radius" ).asFloat();
    _interval = data.at( "interval" ).asFloat();
    _elapse = _interval;
    _count = data.at( "count" ).asInt();
    _current_count = 0;
    _dir = Point( params.at( "dir_x" ).asFloat(), params.at( "dir_y" ).asFloat() );
    _init_pos = _owner->getPosition();
    
    return true;
}
Пример #10
0
bool MissileShowers::init( UnitNode* owner, const cocos2d::ValueMap& data, const cocos2d::ValueMap& params ) {
    if( !SkillNode::init( owner ) ) {
        return false;
    }
    
    int level = data.at( "level" ).asInt();
    _damage = data.at( "damage" ).asValueVector().at( level - 1 ).asFloat();
    _range = data.at( "range" ).asFloat();
    _radius = data.at( "radius" ).asFloat();
    _count = data.at( "count" ).asValueVector().at( level - 1 ).asInt();
    _interval = data.at( "interval" ).asFloat();
    _current_count = 0;
    
    return true;
}
Пример #11
0
void UIStoryLayer::setStoryData( const cocos2d::ValueMap& data ) {
    _story_name = data.at( "name" ).asString();
    _story_data = data.at( "story_data" ).asValueVector();
    this->reset();
    this->gotoNextLine();
}