mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-07 01:04:25 +03:00
Save/load buttons
Save is broken now. Reasons unknown.
This commit is contained in:
parent
29fe51b179
commit
0b5c241cd3
|
@ -45,10 +45,11 @@
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">System</a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">System</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<span class="dropdown-item disabled" id="save">Save</span>
|
<a class="dropdown-item disabled" id="save" href="#">Save</a>
|
||||||
<span class="dropdown-item" id="erase">Restart</span>
|
<a class="dropdown-item disabled" id="load" href="#">Load</a>
|
||||||
|
<a class="dropdown-item disabled" id="erase" href="#">Restart</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<span class="dropdown-item disabled" id="undo">Undo (non-fuctioning)</span>
|
<a class="dropdown-item disabled" id="undo" href="#">Undo (non-fuctioning)</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -10,4 +10,8 @@ $(document).ready(() ->
|
||||||
$("#inventory").on("click", "a", (event) ->
|
$("#inventory").on("click", "a", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
)
|
)
|
||||||
|
$("#load").on("click", "a", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
window.location.reload()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1395,6 +1395,7 @@ var processLink = function(code) {
|
||||||
|
|
||||||
// We're able to save, if we weren't already.
|
// We're able to save, if we weren't already.
|
||||||
$("#save").attr('disabled', false);
|
$("#save").attr('disabled', false);
|
||||||
|
$("#save").removeClass('disabled');
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This gets called to actually do the work of processing a code.
|
/* This gets called to actually do the work of processing a code.
|
||||||
|
@ -1620,7 +1621,10 @@ var saveGame = function() {
|
||||||
|
|
||||||
// Switch the button highlights.
|
// Switch the button highlights.
|
||||||
$("#erase").attr('disabled', false);
|
$("#erase").attr('disabled', false);
|
||||||
|
$("#erase").removeClass('disabled');
|
||||||
|
$("#load").removeClass('disabled');
|
||||||
$("#save").attr('disabled', true);
|
$("#save").attr('disabled', true);
|
||||||
|
$("#save").addClass('disabled');
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Loads the game from the given data */
|
/* Loads the game from the given data */
|
||||||
|
@ -1632,6 +1636,7 @@ var loadGame = function(characterData) {
|
||||||
|
|
||||||
// Empty the display
|
// Empty the display
|
||||||
$("#content").empty();
|
$("#content").empty();
|
||||||
|
$("#intro").empty();
|
||||||
showQualities();
|
showQualities();
|
||||||
|
|
||||||
// Now play through the actions so far:
|
// Now play through the actions so far:
|
||||||
|
@ -1671,6 +1676,7 @@ var begin = function () {
|
||||||
var save = $("#save").click(saveGame);
|
var save = $("#save").click(saveGame);
|
||||||
|
|
||||||
var storedCharacter = localStorage[getSaveId()];
|
var storedCharacter = localStorage[getSaveId()];
|
||||||
|
console.log(storedCharacter)
|
||||||
if (storedCharacter) {
|
if (storedCharacter) {
|
||||||
try {
|
try {
|
||||||
loadGame(JSON.parse(storedCharacter));
|
loadGame(JSON.parse(storedCharacter));
|
||||||
|
|
Loading…
Reference in a new issue