Exemplo n.º 1
0
void GameStateAwards::Start()
{
    mParent->DoAnimation(TRANSITION_FADE_IN);
    char buf[256];
    mState = STATE_LISTVIEW;
    options.checkProfile();

    menu = NULL;
    saveMe = options.newAward();

    listview = NEW WGuiList("Listview");
    listview->setX(210);
    listview->setWidth(SCREEN_WIDTH - 220);
    detailview = NULL;
    WGuiAward * aw;
    WGuiButton * btn;

    WGuiHeader * wgh = NEW WGuiHeader("Achievements");
    listview->Add(wgh);

    aw = NEW WGuiAward(Options::DIFFICULTY_MODE_UNLOCKED, "Difficulty Modes", "Achieved a 66% victory ratio.");
    btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::DIFFICULTY_MODE_UNLOCKED, this);
    listview->Add(btn);

    for (map<string, Unlockable *>::iterator it = Unlockable::unlockables.begin(); it !=  Unlockable::unlockables.end(); ++it) {
        Unlockable * award = it->second;
        aw = NEW WGuiAward(award->getValue("id"), award->getValue("name"), award->getValue("trophyroom_text"));
        btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, 0, this);
        listview->Add(btn);
    }

    aw = NEW WGuiAward(Options::EVILTWIN_MODE_UNLOCKED, "Evil Twin Mode", "Won with same army size.");
    btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::EVILTWIN_MODE_UNLOCKED, this);
    listview->Add(btn);

    aw = NEW WGuiAward(Options::RANDOMDECK_MODE_UNLOCKED, "Random Deck Mode", "Won against a higher difficulty.");
    btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::RANDOMDECK_MODE_UNLOCKED, this);
    listview->Add(btn);

    aw = NEW WGuiAward(Options::AWARD_COLLECTOR, "Valuable Collection", "Collection valued over 10,000c.", "Collection Info");
    btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::AWARD_COLLECTOR, this);
    listview->Add(btn);

    wgh = NEW WGuiHeader("");
    listview->Add(wgh);

    int locked = 0;
    for (int i = 0; i < setlist.size(); i++)
    {
        MTGSetInfo * si = setlist.getInfo(i);
        if (!si)
            continue;
        if (!options[Options::optionSet(i)].number)
        {
            locked++;
            continue;
        }

        if (!si->author.size())
            sprintf(buf, _("%i cards.").c_str(), si->totalCards());
        else if (si->year > 0)
            sprintf(buf, _("%s (%i): %i cards").c_str(), si->author.c_str(), si->year, si->totalCards());
        else
            sprintf(buf, _("%s: %i cards.").c_str(), si->author.c_str(), si->totalCards());

        aw = NEW WGuiAward(Options::optionSet(i), si->getName(), buf, "Card Spoiler");
        aw->mFlags = WGuiItem::NO_TRANSLATE;
        btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::optionSet(i), this);
        listview->Add(btn);
    }
    if (locked)
        sprintf(buf, _("%i locked sets remain.").c_str(), locked);
    else
        sprintf(buf, _("Unlocked all %i sets.").c_str(), setlist.size());

    wgh->setDisplay(buf);
    wgh->mFlags = WGuiItem::NO_TRANSLATE;

    listview->Entering(JGE_BTN_NONE);
    detailview = NULL;
    setSrc = NULL;
    showMenu = false;
}
Exemplo n.º 2
0
void GameStateOptions::Start()
{
    newProfile = "";
    timer = 0;
    mState = SHOW_OPTIONS;
    JRenderer::GetInstance()->EnableVSync(true);

    WGuiList * optionsList;

    optionsList = NEW WGuiList("Settings");

    optionsList->Add(NEW WGuiHeader("General Options"));
    if (GameApp::HasMusic)
        optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MUSICVOLUME, "Music volume", 100, 10, 100),
                        OptionVolume::getInstance()));
    optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::SFXVOLUME, "SFX volume", 100, 10, 100), OptionVolume::getInstance()));
    if (options[Options::DIFFICULTY_MODE_UNLOCKED].number)
    {
        optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::DIFFICULTY, "Difficulty", 3, 1, 0),
                        OptionDifficulty::getInstance()));
        optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::ECON_DIFFICULTY, "Economic Difficuly", Constants::ECON_EASY)));
    }
    optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1));
    optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells"));
    optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities"));
    optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDMAIN, "Interrupt opponent's end of turn"));
    optionsTabs = NEW WGuiTabMenu();
    optionsTabs->Add(optionsList);

    optionsList = NEW WGuiList("Game");
    optionsList->Add(NEW WGuiHeader("Interface Options"));
    optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND, "Closed hand", 1, 1, 0)));
    optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::HANDDIRECTION, "Hand direction", 1, 1, 0)));
    optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MANADISPLAY, "Mana display", 3, 1, 0)));
    optionsList->Add(NEW OptionInteger(Options::REVERSETRIGGERS, "Reverse left and right triggers"));
    optionsList->Add(NEW OptionInteger(Options::DISABLECARDS, "Disable card images"));
    optionsList->Add(NEW OptionInteger(Options::TRANSITIONS, "Disable screen transitions"));
    optionsList->Add(NEW OptionInteger(Options::OSD, "Display InGame extra information"));
    optionsTabs->Add(optionsList);

    optionsList = NEW WGuiList("User");
    optionsList->Add(NEW WGuiHeader("User Options"));
    WDecoConfirm * cPrf = NEW WDecoConfirm(this, NEW OptionProfile(mParent, this));
    cPrf->confirm = "Use this Profile";
    OptionThemeStyle * ots = NEW OptionThemeStyle("Theme Style");
    OptionDirectory * od = NEW OptionTheme(ots);
    WDecoConfirm * cThm = NEW WDecoConfirm(this, od);
    cThm->confirm = "Use this Theme";

    WDecoConfirm * cStyle = NEW WDecoConfirm(this, ots);
    cStyle->confirm = "Use this Style";

    optionsList->Add(NEW WGuiSplit(cPrf, cThm));
    optionsList->Add(cStyle);
    optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, kNewProfileID, this));

    optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
		optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
		optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks")));

    optionsTabs->Add(optionsList);

    optionsList = NEW WGuiList("Advanced");
    optionsList->Add(NEW WGuiHeader("Advanced Options"));
    WDecoStyled * wAdv = NEW WDecoStyled(NEW WGuiHeader("The following options require a restart."));
    wAdv->mStyle = WDecoStyled::DS_STYLE_ALERT;
    optionsList->Add(wAdv);
    WDecoConfirm * cLang = NEW WDecoConfirm(this, NEW OptionLanguage("Language"));
    cLang->confirm = "Use this Language";
    optionsList->Add(cLang);
    WDecoEnum * oGra = NEW WDecoEnum(NEW OptionInteger(Options::MAX_GRADE, "Minimum Card Grade", Constants::GRADE_DANGEROUS, 1,
                    Constants::GRADE_BORDERLINE, "", Constants::GRADE_SUPPORTED));
    optionsList->Add(oGra);
    WDecoEnum * oASPhases = NEW WDecoEnum(NEW OptionInteger(Options::ASPHASES, "Phase Skip Automation", Constants::ASKIP_FULL, 1,
                    Constants::ASKIP_NONE, "", Constants::ASKIP_NONE));
    optionsList->Add(oASPhases);
    optionsTabs->Add(optionsList);

    WDecoEnum * oFirstPlayer = NEW WDecoEnum(NEW OptionInteger(Options::FIRSTPLAYER, "First Turn Player", Constants::WHO_R, 1,
                    Constants::WHO_P, "", Constants::WHO_P));
    optionsList->Add(oFirstPlayer);
    
    WDecoEnum * oKickerPay = NEW WDecoEnum(NEW OptionInteger(Options::KICKERPAYMENT, "Kicker Cost", Constants::KICKER_CHOICE, 1,
        Constants::KICKER_ALWAYS, "", Constants::KICKER_ALWAYS));
    optionsList->Add(oKickerPay);
