From 38d732d8bc87e9c71bba44063f6667f7857d4745 Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Sun, 18 May 2014 11:51:31 -0700 Subject: [PATCH] Disable hover debugger when spell changed --- app/views/play/level/tome/cast_button_view.coffee | 2 +- app/views/play/level/tome/spell_debug_view.coffee | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/play/level/tome/cast_button_view.coffee b/app/views/play/level/tome/cast_button_view.coffee index 1ba2cab3f..bd06e8019 100644 --- a/app/views/play/level/tome/cast_button_view.coffee +++ b/app/views/play/level/tome/cast_button_view.coffee @@ -79,7 +79,7 @@ module.exports = class CastButtonView extends View async.some _.values(@spells), (spell, callback) => spell.hasChangedSignificantly spell.getSource(), null, callback , (castable) => - + Backbone.Mediator.publish 'tome:spell-has-changed-significantly-calculation', hasChangedSignificantly: castable @castButtonGroup.toggleClass('castable', castable).toggleClass('casting', @casting) if @casting s = $.i18n.t("play_level.tome_cast_button_casting", defaultValue: "Casting") diff --git a/app/views/play/level/tome/spell_debug_view.coffee b/app/views/play/level/tome/spell_debug_view.coffee index f0505b513..c48d3beab 100644 --- a/app/views/play/level/tome/spell_debug_view.coffee +++ b/app/views/play/level/tome/spell_debug_view.coffee @@ -17,6 +17,7 @@ module.exports = class DebugView extends View 'tome:spell-shown': 'changeCurrentThangAndSpell' 'tome:cast-spells': 'onTomeCast' 'surface:frame-changed': 'onFrameChanged' + 'tome:spell-has-changed-significantly-calculation': 'onSpellChangedCalculation' events: {} @@ -34,6 +35,8 @@ module.exports = class DebugView extends View @cache = {} @lastFrameRequested = -1 @workerIsSimulating = false + @spellHasChanged = false + pad2: (num) -> @@ -145,10 +148,14 @@ module.exports = class DebugView extends View onFrameChanged: (data) -> @currentFrame = data.frame @frameRate = data.world.frameRate - + onSpellChangedCalculation: (data) -> + @spellHasChanged = data.hasChangedSignificantly + update: -> if @variableChain - if @variableChain.length is 2 and @variableChain[0] is "this" + if @spellHasChanged + @setTooltipText("You've changed this spell! \nPlease recast to use the hover debugger.") + else if @variableChain.length is 2 and @variableChain[0] is "this" @setTooltipKeyAndValue(@variableChain.join("."),@stringifyValue(@thang[@variableChain[1]],0)) else if @variableChain.length is 1 and Aether.globals[@variableChain[0]] @setTooltipKeyAndValue(@variableChain.join("."),@stringifyValue(Aether.globals[@variableChain[0]],0))