Added Manual Save
This commit is contained in:
parent
aa02d23405
commit
6c04ac3df9
|
|
@ -53,6 +53,7 @@
|
|||
??? Dollar
|
||||
</span>
|
||||
<span style="position: fixed;color: white" id="speed"></span>
|
||||
<div style="margin-left: 250px"><textarea id="textarea"></textarea><button id="save">save</button><button id="load">load</button></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
19
js/game.js
19
js/game.js
|
|
@ -23,10 +23,13 @@ var mode = "none"
|
|||
var renderItems = true
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#speed").click(function() {
|
||||
$("#save").click(function() {
|
||||
save()
|
||||
$("#speed").fadeOut("fast")
|
||||
$("#speed").fadeIn("fast")
|
||||
$("#textarea").text(JSON.stringify(game))
|
||||
})
|
||||
$("#load").click(function() {
|
||||
game = JSON.parse($("#textarea").val())
|
||||
loadGameData()
|
||||
})
|
||||
loadGameData()
|
||||
loadItems()
|
||||
|
|
@ -35,10 +38,10 @@ $(document).ready(function() {
|
|||
requestAnimationFrame(loop)
|
||||
})
|
||||
|
||||
var game = {}
|
||||
var game = 0
|
||||
|
||||
$(window).on("beforeunload", function() {
|
||||
save()
|
||||
//save()
|
||||
})
|
||||
|
||||
function save() {
|
||||
|
|
@ -84,9 +87,9 @@ function loadGameData() {
|
|||
//Keine Save Vorhanden
|
||||
factorys.push(new Factory())
|
||||
inventory = new Inventory()
|
||||
game = Cookies.get("game")
|
||||
if (game != undefined) {
|
||||
game = JSON.parse(game)
|
||||
//game = Cookies.get("game")
|
||||
if (game != 0) {
|
||||
//game = JSON.parse(game)
|
||||
money = game.money
|
||||
inventory = new Inventory()
|
||||
factorys = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue