Esempio n. 1
0
void
CSVGStroke::
setOpacity(const string &opacity_def)
{
  double opacity = svg_.decodeOpacityString(opacity_def);

  setOpacity(opacity);
}
Esempio n. 2
0
	void PopUpMenu::logic( double timeElapsed )
	{
		agui::PopUpMenu::logic(timeElapsed);
		if(getOpacity() < 1.0f)
		{
			setOpacity(getOpacity() + m_opacityRate);
		}
	}
MenuItemSprite* ItemWindowLayer::createMenuItemSprite(Color3B color, const ccMenuCallback& callback)
{
    auto rect = Rect(0, 0, 300, 30);
    auto capRect = Rect(0, 0, 300, 30);

    auto pSprite1 = extension::Scale9Sprite::create("menu_button.png", rect, capRect);
    pSprite1->setColor(color);
    pSprite1->setOpacity(192);
    pSprite1->setContentSize(Size(40, 20));
    auto pSprite2 = extension::Scale9Sprite::create("menu_button.png", rect, capRect);
    pSprite2->setColor(color);
    pSprite2->setOpacity(128);
    pSprite2->setContentSize(Size(40, 20));

    // 使用ボタン
    return MenuItemSprite::create(pSprite1, pSprite2, callback);
}
void
MCSkillBarItem::coldTimeDidFinish(CCObject *anObject)
{
    CCProgressTimer *progressTimer = dynamic_cast<CCProgressTimer *>(anObject);
    
    progressTimer->removeFromParentAndCleanup(true);
    setOpacity(kMCSkillBarItemActiveSkillOpacity);
}
Esempio n. 5
0
 RotationOriginIndicator(QGraphicsItem *parent = 0)
     : QGraphicsItem(parent)
 {
     setFlags(QGraphicsItem::ItemIgnoresTransformations |
              QGraphicsItem::ItemIgnoresParentOpacity);
     setZValue(10000 + 1);
     setOpacity(0.5);
 }
