mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-04 07:45:03 +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">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">System</a>
|
||||
<div class="dropdown-menu">
|
||||
<span class="dropdown-item disabled" id="save">Save</span>
|
||||
<span class="dropdown-item" id="erase">Restart</span>
|
||||
<a class="dropdown-item disabled" id="save" href="#">Save</a>
|
||||
<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>
|
||||
<span class="dropdown-item disabled" id="undo">Undo (non-fuctioning)</span>
|
||||
<a class="dropdown-item disabled" id="undo" href="#">Undo (non-fuctioning)</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -10,4 +10,8 @@ $(document).ready(() ->
|
|||
$("#inventory").on("click", "a", (event) ->
|
||||
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.
|
||||
$("#save").attr('disabled', false);
|
||||
$("#save").removeClass('disabled');
|
||||
};
|
||||
|
||||
/* This gets called to actually do the work of processing a code.
|
||||
|
@ -1620,7 +1621,10 @@ var saveGame = function() {
|
|||
|
||||
// Switch the button highlights.
|
||||
$("#erase").attr('disabled', false);
|
||||
$("#erase").removeClass('disabled');
|
||||
$("#load").removeClass('disabled');
|
||||
$("#save").attr('disabled', true);
|
||||
$("#save").addClass('disabled');
|
||||
};
|
||||
|
||||
/* Loads the game from the given data */
|
||||
|
@ -1632,6 +1636,7 @@ var loadGame = function(characterData) {
|
|||
|
||||
// Empty the display
|
||||
$("#content").empty();
|
||||
$("#intro").empty();
|
||||
showQualities();
|
||||
|
||||
// Now play through the actions so far:
|
||||
|
@ -1671,6 +1676,7 @@ var begin = function () {
|
|||
var save = $("#save").click(saveGame);
|
||||
|
||||
var storedCharacter = localStorage[getSaveId()];
|
||||
console.log(storedCharacter)
|
||||
if (storedCharacter) {
|
||||
try {
|
||||
loadGame(JSON.parse(storedCharacter));
|
||||
|
|
Loading…
Reference in a new issue