Fixed panel vs. total counts on other achievements.

This commit is contained in:
Nick Winter 2014-10-20 16:13:56 -07:00
parent d0b878db37
commit bc15ccd240
2 changed files with 14 additions and 6 deletions
app/views

View file

@ -94,11 +94,17 @@ module.exports = class DeltaView extends CocoView
if _.isObject(deltaData.left) and leftEl = deltaEl.find('.old-value')
options = _.defaults {data: deltaData.left}, treemaOptions
TreemaNode.make(leftEl, options).build()
try
TreemaNode.make(leftEl, options).build()
catch error
console.error "Couldn't show left details Treema for", deltaData.left, treemaOptions
if _.isObject(deltaData.right) and rightEl = deltaEl.find('.new-value')
options = _.defaults {data: deltaData.right}, treemaOptions
TreemaNode.make(rightEl, options).build()
try
TreemaNode.make(rightEl, options).build()
catch error
console.error "Couldn't show right details Treema for", deltaData.right, treemaOptions
if deltaData.action is 'text-diff'
return console.error "Couldn't show diff for left: #{deltaData.left}, right: #{deltaData.right} of delta:", deltaData unless deltaData.left? and deltaData.right?

View file

@ -150,17 +150,19 @@ module.exports = class HeroVictoryModal extends ModalView
duration = Math.log(panel.number + 1) / Math.LN10 * 1000 # Math.log10 is ES6
ratio = @getEaseRatio (new Date() - @numberAnimationStart), duration
if panel.unit is 'xp'
totalXP = @totalXPAnimated + Math.floor(ratio * panel.number)
newXP = Math.floor(ratio * panel.number)
totalXP = @totalXPAnimated + newXP
if totalXP isnt @lastTotalXP
panel.textEl.text('+' + totalXP)
panel.textEl.text('+' + newXP)
@XPEl.text('+' + totalXP)
xpTrigger = 'xp-' + (totalXP % 6) # 6 xp sounds
Backbone.Mediator.publish 'audio-player:play-sound', trigger: xpTrigger, volume: 0.5 + ratio / 2
@lastTotalXP = totalXP
else
totalGems = @totalGemsAnimated + Math.floor(ratio * panel.number)
newGems = Math.floor(ratio * panel.number)
totalGems = @totalGemsAnimated + newGems
if totalGems isnt @lastTotalGems
panel.textEl.text('+' + totalGems)
panel.textEl.text('+' + newGems)
@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