Example #1
0
	void Menu::savePersonData()
	{
		Json::Value json = Json::Value::makeObject();
		json.set("persons", persons.toJson());

		Json::Value playing = Json::Value::makeArray();
		for (Size i = 0; i < listbox[CUR_PLAYERS_LIST]->size(); i++)
		{
			playing.add(Json::Value::makeString(listbox[CUR_PLAYERS_LIST]->getItem(i)));
		}
		json.set("playing", playing);

		Json::Writer writer(true);
		writer.writeToFile(D6_FILE_PHIST, json);
	}
Example #2
0
 Json::Value Person::toJson() const {
     Json::Value json = Json::Value::makeObject();
     json.set("name", Json::Value::makeString(getName()));
     json.set("shots", Json::Value::makeNumber(shots));
     json.set("hits", Json::Value::makeNumber(hits));
     json.set("kills", Json::Value::makeNumber(kills));
     json.set("deaths", Json::Value::makeNumber(deaths));
     json.set("assistances", Json::Value::makeNumber(assistances));
     json.set("wins", Json::Value::makeNumber(wins));
     json.set("penalties", Json::Value::makeNumber(penalties));
     json.set("games", Json::Value::makeNumber(games));
     json.set("timeAlive", Json::Value::makeNumber(timeAlive));
     json.set("totalGameTime", Json::Value::makeNumber(totalGameTime));
     json.set("totalDamage", Json::Value::makeNumber(totalDamage));
     json.set("assistedDamage", Json::Value::makeNumber(assistedDamage));
     json.set("elo", Json::Value::makeNumber(elo));
     json.set("eloTrend", Json::Value::makeNumber(eloTrend));
     json.set("eloGames", Json::Value::makeNumber(eloGames));
     return json;
 }