mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-14 14:04:38 -04:00
Several improvements to behavior of pointing out next levels.
This commit is contained in:
parent
563c886bdd
commit
f78ff257ab
2 changed files with 18 additions and 7 deletions
app
|
@ -9,7 +9,7 @@
|
|||
each level in campaign.levels
|
||||
if level.hidden
|
||||
continue;
|
||||
- var next = level.id == nextLevel || (!seenNext && levelStatusMap[level.id] != "complete" && !level.locked && !level.disabled);
|
||||
- var next = level.id == nextLevel || (!seenNext && levelStatusMap[level.id] != "complete" && !level.locked && !level.disabled && (!level.practice || me.getBranchingGroup() == 'all-practice'));
|
||||
- seenNext = seenNext || next;
|
||||
div(style="left: #{level.x}%; bottom: #{level.y}%; background-color: #{level.color}", class="level" + (next ? " next" : "") + (level.disabled ? " disabled" : "") + (level.locked ? " locked" : "") + " " + levelStatusMap[level.id] || "", data-level-id=level.id, title=level.name)
|
||||
a(href=level.type == 'hero' ? '#' : level.disabled ? "/play" : "/play/#{level.levelPath || 'level'}/#{level.id}", disabled=level.disabled, data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||
|
|
|
@ -108,8 +108,13 @@ module.exports = class WorldMapView extends RootView
|
|||
@$el.find('.level').tooltip()
|
||||
@$el.addClass _.string.slugify @terrain
|
||||
@updateVolume()
|
||||
unless window.currentModal or not @ABTestSkipHighlight? or @ABTestSkipHighlight
|
||||
unless window.currentModal or @ABTestSkipHighlight or not @supermodel.finished()
|
||||
@highlightElement '.level.next', delay: 500, duration: 60000, rotation: 0, sides: ['top']
|
||||
if levelID = @$el.find('.level.next').data('level-id')
|
||||
@$levelInfo = @$el.find(".level-info-container[data-level-id=#{levelID}]").show()
|
||||
pos = @$el.find('.level.next').offset()
|
||||
@adjustLevelInfoPosition pageX: pos.left, pageY: pos.top + 250
|
||||
@manuallyPositionedLevelInfoID = levelID
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
|
@ -123,15 +128,18 @@ module.exports = class WorldMapView extends RootView
|
|||
onSessionsLoaded: (e) ->
|
||||
for session in @sessions.models
|
||||
@levelStatusMap[session.get('levelID')] = if session.get('state')?.complete then 'complete' else 'started'
|
||||
if @nextLevel and @levelStatusMap[@nextLevel] is 'complete'
|
||||
@nextLevel = null
|
||||
@render()
|
||||
@initABTestAutoFirstLevel()
|
||||
|
||||
if @supermodel.finished()
|
||||
@initABTestAutoFirstLevel()
|
||||
|
||||
initABTestAutoFirstLevel: ->
|
||||
# A/B testing directly navigating to first level
|
||||
# Excluding admins and users who have already started
|
||||
# TODO: Cleanup @afterRender when this test is finished
|
||||
firstLevelID = 'dungeons-of-kithgard'
|
||||
unless @nextLevel? or firstLevelID of @levelStatusMap
|
||||
unless @nextLevel? or (firstLevelID of @levelStatusMap) or me.isAdmin()
|
||||
testGroup = me.getDirectFirstGroup()
|
||||
if testGroup is 1
|
||||
@ABTestSkipHighlight = true
|
||||
|
@ -141,7 +149,7 @@ module.exports = class WorldMapView extends RootView
|
|||
levelID = levelElement.data('level-id')
|
||||
@startLevel levelElement
|
||||
window.tracker?.trackEvent 'World Map', levelID: firstLevelID, directFirstGroup: testGroup
|
||||
else if not me.isAdmin()
|
||||
else
|
||||
window.tracker?.trackEvent 'World Map', levelID: firstLevelID, directFirstGroup: testGroup
|
||||
@ABTestSkipHighlight = false
|
||||
else
|
||||
|
@ -189,6 +197,7 @@ module.exports = class WorldMapView extends RootView
|
|||
onMouseEnterLevel: (e) ->
|
||||
return if application.isIPadApp
|
||||
levelID = $(e.target).parents('.level').data('level-id')
|
||||
return if @manuallyPositionedLevelInfoID and levelID isnt @manuallyPositionedLevelInfoID
|
||||
@$levelInfo = @$el.find(".level-info-container[data-level-id=#{levelID}]").show()
|
||||
@adjustLevelInfoPosition e
|
||||
@endHighlight()
|
||||
|
@ -196,11 +205,13 @@ module.exports = class WorldMapView extends RootView
|
|||
onMouseLeaveLevel: (e) ->
|
||||
return if application.isIPadApp
|
||||
levelID = $(e.target).parents('.level').data('level-id')
|
||||
return if @manuallyPositionedLevelInfoID and levelID isnt @manuallyPositionedLevelInfoID
|
||||
@$el.find(".level-info-container[data-level-id='#{levelID}']").hide()
|
||||
@manuallyPositionedLevelInfoID = null
|
||||
|
||||
onMouseMoveMap: (e) ->
|
||||
return if application.isIPadApp
|
||||
@adjustLevelInfoPosition e
|
||||
@adjustLevelInfoPosition e unless @manuallyPositionedLevelInfoID
|
||||
|
||||
adjustLevelInfoPosition: (e) ->
|
||||
return unless @$levelInfo
|
||||
|
|
Loading…
Add table
Reference in a new issue