#ifndef IOS
    optionsList = NEW WGuiKeyBinder("Key Bindings", this);
    optionsTabs->Add(optionsList);
#endif
    optionsList = NEW WGuiList("Credits");
    optionsList->failMsg = "";
    optionsTabs->Add(optionsList);

    optionsMenu = NEW SimpleMenu(JGE::GetInstance(), -102, this, Fonts::MAIN_FONT, 50, 170);
    optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu");
    optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit");
    optionsMenu->Add(kCancelMenuID, "Cancel");

    optionsTabs->Entering(JGE_BTN_NONE);
}
Exemplo n.º 3
0
bool GameStateAwards::enterStats(int option)
{
    if (option != Options::AWARD_COLLECTOR)
        return false;
    DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), MTGCollection()));
    if (!ddw)
        return false;

    SAFE_DELETE(detailview);
    detailview = NEW WGuiList("Details");

    detailview->Add(NEW WGuiHeader("Collection Stats"));
    detailview->Entering(JGE_BTN_NONE);

    //Discover favorite set
    if (setlist.size() > 0)
    {
        int * counts = (int*) calloc(setlist.size(), sizeof(int));
        int setid = -1;
        int dupes = 0;
        MTGCard * many = NULL;
        MTGCard * costly = NULL;
        MTGCard * strong = NULL;
        MTGCard * tough = NULL;

        for (int t = 0; t < ddw->Size(); t++)
        {
            MTGCard * c = ddw->getCard(t);
            if (!c)
                continue;
            int count = ddw->count(c);
            if (!c->data->isLand() && (many == NULL || count > dupes))
            {
                many = c;
                dupes = count;
            }
            counts[c->setId] += count;
            if (costly == NULL || c->data->getManaCost()->getConvertedCost() > costly->data->getManaCost()->getConvertedCost())
                costly = c;

            if (c->data->isCreature() && (strong == NULL || c->data->getPower() > strong->data->getPower()))
                strong = c;

            if (c->data->isCreature() && (tough == NULL || c->data->getToughness() > tough->data->getToughness()))
                tough = c;
        }
        for (int i = 0; i < setlist.size(); i++)
        {
            if (setid < 0 || counts[i] > counts[setid])
                setid = i;
        }
        free(counts);

        char buf[1024];
        sprintf(buf, _("Total Value: %ic").c_str(), ddw->totalPrice());
        detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));//ddw->colors

        sprintf(buf, _("Total Cards (including duplicates): %i").c_str(), ddw->getCount(WSrcDeck::UNFILTERED_COPIES));
        detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));//ddw->colors

        sprintf(buf, _("Unique Cards: %i").c_str(), ddw->getCount(WSrcDeck::UNFILTERED_UNIQUE));
        detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));

        if (many)
        {
            sprintf(buf, _("Most Duplicates: %i (%s)").c_str(), dupes, many->data->getName().c_str());
            detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));
        }
        if (setid >= 0)
        {
            sprintf(buf, _("Favorite Set: %s").c_str(), setlist[setid].c_str());
            detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));
        }
        if (costly)
        {
            sprintf(buf, _("Highest Mana Cost: %i (%s)").c_str(), costly->data->getManaCost()->getConvertedCost(),
                            costly->data->getName().c_str());
            detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));
        }
        if (strong)
        {
            sprintf(buf, _("Most Powerful: %i (%s)").c_str(), strong->data->getPower(), strong->data->getName().c_str());
            detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));
        }
        if (tough)
        {
            sprintf(buf, _("Toughest: %i (%s)").c_str(), tough->data->getToughness(), strong->data->getName().c_str());
            detailview->Add(NEW WGuiItem(buf, WGuiItem::NO_TRANSLATE));
        }
    }

    SAFE_DELETE(ddw->parent);
    SAFE_DELETE(ddw);
    return true;
}