booster shop enhancement
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
||||
int has(int ability);
|
||||
|
||||
void setText(const string& value);
|
||||
const vector<string>& getFormattedText();
|
||||
const vector<string>& getFormattedText(bool noremove = false);
|
||||
|
||||
void addMagicText(string value);
|
||||
void addMagicText(string value, string zone);
|
||||
|
||||
@@ -237,12 +237,22 @@ bool CardDisplay::CheckUserInput(JButton key)
|
||||
void CardDisplay::Render(bool norect)
|
||||
{
|
||||
//norect - code shop
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
if(norect)
|
||||
r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(180,5,5,5));
|
||||
//if(norect)
|
||||
// r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(180,5,5,5));
|
||||
|
||||
if(norect)
|
||||
{
|
||||
//info
|
||||
r->FillRect(static_cast<float> (x), static_cast<float> (10), static_cast<float> (nb_displayed_items * 30 + 20), 192,
|
||||
ARGB(200,5,5,5));
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (10), static_cast<float> (nb_displayed_items * 30 + 20), 192,
|
||||
ARGB(255,240,240,240));
|
||||
r->DrawRect(static_cast<float> (x)+1, static_cast<float> (10)+1, static_cast<float> (nb_displayed_items * 30 + 20)-2, 192-2,
|
||||
ARGB(255,89,89,89));
|
||||
|
||||
//navi
|
||||
r->FillRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
ARGB(200,5,5,5));
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
@@ -293,7 +303,23 @@ void CardDisplay::Render(bool norect)
|
||||
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
|
||||
drawMode = observer->getCardSelector()->GetDrawMode();
|
||||
}
|
||||
if(norect)
|
||||
{
|
||||
mFont->SetColor(ARGB(255,240,230,140));
|
||||
mFont->SetScale(1.5f);
|
||||
mFont->DrawString(cardg->card->data->name.c_str(),SCREEN_WIDTH_F/2,20);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->SetScale(1.0f);
|
||||
string details = "";
|
||||
std::vector<string> txt = cardg->card->data->getFormattedText(true);
|
||||
|
||||
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it)
|
||||
{
|
||||
details.append("\n");
|
||||
details.append(it->c_str());
|
||||
}
|
||||
mFont->DrawString(details.c_str(),SCREEN_WIDTH_F/2,25);
|
||||
}
|
||||
cardg->DrawCard(pos, drawMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,11 +254,17 @@ void CardGui::Render()
|
||||
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
|
||||
if(fakeborder)
|
||||
{
|
||||
if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))||
|
||||
((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card)))
|
||||
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
|
||||
if(game)
|
||||
{
|
||||
if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))||
|
||||
((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card)))
|
||||
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
|
||||
else
|
||||
fakeborder->SetColor(ARGB((int)(actA),15,15,15));
|
||||
}
|
||||
else
|
||||
fakeborder->SetColor(ARGB((int)(actA),15,15,15));
|
||||
|
||||
renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16);
|
||||
}
|
||||
//draw border for highlighting
|
||||
|
||||
@@ -298,16 +298,19 @@ void CardPrimitive::setText(const string& value)
|
||||
* Instead, we format when requested, but only once, and cache the result.
|
||||
* To avoid memory to blow up, in exchange of the cached result, we erase the original string
|
||||
*/
|
||||
const vector<string>& CardPrimitive::getFormattedText()
|
||||
const vector<string>& CardPrimitive::getFormattedText(bool noremove)
|
||||
{
|
||||
if (!text.size())
|
||||
return formattedText;
|
||||
|
||||
std::string::size_type found = text.find_first_of("{}");
|
||||
while (found != string::npos)
|
||||
if(!noremove)
|
||||
{
|
||||
text[found] = '/';
|
||||
found = text.find_first_of("{}", found + 1);
|
||||
while (found != string::npos)
|
||||
{
|
||||
text[found] = '/';
|
||||
found = text.find_first_of("{}", found + 1);
|
||||
}
|
||||
}
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
|
||||
mFont->FormatText(text, formattedText);
|
||||
|
||||
@@ -308,7 +308,7 @@ void GameStateShop::purchaseBooster(int controlId)
|
||||
SAFE_DELETE(booster);
|
||||
deleteDisplay();
|
||||
booster = NEW MTGDeck(MTGCollection());
|
||||
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 255, (SCREEN_HEIGHT/2)-20, this, NULL, 7);
|
||||
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 255, SCREEN_HEIGHT-65, this, NULL, 7);
|
||||
mBooster[controlId].addToDeck(booster, srcCards);
|
||||
|
||||
string sort = mBooster[controlId].getSort();
|
||||
|
||||
Reference in New Issue
Block a user