Expand import dialog to a textarea

This commit is contained in:
Michael
2014-05-19 11:48:40 -04:00
parent a925349a13
commit 2ca0a7a948
2 changed files with 60 additions and 44 deletions
+19 -4
View File
@@ -231,14 +231,29 @@ var Engine = {
buttons: { buttons: {
'yes': { 'yes': {
text: 'yes', text: 'yes',
nextScene: 'end', nextScene: {1: 'inputImport'},
onChoose: Engine.import64 onChoose: Engine.enableSelection
}, },
'no': { 'no': {
text: 'no', text: 'no',
nextScene: 'end' nextScene: 'end'
} }
} }
},
'inputImport': {
text: ['put the save code here.'],
textarea: '',
buttons: {
'okay': {
text: 'okay',
nextScene: 'end',
onChoose: Engine.import64
},
'cancel': {
text: 'cancel',
nextScene: 'end'
}
}
} }
} }
}); });
@@ -269,8 +284,8 @@ var Engine = {
}); });
}, },
import64: function() { import64: function(string64) {
var string64 = prompt("put the save code here.",""); Engine.disableSelection();
string64 = string64.replace(/\s/g, ''); string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, ''); string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, ''); string64 = string64.replace(/\n/g, '');
+3 -2
View File
@@ -611,7 +611,7 @@ var Events = {
$('<div>').text(scene.text[i]).appendTo(desc); $('<div>').text(scene.text[i]).appendTo(desc);
} }
if(scene.textarea) { if(scene.textarea != null) {
$('<textarea>').val(scene.textarea).appendTo(desc); $('<textarea>').val(scene.textarea).appendTo(desc);
} }
@@ -690,7 +690,8 @@ var Events = {
} }
if(typeof info.onChoose == 'function') { if(typeof info.onChoose == 'function') {
info.onChoose(); var textarea = Events.eventPanel().find('textarea');
info.onChoose(textarea.length > 0 ? textarea.val() : null);
} }
// Reward // Reward