This commit is contained in:
George Saines 2014-03-15 15:12:09 -07:00
commit 417ff1e48d
33 changed files with 318 additions and 141 deletions

Binary file not shown.

After

(image error) Size: 410 KiB

Binary file not shown.

After

(image error) Size: 411 KiB

View file

@ -2,6 +2,5 @@ LevelComponent = require 'models/LevelComponent'
CocoCollection = require 'models/CocoCollection' CocoCollection = require 'models/CocoCollection'
module.exports = class ComponentsCollection extends CocoCollection module.exports = class ComponentsCollection extends CocoCollection
url: '/db/level_component/search' url: '/db/level.component/search'
model: LevelComponent model: LevelComponent

View file

@ -2,7 +2,7 @@ CocoClass = require 'lib/CocoClass'
module.exports = class LoadingScreen extends CocoClass module.exports = class LoadingScreen extends CocoClass
progress: 0 progress: 0
constructor: (canvas) -> constructor: (canvas) ->
super() super()
@width = canvas.width @width = canvas.width
@ -93,12 +93,12 @@ module.exports = class LoadingScreen extends CocoClass
@text.text = "BUILDING" if @progress is 1 @text.text = "BUILDING" if @progress is 1
@progressBar.scaleX = @progress @progressBar.scaleX = @progress
@stage.update() @stage.update()
showReady: -> showReady: ->
@text.text = 'READY' @text.text = 'READY'
@text.regX = @text.getMeasuredWidth() / 2 @text.regX = @text.getMeasuredWidth() / 2
@stage.update() @stage.update()
destroy: -> destroy: ->
@stage.canvas = null @stage.canvas = null
super() super()

View file

@ -165,7 +165,8 @@ module.exports = class Camera extends CocoClass
target = {x: newTargetX, y:newTargetY} target = {x: newTargetX, y:newTargetY}
else else
target = @target target = @target
@zoomTo target, newZoom, 0 if not(newZoom >= MAX_ZOOM or newZoom <= Math.max(@minZoom, MIN_ZOOM))
@zoomTo target, newZoom, 0
onMouseDown: (e) -> onMouseDown: (e) ->
return if @dragDisabled return if @dragDisabled

View file

@ -205,6 +205,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
.to({alpha: 0.6, scaleY: @options.camera.y2x, scaleX: 1}, 100, createjs.Ease.circOut) .to({alpha: 0.6, scaleY: @options.camera.y2x, scaleX: 1}, 100, createjs.Ease.circOut)
.to({alpha: 0, scaleY: 0, scaleX: 0}, 700, createjs.Ease.circIn) .to({alpha: 0, scaleY: 0, scaleX: 0}, 700, createjs.Ease.circIn)
.call => .call =>
return if @destroyed
@options.groundLayer.removeChild circle @options.groundLayer.removeChild circle
delete @handledAoEs[event] delete @handledAoEs[event]
@ -284,7 +285,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
################################################## ##################################################
updateAction: -> updateAction: ->
action = @determineAction() action = @determineAction()
isDifferent = action isnt @currentRootAction isDifferent = action isnt @currentRootAction or action is null
if not action and @thang?.actionActivated and not @stopLogging if not action and @thang?.actionActivated and not @stopLogging
console.error "action is", action, "for", @thang?.id, "from", @currentRootAction, @thang.action, @thang.getActionName?() console.error "action is", action, "for", @thang?.id, "from", @currentRootAction, @thang.action, @thang.getActionName?()
@stopLogging = true @stopLogging = true

View file

@ -23,7 +23,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
build: -> build: ->
@mouseEnabled = @mouseChildren = false @mouseEnabled = @mouseChildren = false
@addChild @label = new createjs.Text("", "20px Arial", "#003300") @addChild @label = new createjs.Text("", "40px Arial", "#003300")
@label.name = 'position text' @label.name = 'position text'
@label.shadow = new createjs.Shadow("#FFFFFF", 1, 1, 0) @label.shadow = new createjs.Shadow("#FFFFFF", 1, 1, 0)

View file

@ -25,10 +25,10 @@ module.exports = class DebugDisplay extends createjs.Container
build: -> build: ->
@mouseEnabled = @mouseChildren = false @mouseEnabled = @mouseChildren = false
@addChild @frameText = new createjs.Text "...", "20px Arial", "#FFF" @addChild @frameText = new createjs.Text "...", "40px Arial", "#FFF"
@frameText.name = 'frame text' @frameText.name = 'frame text'
@frameText.x = @canvasWidth - 50 @frameText.x = @canvasWidth - 100
@frameText.y = @canvasHeight - 25 @frameText.y = @canvasHeight - 50
@frameText.alpha = 0.5 @frameText.alpha = 0.5
updateFrame: (currentFrame) -> updateFrame: (currentFrame) ->
@ -42,4 +42,4 @@ module.exports = class DebugDisplay extends createjs.Container
@framesRenderedThisSecond = 0 @framesRenderedThisSecond = 0
@frameText.text = Math.round(currentFrame) + (if @fps? then " - " + @fps + ' fps' else '') @frameText.text = Math.round(currentFrame) + (if @fps? then " - " + @fps + ' fps' else '')
@frameText.x = @canvasWidth - @frameText.getMeasuredWidth() - 10 @frameText.x = @canvasWidth - @frameText.getMeasuredWidth() - 20

View file

@ -59,7 +59,7 @@ module.exports = class Label extends CocoClass
o.fontWeight = {D: "bold", S: "bold", N: "bold"}[st] o.fontWeight = {D: "bold", S: "bold", N: "bold"}[st]
o.shadow = {D: false, S: true, N: true}[st] o.shadow = {D: false, S: true, N: true}[st]
o.shadowColor = {D: "#FFF", S: "#000", N: "#FFF"}[st] o.shadowColor = {D: "#FFF", S: "#000", N: "#FFF"}[st]
o.fontSize = {D: 25, S: 12, N: 12}[st] o.fontSize = {D: 50, S: 24, N: 24}[st]
fontFamily = {D: "Arial", S: "Arial", N: "Arial"}[st] fontFamily = {D: "Arial", S: "Arial", N: "Arial"}[st]
o.fontDescriptor = "#{o.fontWeight} #{o.fontSize}px #{fontFamily}" o.fontDescriptor = "#{o.fontWeight} #{o.fontSize}px #{fontFamily}"
o.fontColor = {D: "#000", S: "#FFF", N: "#00a"}[st] o.fontColor = {D: "#000", S: "#FFF", N: "#00a"}[st]

View file

@ -81,7 +81,7 @@ module.exports = class Mark extends CocoClass
shape.graphics.endStroke() shape.graphics.endStroke()
shape.graphics.endFill() shape.graphics.endFill()
text = new createjs.Text "" + index, "20px Arial", color.replace('0.5', '1') text = new createjs.Text "" + index, "40px Arial", color.replace('0.5', '1')
text.regX = text.getMeasuredWidth() / 2 text.regX = text.getMeasuredWidth() / 2
text.regY = text.getMeasuredHeight() / 2 text.regY = text.getMeasuredHeight() / 2
text.shadow = new createjs.Shadow("#000000", 1, 1, 0) text.shadow = new createjs.Shadow("#000000", 1, 1, 0)

View file

