";
} else {
const auto route = id.substr(4);
const std::array colors = {
"#3d789b", "#375a83", "#477c73", "#42846b", "#a58a49", "#586ba0",
"#517d71", "#668a98", "#af6860", "#6b809c", "#657cb3", "#507b9c",
"#559b76", "#a7474e", "#967d50", "#648f91", "#54856b", "#558f93",
"#6379a3", "#788598", "#8d7856", "#a66d64", "#748474", "#6887a2",
"#6b9270", "#7c8b9c", "#ac8b52", "#7783a4", "#648f83", "#927d9d",
"#ac5e63", "#806c98"};
const auto i = std::find(routes.begin(), routes.end(), route);
const auto color = colors[size_t(i - routes.begin())];
const auto top = theme_ == "matchday" ? mixed_color(color, "#27282e", .55)
: mixed_color(color, "#c5ddf1", .1);
const auto bottom =
theme_ == "matchday" ? "#272a30" : mixed_color(color, "#07111e", .38);
out += "";
}
}
return out + "
";
}
std::string App::render_camp() {
const auto index_file =
Json::parse(editor::read_file(gui_.root() / "gui-assets.json"));
const auto demo = index_file.at("demo"), camps = demo.at("training_camps");
const auto s = snap();
const auto id = s.state.at("camp").value("selected", std::string("resort:4"));
const Json *chosen = nullptr;
for (const auto &c : camps)
if (c.value("id", "") == id)
chosen = &c;
if (!chosen)
chosen = &camps.at(0);
auto region = selections_["camp-region"];
if (region.empty())
region = chosen->value("map", "map:eu");
std::string body = "
";
for (const auto &m : demo.at("maps"))
body += btn("camp-region", esc(m.value("name", "")),
m.value("id", "") == region ? "primary" : "",
"data-id=\"" + esc(m.value("id", "")) + "\"");
body += "
" +
img("map." + region.substr(4), 1440, 1603.2, false, false, 1600);
for (const auto &c : camps)
if (c.value("map", "") == region) {
const double x = c.value("x", 0) * 1.2, y = c.value("y", 0) * 1.2;
body += btn("camp-select",
"",
c.value("id", "") == id ? "primary" : "",
"data-id=\"" + esc(c.value("id", "")) +
"\" style=\"position:absolute;" +
rect(x - 34, y - 34, 68, 68) +
"padding:23dp;border-radius:34dp;\"");
}
body += "
";
const std::array focus = {"Kondition", "Technik", "Spiel",
"Erholung"};
const auto values = s.state.at("camp").at("focus");
int sum = 0;
for (const auto &v : values)
sum += v.get();
for (int i = 0; i < 4; ++i) {
const int value = i == 3 ? 15 - sum / 3 : values[size_t(i)].get();
body += "