Esempio n. 6
0
void TextureMapperLayer::syncAnimations()
{
    m_animations.apply(this);
    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform))
        setTransform(m_state.transform);
    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))
        setOpacity(m_state.opacity);
}
Esempio n. 7
0
bool PencilLayer::init()
{
    if (!LayerColor::initWithColor(Color4B::WHITE)) //ÇϾá»ö ¼¼ÆÃ
    {
        return false;
    }
    auto winSize = Director::getInstance()->getWinSize();

    auto background = MenuItemImage::create(
        "Resources/Black.png", 
        "Resources/Black.png", 
        CC_CALLBACK_1(PencilLayer::VoidFunc, this));

    auto menu0 = Menu::create(background, false);
    menu0->setAnchorPoint(Point(0, 0));
    menu0->setPosition(winSize.width / 2, winSize.height / 2);
    menu0->setOpacity(50);
    this->addChild(menu0, 10);

    auto exit = MenuItemImage::create(
        "Resources/Exit.png",
        "Resources/ExitSelected.png",
        CC_CALLBACK_1(PencilLayer::menuCallback, this));
    auto menu = Menu::create(exit, false);
    menu->setPosition(1200, 700);
    this->addChild(menu, 13);

    Sprite* pencil;
    if (Player::getInstance()->IsPencilSharp())
    {
        pencil = Sprite::create("Resources/Pencil2.png");
    }
    else if (Player::getInstance()->GetSharpGauge()>=50)
    {
        pencil = Sprite::create("Resources/Pencil1.png");
    }
    else
    {
        pencil = Sprite::create("Resources/Pencil0.png");
    }
    pencil->setAnchorPoint(Point(0.5, 0));
    pencil->setPosition(640, 0);
    this->addChild(pencil, 11, "pencil");

    auto cuter = Sprite::create("Resources/Cuter.png");
    cuter->setAnchorPoint(Point(0.5, 0.5));
    cuter->setPosition(800, 400);
    this->addChild(cuter,12,"cuter");

    auto mouseListener = EventListenerMouse::create();
    mouseListener->onMouseMove = CC_CALLBACK_1(PencilLayer::OnMouseMove, this);
    mouseListener->onMouseDown = CC_CALLBACK_1(PencilLayer::OnMouseDown, this);
    mouseListener->onMouseUp = CC_CALLBACK_1(PencilLayer::OnMouseUp, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this);


    return true;
}
Esempio n. 8
0
void OpacityCommand::readProperties(boost::property_tree::wptree& pt)
{
    AbstractCommand::readProperties(pt);

    if (pt.count(L"opacity") > 0) setOpacity(pt.get<float>(L"opacity"));
    if (pt.count(L"duration") > 0) setDuration(pt.get<int>(L"duration"));
    if (pt.count(L"tween") > 0) setTween(QString::fromStdWString(pt.get<std::wstring>(L"tween")));
    if (pt.count(L"defer") > 0) setDefer(pt.get<bool>(L"defer"));
}
void HelloWorld::addMenu()
{

	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

    

	auto menuItem1 = MenuItemLabel::create(Label::createWithTTF(" Play ", "fonts/airstrikecond.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene, this));
	auto menuItem2 = MenuItemLabel::create(Label::createWithTTF(" Setting ", "fonts/airstrikehalf.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene2, this));
    auto menuItem3 = MenuItemLabel::create(Label::createWithTTF(" Records ", "fonts/airstrike3d.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene3, this));
	auto menuItem4 = MenuItemLabel::create(Label::createWithTTF(" Agregar Persona ", "fonts/airstrike3d.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene4, this));
    auto menuItem5 = MenuItemLabel::create(Label::createWithTTF(" ScrollView ", "fonts/airstrike3d.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene5, this));
	auto menuItem6 = MenuItemLabel::create(Label::createWithTTF(" PageView ", "fonts/airstrikecond.ttf", 34), CC_CALLBACK_1(HelloWorld::btnNewScene6, this));
 
	auto menuGral = Menu::create(menuItem1,menuItem2,menuItem3,menuItem4, menuItem5,menuItem6,NULL);
	menuGral->alignItemsVertically();


	auto sprite = Sprite::create("greenChild.jpg");

	sprite->setPosition(Point(origin.x + visibleSize.width / 2, origin.y + visibleSize.height + sprite->getContentSize().height));

	menuGral->setPosition(Point(sprite->getContentSize().width / 2, sprite->getContentSize().height / 2));

	sprite->addChild(menuGral);
    
	sprite->setName("menu");

	sprite->setOpacity(30);

	//MoveBy *accion2 ;

	
	if(i == 0)
	{


	  this->addChild(sprite,2);

	  MoveBy *accion2 = MoveBy::create(1, Point(0, - ((visibleSize.height / 2) + sprite->getContentSize().height)));
  
	  sprite->runAction(accion2);

	  i++;
	    
	}

	else if(i>0)
	{
		this->removeChildByName("menu");

		i = 0;
	}


}
Esempio n. 10
0
bool CCRectNode::initWithSize(const CCSize& tSize, const ccColor4F& tColor, bool bFill)
{
	setContentSize(tSize);
	setColor(ccc3(tColor.r * 255, tColor.b * 255, tColor.g * 255));
	setOpacity(tColor.a * 255);
	m_bFill = bFill;

	return true;
}
Esempio n. 11
0
void QgsRasterRenderer::copyCommonProperties( const QgsRasterRenderer* other )
{
    if ( !other )
        return;

    setOpacity( other->opacity() );
    setAlphaBand( other->alphaBand() );
    setRasterTransparency( other->rasterTransparency() ? new QgsRasterTransparency( *other->rasterTransparency() ) : nullptr );
}
Esempio n. 12
0
bool CCLineNode::initWithPoints(const CCPoint& tBeginPoint, const CCPoint& tEndPoint, const ccColor4F& tColor)
{
	setPosition(tBeginPoint);
	setContentSize(ccpDiff(tEndPoint, tBeginPoint));
	setColor(ccc3(tColor.r * 255, tColor.b * 255, tColor.g * 255));
	setOpacity(tColor.a * 255);

	return true;
}
Esempio n. 13
0
GraphicsWidgetBase::GraphicsWidgetBase() {
  setFlag(QGraphicsItem::ItemIsMovable, true);
  setFlag(QGraphicsItem::ItemIsSelectable, true);
  setFlag(QGraphicsItem::ItemIsFocusable, true);
  setAcceptHoverEvents(true);
#if(QT_VERSION >= QT_VERSION_CHECK(4,5,0))
  setOpacity(0.8);
#endif
}
Esempio n. 14
0
void MainScene::initCollisionSprite() {
    CCLOG("CollisionSprite初期化");
    auto collisionSprite = Sprite::create();
    collisionSprite->setAnchorPoint(Point(0, 0));
    collisionSprite->setTextureRect(Rect(0, 0, 640, 100));
    collisionSprite->setOpacity(0);
    collisionSprite->setPosition(0, 0);
    this->addChild(collisionSprite);
}
Esempio n. 15
0
/** A shadow volume only uses a material when it is to be visible during development. */
void CC3ShadowVolumeMeshNode::checkShadowMaterial()
{
	if ( !_shouldDrawTerminator && isVisible() ) 
	{
		setColor( CCColorRefFromCCC4F(ccc4f(kCC3OneThird, kCC3OneThird, kCC3OneThird, 1.0)) );	// Will lazily init material if needed
		setOpacity( (CCOpacity)(kCCOpacityFull * kCC3OneThird) );
	} else
		setMaterial( NULL );
}
void LongPressSpinner::setGoodPress(bool flag)
{
	setVisible(true);
	setOpacity(1.0);
	prepareGeometryChange();
	m_goodPressFlag = flag;
	m_goodPressTimer.start();
	update();
}
Esempio n. 17
0
void Explosion::demmarer(QPointF position, double amplitude)
{
    animationExplosion1->setEndValue(amplitude);
    animationExplosion2->setStartValue(amplitude);

    setPos(position - boundingRect().center());
    setOpacity(1);
    animationExplosionRoot->start();
}
Esempio n. 18
0
void ActiveLabel::show()
{
    QLabel::show();
    setFixedSize(24, 5);
    setOpacity(1);
    m_iconPath = m_openIndicatorIcon;
    update();
    emit sizeChange();
}
Esempio n. 19
0
QVariant CornerHandle::itemChange(GraphicsItemChange change,
                                  const QVariant &value)
{
    if (change == ItemVisibleHasChanged) {
        if (value.toBool())
            setOpacity(isUnderMouse() ? 1 : 0.5);
    }
    return QGraphicsItem::itemChange(change, value);
}
Esempio n. 20
0
void TopData::addStep(cocos2d::Node *node, int step, int time)
{
    this->restStep += step;
    
    auto topNode = node->getChildByTag(MAIN_SCENE_TOP_NODE);
    
    auto textLimit = topNode->getChildByName<ui::Text *>("TextLimit");
    textLimit->setString(Value(this->restStep).asString());
    
    auto text = textLimit->clone();
    text->setGlobalZOrder(100);
    text->setOpacity(200);
    topNode->addChild(text);
    
    auto scale = ScaleTo::create(0.5, 2.5);
    auto fade = FadeOut::create(0.5);
    auto callFunc = CallFunc::create([=]{
        text->removeFromParent();
    });
    
    text->runAction(scale);
    text->runAction(Sequence::create(fade, callFunc, NULL));
    
    if(UserData::getInstance()->challenges == 1)
    {
        this->restime += time;
        
        auto textTime = topNode->getChildByName<ui::Text *>("TextTime");
        textTime->setString(Value(this->restime).asString());
        
        auto text1 = textTime->clone();
        text1->setGlobalZOrder(100);
        text1->setOpacity(200);
        topNode->addChild(text1);
        
        auto scale1 = ScaleTo::create(0.5, 2.5);
        auto fade1 = FadeOut::create(0.5);
        auto callFunc1 = CallFunc::create([=]{
            text1->removeFromParent();
        });
        text1->runAction(scale1);
        text1->runAction(Sequence::create(fade1, callFunc1, NULL));
    }
}
ViewProfileDivider::ViewProfileDivider (QGraphicsScene &scene,
                                        QGraphicsView &view,
                                        int sceneWidth,
                                        int sceneHeight,
                                        int yCenter,
                                        bool isLowerBoundary) :
  QGraphicsRectItem (X_INITIAL,
                     0,
                     PADDLE_WIDTH,
                     PADDLE_HEIGHT),
  m_view (view),
  m_yCenter (yCenter),
  m_divider (0),
  m_shadedArea (0),
  m_sceneWidth (sceneWidth),
  m_sceneHeight (sceneHeight),
  m_isLowerBoundary (isLowerBoundary)
{
  // Initial positions will not appear since they are overridden by setX

  // Paddle
  setVisible (true);
  setPen (QPen (DIVIDER_COLOR));
  setBrush (QBrush (QColor (140, 255, 140)));
  setOpacity (1.0);
  scene.addItem (this);
  setFlags (QGraphicsItem::ItemIsMovable |
            QGraphicsItem::ItemSendsGeometryChanges);
  setCursor (Qt::OpenHandCursor);
  setZValue (2.0);

  // Arrow on paddle
  m_arrow = new QGraphicsPolygonItem (this);

  // Shaded area
  m_shadedArea = new QGraphicsRectItem (X_INITIAL,
                                        0,
                                        0,
                                        sceneHeight - 1);
  m_shadedArea->setOpacity (SHADED_AREA_OPACITY);
  m_shadedArea->setBrush (QBrush (SHADED_AREA_COLOR));
  m_shadedArea->setPen (Qt::NoPen);
  m_shadedArea->setZValue (0.0);
  scene.addItem (m_shadedArea);

  // Vertical divider. This is not made a child of the paddle since that will force the divider
  // to always be drawn above the paddle, rather than underneath the paddle as we want. Even setting
  // the z values will not succeed in drawing the divider under the paddle if they are child-parent.
  m_divider = new QGraphicsLineItem (X_INITIAL,
                                     -SLOP,
                                     X_INITIAL,
                                     2 * SLOP + sceneHeight);
  m_divider->setPen (QPen (QBrush (DIVIDER_COLOR), DIVIDER_WIDTH));
  m_divider->setZValue (1.0);
  scene.addItem (m_divider);
}
Esempio n. 22
0
bool CuttingPhotos::initSlice(const char* photo)
{
    Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(photo);
    
    if (texture==nullptr) {
        return false;
    }
    
    //初始化存储行列的列表
    for (int w=0; w<_rows; ++w) {
        std::vector<Sprite*> row;
        for (int h=0; h<_columns; ++h) {
            row.push_back(nullptr);
        }
        
        _slices.push_back(row);
    }
    
    //计算图片每列的宽度
    auto size=texture->getContentSize();
    _sliceWidth=size.width/_rows;
    _sliceHeight=size.height/_columns;
    
    this->setContentSize(size);//设置Layer大小
    
    //最后一块
    auto endSlice=Sprite::createWithTexture(texture,Rect(_sliceWidth*(_rows-1),_sliceHeight*(_columns-1),_sliceWidth,_sliceHeight));
    endSlice->setAnchorPoint(Vec2(0,0));
    endSlice->setPosition((_rows-1)*_sliceWidth,0);
    endSlice->setOpacity(100);//降低透明度
    this->addChild(endSlice);
    
    _slices[_rows-1][_columns-1]=nullptr;//设为空,表示这格可以移入

    
    //创建切片
    for (int w=0; w<_rows; ++w) {
        for (int h=0; h<_columns; ++h) {
            
            if (w==_rows-1 && h==_columns-1) {
                //最后一块不需要
                break;
            }
            
            Sprite* slice=Sprite::createWithTexture(texture,Rect(_sliceWidth*w,_sliceHeight*h,_sliceWidth,_sliceHeight));
            
            slice->setAnchorPoint(Vec2(0,0));
            slice->setPosition(w*_sliceWidth,size.height-(h+1)*_sliceHeight);
            this->addChild(slice);
            
            _slices[w][h]=slice;
        }
    }
    
    return true;
}
Esempio n. 23
0
    void UiProxyWidget::focusInEvent(QFocusEvent *focus_event)
    {
        QGraphicsProxyWidget::focusInEvent(focus_event);

        if (widget_properties_.GetWidgetType() != UiServices::CoreLayoutWidget)
        {
            if (isVisible() && animations_->state() != QAbstractAnimation::Running)
                setOpacity(1.0);
        }
    }
Esempio n. 24
0
ToolBoxGraphicsItem::ToolBoxGraphicsItem()
{
    this->opacityAnimation = new QPropertyAnimation(this, QByteArrayLiteral("opacity"), this);

    this->opacityAnimation->setKeyValueAt(0, this->idleOpacity);
    this->opacityAnimation->setKeyValueAt(1, this->activeOpacity);
    this->opacityAnimation->setDuration(this->fadeTimeMs);

    setOpacity(this->idleOpacity);
}
Esempio n. 25
0
///=====================================================================================
void CParticleSystemModel::updateOpacityInfos(void)
{
	MINI_TIMER(PSStatsUpdateOpacityInfos);
	nlassert(_ParticleSystem);
	if (!_TransparencyStateTouched) return;
	nlassert(_ParticleSystem);
	setOpacity(_ParticleSystem->hasOpaqueObjects() || _ToolDisplayEnabled);
	setTransparency(_ParticleSystem->hasTransparentObjects());
	_TransparencyStateTouched = false;
}
Esempio n. 26
0
void AllianceAreaPopupView::reDraw(CCNode* obj){
    if( WorldMapView::instance() == NULL )
        return;
    
    auto addPic = [](CCNode *parent, CCPoint &pt, std::string picName, int tag){
        if(parent->getChildByTag(tag)){
            auto sprite = dynamic_cast<CCSprite*>(parent->getChildByTag(tag));
            sprite->setDisplayFrame(CCLoadSprite::loadResource(picName.c_str()));
        }else{
            auto sprite = CCLoadSprite::createSprite(picName.c_str());
            sprite->setPosition(pt);
            float s = WorldMapView::instance()->m_map->getScale();
            sprite->setOpacity(200);
            sprite->setScale(0.95 * s);
            CCSequence *sequene = CCSequence::create(CCFadeTo::create(1, 50), CCFadeTo::create(1, 200), NULL);
            sprite->runAction(CCRepeatForever::create(sequene));
            parent->addChild(sprite);
        }
    };
    m_showNode->removeAllChildren();
    auto centerPt = m_picNode->getPosition() + ccp(_tile_width, _tile_height / 2);
    float s = WorldMapView::instance()->m_map->getScale();
    centerPt = (WorldMapView::instance()->m_map->getPosition() - centerPt) / s;
    auto mapPt1 = WorldMapView::instance()->m_map->getTilePointByViewPoint(-centerPt);
    currentCenterPt = mapPt1;
    auto mapPt2 = mapPt1 + ccp(-1, 0);
    auto mapPt3 = mapPt1 + ccp(-1, -1);
    auto mapPt4 = mapPt1 + ccp(0, -1);
    auto pt1 = WorldMapView::instance()->m_map->getPosition() + WorldMapView::instance()->m_map->getViewPointByTilePoint(mapPt1) * s;
    auto pt2 = WorldMapView::instance()->m_map->getPosition() + WorldMapView::instance()->m_map->getViewPointByTilePoint(mapPt2) * s;
    auto pt3 = WorldMapView::instance()->m_map->getPosition() + WorldMapView::instance()->m_map->getViewPointByTilePoint(mapPt3) * s;
    auto pt4 = WorldMapView::instance()->m_map->getPosition() + WorldMapView::instance()->m_map->getViewPointByTilePoint(mapPt4) * s;
    bool canRelocateFlag1 = isCanRelocationTile(mapPt1);
    bool canRelocateFlag2 = isCanRelocationTile(mapPt2);
    bool canRelocateFlag3 = isCanRelocationTile(mapPt3);
    bool canRelocateFlag4 = isCanRelocationTile(mapPt4);
    
    std::vector<CCPoint> vector;
    vector.push_back(mapPt1);
    vector.push_back(mapPt2);
    vector.push_back(mapPt3);
    vector.push_back(mapPt4);
    
    if(canRelocateFlag1 && canRelocateFlag2 && canRelocateFlag3 && canRelocateFlag4){
        bool isInSame = isInRelicAndNormalBlock(vector);
        if(!isInSame){
            canRelocateFlag1 = canRelocateFlag2 = canRelocateFlag3 = canRelocateFlag4 = false;
        }
    }
    addPic(m_showNode, pt1, (canRelocateFlag1 ? "green_block.png" : "red_block.png"), 1);
    addPic(m_showNode, pt2, (canRelocateFlag2 ? "green_block.png" : "red_block.png"), 2);
    addPic(m_showNode, pt3, (canRelocateFlag3 ? "green_block.png" : "red_block.png"), 3);
    addPic(m_showNode, pt4, (canRelocateFlag4 ? "green_block.png" : "red_block.png"), 4);
    enableBtn(canRelocateFlag1 && canRelocateFlag2 && canRelocateFlag3 && canRelocateFlag4);
}
Esempio n. 27
0
QVariant Pixmap::itemChange(GraphicsItemChange change, const QVariant &value){
    if(change == ItemSelectedHasChanged){
        if(value.toBool()){
            QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect(this);
            effect->setColor(QColor(0xCC, 0x00, 0x00));
            setGraphicsEffect(effect);
        }else
            setGraphicsEffect(NULL);

        emit selected_changed();
    }else if(change == ItemEnabledHasChanged){
        if(value.toBool()){
            setOpacity(1.0);
        }else{
            setOpacity(0.7);
        }
    }

    return QGraphicsObject::itemChange(change, value);
}
Esempio n. 28
0
/* Check if we switched active window, reset the old passive windows
 * if we did. If we have an active window and switched: reset that too.
 * If we have a window (w is true), update the active id and
 * passive list. justMoved is to make sure we recalculate opacity after
 * moving. We can't reset before moving because if we're using a delay
 * and the window being moved is not the active but overlapping, it will
 * be reset, which would conflict with move's opacity change.
 */
static void
opacifyHandleEnter (CompScreen *s,
                    CompWindow *w)
{
	OPACIFY_SCREEN (s);

	if (otherScreenGrabExist (s, NULL))
	{
		if (!otherScreenGrabExist (s, "move", NULL))
		{
			os->justMoved = TRUE;
			return;
		}

		clearPassive (s);
		resetOpacity (s, os->active);
		os->active = 0;
		return;
	}

	if (!w || os->active != w->id || os->justMoved)
	{
		os->justMoved = FALSE;
		clearPassive (s);
		resetOpacity (s, os->active);
		os->active = 0;
	}

	if (!w)
		return;

	if (w->id != os->active && !w->shaded &&
	    matchEval (&os->window_match, w))
	{
		int num;

		os->active = w->id;
		num = passiveWindows (s, w->region);

		const BananaValue *
		option_only_if_block = bananaGetOption (bananaIndex,
		                                        "only_if_block",
		                                        s->screenNum);

		const BananaValue *
		option_active_opacity = bananaGetOption (bananaIndex,
		                                         "active_opacity",
		                                         s->screenNum);

		if (num || option_only_if_block->b)
			setOpacity (w, MAX (OPAQUE * option_active_opacity->i / 100,
			                    w->paint.opacity));
	}
}
Esempio n. 29
0
void TrialPanel::initWithTrial(Trial* trial)
{
    _trial = trial;

    auto nameLab = static_cast<Text*>(Helper::seekWidgetByName(_root, "Label_name"));
    nameLab->setString(trial->getModelByName("nickName").asString());

    auto introLab = static_cast<Text*>(Helper::seekWidgetByName(_root, "Label_intro"));
    introLab->setString(trial->getModelByName("introduce").asString());

    Vector<Achievement*> newAchieves;
    auto achievements = trial->getAchievements();
    for(auto achievement:achievements)
    {
        newAchieves.pushBack(achievement);
    }
    // µ÷Õû˳Ðò
    auto begin = newAchieves.begin();
    auto end = newAchieves.end();
    for(auto iter = begin; iter != end;)
    {
        if((*iter)->getReached() == true)
        {
            auto remove = iter;
            iter = newAchieves.erase(iter);
            newAchieves.pushBack((*remove));
        }
        else
            iter++;
    }

    int i = 0;
    for(auto achieve:newAchieves)
    {
        auto achieveUnit = _achieveUnit->clone();

        auto numLab = static_cast<Text*>(Helper::seekWidgetByName(achieveUnit, "Label_num"));
        auto image = static_cast<ImageView*>(Helper::seekWidgetByName(achieveUnit, "Image_image"));
        auto tagLab = static_cast<Text*>(Helper::seekWidgetByName(achieveUnit, "Label_tag"));
        auto starLab = static_cast<Text*>(Helper::seekWidgetByName(achieveUnit, "Label_star"));

        tagLab->setString(achieve->getModelByName("introduce").asString());
        if(achieve->getReached() == true)
        {
            image->setVisible(false);
            starLab->setVisible(false);
            numLab->setVisible(false);
            achieveUnit->setOpacity(100);
        }
        achieveUnit->setUserData(achieve);
        achieveUnit->setTag(achieve->getId());
        _listView->pushBackCustomItem(achieveUnit);
    }
}
Esempio n. 30
0
bool TipLayer::init(std::string tipText, float fontSize)
{
	if (!Layer::init())return false;
	auto action1 = Sequence::create(Spawn::create(MoveTo::create(0.2, Vec2(Vec2(540, 95))), FadeIn::create(0.2), NULL), DelayTime::create(1.2), FadeOut::create(0.7), CallFunc::create([this](){this->removeFromParent(); }), NULL);
	auto action2 = Sequence::create(Spawn::create(MoveTo::create(0.2, Vec2(Vec2(540, 95))), FadeIn::create(0.2), NULL), DelayTime::create(1.2), FadeOut::create(0.7), NULL);

	auto backgroundSprite = Sprite::create("common_tip_background.png");
	backgroundSprite->setPosition(Vec2(540,75));
	backgroundSprite->setOpacity(0);
	backgroundSprite->runAction(action1);
	addChild(backgroundSprite,5);

	//log(tipText.c_str());
	auto tipLabel = Label::createWithSystemFont(tipText, "simhei.ttf", fontSize);
	tipLabel->setOpacity(0);
	tipLabel->setPosition(Vec2(540, 75));
	tipLabel->runAction(action2);
	addChild(tipLabel,10);
	return true;
}