@ -7,7 +7,6 @@ module.exports = class RegionChooser extends CocoClass
@options.stage.addEventListener 'stagemousedown', @onMouseDown @options.stage.addEventListener 'stagemousedown', @onMouseDown
@options.stage.addEventListener 'stagemousemove', @onMouseMove @options.stage.addEventListener 'stagemousemove', @onMouseMove
@options.stage.addEventListener 'stagemouseup', @onMouseUp @options.stage.addEventListener 'stagemouseup', @onMouseUp
@options.camera.dragDisabled = true
destroy: -> destroy: ->
@options.stage.removeEventListener 'stagemousedown', @onMouseDown @options.stage.removeEventListener 'stagemousedown', @onMouseDown
@ -18,6 +17,7 @@ module.exports = class RegionChooser extends CocoClass
onMouseDown: (e) => onMouseDown: (e) =>
return unless key.shift return unless key.shift
@firstPoint = @options.camera.canvasToWorld {x: e.stageX, y: e.stageY} @firstPoint = @options.camera.canvasToWorld {x: e.stageX, y: e.stageY}
@options.camera.dragDisabled = true
onMouseMove: (e) => onMouseMove: (e) =>
return unless @firstPoint return unless @firstPoint
@ -30,6 +30,7 @@ module.exports = class RegionChooser extends CocoClass
Backbone.Mediator.publish 'choose-region', points: [@firstPoint, @secondPoint] Backbone.Mediator.publish 'choose-region', points: [@firstPoint, @secondPoint]
@firstPoint = null @firstPoint = null
@secondPoint = null @secondPoint = null
@options.camera.dragDisabled = false
restrictRegion: -> restrictRegion: ->
RATIO = 1.56876 # 924 / 589 RATIO = 1.56876 # 924 / 589

View file

@ -110,7 +110,13 @@ module.exports = class SpriteBoss extends CocoClass
createOpponentWizard: (opponent) -> createOpponentWizard: (opponent) ->
# TODO: colorize name and cloud by team, colorize wizard by user's color config, level-specific wizard spawn points # TODO: colorize name and cloud by team, colorize wizard by user's color config, level-specific wizard spawn points
sprite = @createWizardSprite thangID: opponent.id, name: opponent.name sprite = @createWizardSprite thangID: opponent.id, name: opponent.name
sprite.targetPos = if opponent.team is 'ogres' then {x: 52, y: 52} else {x: 28, y: 28} if not opponent.levelSlug or opponent.levelSlug is "brawlwood"
sprite.targetPos = if opponent.team is 'ogres' then {x: 52, y: 52} else {x: 28, y: 28}
else if opponent.levelSlug is "dungeon-arena"
sprite.targetPos = if opponent.team is 'ogres' then {x:72, y: 39} else {x: 9, y:39}
else
sprite.targetPos = if opponent.team is 'ogres' then {x:52, y: 28} else {x: 20, y:28}
createWizardSprite: (options) -> createWizardSprite: (options) ->
sprite = new WizardSprite @thangTypeFor("Wizard"), @createSpriteOptions(options) sprite = new WizardSprite @thangTypeFor("Wizard"), @createSpriteOptions(options)
@ -294,7 +300,7 @@ module.exports = class SpriteBoss extends CocoClass
@willSelectThang = [thangID, null] @willSelectThang = [thangID, null]
@updateTarget() @updateTarget()
return unless @selectionMark return unless @selectionMark
@selectedSprite = null unless @selectedSprite?.thang @selectedSprite = null if @selectedSprite and (@selectedSprite.destroyed or not @selectedSprite.thang)
@selectionMark.toggle @selectedSprite? @selectionMark.toggle @selectedSprite?
@selectionMark.setSprite @selectedSprite @selectionMark.setSprite @selectedSprite
@selectionMark.update() @selectionMark.update()

View file

