Load state menu
This commit is contained in:
parent
5e920f760d
commit
d5ceb0afec
@ -12,6 +12,7 @@ function run(data) {
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if ( (typeof rpyscript === 'undefined') || TextUtils.isEmpty(rpyscript)) {
|
if ( (typeof rpyscript === 'undefined') || TextUtils.isEmpty(rpyscript)) {
|
||||||
|
rpyscript = "undefined";
|
||||||
run('play music music_list["everlasting_summer"]\n' +
|
run('play music music_list["everlasting_summer"]\n' +
|
||||||
'scene bg ext_square_day\n' +
|
'scene bg ext_square_day\n' +
|
||||||
'show mz smile pioneer far at fright\n' +
|
'show mz smile pioneer far at fright\n' +
|
||||||
|
@ -387,6 +387,13 @@ Views.prototype.showMainMenu = function () {
|
|||||||
$('#menu').hide();
|
$('#menu').hide();
|
||||||
views.saveState();
|
views.saveState();
|
||||||
});
|
});
|
||||||
|
var saves = JSON.parse(localStorage.saves || null) || {};
|
||||||
|
saves[rpyscript] = saves[rpyscript] || [];
|
||||||
|
if (saves[rpyscript].length > 0) {
|
||||||
|
this.addMainMenuItem("Загрузить…", function() {
|
||||||
|
views.showLoadStateMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
this.addMainMenuItem("Закрыть", function() {
|
this.addMainMenuItem("Закрыть", function() {
|
||||||
$('#menu').hide();
|
$('#menu').hide();
|
||||||
});
|
});
|
||||||
@ -573,3 +580,32 @@ Views.prototype.createSave = function () {
|
|||||||
save.backgroundName = this.backgroundName;
|
save.backgroundName = this.backgroundName;
|
||||||
return save;
|
return save;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Views.prototype.showLoadStateMenu = function () {
|
||||||
|
var saves = JSON.parse(localStorage.saves || null) || {};
|
||||||
|
var items = saves[rpyscript] || [];
|
||||||
|
|
||||||
|
$('#menuTitle').text('Загрузить');
|
||||||
|
$('#menuChoose').empty();
|
||||||
|
this.addMainMenuItem("Закрыть", function() {
|
||||||
|
$('#menu').hide();
|
||||||
|
});
|
||||||
|
for(var i = items.length - 1; i >= 0; i--) {
|
||||||
|
var li = $('<li>', {text: items[i].time});
|
||||||
|
li.click(this.createLoadStateClickFunction(i, items[i]));
|
||||||
|
li.appendTo($('#menuChoose'));
|
||||||
|
}
|
||||||
|
$('#menu').show();
|
||||||
|
};
|
||||||
|
Views.prototype.createLoadStateClickFunction = function (index, save) {
|
||||||
|
var views = this;
|
||||||
|
return function () {
|
||||||
|
Variables.variables = save.variables;
|
||||||
|
views.characters.names = save.characterNames;
|
||||||
|
if (!TextUtils.isEmpty(save.backgroundName)) {
|
||||||
|
views.background(save.backgroundType, save.backgroundName, "");
|
||||||
|
}
|
||||||
|
views.parser.setPosition(save.position);
|
||||||
|
$('#menu').hide();
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user