mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
Transfer resources widget
This commit is contained in:
parent
4d3bf882ed
commit
4e0ea7355b
@ -125,8 +125,10 @@ set(client_SRCS
|
|||||||
widgets/RadialMenu.cpp
|
widgets/RadialMenu.cpp
|
||||||
widgets/markets/CAltarArtifacts.cpp
|
widgets/markets/CAltarArtifacts.cpp
|
||||||
widgets/markets/CAltarCreatures.cpp
|
widgets/markets/CAltarCreatures.cpp
|
||||||
|
widgets/markets/CArtifactsBuying.cpp
|
||||||
widgets/markets/CFreelancerGuild.cpp
|
widgets/markets/CFreelancerGuild.cpp
|
||||||
widgets/markets/CMarketResources.cpp
|
widgets/markets/CMarketResources.cpp
|
||||||
|
widgets/markets/CTransferResources.cpp
|
||||||
widgets/markets/CTradeBase.cpp
|
widgets/markets/CTradeBase.cpp
|
||||||
widgets/markets/TradePanels.cpp
|
widgets/markets/TradePanels.cpp
|
||||||
|
|
||||||
@ -312,8 +314,10 @@ set(client_HEADERS
|
|||||||
widgets/RadialMenu.h
|
widgets/RadialMenu.h
|
||||||
widgets/markets/CAltarArtifacts.h
|
widgets/markets/CAltarArtifacts.h
|
||||||
widgets/markets/CAltarCreatures.h
|
widgets/markets/CAltarCreatures.h
|
||||||
|
widgets/markets/CArtifactsBuying.h
|
||||||
widgets/markets/CFreelancerGuild.h
|
widgets/markets/CFreelancerGuild.h
|
||||||
widgets/markets/CMarketResources.h
|
widgets/markets/CMarketResources.h
|
||||||
|
widgets/markets/CTransferResources.h
|
||||||
widgets/markets/CTradeBase.h
|
widgets/markets/CTradeBase.h
|
||||||
widgets/markets/TradePanels.h
|
widgets/markets/TradePanels.h
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
CFreelancerGuild::CFreelancerGuild(const IMarket * market, const CGHeroInstance * hero)
|
CFreelancerGuild::CFreelancerGuild(const IMarket * market, const CGHeroInstance * hero)
|
||||||
: CTradeBase(market, hero)
|
: CTradeBase(market, hero)
|
||||||
, CResourcesPurchasing([this](){CResourcesPurchasing::updateSubtitles(EMarketMode::CREATURE_RESOURCE);})
|
, CResourcesBuying([this](){CResourcesBuying::updateSubtitles(EMarketMode::CREATURE_RESOURCE);})
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ void CFreelancerGuild::makeDeal()
|
|||||||
|
|
||||||
void CFreelancerGuild::deselect()
|
void CFreelancerGuild::deselect()
|
||||||
{
|
{
|
||||||
CResourcesPurchasing::deselect();
|
CResourcesBuying::deselect();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "CTradeBase.h"
|
#include "CTradeBase.h"
|
||||||
|
|
||||||
class CFreelancerGuild : public CCreaturesSelling , public CResourcesPurchasing
|
class CFreelancerGuild : public CCreaturesSelling , public CResourcesBuying
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFreelancerGuild(const IMarket * market, const CGHeroInstance * hero);
|
CFreelancerGuild(const IMarket * market, const CGHeroInstance * hero);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
CMarketResources::CMarketResources(const IMarket * market, const CGHeroInstance * hero)
|
CMarketResources::CMarketResources(const IMarket * market, const CGHeroInstance * hero)
|
||||||
: CTradeBase(market, hero)
|
: CTradeBase(market, hero)
|
||||||
, CResourcesPurchasing([this](){CMarketResources::updateSubtitles();})
|
, CResourcesBuying([this](){CMarketResources::updateSubtitles();})
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ void CMarketResources::makeDeal()
|
|||||||
|
|
||||||
void CMarketResources::deselect()
|
void CMarketResources::deselect()
|
||||||
{
|
{
|
||||||
CResourcesPurchasing::deselect();
|
CResourcesBuying::deselect();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void CMarketResources::onSlotClickPressed(const std::shared_ptr<CTradeableItem>
|
|||||||
|
|
||||||
void CMarketResources::updateSubtitles()
|
void CMarketResources::updateSubtitles()
|
||||||
{
|
{
|
||||||
CResourcesPurchasing::updateSubtitles(EMarketMode::RESOURCE_RESOURCE);
|
CResourcesBuying::updateSubtitles(EMarketMode::RESOURCE_RESOURCE);
|
||||||
if(hLeft)
|
if(hLeft)
|
||||||
rightTradePanel->slots[hLeft->serial]->subtitle = CGI->generaltexth->allTexts[164]; // n/a
|
rightTradePanel->slots[hLeft->serial]->subtitle = CGI->generaltexth->allTexts[164]; // n/a
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "CTradeBase.h"
|
#include "CTradeBase.h"
|
||||||
|
|
||||||
class CMarketResources : public CResourcesSelling, public CResourcesPurchasing
|
class CMarketResources : public CResourcesSelling, public CResourcesBuying
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMarketResources(const IMarket * market, const CGHeroInstance * hero);
|
CMarketResources(const IMarket * market, const CGHeroInstance * hero);
|
||||||
|
@ -125,7 +125,7 @@ void CCreaturesSelling::updateSlots()
|
|||||||
leftTradePanel->updateSlots();
|
leftTradePanel->updateSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
CResourcesPurchasing::CResourcesPurchasing(TradePanelBase::UpdateSlotsFunctor callback)
|
CResourcesBuying::CResourcesBuying(TradePanelBase::UpdateSlotsFunctor callback)
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ CResourcesPurchasing::CResourcesPurchasing(TradePanelBase::UpdateSlotsFunctor ca
|
|||||||
labels.emplace_back(std::make_shared<CLabel>(445, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168]));
|
labels.emplace_back(std::make_shared<CLabel>(445, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CResourcesPurchasing::updateSubtitles(EMarketMode marketMode)
|
void CResourcesBuying::updateSubtitles(EMarketMode marketMode)
|
||||||
{
|
{
|
||||||
assert(marketMode == EMarketMode::RESOURCE_RESOURCE || marketMode == EMarketMode::CREATURE_RESOURCE || marketMode == EMarketMode::ARTIFACT_RESOURCE);
|
assert(marketMode == EMarketMode::RESOURCE_RESOURCE || marketMode == EMarketMode::CREATURE_RESOURCE || marketMode == EMarketMode::ARTIFACT_RESOURCE);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ void CResourcesPurchasing::updateSubtitles(EMarketMode marketMode)
|
|||||||
rightTradePanel->clearSubtitles();
|
rightTradePanel->clearSubtitles();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CResourcesPurchasing::deselect()
|
void CResourcesBuying::deselect()
|
||||||
{
|
{
|
||||||
CTradeBase::deselect();
|
CTradeBase::deselect();
|
||||||
bidQty = 0;
|
bidQty = 0;
|
||||||
|
@ -75,10 +75,10 @@ public:
|
|||||||
void updateSlots() override;
|
void updateSlots() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CResourcesPurchasing : virtual public CTradeBase, virtual public CIntObject
|
class CResourcesBuying : virtual public CTradeBase, virtual public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CResourcesPurchasing(TradePanelBase::UpdateSlotsFunctor callback);
|
CResourcesBuying(TradePanelBase::UpdateSlotsFunctor callback);
|
||||||
void updateSubtitles(EMarketMode marketMode);
|
void updateSubtitles(EMarketMode marketMode);
|
||||||
void deselect() override;
|
void deselect() override;
|
||||||
|
|
||||||
|
130
client/widgets/markets/CTransferResources.cpp
Normal file
130
client/widgets/markets/CTransferResources.cpp
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* CTransferResources.cpp, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdInc.h"
|
||||||
|
#include "CTransferResources.h"
|
||||||
|
|
||||||
|
#include "../../gui/CGuiHandler.h"
|
||||||
|
#include "../../widgets/Buttons.h"
|
||||||
|
#include "../../widgets/Slider.h"
|
||||||
|
#include "../../widgets/TextControls.h"
|
||||||
|
|
||||||
|
#include "../../CGameInfo.h"
|
||||||
|
#include "../../CPlayerInterface.h"
|
||||||
|
|
||||||
|
#include "../../../CCallback.h"
|
||||||
|
|
||||||
|
#include "../../../lib/CGeneralTextHandler.h"
|
||||||
|
|
||||||
|
CTransferResources::CTransferResources(const IMarket * market, const CGHeroInstance * hero)
|
||||||
|
: CTradeBase(market, hero)
|
||||||
|
{
|
||||||
|
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
|
labels.emplace_back(std::make_shared<CLabel>(299, 27, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[158]));
|
||||||
|
labels.emplace_back(std::make_shared<CLabel>(445, 56, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169]));
|
||||||
|
deal = std::make_shared<CButton>(Point(306, 520), AnimationPath::builtin("TPMRKB.DEF"),
|
||||||
|
CGI->generaltexth->zelp[595], [this]() {CTransferResources::makeDeal();});
|
||||||
|
maxAmount = std::make_shared<CButton>(Point(228, 520), AnimationPath::builtin("IRCBTNS.DEF"), CGI->generaltexth->zelp[596],
|
||||||
|
[this]() {offerSlider->scrollToMax();});
|
||||||
|
offerSlider = std::make_shared<CSlider>(Point(230, 489), 137, [this](int newVal)
|
||||||
|
{
|
||||||
|
CTransferResources::onOfferSliderMoved(newVal);
|
||||||
|
}, 0, 0, 0, Orientation::HORIZONTAL);
|
||||||
|
|
||||||
|
// Player's resources
|
||||||
|
assert(leftTradePanel);
|
||||||
|
std::for_each(leftTradePanel->slots.cbegin(), leftTradePanel->slots.cend(), [this](auto & slot)
|
||||||
|
{
|
||||||
|
slot->clickPressedCallback = [this](const std::shared_ptr<CTradeableItem> & heroSlot)
|
||||||
|
{
|
||||||
|
CTransferResources::onSlotClickPressed(heroSlot, hLeft);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
leftTradePanel->moveTo(pos.topLeft() + Point(40, 182));
|
||||||
|
|
||||||
|
// Players panel
|
||||||
|
rightTradePanel = std::make_shared<PlayersPanel>([this](const std::shared_ptr<CTradeableItem> & heroSlot)
|
||||||
|
{
|
||||||
|
CTransferResources::onSlotClickPressed(heroSlot, hRight);
|
||||||
|
});
|
||||||
|
rightTradePanel->moveTo(pos.topLeft() + Point(333, 83));
|
||||||
|
|
||||||
|
CResourcesSelling::updateSlots();
|
||||||
|
CTransferResources::deselect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTransferResources::makeDeal()
|
||||||
|
{
|
||||||
|
if(auto toTrade = offerSlider->getValue(); toTrade != 0)
|
||||||
|
{
|
||||||
|
LOCPLINT->cb->trade(market, EMarketMode::RESOURCE_PLAYER, GameResID(hLeft->id), PlayerColor(hRight->id), toTrade, hero);
|
||||||
|
deselect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTransferResources::deselect()
|
||||||
|
{
|
||||||
|
CTradeBase::deselect();
|
||||||
|
updateSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTransferResources::updateSelected()
|
||||||
|
{
|
||||||
|
std::optional<size_t> lImageIndex = std::nullopt;
|
||||||
|
std::optional<size_t> rImageIndex = std::nullopt;
|
||||||
|
|
||||||
|
if(hLeft && hRight)
|
||||||
|
{
|
||||||
|
leftTradePanel->selectedSubtitle->setText(std::to_string(offerSlider->getValue()));
|
||||||
|
rightTradePanel->selectedSubtitle->setText(CGI->generaltexth->capColors[hRight->id]);
|
||||||
|
lImageIndex = hLeft->id;
|
||||||
|
rImageIndex = hRight->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
leftTradePanel->selectedSubtitle->setText("");
|
||||||
|
rightTradePanel->selectedSubtitle->setText("");
|
||||||
|
}
|
||||||
|
leftTradePanel->setSelectedFrameIndex(lImageIndex);
|
||||||
|
rightTradePanel->setSelectedFrameIndex(rImageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTransferResources::onOfferSliderMoved(int newVal)
|
||||||
|
{
|
||||||
|
if(hLeft && hRight)
|
||||||
|
{
|
||||||
|
offerSlider->scrollTo(newVal);
|
||||||
|
updateSelected();
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTransferResources::onSlotClickPressed(const std::shared_ptr<CTradeableItem> & newSlot, std::shared_ptr<CTradeableItem> & hCurSlot)
|
||||||
|
{
|
||||||
|
if(newSlot == hCurSlot)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CTradeBase::onSlotClickPressed(newSlot, hCurSlot);
|
||||||
|
if(hLeft)
|
||||||
|
{
|
||||||
|
if(hRight)
|
||||||
|
{
|
||||||
|
offerSlider->setAmount(LOCPLINT->cb->getResourceAmount(GameResID(hLeft->id)));
|
||||||
|
offerSlider->scrollTo(0);
|
||||||
|
offerSlider->block(false);
|
||||||
|
maxAmount->block(false);
|
||||||
|
deal->block(false);
|
||||||
|
}
|
||||||
|
updateSelected();
|
||||||
|
rightTradePanel->updateSlots();
|
||||||
|
}
|
||||||
|
redraw();
|
||||||
|
}
|
25
client/widgets/markets/CTransferResources.h
Normal file
25
client/widgets/markets/CTransferResources.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* CTransferResources.h, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CTradeBase.h"
|
||||||
|
|
||||||
|
class CTransferResources : public CResourcesSelling
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CTransferResources(const IMarket * market, const CGHeroInstance * hero);
|
||||||
|
void makeDeal() override;
|
||||||
|
void deselect() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateSelected();
|
||||||
|
void onOfferSliderMoved(int newVal);
|
||||||
|
void onSlotClickPressed(const std::shared_ptr<CTradeableItem> & newSlot, std::shared_ptr<CTradeableItem> & hCurSlot);
|
||||||
|
};
|
@ -196,12 +196,19 @@ void CTradeableItem::hover(bool on)
|
|||||||
case EType::CREATURE_PLACEHOLDER:
|
case EType::CREATURE_PLACEHOLDER:
|
||||||
GH.statusbar()->write(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->objects[id]->getNamePluralTranslated()));
|
GH.statusbar()->write(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->objects[id]->getNamePluralTranslated()));
|
||||||
break;
|
break;
|
||||||
|
case EType::ARTIFACT_TYPE:
|
||||||
case EType::ARTIFACT_PLACEHOLDER:
|
case EType::ARTIFACT_PLACEHOLDER:
|
||||||
if(id < 0)
|
if(id < 0)
|
||||||
GH.statusbar()->write(CGI->generaltexth->zelp[582].first);
|
GH.statusbar()->write(CGI->generaltexth->zelp[582].first);
|
||||||
else
|
else
|
||||||
GH.statusbar()->write(CGI->artifacts()->getByIndex(id)->getNameTranslated());
|
GH.statusbar()->write(CGI->artifacts()->getByIndex(id)->getNameTranslated());
|
||||||
break;
|
break;
|
||||||
|
case EType::RESOURCE:
|
||||||
|
GH.statusbar()->write(CGI->generaltexth->restypes[id]);
|
||||||
|
break;
|
||||||
|
case EType::PLAYER:
|
||||||
|
GH.statusbar()->write(CGI->generaltexth->capColors[id]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,6 +379,8 @@ PlayersPanel::PlayersPanel(CTradeableItem::ClickPressedFunctor clickPressedCallb
|
|||||||
slot->subtitle = CGI->generaltexth->capColors[players[slotNum].num];
|
slot->subtitle = CGI->generaltexth->capColors[players[slotNum].num];
|
||||||
slotNum++;
|
slotNum++;
|
||||||
}
|
}
|
||||||
|
selectedImage = std::make_shared<CAnimImage>(AnimationPath::builtin("CREST58"), 0, 0, selectedImagePos.x, selectedImagePos.y);
|
||||||
|
selectedSubtitle = std::make_shared<CLabel>(selectedSubtitlePos.x, selectedSubtitlePos.y, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreaturesPanel::CreaturesPanel(CTradeableItem::ClickPressedFunctor clickPressedCallback, const slotsData & initialSlots)
|
CreaturesPanel::CreaturesPanel(CTradeableItem::ClickPressedFunctor clickPressedCallback, const slotsData & initialSlots)
|
||||||
|
@ -122,6 +122,8 @@ class PlayersPanel : public TradePanelBase
|
|||||||
Point(83, 236)
|
Point(83, 236)
|
||||||
};
|
};
|
||||||
const Point slotDimension = Point(58, 64);
|
const Point slotDimension = Point(58, 64);
|
||||||
|
const Point selectedImagePos = Point(83, 368);
|
||||||
|
const Point selectedSubtitlePos = Point(112, 443);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PlayersPanel(CTradeableItem::ClickPressedFunctor clickPressedCallback);
|
explicit PlayersPanel(CTradeableItem::ClickPressedFunctor clickPressedCallback);
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
|
#include "../widgets/markets/CArtifactsBuying.h"
|
||||||
#include "../widgets/markets/CFreelancerGuild.h"
|
#include "../widgets/markets/CFreelancerGuild.h"
|
||||||
#include "../widgets/markets/CMarketResources.h"
|
#include "../widgets/markets/CMarketResources.h"
|
||||||
|
#include "../widgets/markets/CTransferResources.h"
|
||||||
|
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
@ -72,6 +74,8 @@ void CMarketWindow::resourceChanged()
|
|||||||
{
|
{
|
||||||
if(resRes)
|
if(resRes)
|
||||||
resRes->updateSlots();
|
resRes->updateSlots();
|
||||||
|
if(trRes)
|
||||||
|
trRes->updateSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMarketWindow::close()
|
void CMarketWindow::close()
|
||||||
@ -165,8 +169,20 @@ void CMarketWindow::createArtifactsBuying(const IMarket * market, const CGHeroIn
|
|||||||
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
|
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
background = createBg(ImagePath::builtin("TPMRKABS.bmp"), PLAYER_COLORED);
|
background = createBg(ImagePath::builtin("TPMRKABS.bmp"), PLAYER_COLORED);
|
||||||
this->market = std::make_shared<CMarketplaceWindow>(market, hero, []() {}, EMarketMode::RESOURCE_ARTIFACT);
|
//this->market = std::make_shared<CMarketplaceWindow>(market, hero, []() {}, EMarketMode::RESOURCE_ARTIFACT);
|
||||||
createInternals(EMarketMode::RESOURCE_ARTIFACT, market, hero);
|
//createInternals(EMarketMode::RESOURCE_ARTIFACT, market, hero);
|
||||||
|
|
||||||
|
artsBuy = std::make_shared<CArtifactsBuying>(market, hero);
|
||||||
|
|
||||||
|
background->center();
|
||||||
|
pos = background->pos;
|
||||||
|
artsBuy->setRedrawParent(true);
|
||||||
|
artsBuy->moveTo(pos.topLeft());
|
||||||
|
|
||||||
|
createChangeModeButtons(EMarketMode::RESOURCE_ARTIFACT, market, hero);
|
||||||
|
quitButton = std::make_shared<CButton>(quitButtonPos, AnimationPath::builtin("IOK6432.DEF"),
|
||||||
|
CGI->generaltexth->zelp[600], [this]() {close(); }, EShortcut::GLOBAL_RETURN);
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMarketWindow::createArtifactsSelling(const IMarket * market, const CGHeroInstance * hero)
|
void CMarketWindow::createArtifactsSelling(const IMarket * market, const CGHeroInstance * hero)
|
||||||
@ -219,8 +235,17 @@ void CMarketWindow::createTransferResources(const IMarket * market, const CGHero
|
|||||||
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
|
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
|
||||||
|
|
||||||
background = createBg(ImagePath::builtin("TPMRKPTS.bmp"), PLAYER_COLORED);
|
background = createBg(ImagePath::builtin("TPMRKPTS.bmp"), PLAYER_COLORED);
|
||||||
this->market = std::make_shared<CMarketplaceWindow>(market, hero, []() {}, EMarketMode::RESOURCE_PLAYER);
|
trRes = std::make_shared<CTransferResources>(market, hero);
|
||||||
createInternals(EMarketMode::RESOURCE_PLAYER, market, hero);
|
|
||||||
|
background->center();
|
||||||
|
pos = background->pos;
|
||||||
|
trRes->setRedrawParent(true);
|
||||||
|
trRes->moveTo(pos.topLeft());
|
||||||
|
|
||||||
|
createChangeModeButtons(EMarketMode::RESOURCE_PLAYER, market, hero);
|
||||||
|
quitButton = std::make_shared<CButton>(quitButtonPos, AnimationPath::builtin("IOK6432.DEF"),
|
||||||
|
CGI->generaltexth->zelp[600], [this]() {close(); }, EShortcut::GLOBAL_RETURN);
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMarketWindow::createAltarArtifacts(const IMarket * market, const CGHeroInstance * hero)
|
void CMarketWindow::createAltarArtifacts(const IMarket * market, const CGHeroInstance * hero)
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
#include "CTradeWindow.h"
|
#include "CTradeWindow.h"
|
||||||
#include "CAltarWindow.h"
|
#include "CAltarWindow.h"
|
||||||
|
|
||||||
|
class CArtifactsBuying;
|
||||||
class CFreelancerGuild;
|
class CFreelancerGuild;
|
||||||
class CMarketResources;
|
class CMarketResources;
|
||||||
|
class CTransferResources;
|
||||||
|
|
||||||
class CMarketWindow : public CStatusbarWindow, public CAltarWindow // TODO remove CAltarWindow
|
class CMarketWindow : public CStatusbarWindow, public CAltarWindow // TODO remove CAltarWindow
|
||||||
{
|
{
|
||||||
@ -47,4 +49,6 @@ private:
|
|||||||
std::shared_ptr<CMarketplaceWindow> market;
|
std::shared_ptr<CMarketplaceWindow> market;
|
||||||
std::shared_ptr<CFreelancerGuild> guild;
|
std::shared_ptr<CFreelancerGuild> guild;
|
||||||
std::shared_ptr<CMarketResources> resRes;
|
std::shared_ptr<CMarketResources> resRes;
|
||||||
|
std::shared_ptr<CTransferResources> trRes;
|
||||||
|
std::shared_ptr<CArtifactsBuying> artsBuy;
|
||||||
};
|
};
|
||||||
|
@ -134,11 +134,6 @@ void CTradeWindow::initItems(bool Left)
|
|||||||
return vstd::contains(market->availableItemsIds(EMarketMode::RESOURCE_ARTIFACT), ArtifactID(slot->id)) ? false : true;
|
return vstd::contains(market->availableItemsIds(EMarketMode::RESOURCE_ARTIFACT), ArtifactID(slot->id)) ? false : true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(!Left && mode == EMarketMode::RESOURCE_PLAYER)
|
|
||||||
{
|
|
||||||
rightTradePanel = std::make_shared<PlayersPanel>(std::bind(clickPressedTradePanel, _1, false));
|
|
||||||
rightTradePanel->moveBy(Point(333, 83));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user