Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var key = "AWESOME-TANKS-2";
- function getLS() {
- if (localStorage.gameState) {
- return JSON.parse(localStorage.getItem(key));
- } else {
- return false;
- }
- }
- function setLS(input) {
- try {
- localStorage.setItem(key, JSON.stringify(input));
- refreshGame();
- } catch {
- console.warn("Unable to set localStorage!");
- }
- }
- function clearLS() {
- try {
- localStorage.removeItem(key);
- refreshGame();
- return true;
- } catch {
- return false;
- }
- }
- function refreshGame() {
- cmg_remove_padg();
- }
- //
- function setMoney(val) {
- var t = getLS();
- t.game.money = val;
- setLS(t);
- }
Add Comment
Please, Sign In to add comment