mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-26 00:58:00 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
0d4a384787
25 changed files with 62 additions and 61 deletions
|
@ -59,15 +59,25 @@ module.exports = ModuleLoader = class ModuleLoader extends CocoClass
|
|||
|
||||
onFileLoad: (e) =>
|
||||
$("#module-loading-list li[data-path='#{e.item.id}']").removeClass('loading').addClass('success')
|
||||
have = window.require.list()
|
||||
console.group('Dependencies', e.item.id) if LOG
|
||||
@recentLoadedBytes += e.rawResult.length
|
||||
dependencies = @parseDependencies(e.rawResult)
|
||||
console.groupEnd() if LOG
|
||||
missing = _.difference dependencies, have
|
||||
@load(module, false) for module in missing
|
||||
locale.update() if _.string.startsWith(e.item.id, 'locale')
|
||||
|
||||
# load dependencies if it's not a vendor library
|
||||
if not _.string.startsWith(e.item.id, 'vendor')
|
||||
have = window.require.list()
|
||||
console.group('Dependencies', e.item.id) if LOG
|
||||
@recentLoadedBytes += e.rawResult.length
|
||||
dependencies = @parseDependencies(e.rawResult)
|
||||
console.groupEnd() if LOG
|
||||
missing = _.difference dependencies, have
|
||||
@load(module, false) for module in missing
|
||||
|
||||
# update locale data
|
||||
if _.string.startsWith(e.item.id, 'locale')
|
||||
locale.update()
|
||||
|
||||
# just a bit of cleanup to get the script objects out of the body element
|
||||
$(e.result).remove()
|
||||
|
||||
# a module and its dependencies have loaded!
|
||||
if @queue.progress is 1
|
||||
$('#module-loading-list').modal('hide')
|
||||
@recentPaths.sort()
|
||||
|
@ -96,6 +106,7 @@ module.exports = ModuleLoader = class ModuleLoader extends CocoClass
|
|||
console.groupEnd() if LOG
|
||||
return dependencies
|
||||
|
||||
# basically ripped out of commonjs definition
|
||||
expand: (root, name) ->
|
||||
results = []
|
||||
if /^\.\.?(\/|$)/.test(name)
|
||||
|
|
|
@ -84,8 +84,8 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
|
||||
'play-old': go('play/MainPlayView') # This used to be 'play'.
|
||||
'play': go('play/WorldMapView')
|
||||
'play/ladder/:levelID': go('play/ladder/LadderView')
|
||||
'play/ladder': go('play/ladder/MainLadderView')
|
||||
'play/ladder/:levelID': go('ladder/LadderView')
|
||||
'play/ladder': go('ladder/MainLadderView')
|
||||
'play/level/:levelID': go('play/level/PlayLevelView')
|
||||
'play/spectate/:levelID': go('play/SpectateView')
|
||||
'play/:map': go('play/WorldMapView')
|
||||
|
@ -185,6 +185,14 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
window.tracker?.trackPageView()
|
||||
|
||||
onNavigate: (e) ->
|
||||
if _.isString e.viewClass
|
||||
ViewClass = @tryToLoadModule e.viewClass
|
||||
if not ViewClass and application.moduleLoader.load(e.viewClass)
|
||||
@listenToOnce application.moduleLoader, 'load-complete', ->
|
||||
@onNavigate(e)
|
||||
return
|
||||
e.viewClass = ViewClass
|
||||
|
||||
manualView = e.view or e.viewClass
|
||||
if (e.route is document.location.pathname) and not manualView
|
||||
return document.location.reload()
|
||||
|
|
|
@ -89,8 +89,8 @@ module.exports = class LevelSetupManager extends CocoClass
|
|||
|
||||
onInventoryModalPlayClicked: ->
|
||||
@navigatingToPlay = true
|
||||
PlayLevelView = require 'views/play/level/PlayLevelView'
|
||||
LadderView = require 'views/play/ladder/LadderView'
|
||||
PlayLevelView = 'views/play/level/PlayLevelView'
|
||||
LadderView = 'views/ladder/LadderView'
|
||||
viewClass = if @options.levelPath is 'ladder' then LadderView else PlayLevelView
|
||||
Backbone.Mediator.publish 'router:navigate', {
|
||||
route: "/play/#{@options.levelPath || 'level'}/#{@options.levelID}"
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports =
|
|||
'router:navigate': c.object {required: ['route']},
|
||||
route: {type: 'string'}
|
||||
view: {type: 'object'}
|
||||
viewClass: {type: 'function'}
|
||||
viewClass: {type: ['function', 'string']}
|
||||
viewArgs: {type: 'array'}
|
||||
|
||||
'router:navigated': c.object {required: ['route']},
|
||||
|
|
|
@ -320,7 +320,7 @@ $itemSlotGridHeight: 51px
|
|||
position: relative
|
||||
width: 60px
|
||||
|
||||
&:not(.equipped):not(.restricted):not(.silhouette)
|
||||
&:not(.equipped):not(.restricted)
|
||||
cursor: pointer
|
||||
|
||||
&:hover
|
||||
|
@ -347,18 +347,6 @@ $itemSlotGridHeight: 51px
|
|||
padding: 0
|
||||
@include transition(0.1s ease)
|
||||
|
||||
.required-level
|
||||
@include opacity(0)
|
||||
@include transition(0.6s ease-in)
|
||||
pointer-events: none
|
||||
font-size: 14px
|
||||
text-align: center
|
||||
width: 100%
|
||||
bottom: 20px
|
||||
top: inherit
|
||||
position: absolute
|
||||
color: white
|
||||
|
||||
&.active
|
||||
background-color: rgb(81,153,236)
|
||||
|
||||
|
@ -402,16 +390,6 @@ $itemSlotGridHeight: 51px
|
|||
|
||||
&.locked:not(:hover)
|
||||
@include filter(contrast(75%))
|
||||
|
||||
&.silhouette
|
||||
img
|
||||
@include filter(contrast(25%) brightness(25%))
|
||||
opacity: 0.5
|
||||
|
||||
&:hover
|
||||
.required-level
|
||||
@include opacity(1)
|
||||
text-shadow: 0 1px 0 black, 1px 0 0 black, 0 -1px 0 black, -1px 0 0 black
|
||||
|
||||
//- Hero/Play buttons
|
||||
|
||||
|
|
|
@ -270,14 +270,15 @@
|
|||
.item-img
|
||||
z-index: 1
|
||||
|
||||
.item-shadow
|
||||
left: 5px
|
||||
@include filter(contrast(0%) brightness(0%))
|
||||
opacity: 0.2
|
||||
// Not performant, takes too much memory with filter.
|
||||
//.item-shadow
|
||||
// left: 5px
|
||||
// @include filter(contrast(0%) brightness(0%))
|
||||
// opacity: 0.2
|
||||
|
||||
.item-silhouette
|
||||
@include filter(contrast(0%) brightness(0%))
|
||||
opacity: 0.3
|
||||
opacity: 0.2
|
||||
//@include filter(contrast(0%) brightness(0%))
|
||||
|
||||
.required-level
|
||||
position: absolute
|
||||
|
|
|
@ -50,10 +50,6 @@
|
|||
for item in itemGroups.lockedItems.models
|
||||
.item(class=item.classes, data-item-id=item.id)
|
||||
img(src=item.getPortraitURL(), draggable="false")
|
||||
if item.level
|
||||
.required-level
|
||||
span(data-i18n="general.player_level")
|
||||
span.spl= item.level
|
||||
.clearfix
|
||||
|
||||
#item-details-view
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
if item && !item.owned
|
||||
if item.unequippable
|
||||
// Temp, while we only have Warriors: prevent them from buying non-Warrior stuff
|
||||
button.btn.big-font.disabled.unequippable #{item.get('heroClass')} Only
|
||||
else
|
||||
button#selected-item-unlock-button.btn.big-font.unlock-button(data-item-id=item.id)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
else
|
||||
strong.big-font= item.name
|
||||
img.item-img(src=item.getPortraitURL(), draggable="false")
|
||||
img.item-shadow(src=item.getPortraitURL(), draggable="false")
|
||||
//img.item-shadow(src=item.getPortraitURL(), draggable="false") // Not performant, takes too much memory with filter
|
||||
|
||||
if item.owned
|
||||
span.big-font.owned(data-i18n="play.owned")
|
||||
|
@ -50,7 +50,6 @@
|
|||
img(src="/images/common/gem.png", draggable="false")
|
||||
span.big-font= item.get('gems')
|
||||
if item.unequippable
|
||||
// Temp, while we only have Warriors: prevent them from buying non-Warrior stuff
|
||||
span.big-font.unequippable= item.get('heroClass')
|
||||
else
|
||||
button.btn.unlock-button.big-font(data-i18n="play.unlock", data-item-id=item.id)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
template = require 'templates/editor/delta'
|
||||
deltasLib = require 'core/deltas'
|
||||
require 'vendor/diffview'
|
||||
require 'vendor/difflib'
|
||||
|
||||
TEXTDIFF_OPTIONS =
|
||||
baseTextName: "Old"
|
||||
|
|
|
@ -26,6 +26,8 @@ SystemsDocumentationView = require 'views/editor/docs/SystemsDocumentationView'
|
|||
LevelFeedbackView = require 'views/editor/level/LevelFeedbackView'
|
||||
storage = require 'core/storage'
|
||||
|
||||
require 'vendor/coffeescript' # this is tenuous, since the LevelSession and LevelComponent models are what compile the code
|
||||
|
||||
module.exports = class LevelEditView extends RootView
|
||||
id: 'editor-level-view'
|
||||
className: 'editor'
|
||||
|
|
|
@ -55,7 +55,7 @@ module.exports = class LadderView extends RootView
|
|||
ctx._ = _
|
||||
if tournamentDate = {greed: 1402444800000, 'criss-cross': 1410912000000}[@levelID]
|
||||
ctx.tournamentTimeLeft = moment(new Date(tournamentDate)).fromNow()
|
||||
ctx.winners = require('views/play/ladder/tournament_results')[@levelID]
|
||||
ctx.winners = require('./tournament_results')[@levelID]
|
||||
ctx
|
||||
|
||||
afterRender: ->
|
|
@ -63,18 +63,18 @@ module.exports = class ControlBarView extends CocoView
|
|||
if @level.get('type', true) in ['ladder', 'ladder-tutorial', 'hero-ladder']
|
||||
levelID = @level.get('slug').replace /\-tutorial$/, ''
|
||||
@homeLink = c.homeLink = '/play/ladder/' + levelID
|
||||
@homeViewClass = require 'views/play/ladder/LadderView'
|
||||
@homeViewClass = 'views/ladder/LadderView'
|
||||
@homeViewArgs.push levelID
|
||||
else if @level.get('type', true) in ['hero', 'hero-coop']
|
||||
@homeLink = c.homeLink = '/play'
|
||||
@homeViewClass = require 'views/play/WorldMapView'
|
||||
@homeViewClass = 'views/play/WorldMapView'
|
||||
campaign = CampaignOptions.getCampaignForSlug @level.get 'slug'
|
||||
if campaign isnt 'dungeon'
|
||||
@homeLink += '/' + campaign
|
||||
@homeViewArgs.push campaign
|
||||
else
|
||||
@homeLink = c.homeLink = '/'
|
||||
@homeViewClass = require 'views/HomeView'
|
||||
@homeViewClass = 'views/HomeView'
|
||||
c.editorLink = "/editor/level/#{@level.get('slug')}"
|
||||
c.homeLink = @homeLink
|
||||
c
|
||||
|
|
|
@ -340,6 +340,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
application.tracker?.trackEvent 'Started Level', category:'Play Level', levelID: @levelID
|
||||
|
||||
playAmbientSound: ->
|
||||
return if @destroyed
|
||||
return if @ambientSound
|
||||
return unless file = {Dungeon: 'ambient-dungeon', Grass: 'ambient-grass'}[@level.get('terrain')]
|
||||
src = "/file/interface/#{file}#{AudioPlayer.ext}"
|
||||
|
|
|
@ -260,7 +260,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
|||
onGameSubmitted: (e) ->
|
||||
ladderURL = "/play/ladder/#{@level.get('slug')}#my-matches"
|
||||
# Preserve the supermodel as we navigate back to the ladder.
|
||||
Backbone.Mediator.publish 'router:navigate', route: ladderURL, viewClass: require('views/play/ladder/LadderView'), viewArgs: [{supermodel: @supermodel}, @level.get('slug')]
|
||||
Backbone.Mediator.publish 'router:navigate', route: ladderURL, viewClass: 'views/ladder/LadderView', viewArgs: [{supermodel: @supermodel}, @level.get('slug')]
|
||||
|
||||
playSelectionSound: (hero, preload=false) ->
|
||||
return unless sounds = hero.get('soundTriggers')?.selected
|
||||
|
@ -324,4 +324,4 @@ module.exports = class HeroVictoryModal extends ModalView
|
|||
e.preventDefault()
|
||||
route = $(e.target).data('href')
|
||||
# Preserve the supermodel as we navigate back to the ladder.
|
||||
Backbone.Mediator.publish 'router:navigate', route: route, viewClass: require('views/play/ladder/LadderView'), viewArgs: [{supermodel: if @options.hasReceivedMemoryWarning then null else @supermodel}, @level.get('slug')]
|
||||
Backbone.Mediator.publish 'router:navigate', route: route, viewClass: 'views/ladder/LadderView', viewArgs: [{supermodel: if @options.hasReceivedMemoryWarning then null else @supermodel}, @level.get('slug')]
|
||||
|
|
|
@ -94,10 +94,12 @@ module.exports = class InventoryModal extends ModalView
|
|||
if not item.getFrontFacingStats().props.length and not _.size(item.getFrontFacingStats().stats) and locked # Temp: while there are placeholder items
|
||||
null # Don't put into a collection
|
||||
else if locked and item.get('slug') isnt 'simple-boots'
|
||||
@itemGroups.lockedItems.add(item)
|
||||
item.classes.push 'locked'
|
||||
item.classes.push 'silhouette' if item.isSilhouettedItem()
|
||||
item.classes.push 'hidden' unless item.get('gems')
|
||||
if item.isSilhouettedItem or not item.get('gems')
|
||||
# Don't even load/show these--don't add to a collection. (Bandwidth optimization.)
|
||||
null
|
||||
else
|
||||
@itemGroups.lockedItems.add(item)
|
||||
else if item.get('slug') in _.values(LevelOptions[@options.levelID]?.restrictedGear ? {})
|
||||
@itemGroups.restrictedItems.add(item)
|
||||
item.classes.push 'restricted'
|
||||
|
@ -216,7 +218,6 @@ module.exports = class InventoryModal extends ModalView
|
|||
onUnequippedItemClick: (e) ->
|
||||
return if @justDoubleClicked
|
||||
itemEl = $(e.target).closest('.item')
|
||||
return if itemEl.hasClass('silhouette')
|
||||
@playSound 'menu-button-click'
|
||||
@selectUnequippedItem(itemEl)
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ exports.config =
|
|||
|
||||
#- vendor.js, all the vendor libraries
|
||||
'javascripts/vendor.js': [
|
||||
regJoin('^vendor/(?!scripts/Box2d)')
|
||||
regJoin('^bower_components/(?!(aether|d3))')
|
||||
regJoin('^vendor/scripts/(?!(Box2d|coffeescript))')
|
||||
regJoin('^bower_components/(?!(aether|d3|difflib|diffview))')
|
||||
]
|
||||
|
||||
#- Other vendor libraries in separate bunches
|
||||
|
@ -78,6 +78,9 @@ exports.config =
|
|||
|
||||
# Any vendor libraries we don't want the client to load immediately
|
||||
'javascripts/app/vendor/d3.js': regJoin('^bower_components/d3')
|
||||
'javascripts/app/vendor/coffeescript.js': 'vendor/scripts/coffeescript.js'
|
||||
'javascripts/app/vendor/difflib.js': 'vendor/scripts/difflib.js'
|
||||
'javascripts/app/vendor/diffview.js': 'vendor/scripts/diffview.js'
|
||||
|
||||
#- test, demo libraries
|
||||
'javascripts/test-app.js': regJoin('^test/app/')
|
||||
|
|
Loading…
Reference in a new issue