mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
added values
This commit is contained in:
parent
4b042aa153
commit
70bb918872
@ -175,12 +175,15 @@
|
||||
"vcmi.statisticWindow.title.numberOfArtifacts" : "No. of artifacts",
|
||||
"vcmi.statisticWindow.title.numberOfDwellings" : "No. of dwellings",
|
||||
"vcmi.statisticWindow.title.numberOfMines" : "No. of mines",
|
||||
"vcmi.statisticWindow.title.armyStrength" : "army strength",
|
||||
"vcmi.statisticWindow.title.experience" : "experience",
|
||||
"vcmi.statisticWindow.title.resourcesSpentArmy" : "army costs",
|
||||
"vcmi.statisticWindow.title.resourcesSpentBuildings" : "building costs",
|
||||
"vcmi.statisticWindow.title.mapExplored" : "map explored ratio",
|
||||
"vcmi.statisticWindow.title.armyStrength" : "Army strength",
|
||||
"vcmi.statisticWindow.title.experience" : "Experience",
|
||||
"vcmi.statisticWindow.title.resourcesSpentArmy" : "Army costs",
|
||||
"vcmi.statisticWindow.title.resourcesSpentBuildings" : "Building costs",
|
||||
"vcmi.statisticWindow.title.mapExplored" : "Map explore ratio",
|
||||
"vcmi.statisticWindow.param.daysSurvived" : "Days survived",
|
||||
"vcmi.statisticWindow.param.maxHeroLevel" : "Max hero level",
|
||||
"vcmi.statisticWindow.param.battleWinRatioHero" : "Win ratio (hero)",
|
||||
"vcmi.statisticWindow.param.battleWinRatioNeutral" : "Win ratio (neutral)",
|
||||
|
||||
"vcmi.systemOptions.fullscreenBorderless.hover" : "Fullscreen (borderless)",
|
||||
"vcmi.systemOptions.fullscreenBorderless.help" : "{Borderless Fullscreen}\n\nIf selected, VCMI will run in borderless fullscreen mode. In this mode, game will always use same resolution as desktop, ignoring selected resolution.",
|
||||
|
@ -181,6 +181,9 @@
|
||||
"vcmi.statisticWindow.title.resourcesSpentBuildings" : "Gebäudekosten",
|
||||
"vcmi.statisticWindow.title.mapExplored" : "Maperkundungsrate",
|
||||
"vcmi.statisticWindow.param.daysSurvived" : "Tage überlebt",
|
||||
"vcmi.statisticWindow.param.maxHeroLevel" : "Max Heldenlevel",
|
||||
"vcmi.statisticWindow.param.battleWinRatioHero" : "Sieg Verh. (Helden)",
|
||||
"vcmi.statisticWindow.param.battleWinRatioNeutral" : "Sieg Verh. (Neutral)",
|
||||
|
||||
"vcmi.systemOptions.fullscreenBorderless.hover" : "Vollbild (randlos)",
|
||||
"vcmi.systemOptions.fullscreenBorderless.help" : "{Randloses Vollbild}\n\nWenn diese Option ausgewählt ist, wird VCMI im randlosen Vollbildmodus ausgeführt. In diesem Modus wird das Spiel immer dieselbe Auflösung wie der Desktop verwenden und die gewählte Auflösung ignorieren.",
|
||||
|
@ -43,7 +43,7 @@ CStatisticScreen::CStatisticScreen(StatisticDataSet stat)
|
||||
contentArea = Rect(10, 40, 780, 510);
|
||||
layout.push_back(std::make_shared<CLabel>(400, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.statisticWindow.statistic")));
|
||||
layout.push_back(std::make_shared<TransparentFilledRectangle>(contentArea, ColorRGBA(0, 0, 0, 64), ColorRGBA(64, 80, 128, 255), 1));
|
||||
layout.push_back(std::make_shared<CButton>(Point(725, 564), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT));
|
||||
layout.push_back(std::make_shared<CButton>(Point(725, 558), AnimationPath::builtin("MUBCHCK"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_ACCEPT));
|
||||
|
||||
buttonSelect = std::make_shared<CToggleButton>(Point(10, 564), AnimationPath::builtin("GSPBUT2"), CButton::tooltip(), [this](bool on){
|
||||
std::vector<std::string> texts;
|
||||
@ -200,8 +200,8 @@ void StatisticSelector::update(int to)
|
||||
}
|
||||
}
|
||||
|
||||
OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet data)
|
||||
: CIntObject()
|
||||
OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet stat)
|
||||
: CIntObject(), data(stat)
|
||||
{
|
||||
OBJECT_CONSTRUCTION;
|
||||
|
||||
@ -211,20 +211,39 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet
|
||||
|
||||
canvas = std::make_shared<GraphicalPrimitiveCanvas>(Rect(0, Y_OFFS, pos.w - 16, pos.h - Y_OFFS));
|
||||
|
||||
auto playerDataFilter = [data](PlayerColor color){
|
||||
std::vector<StatisticDataSetEntry> tmpData;
|
||||
std::copy_if(data.data.begin(), data.data.end(), std::back_inserter(tmpData), [color](StatisticDataSetEntry e){return e.player == color;} );
|
||||
return tmpData;
|
||||
};
|
||||
|
||||
dataExtract = {
|
||||
{
|
||||
CGI->generaltexth->translate("vcmi.statisticWindow.param.daysSurvived1"), [playerDataFilter](PlayerColor color){
|
||||
return playerDataFilter(color).size() ? std::to_string(playerDataFilter(color).size()) : "";
|
||||
CGI->generaltexth->translate("vcmi.statisticWindow.param.daysSurvived"), [this](PlayerColor color){
|
||||
return std::to_string(playerDataFilter(color).size());
|
||||
}
|
||||
},
|
||||
{
|
||||
CGI->generaltexth->translate("vcmi.statisticWindow.param.maxHeroLevel"), [this](PlayerColor color){
|
||||
int maxLevel = 0;
|
||||
for(auto val : playerDataFilter(color))
|
||||
if(maxLevel < val.maxHeroLevel)
|
||||
maxLevel = val.maxHeroLevel;
|
||||
return std::to_string(maxLevel);
|
||||
}
|
||||
},
|
||||
{
|
||||
CGI->generaltexth->translate("vcmi.statisticWindow.param.battleWinRatioHero"), [this](PlayerColor color){
|
||||
auto val = playerDataFilter(color).back();
|
||||
if(!val.numBattlesPlayer)
|
||||
return std::string("");
|
||||
float tmp = ((float)val.numWinBattlesPlayer / (float)val.numBattlesPlayer) * 100;
|
||||
return std::to_string((int)tmp) + " %";
|
||||
}
|
||||
},
|
||||
{
|
||||
CGI->generaltexth->translate("vcmi.statisticWindow.param.battleWinRatioNeutral"), [this](PlayerColor color){
|
||||
auto val = playerDataFilter(color).back();
|
||||
if(!val.numBattlesPlayer)
|
||||
return std::string("");
|
||||
float tmp = ((float)val.numWinBattlesNeutral / (float)val.numBattlesNeutral) * 100;
|
||||
return std::to_string((int)tmp) + " %";
|
||||
}
|
||||
},
|
||||
|
||||
//kill dead ratio (numBattles / numWinBattles)
|
||||
};
|
||||
|
||||
int usedLines = dataExtract.size();
|
||||
@ -247,6 +266,13 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, StatisticDataSet
|
||||
update(0);
|
||||
}
|
||||
|
||||
std::vector<StatisticDataSetEntry> OverviewPanel::playerDataFilter(PlayerColor color)
|
||||
{
|
||||
std::vector<StatisticDataSetEntry> tmpData;
|
||||
std::copy_if(data.data.begin(), data.data.end(), std::back_inserter(tmpData), [color](StatisticDataSetEntry e){ return e.player == color; });
|
||||
return tmpData;
|
||||
}
|
||||
|
||||
void OverviewPanel::update(int to)
|
||||
{
|
||||
OBJECT_CONSTRUCTION;
|
||||
@ -263,7 +289,9 @@ void OverviewPanel::update(int to)
|
||||
content.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("ITGFLAGS"), x, 0, 180 + x * fieldSize.x, 35));
|
||||
int xStart = (x + (x == 0 ? 0 : 1)) * fieldSize.x + (x == 0 ? fieldSize.x : (fieldSize.x / 2));
|
||||
int yStart = Y_OFFS + (y + 1 - to) * fieldSize.y + (fieldSize.y / 2);
|
||||
content.push_back(std::make_shared<CLabel>(xStart, yStart, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (x == 0 ? dataExtract[y].first : dataExtract[y].second(PlayerColor(x - 1))), x == 0 ? (fieldSize.x * 2) : fieldSize.x));
|
||||
PlayerColor tmpColor(x - 1);
|
||||
if(playerDataFilter(tmpColor).size() || x == 0)
|
||||
content.push_back(std::make_shared<CLabel>(xStart, yStart, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (x == 0 ? dataExtract[y].first : dataExtract[y].second(tmpColor)), x == 0 ? (fieldSize.x * 2) : fieldSize.x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,15 +90,17 @@ class OverviewPanel : public CIntObject
|
||||
std::shared_ptr<CSlider> slider;
|
||||
|
||||
Point fieldSize;
|
||||
StatisticDataSet data;
|
||||
|
||||
std::vector<std::pair<std::string, std::function<std::string(PlayerColor color)>>> dataExtract;
|
||||
|
||||
const int LINES = 15;
|
||||
const int Y_OFFS = 30;
|
||||
|
||||
std::vector<StatisticDataSetEntry> playerDataFilter(PlayerColor color);
|
||||
void update(int to);
|
||||
public:
|
||||
OverviewPanel(Rect position, std::string title, StatisticDataSet data);
|
||||
OverviewPanel(Rect position, std::string title, StatisticDataSet stat);
|
||||
};
|
||||
|
||||
class LineChart : public CIntObject
|
||||
|
Loading…
x
Reference in New Issue
Block a user