From 4eeb9d15a1188ab8c9b99712ad451a4080d78b09 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 27 Jan 2017 19:42:42 +0700 Subject: [PATCH] WIP instances --- Gulpfile.coffee | 7 +++++++ game/begin.coffee | 31 +++++++++++++++++++++++++++++++ game/story.coffee | 7 ------- game/translations/en.cson | 2 +- game/translations/ru.cson | 16 +++++++++++++++- 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/Gulpfile.coffee b/Gulpfile.coffee index ba1dea6..a0f310e 100644 --- a/Gulpfile.coffee +++ b/Gulpfile.coffee @@ -44,6 +44,7 @@ gulp.task('sass', () -> ) gulp.task('concatCoffee', () -> + fs.mkdir('./build/game/translations') for language in ['ru', 'en'] data = CSON.parseCSONFile('game/translations/'+language+'.cson') json = JSON.stringify(data) + '\n' @@ -104,6 +105,12 @@ gulp.task('sass-dist', () -> ) gulp.task('coffee-dist', ['concatCoffee'], () -> + fs.mkdir('./dist/game/translations') + for language in ['ru', 'en'] + data = CSON.parseCSONFile('game/translations/'+language+'.cson') + json = JSON.stringify(data) + '\n' + fs.writeFileSync("./dist/game/translations/"+language+".json", json) + gulp.src('./build/game/main.coffee', {sourcemaps: false}) .pipe(coffee()) .pipe(buffer()) diff --git a/game/begin.coffee b/game/begin.coffee index ee82b09..331f5ee 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -67,6 +67,37 @@ room "start", dsc: () -> "intro".l() choices: "#start" +button = unit "button", + colors: ["red", "blue", "green", "yellow", "orange", "violet"] + color: 0 + dsc: () -> "{"+"color_"+@colors[@color].l()+"}" + act: () -> + index = @colors.indexOf(@color) + index = index + 1 + if index > @colors.length + index = 0 + @color = @colors[index] + salet.rooms["entry"].canChoose = true + +room "instance", + dsc: () -> "instance".l() + tags: ["start"] + optionText: () -> "begin_game".l() + enter: () -> + for u in @units + u.color = salet.rnd.randomInt(u.colors.length) + units: [ + button "first", + button "second" + ] + +croom "entry", + canChoose: false + optionText: () -> "entry_option".l() + title: () -> "entry_title".l() + ways: ["corridor"] + desc: () -> "entry_dsc".l() + croom = (name, options) -> options.enter = () -> if (salet.interactive) diff --git a/game/story.coffee b/game/story.coffee index 569bb0e..cbcc7d5 100644 --- a/game/story.coffee +++ b/game/story.coffee @@ -1,10 +1,3 @@ -croom "entry", - tags: ["start"], - optionText: () -> "entry_option".l() - title: () -> "entry_title".l() - ways: ["corridor"] - desc: () -> "entry_dsc".l() - croom "corridor", ways: ["entry"] title: () -> "corridor_title".l() diff --git a/game/translations/en.cson b/game/translations/en.cson index 47ce7d7..36bdb48 100644 --- a/game/translations/en.cson +++ b/game/translations/en.cson @@ -5,7 +5,7 @@ intro: """ In a dream all people are equal because they are Astrid. """ room_enter: "And then enters the " -entry_option: "Be Astrid" +begin_game: "Be Astrid" entry_title: "Guest room" entry_dsc: """ You are in a beautiful underwater guest room. diff --git a/game/translations/ru.cson b/game/translations/ru.cson index db1fbb5..7df72fd 100644 --- a/game/translations/ru.cson +++ b/game/translations/ru.cson @@ -4,11 +4,25 @@ intro: """ Астрид спит и видит себя. Во сне все люди равны, потому что все они — Астрид. """ +instance: """ + Вы стоите в круглой комнате перед круглой дверью. + + *Наберите двуцветный код мира и войдите в дверь. + В одном мире не может быть больше четырёх Астрид.* + + Рядом с дверью есть цветная кнопка. +""" +color_red: "Красная." +color_green: "Зелёная." +color_blue: "Синяя." +color_yellow: "Жёлтая." +color_orange: "Оранжевая." +color_violet: "Фиолетовая." no_local_storage: "Локальное хранилище недоступно." erase_message: "Это навсегда удалит вашего персонажа и немедленно вернёт вас на старт игры. Вы уверены?" room_enter: "В комнату входит " room_present: "В комнате стоят " -entry_option: "Быть Астрид" +begin_game: "Быть Астрид" entry_title: "Прихожая" entry_dsc: """ Вы находитесь в красивой подводной прихожей. За прозрачными стенами плавают рыбки.