mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-01 11:27:14 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
77117920a2
16 changed files with 46 additions and 355 deletions
|
@ -74,8 +74,9 @@ module.exports = class CocoRouter extends Backbone.Router
|
||||||
|
|
||||||
'multiplayer': go('MultiplayerView')
|
'multiplayer': go('MultiplayerView')
|
||||||
|
|
||||||
'play': go('play/MainPlayView') # This will become 'play-old' or something.
|
'play-old': go('play/MainPlayView') # This used to be 'play'.
|
||||||
'play-hero': go('play/WorldMapView') # This will become 'play' when it is done.
|
'play': go('play/WorldMapView')
|
||||||
|
'play-hero': go('play/WorldMapView') # Legacy URL for /play; leave up until start of 2015, I guess.
|
||||||
'play/ladder/:levelID': go('play/ladder/LadderView')
|
'play/ladder/:levelID': go('play/ladder/LadderView')
|
||||||
'play/ladder': go('play/ladder/MainLadderView')
|
'play/ladder': go('play/ladder/MainLadderView')
|
||||||
'play/level/:levelID': go('play/level/PlayLevelView')
|
'play/level/:levelID': go('play/level/PlayLevelView')
|
||||||
|
|
BIN
app/assets/images/pages/home/play_img.png
Normal file
BIN
app/assets/images/pages/home/play_img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 KiB |
|
@ -142,10 +142,8 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
|
|
||||||
setWorld: (@world) ->
|
setWorld: (@world) ->
|
||||||
@worldLoaded = true
|
@worldLoaded = true
|
||||||
lastFrame = Math.min(@getCurrentFrame(), @world.frames.length - 1)
|
|
||||||
@world.getFrame(lastFrame).restoreState() unless @options.choosing
|
|
||||||
@spriteBoss.world = @world
|
@spriteBoss.world = @world
|
||||||
|
@restoreWorldState() unless @options.choosing
|
||||||
@showLevel()
|
@showLevel()
|
||||||
@updateState true if @loaded
|
@updateState true if @loaded
|
||||||
@onFrameChanged()
|
@onFrameChanged()
|
||||||
|
|
|
@ -117,6 +117,7 @@
|
||||||
adventurer_forum: "the Adventurer forum"
|
adventurer_forum: "the Adventurer forum"
|
||||||
adventurer_suffix: "."
|
adventurer_suffix: "."
|
||||||
campaign_beginner: "Beginner Campaign"
|
campaign_beginner: "Beginner Campaign"
|
||||||
|
campaign_old_beginner: "Old Beginner Campaign"
|
||||||
campaign_beginner_description: "... in which you learn the wizardry of programming."
|
campaign_beginner_description: "... in which you learn the wizardry of programming."
|
||||||
campaign_dev: "Random Harder Levels"
|
campaign_dev: "Random Harder Levels"
|
||||||
campaign_dev_description: "... in which you learn the interface while doing something a little harder."
|
campaign_dev_description: "... in which you learn the interface while doing something a little harder."
|
||||||
|
@ -139,6 +140,7 @@
|
||||||
next: "Next"
|
next: "Next"
|
||||||
previous: "Previous"
|
previous: "Previous"
|
||||||
choose_inventory: "Equip Items"
|
choose_inventory: "Equip Items"
|
||||||
|
older_campaigns: "Older Campaigns"
|
||||||
|
|
||||||
items:
|
items:
|
||||||
armor: "Armor"
|
armor: "Armor"
|
||||||
|
|
|
@ -196,7 +196,7 @@ a.disabled
|
||||||
.navbar-toggle
|
.navbar-toggle
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
@media only screen and (max-width: 800px)
|
@media only screen and (max-width: 768px)
|
||||||
#top-nav
|
#top-nav
|
||||||
display: inline
|
display: inline
|
||||||
button.navbar-toggle
|
button.navbar-toggle
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
display: block
|
display: block
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
@include transition(box-shadow .50s ease-in-out)
|
@include transition(box-shadow .50s ease-in-out)
|
||||||
|
border-radius: 11px
|
||||||
|
|
||||||
text-shadow: 2px 2px 5px black
|
text-shadow: 2px 2px 5px black
|
||||||
|
|
||||||
|
@ -63,175 +64,11 @@
|
||||||
filter: invert(100%)
|
filter: invert(100%)
|
||||||
-webkit-filter: invert(100%)
|
-webkit-filter: invert(100%)
|
||||||
|
|
||||||
.code-languages
|
@media only screen and (max-width: 768px)
|
||||||
margin: 10px 0 30px 0
|
|
||||||
|
|
||||||
&:hover
|
|
||||||
.code-language
|
|
||||||
opacity: 0.6
|
|
||||||
|
|
||||||
.code-language.selected-language:not(:hover)
|
|
||||||
opacity: 0.8
|
|
||||||
|
|
||||||
h2, h3
|
|
||||||
text-shadow: none
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
opacity: 0.5
|
|
||||||
|
|
||||||
.language-play-count
|
|
||||||
text-transform: lowercase
|
|
||||||
position: absolute
|
|
||||||
left: 0
|
|
||||||
top: 0
|
|
||||||
|
|
||||||
.code-language
|
|
||||||
cursor: pointer
|
|
||||||
text-align: center
|
|
||||||
position: relative
|
|
||||||
opacity: 0.6
|
|
||||||
|
|
||||||
&:hover
|
|
||||||
opacity: 1
|
|
||||||
|
|
||||||
h2, h3
|
|
||||||
text-shadow: 0px 0px 5px white
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
display: block
|
|
||||||
opacity: 1
|
|
||||||
|
|
||||||
&.selected-language
|
|
||||||
opacity: 1
|
|
||||||
|
|
||||||
h2, h3
|
|
||||||
text-shadow: 0px 0px 5px white
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
display: block
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
position: absolute
|
|
||||||
background: transparent url(/images/pages/home/wizard.png) no-repeat
|
|
||||||
background-size: contain
|
|
||||||
width: 111px
|
|
||||||
height: 97px
|
|
||||||
display: none
|
|
||||||
|
|
||||||
.code-language-beta
|
|
||||||
background: transparent url(/images/pages/home/language_beta_sticker.png) no-repeat
|
|
||||||
background-size: contain
|
|
||||||
width: 100px
|
|
||||||
height: 32px
|
|
||||||
position: absolute
|
|
||||||
right: 20px
|
|
||||||
top: -7px
|
|
||||||
|
|
||||||
.primary-code-languages
|
|
||||||
|
|
||||||
#javascript
|
|
||||||
background: transparent url(/images/pages/home/language_js.png) no-repeat
|
|
||||||
padding-right: 150px
|
|
||||||
|
|
||||||
.language-play-count
|
|
||||||
right: -100px
|
|
||||||
.code-wizard
|
|
||||||
left: 120px
|
|
||||||
|
|
||||||
#python
|
|
||||||
background: transparent url(/images/pages/home/language_python.png) no-repeat
|
|
||||||
padding-left: 150px
|
|
||||||
|
|
||||||
.language-play-count
|
|
||||||
left: 125px
|
|
||||||
.code-wizard
|
|
||||||
right: 120px
|
|
||||||
|
|
||||||
.code-language
|
|
||||||
width: 498px
|
|
||||||
height: 153px
|
|
||||||
padding: 30px
|
|
||||||
margin: 0px 0 0 -6px
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
top: -65px
|
|
||||||
|
|
||||||
h2
|
|
||||||
margin: 15px 0 5px
|
|
||||||
|
|
||||||
p
|
|
||||||
overflow: hidden
|
|
||||||
height: 40px
|
|
||||||
|
|
||||||
.secondary-code-languages
|
|
||||||
margin-left: -10px
|
|
||||||
|
|
||||||
.col-md-3
|
|
||||||
padding: 0px
|
|
||||||
|
|
||||||
.language-play-count
|
|
||||||
left: 15px
|
|
||||||
top: -15px
|
|
||||||
|
|
||||||
.code-language
|
|
||||||
background: transparent url(/images/pages/home/language_background_small.png) no-repeat
|
|
||||||
width: 250px
|
|
||||||
height: 80px
|
|
||||||
margin: 20px 0 20px 0
|
|
||||||
padding: 20px 20px 20px 70px
|
|
||||||
|
|
||||||
.code-wizard
|
|
||||||
top: -51px
|
|
||||||
left: 89px
|
|
||||||
height: 63px
|
|
||||||
|
|
||||||
.code-language-logo
|
|
||||||
position: absolute
|
|
||||||
left: 15px
|
|
||||||
top: 17px
|
|
||||||
width: 50px
|
|
||||||
height: 50px
|
|
||||||
|
|
||||||
.code-language-beta
|
|
||||||
right: -15px
|
|
||||||
top: -16px
|
|
||||||
height: 24px
|
|
||||||
|
|
||||||
h3
|
|
||||||
margin: 0
|
|
||||||
padding: 0
|
|
||||||
|
|
||||||
p
|
|
||||||
white-space: nowrap
|
|
||||||
text-overflow: ellipsis
|
|
||||||
overflow: hidden
|
|
||||||
|
|
||||||
#coffeescript .code-language-logo
|
|
||||||
background: transparent url(/images/common/code_languages/coffeescript_small.png) no-repeat center
|
|
||||||
|
|
||||||
#clojure .code-language-logo
|
|
||||||
background: transparent url(/images/common/code_languages/clojure_small.png) no-repeat center
|
|
||||||
|
|
||||||
#lua .code-language-logo
|
|
||||||
background: transparent url(/images/common/code_languages/lua_small.png) no-repeat center
|
|
||||||
|
|
||||||
#io .code-language-logo
|
|
||||||
background: transparent url(/images/common/code_languages/io_small.png) no-repeat center
|
|
||||||
|
|
||||||
|
|
||||||
#mobile-trailer-wrapper
|
|
||||||
display: none
|
|
||||||
|
|
||||||
@media only screen and (max-width: 800px)
|
|
||||||
#home-view
|
#home-view
|
||||||
#site-slogan
|
#site-slogan
|
||||||
font-size: 30px
|
font-size: 30px
|
||||||
margin-bottom: 30px
|
margin-bottom: 30px
|
||||||
.code-languages
|
|
||||||
.col-sm-6, .col-sm-3
|
|
||||||
margin-top: 30px
|
|
||||||
.code-language
|
|
||||||
margin: 0px auto
|
|
||||||
.game-mode-wrapper
|
.game-mode-wrapper
|
||||||
width: 100%
|
width: 100%
|
||||||
img
|
img
|
||||||
|
@ -244,9 +81,6 @@
|
||||||
font-size: 50px
|
font-size: 50px
|
||||||
font-family: Bangers
|
font-family: Bangers
|
||||||
@include transition(color .10s linear)
|
@include transition(color .10s linear)
|
||||||
.code-language-logo
|
|
||||||
right: 0px
|
|
||||||
top: 5px
|
|
||||||
|
|
||||||
h1
|
h1
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
|
@ -180,3 +180,17 @@ $gameControlMargin: 30px
|
||||||
|
|
||||||
.tooltip
|
.tooltip
|
||||||
font-size: 24px
|
font-size: 24px
|
||||||
|
|
||||||
|
.old-levels
|
||||||
|
position: absolute
|
||||||
|
bottom: 1%
|
||||||
|
left: 1%
|
||||||
|
z-index: 3
|
||||||
|
|
||||||
|
a
|
||||||
|
font-size: 20px
|
||||||
|
color: #eee
|
||||||
|
text-decoration: underline
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
color: white
|
||||||
|
|
|
@ -14,10 +14,6 @@ body
|
||||||
img(src="/images/pages/base/logo.png", title="CodeCombat - Learn how to code by playing a game", alt="CodeCombat")
|
img(src="/images/pages/base/logo.png", title="CodeCombat - Learn how to code by playing a game", alt="CodeCombat")
|
||||||
|
|
||||||
ul(class='navbar-link-text').nav.navbar-nav.navbar-collapse.collapse
|
ul(class='navbar-link-text').nav.navbar-nav.navbar-collapse.collapse
|
||||||
li.play
|
|
||||||
a.header-font(href='/play', data-i18n="nav.play") Levels
|
|
||||||
li
|
|
||||||
a.header-font(href='/community', data-i18n="nav.community") Community
|
|
||||||
if me.get('anonymous') === false
|
if me.get('anonymous') === false
|
||||||
li.dropdown
|
li.dropdown
|
||||||
button.btn.btn-primary.navbuttontext.header-font.dropdown-toggle(href="#", data-toggle="dropdown")
|
button.btn.btn-primary.navbuttontext.header-font.dropdown-toggle(href="#", data-toggle="dropdown")
|
||||||
|
@ -68,12 +64,14 @@ body
|
||||||
.content
|
.content
|
||||||
p.footer-link-text
|
p.footer-link-text
|
||||||
if pathname == "/" || (me.get('permissions', true)).indexOf('employer') != -1
|
if pathname == "/" || (me.get('permissions', true)).indexOf('employer') != -1
|
||||||
a(href='/employers', title='Home', tabindex=-1, data-i18n="nav.employers") Employers
|
a(href='/employers', tabindex=-1, data-i18n="nav.employers") Employers
|
||||||
else
|
else
|
||||||
a(href='/', title='Home', tabindex=-1, data-i18n="nav.home") Home
|
a(href='/', tabindex=-1, data-i18n="nav.home") Home
|
||||||
a(href='/contribute', title='Contribute', tabindex=-1, data-i18n="nav.contribute") Contribute
|
a(href='/play/ladder', tabindex=-1, data-i18n="home.multiplayer") Multiplayer
|
||||||
a(href='/legal', title='Legal', tabindex=-1, data-i18n="nav.legal") Legal
|
a(href='/community', tabindex=-1, data-i18n="nav.community") Community
|
||||||
a(href='/about', title='About', tabindex=-1, data-i18n="nav.about") About
|
a(href='/contribute', tabindex=-1, data-i18n="nav.contribute") Contribute
|
||||||
|
a(href='/legal', tabindex=-1, data-i18n="nav.legal") Legal
|
||||||
|
a(href='/about', tabindex=-1, data-i18n="nav.about") About
|
||||||
a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="modal/ContactModal", data-i18n="nav.contact") Contact
|
a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="modal/ContactModal", data-i18n="nav.contact") Contact
|
||||||
a(href='http://blog.codecombat.com/', data-i18n="nav.blog") Blog
|
a(href='http://blog.codecombat.com/', data-i18n="nav.blog") Blog
|
||||||
a(href='http://discourse.codecombat.com/', data-i18n="nav.forum") Forum
|
a(href='http://discourse.codecombat.com/', data-i18n="nav.forum") Forum
|
||||||
|
|
|
@ -4,84 +4,6 @@ block content
|
||||||
|
|
||||||
h1#site-slogan(data-i18n="home.slogan") Learn to Code by Playing a Game
|
h1#site-slogan(data-i18n="home.slogan") Learn to Code by Playing a Game
|
||||||
|
|
||||||
.code-languages
|
|
||||||
.primary-code-languages.row
|
|
||||||
.col-sm-6
|
|
||||||
.code-language#javascript(data-code-language='javascript')
|
|
||||||
.code-wizard
|
|
||||||
h2 JavaScript
|
|
||||||
p(data-i18n="home.javascript_blurb") The language of the web. Great for writing websites, web apps, HTML5 games, and servers.
|
|
||||||
- var playCount = codeLanguageCountMap.javascript
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.col-sm-6
|
|
||||||
.code-language.beta#python(data-code-language='python')
|
|
||||||
.code-wizard
|
|
||||||
.code-language-beta
|
|
||||||
h2 Python
|
|
||||||
p(data-i18n="home.python_blurb") Simple yet powerful, Python is a great general purpose programming language.
|
|
||||||
- var playCount = codeLanguageCountMap.python
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.secondary-code-languages.row
|
|
||||||
.col-sm-3
|
|
||||||
.code-language.beta#coffeescript(data-code-language='coffeescript')
|
|
||||||
.code-language-logo
|
|
||||||
.code-wizard
|
|
||||||
.code-language-beta
|
|
||||||
h3 CoffeeScript
|
|
||||||
p(data-i18n="home.coffeescript_blurb") Nicer JavaScript syntax.
|
|
||||||
- var playCount = codeLanguageCountMap.coffeescript
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.col-sm-3
|
|
||||||
.code-language.beta#clojure(data-code-language='clojure')
|
|
||||||
.code-language-logo
|
|
||||||
.code-wizard
|
|
||||||
.code-language-beta
|
|
||||||
h3 Clojure
|
|
||||||
p(data-i18n="home.clojure_blurb") A modern Lisp.
|
|
||||||
- var playCount = codeLanguageCountMap.clojure
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.col-sm-3
|
|
||||||
.code-language.beta#lua(data-code-language='lua')
|
|
||||||
.code-language-logo
|
|
||||||
.code-wizard
|
|
||||||
.code-language-beta
|
|
||||||
h3 Lua
|
|
||||||
p(data-i18n="home.lua_blurb") Game scripting language.
|
|
||||||
- var playCount = codeLanguageCountMap.lua
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.col-sm-3
|
|
||||||
.code-language.beta#io(data-code-language='io', title="Careful: Io is still quite buggy")
|
|
||||||
.code-language-logo
|
|
||||||
.code-wizard
|
|
||||||
.code-language-beta
|
|
||||||
h3 Io
|
|
||||||
p(data-i18n="home.io_blurb") Simple but obscure.
|
|
||||||
- var playCount = codeLanguageCountMap.io
|
|
||||||
if playCount
|
|
||||||
div.language-play-count
|
|
||||||
span.spr= playCount
|
|
||||||
span(data-i18n="resources.sessions") sessions
|
|
||||||
|
|
||||||
.alert.alert-danger.lt-ie10
|
.alert.alert-danger.lt-ie10
|
||||||
strong(data-i18n="home.no_ie") CodeCombat does not run in Internet Explorer 9 or older. Sorry!
|
strong(data-i18n="home.no_ie") CodeCombat does not run in Internet Explorer 9 or older. Sorry!
|
||||||
|
|
||||||
|
@ -94,26 +16,11 @@ block content
|
||||||
br
|
br
|
||||||
span(data-i18n="home.old_browser_suffix") You can try anyway, but it probably won't work.
|
span(data-i18n="home.old_browser_suffix") You can try anyway, but it probably won't work.
|
||||||
|
|
||||||
a#beginner-campaign(href="/play/level/rescue-mission")
|
a#beginner-campaign(href="/play")
|
||||||
div.game-mode-wrapper
|
div.game-mode-wrapper
|
||||||
if isEnglish
|
img(src="/images/pages/home/play_img.png").img-rounded
|
||||||
img(src="/images/pages/home/campaign.jpg").img-rounded
|
|
||||||
else
|
|
||||||
img(src="/images/pages/home/campaign_notext.jpg").img-rounded
|
|
||||||
h3(data-i18n="home.campaign") Campaign
|
h3(data-i18n="home.campaign") Campaign
|
||||||
h4(data-i18n="home.for_beginners") For Beginners
|
h4(data-i18n="home.for_beginners") For Beginners
|
||||||
.play-text(data-i18n="home.play") Play
|
.play-text(data-i18n="home.play") Play
|
||||||
.code-language-logo
|
|
||||||
|
|
||||||
a#multiplayer(href="/play/ladder")
|
|
||||||
div.game-mode-wrapper
|
|
||||||
if isEnglish
|
|
||||||
img(src="/images/pages/home/multiplayer.jpg").img-rounded
|
|
||||||
else
|
|
||||||
img(src="/images/pages/home/multiplayer_notext.jpg").img-rounded
|
|
||||||
h3(data-i18n="home.multiplayer") Multiplayer
|
|
||||||
h4(data-i18n="home.for_developers") For Developers
|
|
||||||
.play-text(data-i18n="home.play") Play
|
|
||||||
.code-language-logo
|
|
||||||
|
|
||||||
.clearfix
|
.clearfix
|
||||||
|
|
|
@ -34,3 +34,6 @@
|
||||||
button.btn.achievements(data-toggle='coco-modal', data-target='play/modal/PlayAchievementsModal', data-i18n="[title]play.achievements")
|
button.btn.achievements(data-toggle='coco-modal', data-target='play/modal/PlayAchievementsModal', data-i18n="[title]play.achievements")
|
||||||
button.btn.account(data-toggle='coco-modal', data-target='play/modal/PlayAccountModal', data-i18n="[title]play.account")
|
button.btn.account(data-toggle='coco-modal', data-target='play/modal/PlayAccountModal', data-i18n="[title]play.account")
|
||||||
button.btn.settings(data-toggle='coco-modal', data-target='play/modal/PlaySettingsModal', data-i18n="[title]play.settings")
|
button.btn.settings(data-toggle='coco-modal', data-target='play/modal/PlaySettingsModal', data-i18n="[title]play.settings")
|
||||||
|
|
||||||
|
.old-levels
|
||||||
|
a(href="/play-old", data-i18n="play.older_campaigns").header-font Older Campaigns
|
||||||
|
|
|
@ -10,12 +10,7 @@ module.exports = class HomeView extends RootView
|
||||||
template: template
|
template: template
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click .code-language': 'onCodeLanguageSelected'
|
'click #beginner-campaign': 'onClickBeginnerCampaign'
|
||||||
|
|
||||||
constructor: ->
|
|
||||||
super(arguments...)
|
|
||||||
ThangType.loadUniversalWizard()
|
|
||||||
@getCodeLanguageCounts()
|
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
|
@ -28,61 +23,9 @@ module.exports = class HomeView extends RootView
|
||||||
console.warn 'no more jquery browser version...'
|
console.warn 'no more jquery browser version...'
|
||||||
c.isEnglish = (me.get('preferredLanguage') or 'en').startsWith 'en'
|
c.isEnglish = (me.get('preferredLanguage') or 'en').startsWith 'en'
|
||||||
c.languageName = me.get('preferredLanguage')
|
c.languageName = me.get('preferredLanguage')
|
||||||
c.codeLanguage = (me.get('aceConfig') ? {}).language or 'python'
|
|
||||||
c.codeLanguageCountMap = @codeLanguageCountMap
|
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
onClickBeginnerCampaign: (e) ->
|
||||||
super()
|
e.preventDefault()
|
||||||
@$el.find('.modal').on 'shown.bs.modal', ->
|
e.stopImmediatePropagation()
|
||||||
$('input:visible:first', @).focus()
|
window.open '/play', '_blank'
|
||||||
|
|
||||||
# Try to find latest level and set 'Play' link to go to that level
|
|
||||||
lastLevel = me.get('lastLevel')
|
|
||||||
lastLevel ?= localStorage?['lastLevel'] # Temp, until it's migrated to user property
|
|
||||||
if lastLevel
|
|
||||||
playLink = @$el.find('#beginner-campaign')
|
|
||||||
if playLink[0]?
|
|
||||||
href = playLink.attr('href').split('/')
|
|
||||||
href[href.length-1] = lastLevel if href.length isnt 0
|
|
||||||
href = href.join('/')
|
|
||||||
playLink.attr('href', href)
|
|
||||||
|
|
||||||
codeLanguage = (me.get('aceConfig') ? {}).language or 'python'
|
|
||||||
@$el.find(".code-language[data-code-language=#{codeLanguage}]").addClass 'selected-language'
|
|
||||||
@updateLanguageLogos codeLanguage
|
|
||||||
|
|
||||||
updateLanguageLogos: (codeLanguage) ->
|
|
||||||
@$el.find('.game-mode-wrapper .code-language-logo').css('background-image', "url(/images/common/code_languages/#{codeLanguage}_small.png)")
|
|
||||||
|
|
||||||
onCodeLanguageSelected: (e) ->
|
|
||||||
target = $(e.target).closest('.code-language')
|
|
||||||
codeLanguage = target.data('code-language')
|
|
||||||
@$el.find('.code-language').removeClass 'selected-language'
|
|
||||||
target.addClass 'selected-language'
|
|
||||||
aceConfig = me.get('aceConfig') ? {}
|
|
||||||
return if (aceConfig.language or 'python') is codeLanguage
|
|
||||||
aceConfig.language = codeLanguage
|
|
||||||
me.set 'aceConfig', aceConfig
|
|
||||||
me.save() # me.patch() doesn't work if aceConfig previously existed and we switched just once
|
|
||||||
|
|
||||||
firstButton = @$el.find('#beginner-campaign .game-mode-wrapper').delay(500).addClass('hovered', 500).delay(500).removeClass('hovered', 500)
|
|
||||||
lastButton = @$el.find('#multiplayer .game-mode-wrapper').delay(1000).addClass('hovered', 500).delay(500).removeClass('hovered', 500)
|
|
||||||
$('#page-container').animate {scrollTop: firstButton.offset().top - 100, easing: 'easeInOutCubic'}, 500
|
|
||||||
@updateLanguageLogos codeLanguage
|
|
||||||
|
|
||||||
getCodeLanguageCounts: ->
|
|
||||||
@codeLanguageCountMap = {}
|
|
||||||
success = (codeLanguageCounts) =>
|
|
||||||
return if @destroyed
|
|
||||||
for codeLanguage in codeLanguageCounts
|
|
||||||
@codeLanguageCountMap[codeLanguage._id] = codeLanguage.sessions
|
|
||||||
@codeLanguageCountMap.javascript += @codeLanguageCountMap[null]
|
|
||||||
@render() if @supermodel.finished()
|
|
||||||
|
|
||||||
codeLanguageCountsRequest = @supermodel.addRequestResource 'play_counts', {
|
|
||||||
url: '/db/level.session/-/code_language_counts'
|
|
||||||
method: 'POST'
|
|
||||||
success: success
|
|
||||||
}, 0
|
|
||||||
codeLanguageCountsRequest.load()
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ module.exports = class AuthModal extends ModalView
|
||||||
afterInsert: ->
|
afterInsert: ->
|
||||||
super()
|
super()
|
||||||
_.delay application.router.renderLoginButtons, 500
|
_.delay application.router.renderLoginButtons, 500
|
||||||
|
_.delay (=> $('input:visible:first', @$el).focus()), 500
|
||||||
|
|
||||||
onSignupInstead: (e) ->
|
onSignupInstead: (e) ->
|
||||||
@mode = 'signup'
|
@mode = 'signup'
|
||||||
|
|
|
@ -54,11 +54,6 @@ module.exports = class MainPlayView extends RootView
|
||||||
context.levelPlayCountMap = @levelPlayCountMap
|
context.levelPlayCountMap = @levelPlayCountMap
|
||||||
context
|
context
|
||||||
|
|
||||||
afterRender: ->
|
|
||||||
super()
|
|
||||||
@$el.find('.modal').on 'shown.bs.modal', ->
|
|
||||||
$('input:visible:first', @).focus()
|
|
||||||
|
|
||||||
|
|
||||||
tutorials = [
|
tutorials = [
|
||||||
{
|
{
|
||||||
|
@ -327,7 +322,7 @@ playerCreated = [
|
||||||
]
|
]
|
||||||
|
|
||||||
campaigns = [
|
campaigns = [
|
||||||
{id: 'beginner', name: 'Beginner Campaign', description: '... in which you learn the wizardry of programming.', levels: tutorials}
|
{id: 'old_beginner', name: 'Old Beginner Campaign', description: '... in which you learn the wizardry of programming.', levels: tutorials}
|
||||||
{id: 'multiplayer', name: 'Multiplayer Arenas', description: '... in which you code head-to-head against other players.', levels: arenas}
|
{id: 'multiplayer', name: 'Multiplayer Arenas', description: '... in which you code head-to-head against other players.', levels: arenas}
|
||||||
{id: 'dev', name: 'Random Harder Levels', description: '... in which you learn the interface while doing something a little harder.', levels: experienced}
|
{id: 'dev', name: 'Random Harder Levels', description: '... in which you learn the interface while doing something a little harder.', levels: experienced}
|
||||||
{id: 'classic' ,name: 'Classic Algorithms', description: '... in which you learn the most popular algorithms in Computer Science.', levels: classicAlgorithms}
|
{id: 'classic' ,name: 'Classic Algorithms', description: '... in which you learn the most popular algorithms in Computer Science.', levels: classicAlgorithms}
|
||||||
|
|
|
@ -54,11 +54,6 @@ module.exports = class LadderHomeView extends RootView
|
||||||
context.campaigns = campaigns
|
context.campaigns = campaigns
|
||||||
context
|
context
|
||||||
|
|
||||||
afterRender: ->
|
|
||||||
super()
|
|
||||||
@$el.find('.modal').on 'shown.bs.modal', ->
|
|
||||||
$('input:visible:first', @).focus()
|
|
||||||
|
|
||||||
|
|
||||||
arenas = [
|
arenas = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ module.exports = class ControlBarView extends CocoView
|
||||||
@homeViewClass = require 'views/play/ladder/LadderView'
|
@homeViewClass = require 'views/play/ladder/LadderView'
|
||||||
@homeViewArgs.push levelID
|
@homeViewArgs.push levelID
|
||||||
else if @level.get('type', true) is 'hero'
|
else if @level.get('type', true) is 'hero'
|
||||||
@homeLink = c.homeLink = '/play-hero'
|
@homeLink = c.homeLink = '/play'
|
||||||
@homeViewClass = require 'views/play/WorldMapView'
|
@homeViewClass = require 'views/play/WorldMapView'
|
||||||
else
|
else
|
||||||
@homeLink = c.homeLink = '/'
|
@homeLink = c.homeLink = '/'
|
||||||
|
|
|
@ -68,7 +68,7 @@ module.exports = class VictoryModal extends ModalView
|
||||||
onClickWorldMap: (e) ->
|
onClickWorldMap: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopImmediatePropagation()
|
e.stopImmediatePropagation()
|
||||||
Backbone.Mediator.publish 'router:navigate', route: '/play-hero', viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}]
|
Backbone.Mediator.publish 'router:navigate', route: '/play', viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}]
|
||||||
|
|
||||||
onGameSubmitted: (e) ->
|
onGameSubmitted: (e) ->
|
||||||
ladderURL = "/play/ladder/#{@level.get('slug')}#my-matches"
|
ladderURL = "/play/ladder/#{@level.get('slug')}#my-matches"
|
||||||
|
|
Loading…
Reference in a new issue