Fixed : handling four and even five-digit gem/xp totals in victory screen.

This commit is contained in:
Nick Winter 2015-04-18 19:40:53 -07:00
parent a1199a0121
commit 0d81f658ae
2 changed files with 13 additions and 0 deletions
app
styles/play/level/modal
views/play/level/modal

View file

@ -253,6 +253,15 @@
font-weight: bold
color: rgb(40, 33, 22)
margin-right: 12px
width: 78px
&.four-digits
font-size: 40px
margin-top: 3px
&.five-digits
font-size: 30px
margin-top: 10px
.total-label
float: left

View file

@ -229,6 +229,8 @@ module.exports = class HeroVictoryModal extends ModalView
@updateXPBars(totalXP)
xpTrigger = 'xp-' + (totalXP % 6) # 6 xp sounds
Backbone.Mediator.publish 'audio-player:play-sound', trigger: xpTrigger, volume: 0.5 + ratio / 2
@XPEl.addClass 'four-digits' if totalXP >= 1000 and @lastTotalXP < 1000
@XPEl.addClass 'five-digits' if totalXP >= 10000 and @lastTotalXP < 10000
@lastTotalXP = totalXP
else if panel.unit is 'gem'
newGems = Math.floor(panel.previousNumber + ratio * (panel.number - panel.previousNumber))
@ -238,6 +240,8 @@ module.exports = class HeroVictoryModal extends ModalView
@gemEl.text(totalGems)
gemTrigger = 'gem-' + (parseInt(panel.number * ratio) % 4) # 4 gem sounds
Backbone.Mediator.publish 'audio-player:play-sound', trigger: gemTrigger, volume: 0.5 + ratio / 2
@gemEl.addClass 'four-digits' if totalGems >= 1000 and @lastTotalGems < 1000
@gemEl.addClass 'five-digits' if totalGems >= 10000 and @lastTotalGems < 10000
@lastTotalGems = totalGems
else if panel.item
thangType = @thangTypes[panel.item]