@ -81,7 +81,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
campaign_player_created: "Stworzone przez graczy" campaign_player_created: "Stworzone przez graczy"
campaign_player_created_description: "... w których walczysz przeciwko dziełom <a href=\"/contribute#artisan\">Czarodziejów Rękodzielnictwa</a>" campaign_player_created_description: "... w których walczysz przeciwko dziełom <a href=\"/contribute#artisan\">Czarodziejów Rękodzielnictwa</a>"
level_difficulty: "Poziom trudności: " level_difficulty: "Poziom trudności: "
# play_as: "Play As " play_as: "Graj jako "
contact: contact:
contact_us: "Kontakt z CodeCombat" contact_us: "Kontakt z CodeCombat"
@ -123,7 +123,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
wizard_tab: "Czarodziej" wizard_tab: "Czarodziej"
password_tab: "Hasło" password_tab: "Hasło"
emails_tab: "Powiadomienia" emails_tab: "Powiadomienia"
# admin: "Admin" admin: "Administrator"
gravatar_select: "Wybierz fotografię z Gravatar" gravatar_select: "Wybierz fotografię z Gravatar"
gravatar_add_photos: "Dodaj zdjęcia i miniatury do swojego konta Gravatar, by móc wybrać zdjęcie." gravatar_add_photos: "Dodaj zdjęcia i miniatury do swojego konta Gravatar, by móc wybrać zdjęcie."
gravatar_add_more_photos: "Dodaj więcej zdjęć do swojego konta Gravatar, by móc ich użyć." gravatar_add_more_photos: "Dodaj więcej zdjęć do swojego konta Gravatar, by móc ich użyć."
@ -132,7 +132,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
new_password_verify: "Zweryfikuj" new_password_verify: "Zweryfikuj"
email_subscriptions: "Powiadomienia email" email_subscriptions: "Powiadomienia email"
email_announcements: "Ogłoszenia" email_announcements: "Ogłoszenia"
# email_notifications: "Notifications" email_notifications: "Powiadomienia"
email_notifications_description: "Otrzymuj okresowe powiadomienia dotyczące twojego konta." email_notifications_description: "Otrzymuj okresowe powiadomienia dotyczące twojego konta."
email_announcements_description: "Otrzymuj powiadomienia o najnowszych wiadomościach i zmianach w CodeCombat." email_announcements_description: "Otrzymuj powiadomienia o najnowszych wiadomościach i zmianach w CodeCombat."
contributor_emails: "Powiadomienia asystentów" contributor_emails: "Powiadomienia asystentów"
@ -180,9 +180,9 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
victory_sign_up: "Zapisz się, by zapisać postępy" victory_sign_up: "Zapisz się, by zapisać postępy"
victory_sign_up_poke: "Chcesz zapisać swój kod? Utwórz bezpłatne konto!" victory_sign_up_poke: "Chcesz zapisać swój kod? Utwórz bezpłatne konto!"
victory_rate_the_level: "Oceń poziom: " victory_rate_the_level: "Oceń poziom: "
# victory_rank_my_game: "Rank My Game" victory_rank_my_game: "Oceń moją grę"
# victory_ranking_game: "Submitting..." victory_ranking_game: "Wprowadzanie..."
# victory_return_to_ladder: "Return to Ladder" victory_return_to_ladder: "Powrót do drabinki"
victory_play_next_level: "Przejdź na następny poziom" victory_play_next_level: "Przejdź na następny poziom"
victory_go_home: "Powrót do strony głównej" victory_go_home: "Powrót do strony głównej"
victory_review: "Powiedz nam coś więcej!" victory_review: "Powiedz nam coś więcej!"
@ -207,17 +207,17 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
hud_continue: "Kontynuuj (Shift + spacja)" hud_continue: "Kontynuuj (Shift + spacja)"
spell_saved: "Czar zapisany" spell_saved: "Czar zapisany"
skip_tutorial: "Pomiń (esc)" skip_tutorial: "Pomiń (esc)"
# editor_config: "Editor Config" editor_config: "Konfiguracja edytora"
# editor_config_title: "Editor Configuration" editor_config_title: "Konfiguracja edytora"
# editor_config_keybindings_label: "Key Bindings" editor_config_keybindings_label: "Przypisania klawiszy"
# editor_config_keybindings_default: "Default (Ace)" editor_config_keybindings_default: "Domyślny (Ace)"
# editor_config_keybindings_description: "Adds additional shortcuts known from the common editors." editor_config_keybindings_description: "Dodaje skróty znane z popularnych edytorów."
# editor_config_invisibles_label: "Show Invisibles" editor_config_invisibles_label: "Pokaż białe znaki"
# editor_config_invisibles_description: "Displays invisibles such as spaces or tabs." editor_config_invisibles_description: "Wyświetla białe znaki takie jak spacja czy tabulator."
# editor_config_indentguides_label: "Show Indent Guides" editor_config_indentguides_label: "Pokaż linijki wcięć"
# editor_config_indentguides_description: "Displays vertical lines to see indentation better." editor_config_indentguides_description: "Wyświetla pionowe linie, by lepiej zaznaczyć wcięcia."
# editor_config_behaviors_label: "Smart Behaviors" editor_config_behaviors_label: "Inteligentne zachowania"
# editor_config_behaviors_description: "Autocompletes brackets, braces, and quotes." editor_config_behaviors_description: "Autouzupełnianie nawiasów, klamer i cudzysłowów."
admin: admin:
av_title: "Panel administracyjny" av_title: "Panel administracyjny"
@ -242,8 +242,8 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
contact_us: "skontaktuj się z nami!" contact_us: "skontaktuj się z nami!"
hipchat_prefix: "Możesz nas też spotkać w naszym" hipchat_prefix: "Możesz nas też spotkać w naszym"
hipchat_url: "pokoju HipChat." hipchat_url: "pokoju HipChat."
# revert: "Revert" revert: "Przywróć"
# revert_models: "Revert Models" revert_models: "Przywróć wersję"
level_some_options: "Trochę opcji?" level_some_options: "Trochę opcji?"
level_tab_thangs: "Obiekty" level_tab_thangs: "Obiekty"
level_tab_scripts: "Skrypty" level_tab_scripts: "Skrypty"
@ -262,18 +262,18 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
level_components_title: "Powrót do listy obiektów" level_components_title: "Powrót do listy obiektów"
level_components_type: "Typ" level_components_type: "Typ"
level_component_edit_title: "Edytuj komponent" level_component_edit_title: "Edytuj komponent"
# level_component_config_schema: "Config Schema" level_component_config_schema: "Schemat konfiguracji"
# level_component_settings: "Settings" level_component_settings: "Ustawienia"
level_system_edit_title: "Edytuj system" level_system_edit_title: "Edytuj system"
create_system_title: "Stwórz nowy system" create_system_title: "Stwórz nowy system"
new_component_title: "Stwórz nowy komponent" new_component_title: "Stwórz nowy komponent"
new_component_field_system: "System" new_component_field_system: "System"
# new_article_title: "Create a New Article" new_article_title: "Stwórz nowy artykuł"
# new_thang_title: "Create a New Thang Type" new_thang_title: "Stwórz nowy typ obiektu"
# new_level_title: "Create a New Level" new_level_title: "Stwórz nowy poziom"
# article_search_title: "Search Articles Here" article_search_title: "Przeszukaj artykuły"
# thang_search_title: "Search Thang Types Here" thang_search_title: "Przeszukaj typy obiektów"
# level_search_title: "Search Levels Here" level_search_title: "Przeszukaj poziomy"
article: article:
edit_btn_preview: "Podgląd" edit_btn_preview: "Podgląd"
@ -285,27 +285,27 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
body: "Zawartość" body: "Zawartość"
version: "Wersja" version: "Wersja"
commit_msg: "Wiadomość do commitu" commit_msg: "Wiadomość do commitu"
# history: "History" history: "Historia"
version_history_for: "Historia wersji dla: " version_history_for: "Historia wersji dla: "
# result: "Result" result: "Wynik"
results: "Wynik" results: "Wyniki"
description: "Opis" description: "Opis"
or: "lub" or: "lub"
email: "Email" email: "Email"
# password: "Password" password: "Hasło"
message: "Wiadomość" message: "Wiadomość"
# code: "Code" code: "Kod"
# ladder: "Ladder" ladder: "Drabinka"
# when: "When" when: "kiedy"
# opponent: "Opponent" opponent: "Przeciwnik"
# rank: "Rank" rank: "Ranking"
# score: "Score" score: "Wynik"
# win: "Win" win: "Wygrana"
# loss: "Loss" loss: "Przegrana"
# tie: "Tie" tie: "Remis"
# easy: "Easy" easy: "Łatwy"
# medium: "Medium" medium: "Średni"
# hard: "Hard" hard: "Trudny"
about: about:
who_is_codecombat: "Czym jest CodeCombat?" who_is_codecombat: "Czym jest CodeCombat?"
@ -416,7 +416,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
join_desc_4: ", a dowiesz się wszystkiego!" join_desc_4: ", a dowiesz się wszystkiego!"
join_url_email: "Napisz do nas" join_url_email: "Napisz do nas"
join_url_hipchat: "publicznego pokoju HipChat" join_url_hipchat: "publicznego pokoju HipChat"
more_about_archmage: "Dowiedz się więcej na temat stawania się Arcymagiem" more_about_archmage: "Dowiedz się więcej o stawaniu się Arcymagiem"
archmage_subscribe_desc: "Otrzymuj e-maile dotyczące nowych okazji programistycznych oraz ogłoszeń." archmage_subscribe_desc: "Otrzymuj e-maile dotyczące nowych okazji programistycznych oraz ogłoszeń."
artisan_summary_pref: "Chcesz projektować poziomy i rozwijać arsenał CodeCombat? Ludzie grają w dostarczane przez nas zasoby szybciej, niż potrafimy je tworzyć! Obecnie, nasz edytor jest dosyć niemrawy więc czuj się ostrzeżony - tworzenie poziomów przy jego pomocy może być trochę wymagające i zbugowane. Jeśli masz wizję nowych kampanii, od pętli typu for do" artisan_summary_pref: "Chcesz projektować poziomy i rozwijać arsenał CodeCombat? Ludzie grają w dostarczane przez nas zasoby szybciej, niż potrafimy je tworzyć! Obecnie, nasz edytor jest dosyć niemrawy więc czuj się ostrzeżony - tworzenie poziomów przy jego pomocy może być trochę wymagające i zbugowane. Jeśli masz wizję nowych kampanii, od pętli typu for do"
artisan_summary_suf: ", ta klasa jest dla ciebie." artisan_summary_suf: ", ta klasa jest dla ciebie."
@ -441,15 +441,15 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
adventurer_join_suf: "więc jeśli wolałbyś być informowany w ten sposób, zarejestruj się na nich!" adventurer_join_suf: "więc jeśli wolałbyś być informowany w ten sposób, zarejestruj się na nich!"
more_about_adventurer: "Dowiedz się więcej o stawaniu się Podróżnikiem" more_about_adventurer: "Dowiedz się więcej o stawaniu się Podróżnikiem"
adventurer_subscribe_desc: "Otrzymuj e-maile, gdy pojawią się nowe poziomy do tesotwania." adventurer_subscribe_desc: "Otrzymuj e-maile, gdy pojawią się nowe poziomy do tesotwania."
scribe_summary_pref: "Codecombat nie będzie tylko zbieraniną poziomów. Będzie też źródłem wiedzy programistycznej, na której gracze będą mogli sie opierać. Dzięki temu, każdy z Rzemieślników będzie mógł podać link do szczegółowego artykułu, który pomoże graczowi: dokumentacji w stylu zbudowanej przez " scribe_summary_pref: "Codecombat nie będzie tylko zbieraniną poziomów. Będzie też źródłem wiedzy programistycznej, na której gracze będą mogli sie opierać. Dzięki temu, każdy z Rzemieślników będzie mógł podać link do szczegółowego artykułu, który pomoże graczowi: dokumentacji w stylu "
# scribe_summary_suf: " has built. If you enjoy explaining programming concepts, then this class is for you." scribe_summary_suf: ". Jeśli lubisz wyjaśniać idee programistyczne, ta klasa jest dla ciebie."
scribe_introduction_pref: "CodeCombat nie będzie tylko zbieraniną poziomów. Będzie też zawierać źródło wiedzy, wiki programistycznych idei, na której będzie można oprzeć poziomy. Dzięki temu, każdy z Rzemieślników zamiast opisywać ze szczegółami, czym jest operator porónania, będzie mógł po prostu podać graczowi w swoim poziomie link do artykułu opisującego go. Mamy na myśli coś podobnego do " scribe_introduction_pref: "CodeCombat nie będzie tylko zbieraniną poziomów. Będzie też zawierać źródło wiedzy, wiki programistycznych idei, na której będzie można oprzeć poziomy. Dzięki temu, każdy z Rzemieślników zamiast opisywać ze szczegółami, czym jest operator porónania, będzie mógł po prostu podać graczowi w swoim poziomie link do artykułu opisującego go. Mamy na myśli coś podobnego do "
scribe_introduction_url_mozilla: "Mozilla Developer Network" scribe_introduction_url_mozilla: "Mozilla Developer Network"
scribe_introduction_suf: " . Jeśli twoją definicją zabawy jest artykułowanie idei programistycznych przy pomocy składni Markdown, ta klasa może być dla ciebie." scribe_introduction_suf: ". Jeśli twoją definicją zabawy jest artykułowanie idei programistycznych przy pomocy składni Markdown, ta klasa może być dla ciebie."
scribe_attribute_1: "Umiejętne posługiwanie się słowem to właściwie wszystko, czego potrzebujesz. Nie tylko gramatyka i ortografia, ale również umiejętnośc tłumaczenia trudnego materiału innym." scribe_attribute_1: "Umiejętne posługiwanie się słowem to właściwie wszystko, czego potrzebujesz. Nie tylko gramatyka i ortografia, ale również umiejętnośc tłumaczenia trudnego materiału innym."
contact_us_url: "Skontaktuj się z nami" contact_us_url: "Skontaktuj się z nami"
scribe_join_description: "powiedz nam coś o sobie, swoim doświadczeniu w programowaniu i rzeczach, o których chciałbyś pisać, a chętnie to z tobą uzgodnimy!" scribe_join_description: "powiedz nam coś o sobie, swoim doświadczeniu w programowaniu i rzeczach, o których chciałbyś pisać, a chętnie to z tobą uzgodnimy!"
more_about_scribe: "Dowiedz się więcej na temat stawania się Skrybą" more_about_scribe: "Dowiedz się więcej o stawaniu się Skrybą"
scribe_subscribe_desc: "Otrzymuj e-maile na temat ogłoszeń dotyczących pisania artykułów." scribe_subscribe_desc: "Otrzymuj e-maile na temat ogłoszeń dotyczących pisania artykułów."
diplomat_summary: "W krajach nieanglojęzycznych istnieje wielkie zainteresowanie CodeCombat! Szukamy tłumaczy chętnych do poświęcenia swojego czasu na tłumaczenie treści strony, aby CodeCombat było dostępne dla całego świata tak szybko, jak to tylko możliwe. Jeśli chcesz pomóc w sprawieniu, by CodeCombat było prawdziwie międzynarodowe, ta klasa jest dla ciebie." diplomat_summary: "W krajach nieanglojęzycznych istnieje wielkie zainteresowanie CodeCombat! Szukamy tłumaczy chętnych do poświęcenia swojego czasu na tłumaczenie treści strony, aby CodeCombat było dostępne dla całego świata tak szybko, jak to tylko możliwe. Jeśli chcesz pomóc w sprawieniu, by CodeCombat było prawdziwie międzynarodowe, ta klasa jest dla ciebie."
diplomat_introduction_pref: "Jeśli dowiedzieliśmy jednej rzeczy z naszego " diplomat_introduction_pref: "Jeśli dowiedzieliśmy jednej rzeczy z naszego "
@ -459,7 +459,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
diplomat_join_pref_github: "Znajdź plik lokalizacyjny dla wybranego języka " diplomat_join_pref_github: "Znajdź plik lokalizacyjny dla wybranego języka "
diplomat_github_url: "na GitHubie" diplomat_github_url: "na GitHubie"
diplomat_join_suf_github: ", edytuj go online i wyślij pull request. Do tego, zaznacz kratkę poniżej, aby być na bieżąco z naszym międzynarodowym rozwojem!" diplomat_join_suf_github: ", edytuj go online i wyślij pull request. Do tego, zaznacz kratkę poniżej, aby być na bieżąco z naszym międzynarodowym rozwojem!"
more_about_diplomat: "Dowiedz się więcej na temat stawania się Dyplomatą" more_about_diplomat: "Dowiedz się więcej o stawaniu się Dyplomatą"
diplomat_subscribe_desc: "Otrzymuj e-maile na temat postępów i18n i poziomów do tłumaczenia." diplomat_subscribe_desc: "Otrzymuj e-maile na temat postępów i18n i poziomów do tłumaczenia."
ambassador_summary: "Staramy się zbudować społeczność, a każda społeczność potrzebuje zespołu wsparcia, kiedy pojawią się kłopoty. Mamy czaty, e-maile i strony w sieciach społecznościowych, aby nasi użytkownicy mogli zapoznać się z grą. Jeśli chcesz pomóc ludziom w tym, jak do nas dołączyć, dobrze się bawić, a do tego poznać tajniki programowania, ta klasa jest dla ciebie." ambassador_summary: "Staramy się zbudować społeczność, a każda społeczność potrzebuje zespołu wsparcia, kiedy pojawią się kłopoty. Mamy czaty, e-maile i strony w sieciach społecznościowych, aby nasi użytkownicy mogli zapoznać się z grą. Jeśli chcesz pomóc ludziom w tym, jak do nas dołączyć, dobrze się bawić, a do tego poznać tajniki programowania, ta klasa jest dla ciebie."
ambassador_introduction: "Oto społeczność, którą budujemy, a ty jesteś jej łącznikiem. Mamy czaty, e-maile i strony w sieciach społecznościowych oraz wielu ludzi potrzebujących pomocy w zapoznaniu się z grą oraz uczeniu się za jej pomocą. Jeśli chcesz pomóc ludziom, by do nas dołączyli i dobrze się bawili oraz mieć pełne poczucie tętna CodeCombat oraz kierunku, w którym zmierzamy, ta klasa może być dla ciebie." ambassador_introduction: "Oto społeczność, którą budujemy, a ty jesteś jej łącznikiem. Mamy czaty, e-maile i strony w sieciach społecznościowych oraz wielu ludzi potrzebujących pomocy w zapoznaniu się z grą oraz uczeniu się za jej pomocą. Jeśli chcesz pomóc ludziom, by do nas dołączyli i dobrze się bawili oraz mieć pełne poczucie tętna CodeCombat oraz kierunku, w którym zmierzamy, ta klasa może być dla ciebie."
@ -475,7 +475,7 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
counselor_attribute_1: "Doświadczenie, w którymkolwiek z powyższych obszarów lub czymś, co uważasz za pomocne." counselor_attribute_1: "Doświadczenie, w którymkolwiek z powyższych obszarów lub czymś, co uważasz za pomocne."
counselor_attribute_2: "Trochę wolnego czasu" counselor_attribute_2: "Trochę wolnego czasu"
counselor_join_desc: "powiedz nam coś o sobie, o tym, czego dokonałeś i jak chciałbyś nam pomóc. Dodamy cię do naszej listy kontaktów i damy ci znać, kiedy będziemy potrzebować twojej pomocy (nie za często)." counselor_join_desc: "powiedz nam coś o sobie, o tym, czego dokonałeś i jak chciałbyś nam pomóc. Dodamy cię do naszej listy kontaktów i damy ci znać, kiedy będziemy potrzebować twojej pomocy (nie za często)."
more_about_counselor: "Dowiedz się więcej na temat stawania się Opiekunem" more_about_counselor: "Dowiedz się więcej o stawaniu się Opiekunem"
changes_auto_save: "Zmiany zapisują się automatycznie po kliknięci kratki." changes_auto_save: "Zmiany zapisują się automatycznie po kliknięci kratki."
diligent_scribes: "Nasi pilni Skrybowie:" diligent_scribes: "Nasi pilni Skrybowie:"
powerful_archmages: "Nasi potężni Arcymagowie:" powerful_archmages: "Nasi potężni Arcymagowie:"
@ -500,34 +500,34 @@ module.exports = nativeDescription: "język polski", englishDescription: "Polish
counselor_title: "Opiekun" counselor_title: "Opiekun"
counselor_title_description: "(ekspert/nauczyciel)" counselor_title_description: "(ekspert/nauczyciel)"
# ladder: ladder:
# please_login: "Please log in first before playing a ladder game." please_login: "Przed rozpoczęciem gry rankingowej musisz się zalogować."
# my_matches: "My Matches" my_matches: "Moje pojedynki"
# simulate: "Simulate" simulate: "Symuluj"
# simulation_explanation: "By simulating games you can get your game ranked faster!" simulation_explanation: "Symulując gry możesz szybciej uzyskać ocenę swojej gry!"
# simulate_games: "Simulate Games!" simulate_games: "Symuluj gry!"
# simulate_all: "RESET AND SIMULATE GAMES" simulate_all: "RESETUJ I SYMULUJ GRY"
# leaderboard: "Leaderboard" leaderboard: "Tabela rankingowa"
# battle_as: "Battle as " battle_as: "Walcz jako "
# summary_your: "Your " summary_your: "Twój "
# summary_matches: "Matches - " summary_matches: "Pojedynki - "
# summary_wins: " Wins, " summary_wins: " Wygrane, "
# summary_losses: " Losses" summary_losses: " Przegrane"
# rank_no_code: "No New Code to Rank" rank_no_code: "Brak nowego kodu do oceny"
# rank_my_game: "Rank My Game!" rank_my_game: "Oceń moją grę!"
# rank_submitting: "Submitting..." rank_submitting: "Wysyłanie..."
# rank_submitted: "Submitted for Ranking" rank_submitted: "Wysłano do oceny"
# rank_failed: "Failed to Rank" rank_failed: "Błąd oceniania"
# rank_being_ranked: "Game Being Ranked" rank_being_ranked: "Aktualnie oceniane gry"
# code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in." code_being_simulated: "Twój nowy kod jest aktualnie symulowany przez innych graczy w celu oceny. W miarę pojawiania sie nowych pojedynków, nastąpi odświeżenie."
# no_ranked_matches_pre: "No ranked matches for the " no_ranked_matches_pre: "Brak ocenionych pojedynków dla drużyny "
# no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked." no_ranked_matches_post: " ! Zagraj przeciwko kilku oponentom i wróc tutaj, aby uzyskać ocenę gry."
# choose_opponent: "Choose an Opponent" choose_opponent: "Wybierz przeciwnika"
# tutorial_play: "Play Tutorial" tutorial_play: "Rozegraj samouczek"
# tutorial_recommended: "Recommended if you've never played before" tutorial_recommended: "Zalecane, jeśli wcześniej nie grałeś"
# tutorial_skip: "Skip Tutorial" tutorial_skip: "Pomiń samouczek"
# tutorial_not_sure: "Not sure what's going on?" tutorial_not_sure: "Nie wiesz, co się dzieje?"
# tutorial_play_first: "Play the Tutorial first." tutorial_play_first: "Rozegraj najpierw samouczek."
# simple_ai: "Simple AI" simple_ai: "Proste AI"
# warmup: "Warmup" warmup: "Rozgrzewka"
# vs: "VS" # vs: "VS"

