Fixing save/load
This commit is contained in:
parent
372040caf2
commit
b403c3efdd
|
@ -1,19 +0,0 @@
|
||||||
- I looked at Monsieur Fogg
|
|
||||||
* ... and I could contain myself no longer.<st>Continues the story.</st>
|
|
||||||
'What is the purpose of our journey, Monsieur?'
|
|
||||||
'A wager,' he replied.
|
|
||||||
* * 'A wager!'[] I returned.
|
|
||||||
He nodded.
|
|
||||||
* * * 'But surely that is foolishness!'
|
|
||||||
* * * 'A most serious matter then!'
|
|
||||||
- - - He nodded again.
|
|
||||||
* * * 'But can we win?'
|
|
||||||
'That is what we will endeavour to find out,' he answered.
|
|
||||||
* * * 'A modest wager, I trust?'
|
|
||||||
'Twenty thousand pounds,' he replied, quite flatly.
|
|
||||||
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
|
|
||||||
* * 'Ah[.'],' I replied, uncertain what I thought.
|
|
||||||
- - After that, <>
|
|
||||||
* ... but I said nothing<st>Ends the story</st>[] and <>
|
|
||||||
- we passed the day in silence.
|
|
||||||
- -> END
|
|
14
game/game.ink
Normal file
14
game/game.ink
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Интересное дело: когда друзья просят меня о помощи, я готов им помочь. Когда я оказываюсь заперт в хижине пятнадцатилетнего маньяка, никто не хочет поднимать трубку.
|
||||||
|
->beginning
|
||||||
|
|
||||||
|
=== beginning ===
|
||||||
|
|
||||||
|
+ [<ell>Осмотреться<st>Ссылки с символом паузы доступны всегда и не будут продвигать сюжет.</st>]
|
||||||
|
Это милая комната, ничего так.
|
||||||
|
->beginning
|
||||||
|
* Кричать[]?
|
||||||
|
Это заброшенная деревня, здесь нет людей. Ну, кроме маньяка.
|
||||||
|
Но его лучше не призывать. -> beginning
|
||||||
|
* А вообще, лучше начать историю чуть раньше…
|
||||||
|
(Пятью минутами ранее) МАНЬЯК
|
||||||
|
->END
|
26
js/script.js
26
js/script.js
|
@ -1,6 +1,6 @@
|
||||||
import jQuery from 'jquery'
|
import jQuery from 'jquery'
|
||||||
const inkjs = require('inkjs').Story;
|
const inkjs = require('inkjs').Story;
|
||||||
const entryPoint = 'game/fogg.ink.json';
|
const entryPoint = 'game/game.ink.json';
|
||||||
|
|
||||||
let continueToNextChoice, displayText, loadGame, saveChoice, s;
|
let continueToNextChoice, displayText, loadGame, saveChoice, s;
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ continueToNextChoice = function(s) {
|
||||||
choice = ref[j];
|
choice = ref[j];
|
||||||
let text = choice.text.replace('<st>', '<span class="subtitle">');
|
let text = choice.text.replace('<st>', '<span class="subtitle">');
|
||||||
text = text.replace('</st>', '</span>')
|
text = text.replace('</st>', '</span>')
|
||||||
|
text = text.replace('<ell>', '<span class="ellipsis">⏸️ </span>');
|
||||||
jQuery("#options").append(`<li><a href='#' id='choice-${choice.index}' data-index=${choice.index}>${text}</a></li>`);
|
jQuery("#options").append(`<li><a href='#' id='choice-${choice.index}' data-index=${choice.index}>${text}</a></li>`);
|
||||||
}
|
}
|
||||||
jQuery("#options").fadeIn(500);
|
jQuery("#options").fadeIn(500);
|
||||||
|
@ -71,13 +72,26 @@ continueToNextChoice = function(s) {
|
||||||
};
|
};
|
||||||
|
|
||||||
loadGame = function(s) {
|
loadGame = function(s) {
|
||||||
let index, j, len, ref, results;
|
let index, j, ref, results;
|
||||||
ref = window.progress;
|
ref = window.progress;
|
||||||
results = [];
|
results = [];
|
||||||
for (j = 0, len = ref.length; j < len; j++) {
|
const len = ref.length;
|
||||||
index = ref[j];
|
while(s.canContinue) {
|
||||||
displayText(s, false);
|
displayText(s, false);
|
||||||
results.push(s.ChooseChoiceIndex(index));
|
}
|
||||||
|
for (j = 0; j < len; j++) {
|
||||||
|
index = ref[j];
|
||||||
|
if (!index) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (!s.currentChoices[index]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
displayText(s, false);
|
||||||
|
s.ChooseChoiceIndex(index)
|
||||||
|
while(s.canContinue) {
|
||||||
|
displayText(s, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
@ -114,7 +128,7 @@ jQuery(document).on('click', "#options li a", function() {
|
||||||
});
|
});
|
||||||
jQuery(document).on('click', "#options li", function() {
|
jQuery(document).on('click', "#options li", function() {
|
||||||
s.ChooseChoiceIndex(jQuery(this).find('a').data("index"));
|
s.ChooseChoiceIndex(jQuery(this).find('a').data("index"));
|
||||||
saveChoice(jQuery(this).data("index"));
|
saveChoice(jQuery(this).find('a').data("index"));
|
||||||
continueToNextChoice(s);
|
continueToNextChoice(s);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ module.exports = {
|
||||||
onBeforeRun: [
|
onBeforeRun: [
|
||||||
{
|
{
|
||||||
cmd: "inklecate",
|
cmd: "inklecate",
|
||||||
args: ["game/fogg.ink"],
|
args: ["game/game.ink"],
|
||||||
options: {
|
options: {
|
||||||
cwd: process.cwd()
|
cwd: process.cwd()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue