예제 #1
0
void WorldHudLayer::showUI()
{
    auto ui = GUIReader::getInstance()->widgetFromJsonFile(UI_LAYER_WORLDHUD);
    this->addChild(ui, 0, "UI");
    
    // HomeButton
    auto btnEnter = (Button*)Helper::seekWidgetByName(ui, "HomeButton");
    btnEnter->addTouchEventListener(CC_CALLBACK_2(WorldHudLayer::btnCallback, this));

    // player
    auto playerName = (Text*)Helper::seekWidgetByName(ui, "PlayerName");
    auto playerLevel = (Text*)Helper::seekWidgetByName(ui, "PlayerLevel");
    auto playerBar = (LoadingBar*)Helper::seekWidgetByName(ui, "PlayerBar");
    playerName->setString(_name);
    playerLevel->setString(GM()->getIntToStr(_level));
    playerBar->setPercent(100.0 * _exp / _expRequire);
    // gold
    auto goldCount = (Text*)Helper::seekWidgetByName(ui, "GoldCount");
    auto goldCapacity = (Text*)Helper::seekWidgetByName(ui, "GoldCapacity");
    auto goldBar = (LoadingBar*)Helper::seekWidgetByName(ui, "GoldBar");
    goldCount->setString(GM()->getIntToStr(_goldCount));
    goldCapacity->setString(GM()->getIntToStr(_goldCapacity));
    goldBar->setPercent(100.0 * _goldCount / _goldCapacity);
    // wood
    auto woodCount = (Text*)Helper::seekWidgetByName(ui, "WoodCount");
    auto woodCapacity = (Text*)Helper::seekWidgetByName(ui, "WoodCapacity");
    auto woodBar = (LoadingBar*)Helper::seekWidgetByName(ui, "WoodBar");
    woodCount->setString(GM()->getIntToStr(_woodCount));
    woodCapacity->setString(GM()->getIntToStr(_woodCapacity));
    woodBar->setPercent(100.0 * _woodCount / _woodCapacity);
    // ring
    auto ringCount = (Text*)Helper::seekWidgetByName(ui, "RingCount");
    ringCount->setString(GM()->getIntToStr(_ringCount));
}
예제 #2
0
파일: UISlider.cpp 프로젝트: CryQ/coclua
void UISlider::onTouchMoved(const cocos2d::Point &touchPoint)
{
    cocos2d::Point nsp = _renderer->convertToNodeSpace(touchPoint);
    _slidBallRenderer->setPosition(cocos2d::Point(nsp.x,0));
    setPercent(getPercentWithBallPos(nsp.x));
    percentChangedEvent();
}
예제 #3
0
void GameScene::update(float dt)
{
	auto UIComponent = (cocostudio::ComRender*) UINode->getComponent("gameSceneUI");
	auto UILayer = (Layer*)UIComponent->getNode();
	auto loadingBar = dynamic_cast<LoadingBar*>(UILayer->getChildByTag(GAMESCENE_LOADINGBAR));
	auto labelLevel = dynamic_cast<Text*>(UILayer->getChildByTag(GAMESCENE_LABEL_LEVEL));
	auto labelInfo = dynamic_cast<Text*>(UILayer->getChildByTag(GAMESCENE_LABEL_INFO));
	int currPos = AudioEngine::getInstance()->getPosition();
	int percent = currPos * 100 / AudioEngine::getInstance()->getLength();
	loadingBar->setPercent(percent);
	while ((currPos + preloadTime + setting_lag >= noteline.time))//提前一些生成
	{
		if (noteline.time == 0)break;//读到最后跳出
		int arg1 = noteline.type;
		int arg2 = noteline.length;
		int arg3 = noteline.posX;
		int arg4 = noteline.posY;
		MapUtils::getNoteline();//读取下个音符
		addNewNote(arg1, arg2, arg3, arg4);
	}
	if (!AudioEngine::getInstance()->isPlaying())//一首歌结束则切换到结算界面
	{
		this->unscheduleUpdate();
		auto scene = ClearScene::createScene(labelInfo->getString(), labelLevel->getString());
		Director::getInstance()->replaceScene(TransitionCrossFade::create(2, scene));
	}
}
예제 #4
0
void GameScene::resumeGame(float dt)
{
	auto UIComponent = (cocostudio::ComRender*) UINode->getComponent("gameSceneUI");
	auto UILayer = (Layer*)UIComponent->getNode();
	auto loadingBar = dynamic_cast<LoadingBar*>(UILayer->getChildByTag(GAMESCENE_LOADINGBAR));
	auto labelCombo = dynamic_cast<Text*>(UILayer->getChildByTag(GAMESCENE_LABEL_COMBO));
	static int calledtime = 0;
	loadingBar->setPercent(calledtime++);
	if (loadingBar->getPercent() == 1)
	{
		labelCombo->setString("READY");
		labelCombo->setOpacity(255);
	}
	if (loadingBar->getPercent() == 50)
		labelCombo->runAction(FadeOut::create(1));
	if (loadingBar->getPercent() == 100)
	{
		this->unscheduleAllSelectors();
		calledtime = 0;
		labelCombo->setString("");
		labelCombo->setOpacity(100);
		for (auto&i : UINode->getChildren())
		{
			i->resume();
			for (auto&j : i->getChildren())
				j->resume();
		}
		AudioEngine::getInstance()->resume();
		this->scheduleUpdate();
	}
}
예제 #5
0
void Slider::copySpecialProperties(Widget *widget)
{
    Slider* slider = dynamic_cast<Slider*>(widget);
    if (slider)
    {
        _prevIgnoreSize = slider->_prevIgnoreSize;
        setScale9Enabled(slider->_scale9Enabled);

        // clone the inner sprite: https://github.com/cocos2d/cocos2d-x/issues/16928
        slider->_barRenderer->copyTo(_barRenderer);
        setupBarTexture();
        slider->_progressBarRenderer->copyTo(_progressBarRenderer);
        setupProgressBarTexture();

        loadSlidBallTextureNormal(slider->_slidBallNormalRenderer->getSpriteFrame());
        loadSlidBallTexturePressed(slider->_slidBallPressedRenderer->getSpriteFrame());
        loadSlidBallTextureDisabled(slider->_slidBallDisabledRenderer->getSpriteFrame());
        setPercent(slider->getPercent());
        setMaxPercent(slider->getMaxPercent());
        _isSliderBallPressedTextureLoaded = slider->_isSliderBallPressedTextureLoaded;
        _isSliderBallDisabledTexturedLoaded = slider->_isSliderBallDisabledTexturedLoaded;
        _sliderEventListener = slider->_sliderEventListener;
        _sliderEventSelector = slider->_sliderEventSelector;
        _eventCallback = slider->_eventCallback;
        _ccEventCallback = slider->_ccEventCallback;
    }
}
예제 #6
0
파일: Load.cpp 프로젝트: joyfish/MyGame
void Load::LoadingBar(float dt)
{
    auto size = Director::getInstance()->getVisibleSize();

    auto lb = dynamic_cast<class LoadingBar*>(getChildByTag(1));
    float per = lb->getPercent() + 1.0f;
    lb->setPercent(per);
   //图片加载
    auto load = Sprite::create("load.png");
    load->setPosition(Vec2(size.width/2-150,size.height/2+60));
    auto moveTo = MoveTo::create(0.6,Vec2( size.width/2+130,size.height/2+60));
    auto seq = Sequence::create(moveTo, NULL);
    load->runAction(seq);
    addChild(load);
    
   if (per==100) {
       unschedule("LoadingBar");
       auto callf=CallFunc::create([this](){
           Director::getInstance()->replaceScene(GameScene::createScene());
       });
       auto seq=Sequence::create(DelayTime::create(1.1), callf,NULL);
       this->runAction(seq);
   }
    
}
예제 #7
0
void LoadingBar::setScale9Enabled(bool enabled)
{
    if (_scale9Enabled == enabled)
    {
        return;
    }
    _scale9Enabled = enabled;
    removeProtectedChild(_barRenderer);
    _barRenderer = nullptr;
    if (_scale9Enabled)
    {
        _barRenderer = extension::Scale9Sprite::create();
    }
    else
    {
        _barRenderer = Sprite::create();
    }
    loadTexture(_textureFile,_renderBarTexType);
    addProtectedChild(_barRenderer, BAR_RENDERER_Z, -1);
    if (_scale9Enabled)
    {
        bool ignoreBefore = _ignoreSize;
        ignoreContentAdaptWithSize(false);
        _prevIgnoreSize = ignoreBefore;
    }
    else
    {
        ignoreContentAdaptWithSize(_prevIgnoreSize);
    }
    setCapInsets(_capInsets);
    setPercent(_percent);
}
예제 #8
0
void UISlider::onTouchMoved(const CCPoint &touchPoint)
{
    CCPoint nsp = m_pRenderer->convertToNodeSpace(touchPoint);
    m_pSlidBallRenderer->setPosition(ccp(nsp.x,0));
    setPercent(getPercentWithBallPos(nsp.x));
    percentChangedEvent();
}
예제 #9
0
void Slider::onTouchMoved(Touch *touch, Event *unusedEvent)
{
    _touchMovePosition = touch->getLocation();
    Vec2 nsp = convertToNodeSpace(_touchMovePosition);
    setPercent(getPercentWithBallPos(nsp.x));
    percentChangedEvent();
}
예제 #10
0
파일: Load.cpp 프로젝트: joyfish/MyGame
bool Load::init()
{
    
    if (!Layer::init()) {
        return false;
    }
    
    auto listenerkey=EventListenerKeyboard::create();
    listenerkey->onKeyReleased=[this](EventKeyboard::KeyCode keyCode, Event* event){
        if(keyCode==EventKeyboard::KeyCode::KEY_BACKSPACE)
        {
            auto interact=Interfactionlayer::create(100);
            this->addChild(interact);
        }
    };
    
    auto size = Director::getInstance()->getVisibleSize();
    
    auto loadbg = Sprite::create("loading_word.png");
    loadbg->setPosition(Vec2(size.width/2,size.height/2-50));
    addChild(loadbg);
    auto bg = Sprite::create("loading_progress_1.png");
    bg->setPosition(Vec2(size.width/2,size.height/2));
    addChild(bg);
    
    auto lb = LoadingBar::create("loading_progress_2.png");
    lb->setPosition(Vec2(size.width/2,size.height/2));
    lb->setDirection(LoadingBar::Direction::LEFT);
    lb->setPercent(0);
    addChild(lb,1,1);//同时设置Tag值为1
    schedule(CC_CALLBACK_1(Load::LoadingBar,this),"LoadingBar");
    return true;
}
예제 #11
0
void Slider::barRendererScaleChangedWithSize()
{
    if (_ignoreSize)
    {
        
        _barRenderer->setScale(1.0f);
        _size = _barRenderer->getContentSize();
        _barLength = _size.width;
    }
    else
    {
        _barLength = _size.width;
        if (_scale9Enabled)
        {
            static_cast<extension::CCScale9Sprite*>(_barRenderer)->setPreferredSize(_size);
        }
        else
        {
            CCSize btextureSize = _barRenderer->getContentSize();
            if (btextureSize.width <= 0.0f || btextureSize.height <= 0.0f)
            {
                _barRenderer->setScale(1.0f);
                return;
            }
            float bscaleX = _size.width / btextureSize.width;
            float bscaleY = _size.height / btextureSize.height;
            _barRenderer->setScaleX(bscaleX);
            _barRenderer->setScaleY(bscaleY);
        }
    }
    setPercent(_percent);
}
예제 #12
0
void UISlider::barRendererScaleChangedWithSize()
{
    if (m_bIgnoreSize)
    {
        
        m_pBarRenderer->setScale(1.0f);
        m_size = m_pBarRenderer->getContentSize();
        m_fBarLength = m_size.width;
    }
    else
    {
        m_fBarLength = m_size.width;
        if (m_bScale9Enabled)
        {
            dynamic_cast<CCScale9Sprite*>(m_pBarRenderer)->setPreferredSize(m_size);
        }
        else
        {
            CCSize btextureSize = m_pBarRenderer->getContentSize();
            if (btextureSize.width <= 0.0f || btextureSize.height <= 0.0f)
            {
                m_pBarRenderer->setScale(1.0f);
                return;
            }
            float bscaleX = m_size.width / btextureSize.width;
            float bscaleY = m_size.height / btextureSize.height;
            m_pBarRenderer->setScaleX(bscaleX);
            m_pBarRenderer->setScaleY(bscaleY);
        }
    }
    setPercent(m_nPercent);
}
예제 #13
0
	void GUISlider::setValue(float value)
	{
		float diff = mMaxRange - mMinRange;
		float pct = (value - mMinRange) / diff;

		setPercent(pct);
	}