View file

@ -4,6 +4,10 @@
html html
background-color: #2f261d background-color: #2f261d
html, body
// For level loading view wings
overflow-x: hidden
// https://github.com/twbs/bootstrap/issues/9237 -- need a version that's not !important // https://github.com/twbs/bootstrap/issues/9237 -- need a version that's not !important
.secret .secret
display: none display: none

View file

@ -18,8 +18,6 @@
display: block display: block
z-index: 1 z-index: 1
//max-width: 1680px // guideline, but for now let's let it stretch out
min-width: 1024px min-width: 1024px
position: relative position: relative

View file

@ -0,0 +1,65 @@
@import "app/styles/bootstrap/mixins"
@import "app/styles/mixins"
@mixin sky-background($url: '', $backgroundPosition: left)
$top: #95D9EF
$mid: #FFFFFF
$bot: #8EC643
$stop: 99.6%
background: $mid
background-image: url($url) // fallback
background-image: url($url), -webkit-linear-gradient(top, $top, $mid $stop, $bot)
background-image: url($url), -ms-linear-gradient(top, $top, $mid $stop, $bot)
background-image: url($url), linear-gradient(to bottom, $top, $mid $stop, $bot)
background-repeat: no-repeat
background-position: top $backgroundPosition
#level-loading-view
color: blue
width: 100%
height: 100%
position: absolute
z-index: 20
$UNVEIL_TIME: 1.2s
pointer-events: none
.loading-details
position: absolute
top: 20px
left: 50%
$WIDTH: 1000px
width: $WIDTH
margin-left: (-$WIDTH / 2)
z-index: 100
background-color: rgba(220, 255, 230, 0.5)
border-radius: 30px
padding: 10px
text-align: center
// http://matthewlein.com/ceaser/ Bounce down a bit, then snap up.
-webkit-transition: top $UNVEIL_TIME cubic-bezier(0.285, 0, 0.670, 0)
-webkit-transition: top $UNVEIL_TIME cubic-bezier(0.285, -0.595, 0.670, -0.600)
-moz-transition: top $UNVEIL_TIME cubic-bezier(0.285, -0.595, 0.670, -0.600)
-o-transition: top $UNVEIL_TIME cubic-bezier(0.285, -0.595, 0.670, -0.600)
transition: top $UNVEIL_TIME cubic-bezier(0.285, -0.595, 0.670, -0.600)
.load-progress
width: 100%
.progress-bar
width: 1%
transition-duration: 1.2s
.left-wing, .right-wing
width: 100%
height: 100%
position: absolute
.left-wing
@include sky-background('/images/level/loading_left_wing.png', right)
left: -50%
transition: all $UNVEIL_TIME ease
.right-wing
@include sky-background('/images/level/loading_right_wing.png', left)
right: -50%
transition: all $UNVEIL_TIME ease

