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() super()
@onWindowResize() @onWindowResize()
unless application.isIPadApp 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.find('.level').tooltip()
@$el.addClass _.string.slugify @terrain @$el.addClass _.string.slugify @terrain
@updateVolume() @updateVolume()
@ -865,6 +865,17 @@ dungeon = [
nextLevels: nextLevels:
continue: 'defense-of-plainswood' 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 = [ forest = [
@ -875,19 +886,39 @@ forest = [
id: 'defense-of-plainswood' id: 'defense-of-plainswood'
original: '541b67f71ccc8eaae19f3c62' original: '541b67f71ccc8eaae19f3c62'
description: 'Protect the peasants from the pursuing ogres.' description: 'Protect the peasants from the pursuing ogres.'
x: 48 x: 29.63
y: 65 y: 53.69
} }
{ {
name: 'Dueling Grounds' name: 'Winding Trail'
type: 'hero-ladder' type: 'hero'
difficulty: 1 difficulty: 1
id: 'dueling-grounds' id: 'winding-trail'
original: '5442ba0e1e835500007eb1c7' original: '5446cb40ce01c23e05ecf027'
description: 'Battle head-to-head against another hero in this basic beginner combat arena.' description: 'Stay alive and navigate through the forest.'
disabled: not me.isAdmin() x: 39.03
x: 26 y: 54.97
y: 77 }
{
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: '' # name: ''
@ -934,7 +965,17 @@ forest = [
# x: 84.29 # x: 84.29
# y: 61.23 # 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 = [ 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'] else if @level.get('type', true) in ['hero', 'hero-coop']
@homeLink = c.homeLink = '/play' @homeLink = c.homeLink = '/play'
@homeViewClass = require 'views/play/WorldMapView' @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 else
@homeLink = c.homeLink = '/' @homeLink = c.homeLink = '/'
@homeViewClass = require 'views/HomeView' @homeViewClass = require 'views/HomeView'

View file

@ -269,9 +269,18 @@ module.exports = class HeroVictoryModal extends ModalView
break break
levelInfo?.nextLevels?[type] # 'more_practice', 'skip_ahead', 'continue' 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) -> getNextLevelLink: (type) ->
return '/play' unless nextLevel = @getNextLevel type link = '/play'
"play?next=#{nextLevel}" nextMap = @getNextLevelMap()
link += '/' + nextMap unless nextMap is 'dungeon'
return link unless nextLevel = @getNextLevel type
"#{link}?next=#{nextLevel}"
onClickContinue: (e) -> onClickContinue: (e) ->
nextLevelLink = @continueLevelLink nextLevelLink = @continueLevelLink
@ -281,13 +290,14 @@ module.exports = class HeroVictoryModal extends ModalView
skipPrompt ||= not (@skipAheadLevelLink or @morePractiveLevelLink) and me.getBranchingGroup() is 'choice-explicit' skipPrompt ||= not (@skipAheadLevelLink or @morePractiveLevelLink) and me.getBranchingGroup() is 'choice-explicit'
if skipPrompt if skipPrompt
# Preserve the supermodel as we navigate back to the world map. # 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 else
# Hide everything except the buttons prompting them for which kind of next level to do # Hide everything except the buttons prompting them for which kind of next level to do
@$el.find('.modal-footer, .modal-body > *').hide() @$el.find('.modal-footer, .modal-body > *').hide()
@$el.find('.next-levels-prompt').show() @$el.find('.next-levels-prompt').show()
onClickNextLevelBranch: (e) -> 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() 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. # 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()]