GameStateShop::GameStateShop(GameApp* parent) : GameState(parent, "shop") { menu = NULL; boosterDisplay = NULL; taskList = NULL; srcCards = NULL; shopMenu = NULL; bigDisplay = NULL; myCollection = NULL; packlist = NULL; pricelist = NULL; playerdata = NULL; booster = NULL; lightAlpha = 0; filterMenu = NULL; alphaChange = 0; for (int i = 0; i < SHOP_ITEMS; i++) { mPrices[i] = 0; mCounts[i] = 0; } mTouched = false; kOtherCardsString = _(kOtherCardsString); kCreditsString = _(kCreditsString); cycleCardsButton = NEW InteractiveButton(NULL, kCycleCardsButtonId, Fonts::MAIN_FONT, "New Cards", SCREEN_WIDTH_F - 80, SCREEN_HEIGHT_F - 20, JGE_BTN_PRI); showCardListButton = NEW InteractiveButton(NULL, kShowCardListButtonId, Fonts::MAIN_FONT, "Show List", SCREEN_WIDTH_F - 150, SCREEN_HEIGHT_F - 20, JGE_BTN_SEC); disablePurchase = false; clearInput = false; }
SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title, DeckMetaData* deckMetaData, MTGAllCards * collection, float cancelX, float cancelY) : JGuiController(JGE::GetInstance(), id, listener), mCollection(collection) { mX = 19; mY = 66; mWidth = 180.0f; mTitle = _title; mMaxLines = 12; mTextFont = WResourceManager::Instance()->GetWFont(fontId); this->mCount = 1; // a hack to ensure the menus do book keeping correctly. Since we aren't adding items to the menu, this is required mStatsWrapper = NULL; JGuiController::Add(NEW InteractiveButton(this, kDismissButtonId, Fonts::MAIN_FONT, "Detailed Info", cancelX, cancelY, JGE_BTN_CANCEL), true); Update(deckMetaData); }
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int&, bool showDetailsOverride) : JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOverride ) { backgroundName = "DeckMenuBackdrop"; mAlwaysShowDetailsButton = false; mSelectedDeck = NULL; mY = 50; mWidth = 176; mX = 115; titleX = 110; // center point in title box titleY = 15; titleWidth = 180; // width of inner box of title descX = 260 + DeckMenuConst::kDescriptionHorizontalBoxPadding; descY = 100 + DeckMenuConst::kDescriptionVerticalBoxPadding; descHeight = 145; descWidth = 195; detailedInfoBoxX = 400; detailedInfoBoxY = 235; starsOffsetX = 50; statsX = 300; statsY = 15; statsHeight = 50; statsWidth = 227; avatarX = 232; avatarY = 11; menuInitialized = false; float scrollerWidth = 200.0f; float scrollerHeight = 28.0f; mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed); mAutoTranslate = true; maxItems = 6; mHeight = 2 * DeckMenuConst::kVerticalMargin + (maxItems * DeckMenuConst::kLineHeight); // we want to cap the deck titles to 15 characters to avoid overflowing deck names title = _(_title); displayTitle = title; mFont = WResourceManager::Instance()->GetWFont(fontId); startId = 0; selectionT = 0; timeOpen = 0; mClosed = false; if (mFont->GetStringWidth(title.c_str()) > titleWidth) titleFontScale = SCALE_SHRINK; else titleFontScale = SCALE_NORMAL; mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin; if (NULL == stars) stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get())); stars->FireAt(mX, mY); const string detailedInfoString = _("Detailed Info"); WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str()); float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20; dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL); JGuiController::Add(dismissButton, true); updateScroller(); }