diff --git a/Gulpfile.coffee b/Gulpfile.coffee index a0f310e..57fd7c1 100644 --- a/Gulpfile.coffee +++ b/Gulpfile.coffee @@ -44,7 +44,8 @@ gulp.task('sass', () -> ) gulp.task('concatCoffee', () -> - fs.mkdir('./build/game/translations') + if !fs.existsSync('./build/game/translations') + fs.mkdirSync('./build/game/translations') for language in ['ru', 'en'] data = CSON.parseCSONFile('game/translations/'+language+'.cson') json = JSON.stringify(data) + '\n' @@ -105,7 +106,8 @@ gulp.task('sass-dist', () -> ) gulp.task('coffee-dist', ['concatCoffee'], () -> - fs.mkdir('./dist/game/translations') + if !fs.existsSync('./dist/game/translations') + fs.mkdirSync('./dist/game/translations') for language in ['ru', 'en'] data = CSON.parseCSONFile('game/translations/'+language+'.cson') json = JSON.stringify(data) + '\n' diff --git a/game/begin.coffee b/game/begin.coffee index 331f5ee..323815c 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -1,13 +1,6 @@ salet.game_id = "being-astrid-is-hard-enough-but-try-living-as-one" salet.game_version = "1.0" client = deepstream('localhost:6020').login() -client.record.listen('presence.*', (match, isSubscribed, response) => - if (isSubscribed) - response.accept() - else - # stop publishing data, client disconnected - client.record.getRecord(match).discard() -) $.holdReady( true ) $.getJSON('game/translations/'+i18n.lang+'.json', (data) -> @@ -44,6 +37,12 @@ $(document).ready(() -> salet.beginGame() ) +salet.initGame = () -> + names = "names".l() + salet.character.name = names[salet.rnd.randomInt(names.length)] + salet.character.id = salet.rnd.randn() + button.color = salet.rnd.randomInt(button.colors.length) + ### Element helpers. There is no real need to build monsters like a().id("hello") because you won't use them as is. It does not make sense in context, the @@ -59,44 +58,37 @@ actlink = (content, ref) -> # The first room of the game. # For accessibility reasons the text is provided in HTML, not here. room "start", - enter: () -> - if (salet.character.name == undefined) - names = "names".l() - salet.character.name = names[salet.rnd.randomInt(names.length)] - salet.character.id = salet.rnd.randn() dsc: () -> "intro".l() choices: "#start" button = unit "button", colors: ["red", "blue", "green", "yellow", "orange", "violet"] color: 0 - dsc: () -> "{"+"color_"+@colors[@color].l()+"}" + dsc: () -> "