refactored menu classes
fixed some layout issues with detailed info popup changed requirements for detailed info popup button to be determined by the number of wins aginst AI deck instead of just the number of games.
This commit is contained in:
@@ -29,7 +29,6 @@ protected:
|
|||||||
string title;
|
string title;
|
||||||
string displayTitle;
|
string displayTitle;
|
||||||
WFont * mFont;
|
WFont * mFont;
|
||||||
float menuFontScale;
|
|
||||||
float titleFontScale;
|
float titleFontScale;
|
||||||
|
|
||||||
int maxItems, startId;
|
int maxItems, startId;
|
||||||
@@ -42,26 +41,30 @@ protected:
|
|||||||
void initMenuItems();
|
void initMenuItems();
|
||||||
string getDescription();
|
string getDescription();
|
||||||
string getMetaInformation();
|
string getMetaInformation();
|
||||||
DeckMetaData *selectedDeck;
|
DeckMetaData *mSelectedDeck;
|
||||||
|
int mSelectedDeckId;
|
||||||
|
bool mShowDetailsScreen;
|
||||||
|
bool mAlwaysShowDetailsButton;
|
||||||
|
bool mClosed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextScroller * scroller;
|
TextScroller * mScroller;
|
||||||
bool autoTranslate;
|
bool mAutoTranslate;
|
||||||
|
float mSelectionTargetY;
|
||||||
|
|
||||||
//used for detailed info button
|
//used for detailed info button
|
||||||
JQuad * pspIcons[8];
|
JQuad * pspIcons[8];
|
||||||
JTexture * pspIconsTexture;
|
JTexture * pspIconsTexture;
|
||||||
DeckMetaData * getSelectedDeck();
|
|
||||||
bool selectedDeckHasDetails();
|
|
||||||
int selectedDeckId;
|
|
||||||
bool showDetailsScreen;
|
|
||||||
bool enableDetails;
|
|
||||||
float selectionTargetY;
|
|
||||||
bool closed;
|
|
||||||
|
|
||||||
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, const float& mFontScale = 1.0f);
|
|
||||||
|
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
|
||||||
~DeckMenu();
|
~DeckMenu();
|
||||||
|
|
||||||
|
DeckMetaData * getSelectedDeck();
|
||||||
|
bool showDetailsScreen();
|
||||||
|
bool isClosed() { return mClosed; }
|
||||||
|
int getSelectedDeckId() { return mSelectedDeckId; }
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
|
void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
int percentVictories();
|
int percentVictories();
|
||||||
DeckStat * getDeckStat(string opponentsFile);
|
DeckStat * getDeckStat(string opponentsFile);
|
||||||
int nbGames();
|
int nbGames();
|
||||||
|
int nbVictories();
|
||||||
};
|
};
|
||||||
|
|
||||||
class StatsWrapper
|
class StatsWrapper
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class SimpleMenu:public JGuiController{
|
|||||||
int maxItems,startId;
|
int maxItems,startId;
|
||||||
float selectionT, selectionY;
|
float selectionT, selectionY;
|
||||||
float timeOpen;
|
float timeOpen;
|
||||||
|
bool mClosed;
|
||||||
|
|
||||||
static JQuad *spadeR, *spadeL, *jewel, *side;
|
static JQuad *spadeR, *spadeL, *jewel, *side;
|
||||||
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
||||||
@@ -37,7 +38,7 @@ class SimpleMenu:public JGuiController{
|
|||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
float selectionTargetY;
|
float selectionTargetY;
|
||||||
bool closed;
|
bool isClosed() { return mClosed; }
|
||||||
static void destroy();
|
static void destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,18 +24,22 @@ private:
|
|||||||
DeckMetaData * mDeckInformation;
|
DeckMetaData * mDeckInformation;
|
||||||
string mTitle;
|
string mTitle;
|
||||||
WFont *mTextFont;
|
WFont *mTextFont;
|
||||||
StatsWrapper *stw;
|
StatsWrapper *mStatsWrapper;
|
||||||
|
bool mClosed;
|
||||||
|
MTGAllCards * mCollection;
|
||||||
|
|
||||||
void drawHorzPole(float x, float y, float width);
|
void drawHorzPole(float x, float y, float width);
|
||||||
void drawVertPole(float x, float y, float height);
|
void drawVertPole(float x, float y, float height);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MTGAllCards * mCollection;
|
|
||||||
bool autoTranslate;
|
bool autoTranslate;
|
||||||
bool closed;
|
|
||||||
|
|
||||||
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
|
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
|
||||||
~SimplePopup(void);
|
~SimplePopup(void);
|
||||||
|
|
||||||
|
bool isClosed() { return mClosed; }
|
||||||
|
MTGAllCards* getCollection() { return mCollection; }
|
||||||
void Render();
|
void Render();
|
||||||
void Update(DeckMetaData* deckMetaData);
|
void Update(DeckMetaData* deckMetaData);
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
|||||||
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
|
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
|
||||||
{
|
{
|
||||||
backgroundName = "DeckEditorMenuBackdrop";
|
backgroundName = "DeckEditorMenuBackdrop";
|
||||||
|
mShowDetailsScreen = false;
|
||||||
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
|
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
|
||||||
enableDetails = false;
|
|
||||||
|
|
||||||
mX = 123;
|
mX = 123;
|
||||||
mY = 70;
|
mY = 70;
|
||||||
@@ -36,9 +35,8 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
|||||||
avatarY = 8;
|
avatarY = 8;
|
||||||
|
|
||||||
float scrollerWidth = 80;
|
float scrollerWidth = 80;
|
||||||
SAFE_DELETE(scroller); // need to delete the scroller init in the base class
|
SAFE_DELETE(mScroller); // need to delete the scroller init in the base class
|
||||||
this->showDetailsScreen = false;
|
mScroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
|
||||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,5 +96,5 @@ void DeckEditorMenu::drawDeckStatistics()
|
|||||||
|
|
||||||
DeckEditorMenu::~DeckEditorMenu()
|
DeckEditorMenu::~DeckEditorMenu()
|
||||||
{
|
{
|
||||||
SAFE_DELETE( scroller );
|
SAFE_DELETE( mScroller );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace
|
|||||||
const float kLineHeight = 20;
|
const float kLineHeight = 20;
|
||||||
const float kDescriptionVerticalBoxPadding = 5;
|
const float kDescriptionVerticalBoxPadding = 5;
|
||||||
const float kDescriptionHorizontalBoxPadding = 5;
|
const float kDescriptionHorizontalBoxPadding = 5;
|
||||||
const int DETAILED_INFO_THRESHOLD = 4;
|
const float kMenuFontScale = 1.0f;
|
||||||
|
const int DETAILED_INFO_THRESHOLD = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
hgeParticleSystem* DeckMenu::stars = NULL;
|
hgeParticleSystem* DeckMenu::stars = NULL;
|
||||||
@@ -31,14 +32,13 @@ hgeParticleSystem* DeckMenu::stars = NULL;
|
|||||||
// * descriptive information 125
|
// * descriptive information 125
|
||||||
// *** Need to make this configurable in a file somewhere to allow for class reuse
|
// *** Need to make this configurable in a file somewhere to allow for class reuse
|
||||||
|
|
||||||
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int& startIndex, const float& mFontScale) :
|
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int& startIndex, bool showDetailsOverride) :
|
||||||
JGuiController(id, listener), fontId(fontId), menuFontScale(mFontScale)
|
JGuiController(id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOverride )
|
||||||
{
|
{
|
||||||
|
|
||||||
backgroundName = "DeckMenuBackdrop";
|
backgroundName = "DeckMenuBackdrop";
|
||||||
|
mAlwaysShowDetailsButton = false;
|
||||||
selectedDeck = NULL;
|
mSelectedDeck = NULL;
|
||||||
enableDetails = true;
|
|
||||||
mY = 55;
|
mY = 55;
|
||||||
mWidth = 176;
|
mWidth = 176;
|
||||||
mX = 125;
|
mX = 125;
|
||||||
@@ -61,7 +61,7 @@ DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _tit
|
|||||||
statsHeight = 50;
|
statsHeight = 50;
|
||||||
statsWidth = 227;
|
statsWidth = 227;
|
||||||
|
|
||||||
selectedDeckId = startIndex;
|
mSelectedDeckId = startIndex;
|
||||||
|
|
||||||
avatarX = 230;
|
avatarX = 230;
|
||||||
avatarY = 8;
|
avatarY = 8;
|
||||||
@@ -69,9 +69,9 @@ DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _tit
|
|||||||
menuInitialized = false;
|
menuInitialized = false;
|
||||||
|
|
||||||
float scrollerWidth = 80;
|
float scrollerWidth = 80;
|
||||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
|
mScroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
|
||||||
|
|
||||||
autoTranslate = true;
|
mAutoTranslate = true;
|
||||||
maxItems = 7;
|
maxItems = 7;
|
||||||
mHeight = 2 * kVerticalMargin + (maxItems * kLineHeight);
|
mHeight = 2 * kVerticalMargin + (maxItems * kLineHeight);
|
||||||
|
|
||||||
@@ -83,14 +83,14 @@ DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _tit
|
|||||||
startId = 0;
|
startId = 0;
|
||||||
selectionT = 0;
|
selectionT = 0;
|
||||||
timeOpen = 0;
|
timeOpen = 0;
|
||||||
closed = false;
|
mClosed = false;
|
||||||
|
|
||||||
if (mFont->GetStringWidth(title.c_str()) > titleWidth)
|
if (mFont->GetStringWidth(title.c_str()) > titleWidth)
|
||||||
titleFontScale = 0.75f;
|
titleFontScale = 0.75f;
|
||||||
else
|
else
|
||||||
titleFontScale = 1.0f;
|
titleFontScale = 1.0f;
|
||||||
|
|
||||||
selectionTargetY = selectionY = kVerticalMargin;
|
mSelectionTargetY = selectionY = kVerticalMargin;
|
||||||
|
|
||||||
if (NULL == stars) stars = NEW hgeParticleSystem(resources.RetrievePSI("stars.psi", resources.GetQuad("stars")));
|
if (NULL == stars) stars = NEW hgeParticleSystem(resources.RetrievePSI("stars.psi", resources.GetQuad("stars")));
|
||||||
stars->FireAt(mX, mY);
|
stars->FireAt(mX, mY);
|
||||||
@@ -116,15 +116,19 @@ void DeckMenu::RenderBackground()
|
|||||||
|
|
||||||
DeckMetaData * DeckMenu::getSelectedDeck()
|
DeckMetaData * DeckMenu::getSelectedDeck()
|
||||||
{
|
{
|
||||||
if (selectedDeck) return selectedDeck;
|
if (mSelectedDeck) return mSelectedDeck;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckMenu::selectedDeckHasDetails()
|
bool DeckMenu::showDetailsScreen()
|
||||||
{
|
{
|
||||||
DeckMetaData * currentMenuItem = getSelectedDeck();
|
DeckMetaData * currentMenuItem = getSelectedDeck();
|
||||||
if (currentMenuItem) return (enableDetails && currentMenuItem->getGamesPlayed() > DETAILED_INFO_THRESHOLD);
|
if (currentMenuItem)
|
||||||
|
{
|
||||||
|
if (mAlwaysShowDetailsButton) return true;
|
||||||
|
if (mShowDetailsScreen && currentMenuItem->getVictories() > DETAILED_INFO_THRESHOLD) return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,7 +143,7 @@ void DeckMenu::initMenuItems()
|
|||||||
currentMenuItem->Relocate(mX, y);
|
currentMenuItem->Relocate(mX, y);
|
||||||
if (currentMenuItem->hasFocus()) sY = y;
|
if (currentMenuItem->hasFocus()) sY = y;
|
||||||
}
|
}
|
||||||
selectionTargetY = selectionY = sY;
|
mSelectionTargetY = selectionY = sY;
|
||||||
|
|
||||||
//Grab a texture in VRAM.
|
//Grab a texture in VRAM.
|
||||||
pspIconsTexture = resources.RetrieveTexture("iconspsp.png", RETRIEVE_LOCK);
|
pspIconsTexture = resources.RetrieveTexture("iconspsp.png", RETRIEVE_LOCK);
|
||||||
@@ -176,28 +180,24 @@ void DeckMenu::Render()
|
|||||||
{
|
{
|
||||||
if (currentMenuItem->hasFocus())
|
if (currentMenuItem->hasFocus())
|
||||||
{
|
{
|
||||||
selectedDeckId = i;
|
mSelectedDeckId = i;
|
||||||
selectedDeck = currentMenuItem->meta;
|
mSelectedDeck = currentMenuItem->meta;
|
||||||
|
|
||||||
WFont *mainFont = resources.GetWFont(Fonts::MAIN_FONT);
|
WFont *mainFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||||
|
|
||||||
// display the "more info" button if special condition is met
|
// display the "more info" button if special condition is met
|
||||||
if (selectedDeckHasDetails())
|
if (showDetailsScreen())
|
||||||
{
|
{
|
||||||
showDetailsScreen = true;
|
|
||||||
float pspIconsSize = 0.5;
|
float pspIconsSize = 0.5;
|
||||||
const string detailedInfoString = "Detailed Info";
|
const string detailedInfoString = "Detailed Info";
|
||||||
float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str());
|
float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str());
|
||||||
float boxStartX = detailedInfoBoxX - stringWidth / 2;
|
float boxStartX = detailedInfoBoxX - stringWidth / 2;
|
||||||
DWORD currentColor = mainFont->GetColor();
|
DWORD currentColor = mainFont->GetColor();
|
||||||
renderer->FillRoundRect( boxStartX, detailedInfoBoxY - 5, stringWidth,
|
renderer->FillRoundRect( boxStartX, detailedInfoBoxY - 5, stringWidth, mainFont->GetHeight() + 15, .5, ARGB( 255, 0, 0, 0) );
|
||||||
mainFont->GetHeight() + 15, .5, ARGB( 125, 0, 255, 255) );
|
|
||||||
renderer->RenderQuad(pspIcons[5], detailedInfoBoxX, detailedInfoBoxY + 2, 0, pspIconsSize, pspIconsSize);
|
renderer->RenderQuad(pspIcons[5], detailedInfoBoxX, detailedInfoBoxY + 2, 0, pspIconsSize, pspIconsSize);
|
||||||
mainFont->SetColor(currentColor);
|
mainFont->SetColor(currentColor);
|
||||||
mainFont->DrawString(detailedInfoString, boxStartX, detailedInfoBoxY + 10);
|
mainFont->DrawString(detailedInfoString, boxStartX, detailedInfoBoxY + 10);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
showDetailsScreen = false;
|
|
||||||
|
|
||||||
// display the avatar image
|
// display the avatar image
|
||||||
if (currentMenuItem->imageFilename.size() > 0)
|
if (currentMenuItem->imageFilename.size() > 0)
|
||||||
@@ -224,7 +224,7 @@ void DeckMenu::Render()
|
|||||||
{
|
{
|
||||||
mFont->SetColor(ARGB(150,255,255,255));
|
mFont->SetColor(ARGB(150,255,255,255));
|
||||||
}
|
}
|
||||||
mFont->SetScale(menuFontScale);
|
mFont->SetScale(kMenuFontScale);
|
||||||
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
|
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ void DeckMenu::Render()
|
|||||||
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
|
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
mFont->SetScale(1.0f);
|
mFont->SetScale(1.0f);
|
||||||
scroller->Render();
|
mScroller->Render();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ void DeckMenu::Update(float dt)
|
|||||||
else if (mCurr < startId) startId = mCurr;
|
else if (mCurr < startId) startId = mCurr;
|
||||||
stars->Update(dt);
|
stars->Update(dt);
|
||||||
selectionT += 3 * dt;
|
selectionT += 3 * dt;
|
||||||
selectionY += (selectionTargetY - selectionY) * 8 * dt;
|
selectionY += (mSelectionTargetY - selectionY) * 8 * dt;
|
||||||
|
|
||||||
float starsX = starsOffsetX + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2);
|
float starsX = starsOffsetX + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2);
|
||||||
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId;
|
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId;
|
||||||
@@ -261,22 +261,22 @@ void DeckMenu::Update(float dt)
|
|||||||
if (timeOpen >= 0)
|
if (timeOpen >= 0)
|
||||||
{
|
{
|
||||||
timeOpen = 0;
|
timeOpen = 0;
|
||||||
closed = true;
|
mClosed = true;
|
||||||
stars->FireAt(mX, mY);
|
stars->FireAt(mX, mY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
closed = false;
|
mClosed = false;
|
||||||
timeOpen += dt * 10;
|
timeOpen += dt * 10;
|
||||||
}
|
}
|
||||||
if (scroller) scroller->Update(dt);
|
if (mScroller) mScroller->Update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, DeckMetaData * deckMetaData)
|
void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, DeckMetaData * deckMetaData)
|
||||||
{
|
{
|
||||||
DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0, mY + kVerticalMargin + mCount * kLineHeight,
|
DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0,
|
||||||
(mCount == 0), autoTranslate, deckMetaData);
|
mY + kVerticalMargin + mCount * kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData);
|
||||||
Translator * t = Translator::GetInstance();
|
Translator * t = Translator::GetInstance();
|
||||||
map<string, string>::iterator it = t->deckValues.find(text);
|
map<string, string>::iterator it = t->deckValues.find(text);
|
||||||
if (it != t->deckValues.end()) //translate decks desc
|
if (it != t->deckValues.end()) //translate decks desc
|
||||||
@@ -299,13 +299,13 @@ void DeckMenu::updateScroller()
|
|||||||
{
|
{
|
||||||
// add all the items from the Tasks db.
|
// add all the items from the Tasks db.
|
||||||
TaskList taskList;
|
TaskList taskList;
|
||||||
scroller->Reset();
|
mScroller->Reset();
|
||||||
for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++)
|
for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++)
|
||||||
{
|
{
|
||||||
ostringstream taskDescription;
|
ostringstream taskDescription;
|
||||||
taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] "
|
taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] "
|
||||||
<< (*it)->getDesc() << endl;
|
<< (*it)->getDesc() << endl;
|
||||||
scroller->Add(taskDescription.str());
|
mScroller->Add(taskDescription.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,6 +323,6 @@ void DeckMenu::destroy()
|
|||||||
DeckMenu::~DeckMenu()
|
DeckMenu::~DeckMenu()
|
||||||
{
|
{
|
||||||
resources.Release(pspIconsTexture);
|
resources.Release(pspIconsTexture);
|
||||||
SAFE_DELETE(scroller);
|
SAFE_DELETE(mScroller);
|
||||||
scroller = NULL;
|
mScroller = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ void DeckMenuItem::Render()
|
|||||||
void DeckMenuItem::Entering()
|
void DeckMenuItem::Entering()
|
||||||
{
|
{
|
||||||
mHasFocus = true;
|
mHasFocus = true;
|
||||||
parent->selectionTargetY = mY;
|
parent->mSelectionTargetY = mY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckMenuItem::Leaving(JButton key)
|
bool DeckMenuItem::Leaving(JButton key)
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ void DeckMetaData::loadStatsForPlayer(Player * statsPlayer, string deckStatsFile
|
|||||||
stats->load(deckStatsFileName.c_str());
|
stats->load(deckStatsFileName.c_str());
|
||||||
_nbGamesPlayed = stats->nbGames();
|
_nbGamesPlayed = stats->nbGames();
|
||||||
_percentVictories = stats->percentVictories();
|
_percentVictories = stats->percentVictories();
|
||||||
|
_victories = stats->nbVictories();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stats = NULL;
|
stats = NULL;
|
||||||
|
|||||||
@@ -82,6 +82,21 @@ int DeckStats::nbGames()
|
|||||||
return nbgames;
|
return nbgames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeckStats::nbVictories()
|
||||||
|
{
|
||||||
|
int victories = 0;
|
||||||
|
int nbgames = 0;
|
||||||
|
map<string, DeckStat *>::iterator it;
|
||||||
|
for (it = stats.begin(); it != stats.end(); it++)
|
||||||
|
{
|
||||||
|
DeckStat * d = it->second;
|
||||||
|
nbgames += d->nbgames;
|
||||||
|
victories += d->victories;
|
||||||
|
}
|
||||||
|
|
||||||
|
return victories;
|
||||||
|
}
|
||||||
|
|
||||||
int DeckStats::percentVictories()
|
int DeckStats::percentVictories()
|
||||||
{
|
{
|
||||||
int victories = 0;
|
int victories = 0;
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ vector<DeckMetaData *> GameState::fillDeckMenu(SimpleMenu * _menu, const string&
|
|||||||
vector<DeckMetaData *> GameState::fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix,
|
vector<DeckMetaData *> GameState::fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix,
|
||||||
Player * statsPlayer)
|
Player * statsPlayer)
|
||||||
{
|
{
|
||||||
bool translate = _menu->autoTranslate;
|
bool translate = _menu->mAutoTranslate;
|
||||||
_menu->autoTranslate = false;
|
_menu->mAutoTranslate = false;
|
||||||
vector<DeckMetaData *> deckMetaDataVector = getValidDeckMetaData(path, smallDeckPrefix, statsPlayer);
|
vector<DeckMetaData *> deckMetaDataVector = getValidDeckMetaData(path, smallDeckPrefix, statsPlayer);
|
||||||
renderDeckMenu(_menu, deckMetaDataVector);
|
renderDeckMenu(_menu, deckMetaDataVector);
|
||||||
_menu->autoTranslate = translate;
|
_menu->mAutoTranslate = translate;
|
||||||
|
|
||||||
return deckMetaDataVector;
|
return deckMetaDataVector;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ void GameStateDeckViewer::Update(float dt)
|
|||||||
if (subMenu)
|
if (subMenu)
|
||||||
{
|
{
|
||||||
subMenu->Update(dt);
|
subMenu->Update(dt);
|
||||||
if (subMenu->closed)
|
if (subMenu->isClosed())
|
||||||
{
|
{
|
||||||
SAFE_DELETE(subMenu);
|
SAFE_DELETE(subMenu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void GameStateDuel::Start()
|
|||||||
decksneeded = 1;
|
decksneeded = 1;
|
||||||
|
|
||||||
deckmenu = NEW DeckMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::OPTION_FONT, "Choose a Deck",
|
deckmenu = NEW DeckMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::OPTION_FONT, "Choose a Deck",
|
||||||
GameStateDuel::selectedPlayerDeckId);
|
GameStateDuel::selectedPlayerDeckId, true);
|
||||||
|
|
||||||
DeckManager *deckManager = DeckManager::GetInstance();
|
DeckManager *deckManager = DeckManager::GetInstance();
|
||||||
vector<DeckMetaData *> playerDeckList = getValidDeckMetaData(options.profileFile());
|
vector<DeckMetaData *> playerDeckList = getValidDeckMetaData(options.profileFile());
|
||||||
@@ -279,7 +279,7 @@ void GameStateDuel::ensureOpponentMenu()
|
|||||||
if (opponentMenu == NULL)
|
if (opponentMenu == NULL)
|
||||||
{
|
{
|
||||||
opponentMenu = NEW DeckMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::OPTION_FONT, "Choose Your Opponent",
|
opponentMenu = NEW DeckMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::OPTION_FONT, "Choose Your Opponent",
|
||||||
GameStateDuel::selectedAIDeckId);
|
GameStateDuel::selectedAIDeckId, true);
|
||||||
opponentMenu->Add(MENUITEM_RANDOM_AI, "Random");
|
opponentMenu->Add(MENUITEM_RANDOM_AI, "Random");
|
||||||
if (options[Options::EVILTWIN_MODE_UNLOCKED].number) opponentMenu->Add(MENUITEM_EVIL_TWIN, "Evil Twin", _(
|
if (options[Options::EVILTWIN_MODE_UNLOCKED].number) opponentMenu->Add(MENUITEM_EVIL_TWIN, "Evil Twin", _(
|
||||||
"Can you play against yourself?").c_str());
|
"Can you play against yourself?").c_str());
|
||||||
@@ -349,7 +349,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
if (!rules) rules = NEW Rules("mtg.txt");
|
if (!rules) rules = NEW Rules("mtg.txt");
|
||||||
if (mParent->players[0] == PLAYER_TYPE_HUMAN)
|
if (mParent->players[0] == PLAYER_TYPE_HUMAN)
|
||||||
{
|
{
|
||||||
if (!popupScreen || popupScreen->closed) deckmenu->Update(dt);
|
if (!popupScreen || popupScreen->isClosed()) deckmenu->Update(dt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -359,7 +359,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DUEL_STATE_CHOOSE_DECK1_TO_2:
|
case DUEL_STATE_CHOOSE_DECK1_TO_2:
|
||||||
if (deckmenu->closed)
|
if (deckmenu->isClosed())
|
||||||
mGamePhase = DUEL_STATE_CHOOSE_DECK2;
|
mGamePhase = DUEL_STATE_CHOOSE_DECK2;
|
||||||
else
|
else
|
||||||
deckmenu->Update(dt);
|
deckmenu->Update(dt);
|
||||||
@@ -384,7 +384,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
case DUEL_STATE_CHOOSE_DECK2_TO_PLAY:
|
case DUEL_STATE_CHOOSE_DECK2_TO_PLAY:
|
||||||
if (mParent->players[1] == PLAYER_TYPE_HUMAN)
|
if (mParent->players[1] == PLAYER_TYPE_HUMAN)
|
||||||
{
|
{
|
||||||
if (deckmenu->closed)
|
if (deckmenu->isClosed())
|
||||||
mGamePhase = DUEL_STATE_PLAY;
|
mGamePhase = DUEL_STATE_PLAY;
|
||||||
else
|
else
|
||||||
deckmenu->Update(dt);
|
deckmenu->Update(dt);
|
||||||
@@ -392,7 +392,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensureOpponentMenu();
|
ensureOpponentMenu();
|
||||||
if (opponentMenu->closed)
|
if (opponentMenu->isClosed())
|
||||||
mGamePhase = DUEL_STATE_PLAY;
|
mGamePhase = DUEL_STATE_PLAY;
|
||||||
else
|
else
|
||||||
opponentMenu->Update(dt);
|
opponentMenu->Update(dt);
|
||||||
@@ -482,7 +482,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
break;
|
break;
|
||||||
case DUEL_STATE_CANCEL:
|
case DUEL_STATE_CANCEL:
|
||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
if (menu->closed)
|
if (menu->isClosed())
|
||||||
{
|
{
|
||||||
mGamePhase = DUEL_STATE_PLAY;
|
mGamePhase = DUEL_STATE_PLAY;
|
||||||
SAFE_DELETE(menu);
|
SAFE_DELETE(menu);
|
||||||
@@ -492,7 +492,7 @@ void GameStateDuel::Update(float dt)
|
|||||||
if (menu)
|
if (menu)
|
||||||
{
|
{
|
||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
if (menu->closed)
|
if (menu->isClosed())
|
||||||
{
|
{
|
||||||
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
||||||
playerdata->taskList->passOneDay();
|
playerdata->taskList->passOneDay();
|
||||||
@@ -577,11 +577,11 @@ void GameStateDuel::Render()
|
|||||||
{
|
{
|
||||||
if (opponentMenu)
|
if (opponentMenu)
|
||||||
opponentMenu->Render();
|
opponentMenu->Render();
|
||||||
else if (deckmenu && !deckmenu->closed) deckmenu->Render();
|
else if (deckmenu && !deckmenu->isClosed()) deckmenu->Render();
|
||||||
|
|
||||||
if (menu) menu->Render();
|
if (menu) menu->Render();
|
||||||
|
|
||||||
if (popupScreen && !popupScreen->closed) popupScreen->Render();
|
if (popupScreen && !popupScreen->isClosed()) popupScreen->Render();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DUEL_STATE_ERROR_NO_DECK:
|
case DUEL_STATE_ERROR_NO_DECK:
|
||||||
@@ -612,10 +612,10 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
{
|
{
|
||||||
|
|
||||||
case DUEL_MENU_DETAILED_DECK1_INFO:
|
case DUEL_MENU_DETAILED_DECK1_INFO:
|
||||||
if ((popupScreen || deckmenu->selectedDeckHasDetails()))
|
if ((popupScreen || deckmenu->showDetailsScreen()))
|
||||||
{
|
{
|
||||||
DeckMetaData* selectedDeck = deckmenu->getSelectedDeck();
|
DeckMetaData* selectedDeck = deckmenu->getSelectedDeck();
|
||||||
if (!popupScreen->closed)
|
if (!popupScreen->isClosed())
|
||||||
{
|
{
|
||||||
popupScreen->Close();
|
popupScreen->Close();
|
||||||
mGamePhase = DUEL_STATE_CHOOSE_DECK1;
|
mGamePhase = DUEL_STATE_CHOOSE_DECK1;
|
||||||
@@ -629,10 +629,10 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DUEL_MENU_DETAILED_DECK2_INFO:
|
case DUEL_MENU_DETAILED_DECK2_INFO:
|
||||||
if ((popupScreen || opponentMenu->selectedDeckHasDetails()))
|
if ((popupScreen || opponentMenu->showDetailsScreen()))
|
||||||
{
|
{
|
||||||
DeckMetaData* selectedDeck = opponentMenu->getSelectedDeck();
|
DeckMetaData* selectedDeck = opponentMenu->getSelectedDeck();
|
||||||
if (!popupScreen->closed)
|
if (!popupScreen->isClosed())
|
||||||
{
|
{
|
||||||
popupScreen->Close();
|
popupScreen->Close();
|
||||||
mGamePhase = DUEL_STATE_CHOOSE_DECK2_TO_PLAY;
|
mGamePhase = DUEL_STATE_CHOOSE_DECK2_TO_PLAY;
|
||||||
@@ -667,7 +667,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (controlId == MENUITEM_MORE_INFO && opponentMenu->showDetailsScreen)
|
else if (controlId == MENUITEM_MORE_INFO && opponentMenu->showDetailsScreen())
|
||||||
{
|
{
|
||||||
DeckMetaData* selectedDeck = opponentMenu->getSelectedDeck();
|
DeckMetaData* selectedDeck = opponentMenu->getSelectedDeck();
|
||||||
if (!popupScreen)
|
if (!popupScreen)
|
||||||
@@ -684,7 +684,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
mGamePhase = DUEL_STATE_DECK2_DETAILED_INFO;
|
mGamePhase = DUEL_STATE_DECK2_DETAILED_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (controlId == MENUITEM_MORE_INFO && !opponentMenu->showDetailsScreen)
|
else if (controlId == MENUITEM_MORE_INFO && !opponentMenu->showDetailsScreen())
|
||||||
{
|
{
|
||||||
// do nothing, ignore all key requests until popup is dismissed.
|
// do nothing, ignore all key requests until popup is dismissed.
|
||||||
break;
|
break;
|
||||||
@@ -716,7 +716,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
mGamePhase = DUEL_STATE_BACK_TO_MAIN_MENU;
|
mGamePhase = DUEL_STATE_BACK_TO_MAIN_MENU;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (controlId == MENUITEM_MORE_INFO && deckmenu->showDetailsScreen)
|
else if (controlId == MENUITEM_MORE_INFO && deckmenu->showDetailsScreen())
|
||||||
{
|
{
|
||||||
DeckMetaData* selectedDeck = deckmenu->getSelectedDeck();
|
DeckMetaData* selectedDeck = deckmenu->getSelectedDeck();
|
||||||
if (!popupScreen)
|
if (!popupScreen)
|
||||||
@@ -724,7 +724,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK1_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
popupScreen = NEW SimplePopup(DUEL_MENU_DETAILED_DECK1_INFO, this, Fonts::MAIN_FONT, "Detailed Information",
|
||||||
selectedDeck, mParent->collection);
|
selectedDeck, mParent->collection);
|
||||||
popupScreen->Render();
|
popupScreen->Render();
|
||||||
selectedPlayerDeckId = deckmenu->selectedDeckId;
|
selectedPlayerDeckId = deckmenu->getSelectedDeckId();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ void GameStateMenu::Update(float dt)
|
|||||||
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (subMenuController->closed)
|
if (subMenuController->isClosed())
|
||||||
{
|
{
|
||||||
SAFE_DELETE(subMenuController);
|
SAFE_DELETE(subMenuController);
|
||||||
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ void GameStateShop::beginFilters()
|
|||||||
}
|
}
|
||||||
void GameStateShop::Update(float dt)
|
void GameStateShop::Update(float dt)
|
||||||
{
|
{
|
||||||
if (menu && menu->closed)
|
if (menu && menu->isClosed())
|
||||||
SAFE_DELETE(menu);
|
SAFE_DELETE(menu);
|
||||||
srcCards->Update(dt);
|
srcCards->Update(dt);
|
||||||
alphaChange = static_cast<int> (500 - (int) ((rand() % 1000)) * dt);
|
alphaChange = static_cast<int> (500 - (int) ((rand() % 1000)) * dt);
|
||||||
@@ -536,7 +536,7 @@ void GameStateShop::Update(float dt)
|
|||||||
break;
|
break;
|
||||||
case STAGE_ASK_ABOUT:
|
case STAGE_ASK_ABOUT:
|
||||||
btn = mEngine->ReadButton();
|
btn = mEngine->ReadButton();
|
||||||
if (menu && !menu->closed)
|
if (menu && !menu->isClosed())
|
||||||
{
|
{
|
||||||
menu->CheckUserInput(btn);
|
menu->CheckUserInput(btn);
|
||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
@@ -576,7 +576,7 @@ void GameStateShop::Update(float dt)
|
|||||||
break;
|
break;
|
||||||
case STAGE_SHOP_SHOP:
|
case STAGE_SHOP_SHOP:
|
||||||
btn = mEngine->ReadButton();
|
btn = mEngine->ReadButton();
|
||||||
if (menu && !menu->closed)
|
if (menu && !menu->isClosed())
|
||||||
{
|
{
|
||||||
menu->CheckUserInput(btn);
|
menu->CheckUserInput(btn);
|
||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void GameStateStory::Update(float dt)
|
|||||||
if (menu)
|
if (menu)
|
||||||
{
|
{
|
||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
if (menu->closed)
|
if (menu->isClosed())
|
||||||
SAFE_DELETE(menu);
|
SAFE_DELETE(menu);
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, float x, floa
|
|||||||
maxItems = _maxItems;
|
maxItems = _maxItems;
|
||||||
selectionT = 0;
|
selectionT = 0;
|
||||||
timeOpen = 0;
|
timeOpen = 0;
|
||||||
closed = false;
|
mClosed = false;
|
||||||
selectionTargetY = selectionY = y + kVerticalMargin;
|
selectionTargetY = selectionY = y + kVerticalMargin;
|
||||||
|
|
||||||
JRenderer* renderer = JRenderer::GetInstance();
|
JRenderer* renderer = JRenderer::GetInstance();
|
||||||
@@ -168,13 +168,13 @@ void SimpleMenu::Update(float dt)
|
|||||||
if (timeOpen >= 0)
|
if (timeOpen >= 0)
|
||||||
{
|
{
|
||||||
timeOpen = 0;
|
timeOpen = 0;
|
||||||
closed = true;
|
mClosed = true;
|
||||||
stars->FireAt(mX, mY);
|
stars->FireAt(mX, mY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
closed = false;
|
mClosed = false;
|
||||||
timeOpen += dt * 10;
|
timeOpen += dt * 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const
|
|||||||
mMaxLines = 10;
|
mMaxLines = 10;
|
||||||
mTextFont = resources.GetWFont(fontId);
|
mTextFont = resources.GetWFont(fontId);
|
||||||
this->mCount = 1;
|
this->mCount = 1;
|
||||||
stw = NULL;
|
mStatsWrapper = NULL;
|
||||||
Update(deckMetaData);
|
Update(deckMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimplePopup::Render()
|
void SimplePopup::Render()
|
||||||
{
|
{
|
||||||
closed = false;
|
mClosed = false;
|
||||||
|
|
||||||
JRenderer *r = JRenderer::GetInstance();
|
JRenderer *r = JRenderer::GetInstance();
|
||||||
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
|
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
|
||||||
@@ -45,9 +45,9 @@ void SimplePopup::Render()
|
|||||||
void SimplePopup::Update(DeckMetaData* selectedDeck)
|
void SimplePopup::Update(DeckMetaData* selectedDeck)
|
||||||
{
|
{
|
||||||
mDeckInformation = selectedDeck;
|
mDeckInformation = selectedDeck;
|
||||||
SAFE_DELETE(stw);
|
SAFE_DELETE(mStatsWrapper);
|
||||||
stw = NEW StatsWrapper(mDeckInformation->getDeckId());
|
mStatsWrapper = NEW StatsWrapper(mDeckInformation->getDeckId());
|
||||||
stw->updateStats(mDeckInformation->getFilename(), mCollection);
|
mStatsWrapper->updateStats(mDeckInformation->getFilename(), mCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,31 +56,31 @@ string SimplePopup::getDetailedInformation(string filename)
|
|||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
oss
|
oss
|
||||||
<< "------- Deck Summary -----" << endl
|
<< "------- Deck Summary -----" << endl
|
||||||
<< "Cards: "<< stw->cardCount << endl
|
<< "Cards: "<< mStatsWrapper->cardCount << endl
|
||||||
<< "Creatures: "<< setw(2) << stw->countCreatures
|
<< "Creatures: "<< setw(2) << mStatsWrapper->countCreatures
|
||||||
<< " Enchantments: " << stw->countEnchantments << endl
|
<< " Enchantments: " << mStatsWrapper->countEnchantments << endl
|
||||||
<< "Instants: " << setw(4) << stw->countInstants
|
<< "Instants: " << setw(4) << mStatsWrapper->countInstants
|
||||||
<< " Sorceries: " << setw(2) << stw->countSorceries << endl
|
<< " Sorceries: " << setw(2) << mStatsWrapper->countSorceries << endl
|
||||||
<< "Lands: "
|
<< "Lands: "
|
||||||
<< "A: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
|
<< "A: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
|
||||||
<< "G: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
|
<< "G: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
|
||||||
<< "R: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
|
<< "R: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_RED ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
|
||||||
<< "U: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
|
<< "U: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
|
||||||
<< "B: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
|
<< "B: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
|
||||||
<< "W: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
|
<< "W: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
|
||||||
<< " --- Mana Curve --- " << endl;
|
<< " --- Mana Curve --- " << endl;
|
||||||
|
|
||||||
for ( int costIdx = 0; costIdx < Constants::STATS_MAX_MANA_COST+1; ++costIdx )
|
for ( int costIdx = 0; costIdx < Constants::STATS_MAX_MANA_COST+1; ++costIdx )
|
||||||
if ( stw->countCardsPerCost[ costIdx ] > 0 )
|
if ( mStatsWrapper->countCardsPerCost[ costIdx ] > 0 )
|
||||||
oss << costIdx << ": " << setw(2) << left << stw->countCardsPerCost[ costIdx ] << " ";
|
oss << costIdx << ": " << setw(2) << left << mStatsWrapper->countCardsPerCost[ costIdx ] << " ";
|
||||||
|
|
||||||
oss << endl;
|
oss << endl;
|
||||||
|
|
||||||
oss
|
oss
|
||||||
<< " --- Average Cost --- " << endl
|
<< " --- Average Cost --- " << endl
|
||||||
<< "Creature: "<< setprecision(2) << stw->avgCreatureCost << endl
|
<< "Creature: "<< setprecision(2) << mStatsWrapper->avgCreatureCost << endl
|
||||||
<< "Mana: " << setprecision(2) << stw->avgManaCost << " "
|
<< "Mana: " << setprecision(2) << mStatsWrapper->avgManaCost << " "
|
||||||
<< "Spell: " << setprecision(2) << stw->avgSpellCost << endl;
|
<< "Spell: " << setprecision(2) << mStatsWrapper->avgSpellCost << endl;
|
||||||
|
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ string SimplePopup::getDetailedInformation(string filename)
|
|||||||
|
|
||||||
void SimplePopup::Close()
|
void SimplePopup::Close()
|
||||||
{
|
{
|
||||||
closed = true;
|
mClosed = true;
|
||||||
mCount = 0;
|
mCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ SimplePopup::~SimplePopup(void)
|
|||||||
{
|
{
|
||||||
mTextFont = NULL;
|
mTextFont = NULL;
|
||||||
mDeckInformation = NULL;
|
mDeckInformation = NULL;
|
||||||
SAFE_DELETE(stw);
|
SAFE_DELETE(mStatsWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimplePopup::drawHorzPole(float x, float y, float width)
|
void SimplePopup::drawHorzPole(float x, float y, float width)
|
||||||
|
|||||||
@@ -1616,7 +1616,7 @@ void WGuiFilters::setSrc(WSrcCards * wsc)
|
|||||||
}
|
}
|
||||||
void WGuiFilters::Update(float dt)
|
void WGuiFilters::Update(float dt)
|
||||||
{
|
{
|
||||||
if (subMenu && !subMenu->closed) subMenu->Update(dt);
|
if (subMenu && !subMenu->isClosed()) subMenu->Update(dt);
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
list->Update(dt);
|
list->Update(dt);
|
||||||
@@ -1652,11 +1652,11 @@ void WGuiFilters::Render()
|
|||||||
list->setY(tY);
|
list->setY(tY);
|
||||||
list->Render();
|
list->Render();
|
||||||
|
|
||||||
if (subMenu && !subMenu->closed) subMenu->Render();
|
if (subMenu && !subMenu->isClosed()) subMenu->Render();
|
||||||
}
|
}
|
||||||
bool WGuiFilters::CheckUserInput(JButton key)
|
bool WGuiFilters::CheckUserInput(JButton key)
|
||||||
{
|
{
|
||||||
if (subMenu && !subMenu->closed && subMenu->CheckUserInput(key)) return true;
|
if (subMenu && !subMenu->isClosed() && subMenu->CheckUserInput(key)) return true;
|
||||||
if (key == JGE_BTN_SEC)
|
if (key == JGE_BTN_SEC)
|
||||||
{//|| key == JGE_BTN_MENU){
|
{//|| key == JGE_BTN_MENU){
|
||||||
//TODO Pop up a "Are you sure?" dialog.
|
//TODO Pop up a "Are you sure?" dialog.
|
||||||
|
|||||||
Reference in New Issue
Block a user