View file

@ -1,7 +1,6 @@
@import "app/styles/bootstrap/mixins" @import "app/styles/bootstrap/mixins"
@import "app/styles/mixins" @import "app/styles/mixins"
#spectate-level-view #spectate-level-view
#playback-view #playback-view
width: 100% width: 100%
@ -24,12 +23,16 @@
line-height: 15px line-height: 15px
left: 0 left: 0
max-width: 1920px
margin: 0 auto margin: 0 auto
@include user-select(none) @include user-select(none)
#level-loading-view
max-height: 1284px
.level-content .level-content
position: relative position: relative
margin: 0px auto
#canvas-wrapper #canvas-wrapper
height: 100% height: 100%
@ -38,6 +41,8 @@
canvas#surface canvas#surface
background-color: #ddd background-color: #ddd
max-height: 93%
max-height: -webkit-calc(100% - 60px)
max-height: calc(100% - 60px) max-height: calc(100% - 60px)
height: auto height: auto
max-width: 100% max-width: 100%
@ -46,7 +51,6 @@
margin: 0 auto margin: 0 auto
//max-width: 1680px // guideline, but for now let's let it stretch out
min-width: 1024px min-width: 1024px
position: relative position: relative
#thang-hud #thang-hud

View file

@ -27,7 +27,7 @@
div.alert.alert-info div.alert.alert-info
strong Enter strong Enter
| to confirm | to confirm
canvas(width=924, height=590) canvas(width=1920, height=1224)
.modal-footer .modal-footer
a.btn.btn-primary#done-button Done a.btn.btn-primary#done-button Done

