Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-12-07 20:18:40 -08:00
commit 78a3a5b38b
9 changed files with 63 additions and 9 deletions

View file

@ -34,7 +34,7 @@
<script src="/javascripts/aether.js" defer></script>
<script src="/javascripts/app.js" defer></script> <!-- it's all Backbone! -->
<script>
// Placeholder for iPad, which inspects the user object at the bottom of an injected page.
window.userObject = "userObjectTag";
window.me = {
@ -42,8 +42,20 @@
}
onLoad = function() {
FastClick.attach(document.body);
require('core/initialize');
try {
// IE8 warning
var htmlElement = document.querySelector("html");
if (htmlElement) {
var classAttribute = htmlElement.getAttribute('class');
if (classAttribute && classAttribute.indexOf('lt-ie9') >= 0) {
alert("CodeCombat does not run in Internet Explorer 8 or older. Sorry!");
}
}
// IE8 can't handle this
FastClick.attach(document.body);
require('core/initialize');
} catch (error) { }
}
</script>

View file

@ -691,10 +691,13 @@ module.exports = Lank = class Lank extends CocoClass
Backbone.Mediator.publish 'surface:gold-changed', {team: @thang.team, gold: gold, goldEarned: Math.floor(@thang.goldEarned ? 0)}
shouldMuteMessage: (m) ->
if me.getAnnouncesActionAudioGroup() in ['no-audio', 'just-take-damage']
return true if m in ['moveRight', 'moveUp', 'moveDown', 'moveLeft']
return true if /^attack /.test m
return true if /^Repeating loop/.test m
return true if /^findNearestEnemy/.test m
return false if m in ['moveRight', 'moveUp', 'moveDown', 'moveLeft']
#return true if /^attack /.test m
#return true if /^Repeating loop/.test m
#return true if /^findNearestEnemy/.test m
@previouslySaidMessages ?= {}
t0 = @previouslySaidMessages[m] ? 0
t1 = new Date()
@ -704,7 +707,10 @@ module.exports = Lank = class Lank extends CocoClass
playSounds: (withDelay=true, volume=1.0) ->
for event in @thang.currentEvents ? []
@playSound event, withDelay, volume
if event is 'take-damage' and me.getAnnouncesActionAudioGroup() in ['no-audio', 'without-take-damage']
null # Skip playing it
else
@playSound event, withDelay, volume
if event is 'pay-bounty-gold' and @thang.bountyGold > 25 and @thang.team isnt me.team
AudioPlayer.playInterfaceSound 'coin_1', 0.25
if @thang.actionActivated and (action = @thang.getActionName()) isnt 'say'

View file

@ -103,6 +103,18 @@ module.exports = class User extends CocoModel
myHeroClasses.push heroClass for heroClass, heroSlugs of ThangType.heroClasses when _.intersection(myHeroSlugs, heroSlugs).length
myHeroClasses
getAnnouncesActionAudioGroup: ->
return @announcesActionAudioGroup if @announcesActionAudioGroup
group = me.get('testGroupNumber') % 4
@announcesActionAudioGroup = switch group
when 0 then 'all-audio'
when 1 then 'no-audio'
when 2 then 'just-take-damage'
when 3 then 'without-take-damage'
@announcesActionAudioGroup = 'all-audio' if me.isAdmin()
application.tracker.identify announcesActionAudioGroup: @announcesActionAudioGroup unless me.isAdmin()
@announcesActionAudioGroup
getGemPromptGroup: ->
return @gemPromptGroup if @gemPromptGroup
group = me.get('testGroupNumber') % 8

View file

@ -66,7 +66,7 @@
@media screen and ( max-height: 800px )
top: 451px
.alert
top: 213px
border: 5px solid darkred
@ -82,3 +82,8 @@
a
color: lighten(#0b63bc, 10%)
body[lang='ru'], body[lang^='de'], body[lang^='pt'], body[lang='pl'], body[lang='tr'], body[lang^='nl'], body[lang^='cs'], body[lang^='sv'], body[lang^='el'], body[lang^='hu'], body[lang^='bg']
#home-view #slogan
font-size: 22px
line-height: 23px

View file

@ -107,3 +107,16 @@
.unequippable
position: absolute
body:not([lang^='en'])
#item-details-view
#item-details-body
.stat-row
text-align: center
.stat-label, .stat
position: initial
display: inline-block
.stat-label
margin-right: 8px

View file

@ -13,6 +13,7 @@ block outer_content
#slogan(data-i18n="home.slogan")
//- TODO: This does not work on IE8
.alert.alert-danger.lt-ie9
strong(data-i18n="home.no_ie") CodeCombat does not run in Internet Explorer 8 or older. Sorry!

View file

@ -147,7 +147,7 @@ module.exports = class PlayLevelView extends RootView
afterRender: ->
super()
window.onPlayLevelViewLoaded? @ # still a hack
@insertSubView @loadingView = new LevelLoadingView autoUnveil: @options.autoUnveil, level: @level # May not have @level loaded yet
@insertSubView @loadingView = new LevelLoadingView autoUnveil: @options.autoUnveil, level: @levelLoader?.level ? @level # May not have @level loaded yet
@$el.find('#level-done-button').hide()
$('body').addClass('is-playing')
$('body').bind('touchmove', false) if @isIPadApp()

View file

@ -270,6 +270,10 @@ module.exports = class HeroVictoryModal extends ModalView
levelLabel = xpEl.find('.level')
utils.replaceText levelLabel, currentLevel
if leveledUp and (not @displayedLevel or currentLevel > @displayedLevel)
@playSound 'level-up'
@displayedLevel = currentLevel
endSequentialAnimations: ->
clearInterval @sequentialAnimationInterval
@animationComplete = true

View file

@ -55,6 +55,7 @@ exports.config =
regJoin('^app/core')
regJoin('^app/views/core')
'app/locale/locale.coffee'
'app/locale/en.coffee'
'app/lib/sprites/SpriteBuilder.coffee' # loaded by ThangType
]