예제 #14
0
void Slider::copySpecialProperties(Widget *widget)
{
    Slider* slider = dynamic_cast<Slider*>(widget);
    if (slider)
    {
        _prevIgnoreSize = slider->_prevIgnoreSize;
        setScale9Enabled(slider->_scale9Enabled);
        auto barSprite = slider->_barRenderer->getSprite();
        if (nullptr != barSprite)
        {
            loadBarTexture(barSprite->getSpriteFrame());
        }
        auto progressSprite = slider->_progressBarRenderer->getSprite();
        if (nullptr != progressSprite)
        {
            loadProgressBarTexture(progressSprite->getSpriteFrame());
        }
        loadSlidBallTextureNormal(slider->_slidBallNormalRenderer->getSpriteFrame());
        loadSlidBallTexturePressed(slider->_slidBallPressedRenderer->getSpriteFrame());
        loadSlidBallTextureDisabled(slider->_slidBallDisabledRenderer->getSpriteFrame());
        setPercent(slider->getPercent());
        setMaxPercent(slider->getMaxPercent());
        _isSliderBallPressedTextureLoaded = slider->_isSliderBallPressedTextureLoaded;
        _isSliderBallDisabledTexturedLoaded = slider->_isSliderBallDisabledTexturedLoaded;
        _sliderEventListener = slider->_sliderEventListener;
        _sliderEventSelector = slider->_sliderEventSelector;
        _eventCallback = slider->_eventCallback;
        _ccEventCallback = slider->_ccEventCallback;
    }
}
예제 #15
0
bool UISlider::onTouchBegan(const CCPoint &touchPoint)
{
    bool pass = UIWidget::onTouchBegan(touchPoint);
    CCPoint nsp = m_pRenderer->convertToNodeSpace(touchPoint);
    setPercent(getPercentWithBallPos(nsp.x));
    percentChangedEvent();
    return pass;
}
예제 #16
0
void Slider::onTouchMoved(CCTouch *touch, CCEvent *unused_event)
{
    _touchMovePos = touch->getLocation();
    CCPoint nsp = convertToNodeSpace(_touchMovePos);
    _slidBallRenderer->setPosition(CCPoint(nsp.x,0));
    setPercent(getPercentWithBallPos(nsp.x));
    percentChangedEvent();
}
예제 #17
0
void UIProgressRect::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
    UIWidget::onStyleApply(styleName, styleNode);

    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "percent")
            setPercent(node->value<float>());
    }
}
예제 #18
0
void CreateProgPage::onProgress(MCFCore::Misc::ProgressInfo& info)
{
	setPercent(info.percent);

	gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
	if (par)
		par->setProgress(info.percent);

	Update();
}
예제 #19
0
bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent)
{
    bool pass = Widget::onTouchBegan(touch, unusedEvent);
    if (_hitted)
    {
        setPercent(getPercentWithBallPos(_touchBeganPosition));
        percentChangedEvent(EventType::ON_SLIDEBALL_DOWN);
    }
    return pass;
}
예제 #20
0
GlPictureFlow::GlPictureFlow(GlObject* parent) : GlObject(parent)
{
    setGeometry(0,0,800,300);
    setPercent(0);
    for_backward = &GlPictureFlow::draw_forward;

    buttonLeft = new GlButton(this);
    buttonLeft->setGeometry(280,270,60,30);
    buttonLeft->setBackGroundPixmap(QPixmap(":/images/pictureFlowLeft.png"));
    buttonLeft->setBackGroundPixmapPressed(QPixmap(":/images/pictureFlowLeftPressed.png"));
    buttonLeft->setText("<");
    connect(buttonLeft, SIGNAL(clicked()), this, SLOT(startForward()));

    buttonRigth = new GlButton(this);
    buttonRigth->setGeometry(460,270,60,30);
    buttonRigth->setBackGroundPixmap(QPixmap(":/images/pictureFlowRigth.png"));
    buttonRigth->setBackGroundPixmapPressed(QPixmap(":/images/pictureFlowRigthPressed.png"));
    buttonRigth->setText(">");
    connect(buttonRigth, SIGNAL(clicked()), this, SLOT(startBackward()));

    buttonTracks = new GlButton(this);
    buttonTracks->setGeometry(340,270,120,30);
    buttonTracks->setBackGroundPixmap(QPixmap(":/images/button120.png"));
    buttonTracks->setBackGroundPixmapPressed(QPixmap(":/images/button120Pressed.png"));
    buttonTracks->setText("Tracks");
    connect(buttonTracks, SIGNAL(clicked()), this, SIGNAL(buttonTracks_Clicked()));

    timeLine = new QTimeLine(350, this);
    timeLine->setLoopCount(1);
    timeLine->setFrameRange(0, 100);
    timeLine->setCurveShape(QTimeLine::EaseInCurve);

    connect(timeLine, SIGNAL(frameChanged(int)), this, SLOT(newPercent(int)));
    connect(timeLine, SIGNAL(finished()), this, SLOT(done()));

    distShort = 50;
    distLong = 150;

    sizeSmall = 130;
    sizeBig = 150;

    pt0.setX(50); pt0.setY(150);
    pt1.setX(100); pt1.setY(150);
    pt2.setX(150); pt2.setY(150);
    pt3.setX(200); pt3.setY(150);
    pt4.setX(250); pt4.setY(150);
    pt5.setX(400); pt5.setY(150);
    pt6.setX(750); pt6.setY(150);
    pt7.setX(700); pt7.setY(150);
    pt8.setX(650); pt8.setY(150);
    pt9.setX(600); pt9.setY(150);
    pt10.setX(550); pt10.setY(150);
    pt11.setX(400); pt11.setY(150);
}
예제 #21
0
bool Slider::onTouchBegan(CCTouch *touch, CCEvent *unused_event)
{
    bool pass = Widget::onTouchBegan(touch, unused_event);
    if (_hitted)
    {
        CCPoint nsp = convertToNodeSpace(_touchStartPos);
        setPercent(getPercentWithBallPos(nsp.x));
        percentChangedEvent();
    }
    return pass;
}
예제 #22
0
bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent)
{
    bool pass = Widget::onTouchBegan(touch, unusedEvent);
    if (_hitted)
    {
        Vec2 nsp = convertToNodeSpace(_touchBeganPosition);
        setPercent(getPercentWithBallPos(nsp.x));
        percentChangedEvent();
    }
    return pass;
}
예제 #23
0
void PageTest::update(float f)
{
    percent++;
    
    if(percent > 100) {
        percent = 100;
    }
    
    auto loadingBar = static_cast<ui::LoadingBar*>(this->getChildByTag(0));
    loadingBar->setPercent(percent);
}
예제 #24
0
void UILoadingBar::copySpecialProperties(UIWidget *widget)
{
    UILoadingBar* loadingBar = dynamic_cast<UILoadingBar*>(widget);
    if (loadingBar)
    {
        m_bPrevIgnoreSize = loadingBar->m_bPrevIgnoreSize;
        setScale9Enabled(loadingBar->m_bScale9Enabled);
        loadTexture(loadingBar->m_strTextureFile.c_str(), loadingBar->m_eRenderBarTexType);
        setCapInsets(loadingBar->m_capInsets);
        setPercent(loadingBar->m_nPercent);
    }
}
예제 #25
0
void HomeHudLayer::addPlayerExp(int add)
{
    DM()->updatePlayerExp(add);
    loadData();

    // player
    auto ui = (Widget*)this->getChildByName("UI");
    auto playerLevel = (Text*)Helper::seekWidgetByName(ui, "PlayerLevel");
    auto playerBar = (LoadingBar*)Helper::seekWidgetByName(ui, "PlayerBar");
    playerLevel->setString(GM()->getIntToStr(_level));
    playerBar->setPercent(100.0 * _exp / _expRequire);
}
예제 #26
0
void LoadingBar::copySpecialProperties(Widget *widget)
{
    LoadingBar* loadingBar = dynamic_cast<LoadingBar*>(widget);
    if (loadingBar)
    {
        _prevIgnoreSize = loadingBar->_prevIgnoreSize;
        setScale9Enabled(loadingBar->_scale9Enabled);
        loadTexture(loadingBar->_textureFile.c_str(), loadingBar->_renderBarTexType);
        setCapInsets(loadingBar->_capInsets);
        setPercent(loadingBar->_percent);
    }
}
예제 #27
0
void GlPictureFlow::done()
{
    setPercent(0);
    if(for_backward == &GlPictureFlow::draw_forward)
       centerImage++;

    if(for_backward == &GlPictureFlow::draw_backward)
       centerImage--;

    QTimer::singleShot(100, this, SIGNAL(animationDone()));
   // newAlbum(alben.at(centerImage));
}
예제 #28
0
void OptionLayer::addOption()
{

	this->setDJ(DiscJockey::getInstance());

	Node *optionNode = CSLoader::createNode("optionNode.csb");//传入Studio2.x的资源路径
	optionNode->setPosition(Point(originPoint.x + visibleSize.width / 2, (originPoint.y + visibleSize.height / 2)));
	this->addChild(optionNode);
	optionNode->setName("optionNode");

	this->setAnchorPoint(Point(0.5, 0.5));
	this->ignoreAnchorPointForPosition(false);
	this->setPosition(Point(originPoint.x + visibleSize.width / 2, -(originPoint.y + visibleSize.height / 2)));


	auto eventListener = EventListenerTouchOneByOne::create();
	eventListener->setSwallowTouches(true);
	eventListener->onTouchBegan = CC_CALLBACK_2(OptionLayer::onTouchBegan, this);
	eventListener->onTouchCancelled = CC_CALLBACK_2(OptionLayer::onTouchCancelled, this);
	eventListener->onTouchEnded = CC_CALLBACK_2(OptionLayer::onTouchEnded, this);
	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(eventListener, this);

	auto cancelButton = dynamic_cast<ui::Button*> (optionNode->getChildByName("cancelButton"));
	if (cancelButton)
	{
		cancelButton->addClickEventListener(CC_CALLBACK_1(OptionLayer::cancel, this));
	}

	//set font name again due to the cocos studio 2.0 bugs (Text load ttf error)
	for (auto node : optionNode->getChildren())
	{
		auto textNode = dynamic_cast<ui::Text*>(node);
		if (textNode)
		{
			textNode->enableOutline(Color4B(25, 26, 25, 155), 2);
		}
	}

	auto musicBox = dynamic_cast<ui::CheckBox*>(optionNode->getChildByName("soundCheck"));
	musicBox->addEventListenerCheckBox(this, checkboxselectedeventselector(OptionLayer::musicCheckBoxCallback));
	auto effectBox = dynamic_cast<ui::CheckBox*>(optionNode->getChildByName("effectCheck"));
	effectBox->addEventListenerCheckBox(this, checkboxselectedeventselector(OptionLayer::effectCheckBoxCallback));
	musicBox->setSelectedState(getDJ()->isMusicOn());
	effectBox->setSelectedState(getDJ()->isEffectOn());

	int curSpeed = CommandCenter::getInstance()->getSpeedLevel();
	auto textNode = dynamic_cast<ui::Text*>(optionNode->getChildByName("textCurSpeed"));
	textNode->setText(String::createWithFormat("%d", curSpeed)->getCString());
	auto speedSlider = dynamic_cast<ui::Slider*>(optionNode->getChildByName("speedSlider"));
	speedSlider->addEventListenerSlider(this, sliderpercentchangedselector(OptionLayer::speedSliderCallback));
	speedSlider->setPercent(curSpeed * 10);
}
예제 #29
0
/**
 * 回调改变百分比的update
 */
void LoadingLayer::callFuncChange(float dt)
{
    if (m_nowPercent < 100)
    {
        float length = m_taxiBus->getPosition().x - m_startLength;
        m_nowPercent = (length / m_moveLength) * 100;
        if (m_nowPercent >= 100)
        {
            m_nowPercent = 100;
        }
        setPercent(m_nowPercent);
    }
}
예제 #30
0
void WorldHudLayer::addWood(int add)
{
    auto ui = (Widget*)this->getChildByName("UI");
    auto woodCount = (Text*)Helper::seekWidgetByName(ui, "WoodCount");
    auto woodCapacity = (Text*)Helper::seekWidgetByName(ui, "WoodCapacity");
    auto woodBar = (LoadingBar*)Helper::seekWidgetByName(ui, "WoodBar");
    
    _woodCount = GM()->getMin(_woodCount + add, _woodCapacity);
    DM()->updateWood(_woodCount);
    
    woodCount->setString(GM()->getIntToStr(_woodCount));
    woodCapacity->setString(GM()->getIntToStr(_woodCapacity));
    woodBar->setPercent(100.0 * _woodCount / _woodCapacity);
}