1
0
Fork 0

Player: added export feature to a given SharedPreferences file

This commit is contained in:
kauron 2015-07-19 13:15:56 +02:00
parent 172d969370
commit 1e6135eb2b

View file

@ -247,4 +247,23 @@ class Player implements Serializable {
}
//TODO: here implement action points!
}
void saveToPreferences(SharedPreferences s) {
s.edit().clear().commit();
SharedPreferences.Editor e = s.edit();
e.putString(NAME, name);
e.putInt(XP, xp);
e.putInt(RACE, raceInt);
e.putInt(CLASS, classInt);
e.putInt("fue", atk[STR]);
e.putInt("con", atk[CON]);
e.putInt("des", atk[DEX]);
e.putInt("int", atk[INT]);
e.putInt("sab", atk[WIS]);
e.putInt("car", atk[CHA]);
//TODO: defenses (add armor and other bonuses)
e.putInt("pg", hp);
e.putInt("curativeEfforts", surges);
e.commit();
}
}