View file

@ -17,7 +17,7 @@
.world-container.thangs-column .world-container.thangs-column
h3(data-i18n="editor.level_tab_thangs_conditions") Starting Conditions h3(data-i18n="editor.level_tab_thangs_conditions") Starting Conditions
#canvas-wrapper #canvas-wrapper
canvas(width=924, height=589)#surface canvas(width=1920, height=1224)#surface
#canvas-left-gradient.gradient #canvas-left-gradient.gradient
#canvas-top-gradient.gradient #canvas-top-gradient.gradient

View file

@ -1,3 +1,5 @@
#level-loading-view
.level-content .level-content
#control-bar-view #control-bar-view
@ -7,7 +9,7 @@
#tome-view #tome-view
#canvas-wrapper #canvas-wrapper
canvas(width=924, height=589)#surface canvas(width=1920, height=1224)#surface
#canvas-left-gradient.gradient #canvas-left-gradient.gradient
#canvas-top-gradient.gradient #canvas-top-gradient.gradient

View file

@ -0,0 +1,13 @@
.left-wing
.right-wing
.loading-details
h2(data-i18n='play_level.loading_level') Loading Level
.load-progress
.progress.progress-striped.active
.progress-bar.progress-bar-success
h4 Tip: you can shift+click a position on the map to insert it into the spell editor.

View file

@ -1,7 +1,9 @@
#level-loading-view
.level-content .level-content
#control-bar-view #control-bar-view
#canvas-wrapper #canvas-wrapper
canvas(width=1848, height=1178)#surface canvas(width=1920, height=1224)#surface
#canvas-left-gradient.gradient #canvas-left-gradient.gradient
#canvas-top-gradient.gradient #canvas-top-gradient.gradient
#gold-view.secret.expanded #gold-view.secret.expanded

View file

@ -29,7 +29,8 @@ module.exports = class AdminView extends View
espionageSuccess: (model) -> espionageSuccess: (model) ->
storage.save('whoami',model) storage.save('whoami',model)
window.location.reload() window.location.reload()
espionageFailure: (jqxhr, status,error)-> espionageFailure: (jqxhr, status,error)->
console.log "There was an error entering espionage mode: #{error}" console.log "There was an error entering espionage mode: #{error}"

View file

@ -8,6 +8,7 @@ CocoCollection = require 'models/CocoCollection'
Surface = require 'lib/surface/Surface' Surface = require 'lib/surface/Surface'
Thang = require 'lib/world/thang' Thang = require 'lib/world/thang'
LevelThangEditView = require './thang/edit' LevelThangEditView = require './thang/edit'
ComponentsCollection = require 'collections/ComponentsCollection'
# Moving the screen while dragging thangs constants # Moving the screen while dragging thangs constants
MOVE_MARGIN = 0.15 MOVE_MARGIN = 0.15
@ -60,12 +61,25 @@ module.exports = class ThangsTabView extends View
@thangTypes.once 'sync', @onThangTypesLoaded @thangTypes.once 'sync', @onThangTypesLoaded
@thangTypes.fetch() @thangTypes.fetch()
# just loading all Components for now: https://github.com/codecombat/codecombat/issues/405
@componentCollection = @supermodel.getCollection new ComponentsCollection()
@componentCollection.once 'sync', @onComponentsLoaded
@componentCollection.fetch()
onThangTypesLoaded: => onThangTypesLoaded: =>
return if @destroyed
@supermodel.addCollection @thangTypes @supermodel.addCollection @thangTypes
@supermodel.populateModel model for model in @thangTypes.models @supermodel.populateModel model for model in @thangTypes.models
@startsLoading = false @startsLoading = not @componentCollection.loaded
@render() # do it again but without the loading screen @render() # do it again but without the loading screen
@onLevelLoaded level: @level if @level @onLevelLoaded level: @level if @level and not @startsLoading
onComponentsLoaded: =>
return if @destroyed
@supermodel.addCollection @componentCollection
@startsLoading = not @thangTypes.loaded
@render() # do it again but without the loading screen
@onLevelLoaded level: @level if @level and not @startsLoading
getRenderData: (context={}) -> getRenderData: (context={}) ->
context = super(context) context = super(context)
@ -146,7 +160,6 @@ module.exports = class ThangsTabView extends View
@surface.playing = false @surface.playing = false
@surface.setWorld @world @surface.setWorld @world
@surface.camera.zoomTo({x:262, y:-164}, 1.66, 0) @surface.camera.zoomTo({x:262, y:-164}, 1.66, 0)
@surface.camera.dragDisabled = true
destroy: -> destroy: ->
@selectAddThangType null @selectAddThangType null
@ -168,6 +181,7 @@ module.exports = class ThangsTabView extends View
onSpriteDragged: (e) -> onSpriteDragged: (e) ->
return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id
@surface.camera.dragDisabled = true
{stageX, stageY} = e.originalEvent {stageX, stageY} = e.originalEvent
wop = @surface.camera.canvasToWorld x: stageX, y: stageY wop = @surface.camera.canvasToWorld x: stageX, y: stageY
wop.z = @selectedExtantThang.depth / 2 wop.z = @selectedExtantThang.depth / 2
@ -178,6 +192,7 @@ module.exports = class ThangsTabView extends View
onSpriteMouseUp: (e) -> onSpriteMouseUp: (e) ->
clearInterval(@movementInterval) if @movementInterval? clearInterval(@movementInterval) if @movementInterval?
@movementInterval = null @movementInterval = null
@surface.camera.dragDisabled = false
return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id
pos = @selectedExtantThang.pos pos = @selectedExtantThang.pos
physicalOriginal = componentOriginals["physics.Physical"] physicalOriginal = componentOriginals["physics.Physical"]

View file

