GUI: Add Statistics dialog to game options
This commit is contained in:
parent
ebf6c3973a
commit
3ea4faeab7
4 changed files with 43 additions and 2 deletions
|
@ -331,13 +331,17 @@ ConfigDialog::ConfigDialog() :
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Achievements tab
|
// The Achievements & The Statistics tabs
|
||||||
//
|
//
|
||||||
Common::AchievementsInfo achievementsInfo = metaEngine->getAchievementsInfo(gameDomain);
|
Common::AchievementsInfo achievementsInfo = metaEngine->getAchievementsInfo(gameDomain);
|
||||||
if (achievementsInfo.descriptions.size() > 0) {
|
if (achievementsInfo.descriptions.size() > 0) {
|
||||||
tab->addTab(_("Achievements"), "GlobalConfig_Achievements");
|
tab->addTab(_("Achievements"), "GlobalConfig_Achievements");
|
||||||
addAchievementsControls(tab, "GlobalConfig_Achievements.", achievementsInfo);
|
addAchievementsControls(tab, "GlobalConfig_Achievements.", achievementsInfo);
|
||||||
}
|
}
|
||||||
|
if (achievementsInfo.stats.size() > 0) {
|
||||||
|
tab->addTab(_("Statistics"), "GameOptions_Achievements");
|
||||||
|
addStatisticsControls(tab, "GameOptions_Achievements.", achievementsInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// Activate the first tab
|
// Activate the first tab
|
||||||
tab->setActiveTab(0);
|
tab->setActiveTab(0);
|
||||||
|
|
|
@ -361,7 +361,7 @@ EditGameDialog::EditGameDialog(const String &domain)
|
||||||
_savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
|
_savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
|
||||||
|
|
||||||
//
|
//
|
||||||
// 9) The Achievements tab
|
// 9) The Achievements & The Statistics tabs
|
||||||
//
|
//
|
||||||
if (enginePlugin) {
|
if (enginePlugin) {
|
||||||
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||||
|
@ -370,6 +370,10 @@ EditGameDialog::EditGameDialog(const String &domain)
|
||||||
tab->addTab(_("Achievements"), "GameOptions_Achievements");
|
tab->addTab(_("Achievements"), "GameOptions_Achievements");
|
||||||
addAchievementsControls(tab, "GameOptions_Achievements.", achievementsInfo);
|
addAchievementsControls(tab, "GameOptions_Achievements.", achievementsInfo);
|
||||||
}
|
}
|
||||||
|
if (achievementsInfo.stats.size() > 0) {
|
||||||
|
tab->addTab(_("Statistics"), "GameOptions_Achievements");
|
||||||
|
addStatisticsControls(tab, "GameOptions_Achievements.", achievementsInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate the first tab
|
// Activate the first tab
|
||||||
|
|
|
@ -1261,6 +1261,38 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::addStatisticsControls(GuiObject *boss, const Common::String &prefix, const Common::AchievementsInfo &info) {
|
||||||
|
Common::String achDomainId = ConfMan.get("achievements", _domain);
|
||||||
|
AchMan.setActiveDomain(info);
|
||||||
|
|
||||||
|
GUI::ScrollContainerWidget *scrollContainer;
|
||||||
|
scrollContainer = new GUI::ScrollContainerWidget(boss, prefix + "Container", "");
|
||||||
|
scrollContainer->setBackgroundType(GUI::ThemeEngine::kWidgetBackgroundNo);
|
||||||
|
|
||||||
|
uint16 nMax = info.stats.size();
|
||||||
|
|
||||||
|
uint16 lineHeight = g_gui.xmlEval()->getVar("Globals.Line.Height");
|
||||||
|
uint16 yStep = lineHeight;
|
||||||
|
uint16 ySmallStep = yStep/3;
|
||||||
|
uint16 yPos = lineHeight;
|
||||||
|
uint16 width = g_system->getOverlayWidth() <= 320 ? 240 : 410;
|
||||||
|
|
||||||
|
for (uint16 idx = 0; idx < nMax ; idx++) {
|
||||||
|
Common::String key = info.stats[idx].id;
|
||||||
|
if (info.stats[idx].comment) {
|
||||||
|
key = info.stats[idx].comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::String value = AchMan.getStatRaw(info.stats[idx].id);
|
||||||
|
|
||||||
|
Common::U32String str = Common::U32String::format(_("%s: %s"), key.c_str(), value.c_str());
|
||||||
|
new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, str, Graphics::kTextAlignStart);
|
||||||
|
|
||||||
|
yPos += yStep;
|
||||||
|
yPos += ySmallStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::addShaderControls(GuiObject *boss, const Common::String &prefix) {
|
void OptionsDialog::addShaderControls(GuiObject *boss, const Common::String &prefix) {
|
||||||
Common::String context;
|
Common::String context;
|
||||||
if (g_system->getOverlayWidth() <= 320)
|
if (g_system->getOverlayWidth() <= 320)
|
||||||
|
|
|
@ -92,6 +92,7 @@ protected:
|
||||||
void addControlControls(GuiObject *boss, const Common::String &prefix);
|
void addControlControls(GuiObject *boss, const Common::String &prefix);
|
||||||
void addKeyMapperControls(GuiObject *boss, const Common::String &prefix, const Common::Array<Common::Keymap *> &keymaps, const Common::String &domain);
|
void addKeyMapperControls(GuiObject *boss, const Common::String &prefix, const Common::Array<Common::Keymap *> &keymaps, const Common::String &domain);
|
||||||
void addAchievementsControls(GuiObject *boss, const Common::String &prefix, const Common::AchievementsInfo &info);
|
void addAchievementsControls(GuiObject *boss, const Common::String &prefix, const Common::AchievementsInfo &info);
|
||||||
|
void addStatisticsControls(GuiObject *boss, const Common::String &prefix, const Common::AchievementsInfo &info);
|
||||||
void addGraphicControls(GuiObject *boss, const Common::String &prefix);
|
void addGraphicControls(GuiObject *boss, const Common::String &prefix);
|
||||||
void addShaderControls(GuiObject *boss, const Common::String &prefix);
|
void addShaderControls(GuiObject *boss, const Common::String &prefix);
|
||||||
void addAudioControls(GuiObject *boss, const Common::String &prefix);
|
void addAudioControls(GuiObject *boss, const Common::String &prefix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue