Added some levels to the forest map. Beating levels and returning home now takes you to the proper map.

This commit is contained in:
Nick Winter 2014-10-29 10:47:17 -07:00
parent 642fda9520
commit efa28b1064
3 changed files with 71 additions and 16 deletions

View file

@ -100,7 +100,7 @@ module.exports = class WorldMapView extends RootView
super()
@onWindowResize()
unless application.isIPadApp
_.defer => @$el.find('.game-controls .btn').tooltip() # Have to defer or i18n doesn't take effect.
_.defer => @$el?.find('.game-controls .btn').tooltip() # Have to defer or i18n doesn't take effect.
@$el.find('.level').tooltip()
@$el.addClass _.string.slugify @terrain
@updateVolume()
@ -865,6 +865,17 @@ dungeon = [
nextLevels:
continue: 'defense-of-plainswood'
}
{
name: 'Cavern Survival'
type: 'hero-ladder'
difficulty: 1
id: 'cavern-survival'
original: '544437e0645c0c0000c3291d'
description: 'Stay alive longer than your opponent amidst hordes of ogres!'
disabled: not me.isAdmin()
x: 17.54
y: 78.39
}
]
forest = [
@ -875,19 +886,39 @@ forest = [
id: 'defense-of-plainswood'
original: '541b67f71ccc8eaae19f3c62'
description: 'Protect the peasants from the pursuing ogres.'
x: 48
y: 65
x: 29.63
y: 53.69
}
{
name: 'Dueling Grounds'
type: 'hero-ladder'
name: 'Winding Trail'
type: 'hero'
difficulty: 1
id: 'dueling-grounds'
original: '5442ba0e1e835500007eb1c7'
description: 'Battle head-to-head against another hero in this basic beginner combat arena.'
disabled: not me.isAdmin()
x: 26
y: 77
id: 'winding-trail'
original: '5446cb40ce01c23e05ecf027'
description: 'Stay alive and navigate through the forest.'
x: 39.03
y: 54.97
}
{
name: 'Thornbush Farm'
type: 'hero'
difficulty: 1
id: 'thornbush-farm'
original: '5447030525cce60000745e2a'
description: 'Determine refugee peasant from ogre when defending the farm.'
x: 44.09
y: 57.75
}
{
name: 'A Fiery Trap'
type: 'hero'
difficulty: 1
id: 'a-fiery-trap'
original: '5448330517d7283e051f9b9e'
description: 'Patrol the village entrances, but stay defensive.'
disabled: true
x: 40.14
y: 63.96
}
#{
# name: ''
@ -934,7 +965,17 @@ forest = [
# x: 84.29
# y: 61.23
#}
{
name: 'Dueling Grounds'
type: 'hero-ladder'
difficulty: 1
id: 'dueling-grounds'
original: '5442ba0e1e835500007eb1c7'
description: 'Battle head-to-head against another hero in this basic beginner combat arena.'
disabled: not me.isAdmin()
x: 25.5
y: 77.5
}
]
WorldMapView.campaigns = campaigns = [

View file

@ -54,6 +54,10 @@ module.exports = class ControlBarView extends CocoView
else if @level.get('type', true) in ['hero', 'hero-coop']
@homeLink = c.homeLink = '/play'
@homeViewClass = require 'views/play/WorldMapView'
# TODO: dynamically figure out which world map to return to
if @level.get('slug') in ['defense-of-plainswood', 'winding-trail', 'thornbush-farm', 'a-fiery-trap']
@homeLink += '/forest'
@homeViewArgs.push 'forest'
else
@homeLink = c.homeLink = '/'
@homeViewClass = require 'views/HomeView'

View file

@ -269,9 +269,18 @@ module.exports = class HeroVictoryModal extends ModalView
break
levelInfo?.nextLevels?[type] # 'more_practice', 'skip_ahead', 'continue'
getNextLevelMap: ->
# TODO: dynamically figure out which world map to return to
if @level.get('slug') in ['kithgard-gates', 'defense-of-plainswood', 'winding-trail', 'thornbush-farm', 'a-fiery-trap']
return 'forest'
return 'dungeon'
getNextLevelLink: (type) ->
return '/play' unless nextLevel = @getNextLevel type
"play?next=#{nextLevel}"
link = '/play'
nextMap = @getNextLevelMap()
link += '/' + nextMap unless nextMap is 'dungeon'
return link unless nextLevel = @getNextLevel type
"#{link}?next=#{nextLevel}"
onClickContinue: (e) ->
nextLevelLink = @continueLevelLink
@ -281,13 +290,14 @@ module.exports = class HeroVictoryModal extends ModalView
skipPrompt ||= not (@skipAheadLevelLink or @morePractiveLevelLink) and me.getBranchingGroup() is 'choice-explicit'
if skipPrompt
# Preserve the supermodel as we navigate back to the world map.
Backbone.Mediator.publish 'router:navigate', route: nextLevelLink, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}]
Backbone.Mediator.publish 'router:navigate', route: nextLevelLink, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelMap()]
else
# Hide everything except the buttons prompting them for which kind of next level to do
@$el.find('.modal-footer, .modal-body > *').hide()
@$el.find('.next-levels-prompt').show()
onClickNextLevelBranch: (e) ->
e.preventDefault()
application.tracker?.trackEvent 'Branch Selected', level: @level.get('slug'), label: @level.get('slug'), branch: $(e.target).data('branch-key'), branchingGroup: me.getBranchingGroup()
# Preserve the supermodel as we navigate back to world map.
Backbone.Mediator.publish 'router:navigate', route: '/play', viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}]
Backbone.Mediator.publish 'router:navigate', route: $(e.target).attr('href'), viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelMap()]