mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Merge branch 'feature/play-button' of https://github.com/dristic/codecombat into test
This commit is contained in:
commit
1f486c3cb6
2 changed files with 15 additions and 0 deletions
|
@ -34,6 +34,17 @@ module.exports = class HomeView extends View
|
|||
@wizardType.fetch()
|
||||
@wizardType.once 'sync', @initCanvas
|
||||
|
||||
# Try to find latest level and set "Play" link to go to that level
|
||||
if localStorage?
|
||||
lastLevel = localStorage["lastLevel"]
|
||||
if lastLevel? and lastLevel isnt ""
|
||||
playLink = @$el.find("#beginner-campaign")
|
||||
if playLink?
|
||||
href = playLink.attr("href").split("/")
|
||||
href[href.length-1] = lastLevel if href.length isnt 0
|
||||
href = href.join("/")
|
||||
playLink.attr("href", href)
|
||||
|
||||
initCanvas: =>
|
||||
@stage = new createjs.Stage($('#beginner-campaign canvas', @$el)[0])
|
||||
@createWizard()
|
||||
|
|
|
@ -81,6 +81,10 @@ module.exports = class PlayLevelView extends View
|
|||
|
||||
@load() unless @isEditorPreview
|
||||
|
||||
# Save latest level played in local storage
|
||||
if localStorage?
|
||||
localStorage["lastLevel"] = @levelID
|
||||
|
||||
setLevel: (@level, @supermodel) ->
|
||||
@god?.level = @level.serialize @supermodel
|
||||
@load()
|
||||
|
|
Loading…
Reference in a new issue