@ -102,7 +102,7 @@ module.exports = class MyMatchesTabView extends CocoView
@$el.find('.rank-button').each (i, el) => @$el.find('.rank-button').each (i, el) =>
button = $(el) button = $(el)
sessionID = button.data('session-id') sessionID = button.data('session-id')
session = _.find @sessions.models, { id: sessionID } session = _.find @sessions.models, {id: sessionID}
rankingState = 'unavailable' rankingState = 'unavailable'
if @readyToRank session if @readyToRank session
rankingState = 'rank' rankingState = 'rank'
@ -119,14 +119,14 @@ module.exports = class MyMatchesTabView extends CocoView
rankSession: (e) -> rankSession: (e) ->
button = $(e.target).closest('.rank-button') button = $(e.target).closest('.rank-button')
sessionID = button.data('session-id') sessionID = button.data('session-id')
session = _.find @sessions.models, { id: sessionID } session = _.find @sessions.models, {id: sessionID}
return unless @readyToRank(session) return unless @readyToRank(session)
@setRankingButtonText(button, 'submitting') @setRankingButtonText(button, 'submitting')
success = => @setRankingButtonText(button, 'submitted') success = => @setRankingButtonText(button, 'submitted')
failure = => @setRankingButtonText(button, 'failed') failure = => @setRankingButtonText(button, 'failed')
ajaxData = { session: sessionID, levelID: @level.id, originalLevelID: @level.attributes.original, levelMajorVersion: @level.attributes.version.major } ajaxData = {session: sessionID, levelID: @level.id, originalLevelID: @level.attributes.original, levelMajorVersion: @level.attributes.version.major}
console.log "Posting game for ranking from My Matches view." console.log "Posting game for ranking from My Matches view."
$.ajax '/queue/scoring', { $.ajax '/queue/scoring', {
type: 'POST' type: 'POST'

View file

@ -0,0 +1,40 @@
View = require 'views/kinds/CocoView'
template = require 'templates/play/level/level_loading'
module.exports = class LevelLoadingView extends View
id: "level-loading-view"
template: template
subscriptions:
'level-loader:progress-changed': 'onLevelLoaderProgressChanged'
onLevelLoaderProgressChanged: (e) ->
@progress = e.progress
@updateProgressBar()
updateProgressBar: ->
#@text.text = "BUILDING" if @progress is 1
@$el.find('.progress-bar').css('width', (100 * @progress) + '%')
showReady: ->
return
unveil: ->
_.delay @reallyUnveil, 1000
reallyUnveil: =>
return if @destroyed
loadingDetails = @$el.find('.loading-details')
duration = parseFloat loadingDetails.css 'transition-duration'
loadingDetails.css 'top', -loadingDetails.outerHeight(true)
@$el.find('.left-wing').css left: '-100%', backgroundPosition: 'right -400px top 0'
@$el.find('.right-wing').css right: '-100%', backgroundPosition: 'left -400px top 0'
_.delay @onUnveilEnded, duration * 1000
onUnveilEnded: =>
return if @destroyed
Backbone.Mediator.publish 'onLoadingViewUnveiled', view: @
getRenderData: (c={}) ->
super c
c

View file

@ -22,6 +22,7 @@ Camera = require 'lib/surface/Camera'
AudioPlayer = require 'lib/AudioPlayer' AudioPlayer = require 'lib/AudioPlayer'
# subviews # subviews
LoadingView = require './level/level_loading_view'
TomeView = require './level/tome/tome_view' TomeView = require './level/tome/tome_view'
ChatView = require './level/level_chat_view' ChatView = require './level/level_chat_view'
HUDView = require './level/hud_view' HUDView = require './level/hud_view'
@ -32,8 +33,6 @@ GoldView = require './level/gold_view'
VictoryModal = require './level/modal/victory_modal' VictoryModal = require './level/modal/victory_modal'
InfiniteLoopModal = require './level/modal/infinite_loop_modal' InfiniteLoopModal = require './level/modal/infinite_loop_modal'
LoadingScreen = require 'lib/LoadingScreen'
PROFILE_ME = false PROFILE_ME = false
module.exports = class PlayLevelView extends View module.exports = class PlayLevelView extends View
@ -62,6 +61,8 @@ module.exports = class PlayLevelView extends View
'level:session-will-save': 'onSessionWillSave' 'level:session-will-save': 'onSessionWillSave'
'level:set-team': 'setTeam' 'level:set-team': 'setTeam'
'god:new-world-created': 'loadSoundsForWorld' 'god:new-world-created': 'loadSoundsForWorld'
'level:started': 'onLevelStarted'
'level:loading-view-unveiled': 'onLoadingViewUnveiled'
events: events:
'click #level-done-button': 'onDonePressed' 'click #level-done-button': 'onDonePressed'
@ -122,8 +123,7 @@ module.exports = class PlayLevelView extends View
afterRender: -> afterRender: ->
window.onPlayLevelViewLoaded? @ # still a hack window.onPlayLevelViewLoaded? @ # still a hack
@loadingScreen = new LoadingScreen(@$el.find('canvas')[0]) @insertSubView @loadingView = new LoadingView {}
@loadingScreen.show()
@$el.find('#level-done-button').hide() @$el.find('#level-done-button').hide()
super() super()
@ -149,23 +149,22 @@ module.exports = class PlayLevelView extends View
onLevelLoaderLoaded: -> onLevelLoaderLoaded: ->
return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early
# Save latest level played in local storage
if window.currentModal and not window.currentModal.destroyed if window.currentModal and not window.currentModal.destroyed
@loadingScreen.showReady() @loadingView.showReady()
return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @ return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
# Save latest level played in local storage
localStorage["lastLevel"] = @levelID if localStorage? localStorage["lastLevel"] = @levelID if localStorage?
@grabLevelLoaderData() @grabLevelLoaderData()
team = @getQueryVariable("team") ? @world.teamForPlayer(0) team = @getQueryVariable("team") ? @world.teamForPlayer(0)
@loadOpponentTeam(team) @loadOpponentTeam(team)
@loadingScreen.destroy()
@god.level = @level.serialize @supermodel @god.level = @level.serialize @supermodel
@god.worldClassMap = @world.classMap @god.worldClassMap = @world.classMap
@setTeam team @setTeam team
@initSurface() @initSurface()
@initGoalManager() @initGoalManager()
@initScriptManager() @initScriptManager()
@insertSubviews ladderGame: @otherSession? @insertSubviews ladderGame: (@level.get('type') is "ladder")
@initVolume() @initVolume()
@session.on 'change:multiplayer', @onMultiplayerChanged, @ @session.on 'change:multiplayer', @onMultiplayerChanged, @
@originalSessionState = _.cloneDeep(@session.get('state')) @originalSessionState = _.cloneDeep(@session.get('state'))
@ -202,6 +201,12 @@ module.exports = class PlayLevelView extends View
# For now, ladderGame will disallow multiplayer, because session code combining doesn't play nice yet. # For now, ladderGame will disallow multiplayer, because session code combining doesn't play nice yet.
@session.set 'multiplayer', false @session.set 'multiplayer', false
onLevelStarted: (e) ->
@loadingView?.unveil()
onLoadingViewUnveiled: (e) ->
@removeSubView @loadingView
@loadingView = null
onSupermodelLoadedOne: => onSupermodelLoadedOne: =>
@modelsLoaded ?= 0 @modelsLoaded ?= 0

View file

@ -20,6 +20,7 @@ Camera = require 'lib/surface/Camera'
AudioPlayer = require 'lib/AudioPlayer' AudioPlayer = require 'lib/AudioPlayer'
# subviews # subviews
LoadingView = require './level/level_loading_view'
TomeView = require './level/tome/tome_view' TomeView = require './level/tome/tome_view'
ChatView = require './level/level_chat_view' ChatView = require './level/level_chat_view'
HUDView = require './level/hud_view' HUDView = require './level/hud_view'
@ -30,8 +31,6 @@ GoldView = require './level/gold_view'
VictoryModal = require './level/modal/victory_modal' VictoryModal = require './level/modal/victory_modal'
InfiniteLoopModal = require './level/modal/infinite_loop_modal' InfiniteLoopModal = require './level/modal/infinite_loop_modal'
LoadingScreen = require 'lib/LoadingScreen'
PROFILE_ME = false PROFILE_ME = false
module.exports = class SpectateLevelView extends View module.exports = class SpectateLevelView extends View
@ -57,6 +56,8 @@ module.exports = class SpectateLevelView extends View
'level:set-team': 'setTeam' 'level:set-team': 'setTeam'
'god:new-world-created': 'loadSoundsForWorld' 'god:new-world-created': 'loadSoundsForWorld'
'next-game-pressed': 'onNextGamePressed' 'next-game-pressed': 'onNextGamePressed'
'level:started': 'onLevelStarted'
'level:loading-view-unveiled': 'onLoadingViewUnveiled'
events: events:
'click #level-done-button': 'onDonePressed' 'click #level-done-button': 'onDonePressed'
@ -70,9 +71,13 @@ module.exports = class SpectateLevelView extends View
super options super options
$(window).on('resize', @onWindowResize) $(window).on('resize', @onWindowResize)
@supermodel.once 'error', @onLevelLoadError @supermodel.once 'error', @onLevelLoadError
@sessionOne = @getQueryVariable 'session-one' @sessionOne = @getQueryVariable 'session-one'
@sessionTwo = @getQueryVariable 'session-two' @sessionTwo = @getQueryVariable 'session-two'
if options.spectateSessions
@sessionOne = options.spectateSessions.sessionOne
@sessionTwo = options.spectateSessions.sessionTwo
if not @sessionOne or not @sessionTwo if not @sessionOne or not @sessionTwo
@fetchRandomSessionPair (err, data) => @fetchRandomSessionPair (err, data) =>
if err? then return console.log "There was an error fetching the random session pair: #{data}" if err? then return console.log "There was an error fetching the random session pair: #{data}"
@ -112,8 +117,7 @@ module.exports = class SpectateLevelView extends View
afterRender: -> afterRender: ->
window.onPlayLevelViewLoaded? @ # still a hack window.onPlayLevelViewLoaded? @ # still a hack
@loadingScreen = new LoadingScreen(@$el.find('canvas')[0]) @insertSubView @loadingView = new LoadingView {}
@loadingScreen.show()
@$el.find('#level-done-button').hide() @$el.find('#level-done-button').hide()
super() super()
@ -141,14 +145,13 @@ module.exports = class SpectateLevelView extends View
return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early
# Save latest level played in local storage # Save latest level played in local storage
if window.currentModal and not window.currentModal.destroyed if window.currentModal and not window.currentModal.destroyed
@loadingScreen.showReady() @loadingView.showReady()
return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @ return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
@grabLevelLoaderData() @grabLevelLoaderData()
#at this point, all requisite data is loaded, and sessions are not denormalized #at this point, all requisite data is loaded, and sessions are not denormalized
team = @world.teamForPlayer(0) team = @world.teamForPlayer(0)
@loadOpponentTeam(team) @loadOpponentTeam(team)
@loadingScreen.destroy()
@god.level = @level.serialize @supermodel @god.level = @level.serialize @supermodel
@god.worldClassMap = @world.classMap @god.worldClassMap = @world.classMap
@setTeam team @setTeam team
@ -157,7 +160,7 @@ module.exports = class SpectateLevelView extends View
@initScriptManager() @initScriptManager()
@insertSubviews ladderGame: @otherSession? @insertSubviews ladderGame: @otherSession?
@initVolume() @initVolume()
@originalSessionState = _.cloneDeep(@session.get('state')) @originalSessionState = _.cloneDeep(@session.get('state'))
@register() @register()
@controlBar.setBus(@bus) @controlBar.setBus(@bus)
@ -167,11 +170,13 @@ module.exports = class SpectateLevelView extends View
id: @session.get('creator') id: @session.get('creator')
name: @session.get('creatorName') name: @session.get('creatorName')
team: @session.get('team') team: @session.get('team')
levelSlug: @level.get('slug')
@surface.createOpponentWizard @surface.createOpponentWizard
id: @otherSession.get('creator') id: @otherSession.get('creator')
name: @otherSession.get('creatorName') name: @otherSession.get('creatorName')
team: @otherSession.get('team') team: @otherSession.get('team')
levelSlug: @level.get('slug')
grabLevelLoaderData: -> grabLevelLoaderData: ->
@session = @levelLoader.session @session = @levelLoader.session
@ -199,6 +204,12 @@ module.exports = class SpectateLevelView extends View
# For now, ladderGame will disallow multiplayer, because session code combining doesn't play nice yet. # For now, ladderGame will disallow multiplayer, because session code combining doesn't play nice yet.
@session.set 'multiplayer', false @session.set 'multiplayer', false
onLevelStarted: (e) ->
@loadingView?.unveil()
onLoadingViewUnveiled: (e) ->
@removeSubView @loadingView
@loadingView = null
onSupermodelLoadedOne: => onSupermodelLoadedOne: =>
@modelsLoaded ?= 0 @modelsLoaded ?= 0
@ -429,12 +440,11 @@ module.exports = class SpectateLevelView extends View
if err? then return console.log "There was an error fetching the random session pair: #{data}" if err? then return console.log "There was an error fetching the random session pair: #{data}"
@sessionOne = data[0]._id @sessionOne = data[0]._id
@sessionTwo = data[1]._id @sessionTwo = data[1]._id
console.log "Playing session #{@sessionOne} against #{@sessionTwo}" url = "/play/spectate/#{@levelID}?session-one=#{@sessionOne}&session-two=#{@sessionTwo}"
url = "/play/spectate/dungeon-arena?session-one=#{@sessionOne}&session-two=#{@sessionTwo}"
Backbone.Mediator.publish 'router:navigate', { Backbone.Mediator.publish 'router:navigate', {
route: url, route: url,
viewClass: SpectateLevelView, viewClass: SpectateLevelView,
viewArgs: [{spectateSessions:{sessionOne: @sessionOne, sessionTwo: @sessionTwo}}, "dungeon-arena"]} viewArgs: [{spectateSessions:{sessionOne: @sessionOne, sessionTwo: @sessionTwo}}, @levelID ]}
fetchRandomSessionPair: (cb) -> fetchRandomSessionPair: (cb) ->
console.log "Fetching random session pair!" console.log "Fetching random session pair!"
@ -447,10 +457,6 @@ module.exports = class SpectateLevelView extends View
cb("error", jqxhr.statusText) cb("error", jqxhr.statusText)
else else
cb(null, $.parseJSON(jqxhr.responseText)) cb(null, $.parseJSON(jqxhr.responseText))
destroy: ()-> destroy: ()->
@supermodel?.off 'error', @onLevelLoadError @supermodel?.off 'error', @onLevelLoadError

View file

@ -185,7 +185,8 @@ class MongoQueue extends events.EventEmitter
subscribe: (eventName, callback) -> @on eventName, callback subscribe: (eventName, callback) -> @on eventName, callback
unsubscribe: (eventName, callback) -> @removeListener eventName, callback unsubscribe: (eventName, callback) -> @removeListener eventName, callback
totalMessagesInQueue: (callback) -> @Message.count {}, callback
receiveMessage: (callback) -> receiveMessage: (callback) ->
conditions = conditions =
queue: @queueName queue: @queueName

View file

@ -24,6 +24,14 @@ connectToScoringQueue = ->
if error? then throw new Error "There was an error registering the scoring queue: #{error}" if error? then throw new Error "There was an error registering the scoring queue: #{error}"
scoringTaskQueue = data scoringTaskQueue = data
log.info "Connected to scoring task queue!" log.info "Connected to scoring task queue!"
module.exports.messagesInQueueCount = (req, res) ->
scoringTaskQueue.totalMessagesInQueue (err, count) ->
if err? then return errors.serverError res, "There was an issue finding the Mongoose count:#{err}"
response = String(count)
res.send(response)
res.end()
module.exports.addPairwiseTaskToQueueFromRequest = (req, res) -> module.exports.addPairwiseTaskToQueueFromRequest = (req, res) ->
taskPair = req.body.sessions taskPair = req.body.sessions

View file

@ -100,8 +100,8 @@ sendLadderUpdateEmail = (session, daysAgo) ->
context = context =
email_id: sendwithus.templates.ladder_update_email email_id: sendwithus.templates.ladder_update_email
recipient: recipient:
#address: user.email address: user.email
address: 'nick@codecombat.com' # Debugging #address: 'nick@codecombat.com' # Debugging
name: name name: name
email_data: email_data:
name: name name: name

View file

@ -9,6 +9,11 @@ module.exports.setup = (app) ->
#app.post '/queue/scoring/pairwise', (req, res) -> #app.post '/queue/scoring/pairwise', (req, res) ->
# handler = loadQueueHandler 'scoring' # handler = loadQueueHandler 'scoring'
# handler.addPairwiseTaskToQueue req, res # handler.addPairwiseTaskToQueue req, res
app.get '/queue/messagesInQueueCount', (req, res) ->
handler = loadQueueHandler 'scoring'
handler.messagesInQueueCount req, res
app.all '/queue/*', (req, res) -> app.all '/queue/*', (req, res) ->
setResponseHeaderToJSONContentType res setResponseHeaderToJSONContentType res

View file

@ -20,7 +20,7 @@ config = require './server_config'
# self.emit('pass',message) # self.emit('pass',message)
# next() # next()
productionLogging = (tokens, req, res)-> productionLogging = (tokens, req, res) ->
status = res.statusCode status = res.statusCode
color = 32 color = 32
if status >= 500 then color = 31 if status >= 500 then color = 31