diff --git a/app/styles/play/level/tome/cast_button.sass b/app/styles/play/level/tome/cast_button.sass index 87afdad55..38e71cc3d 100644 --- a/app/styles/play/level/tome/cast_button.sass +++ b/app/styles/play/level/tome/cast_button.sass @@ -82,7 +82,9 @@ height: 40px .cast-button - width: 100% + width: 80% + width: -webkit-calc(100% - 40px) + width: calc(100% - 40px) border-top-left-radius: 6px border-bottom-left-radius: 6px @@ -92,3 +94,8 @@ font-size: 14px @media screen and (max-width: 1024px) font-size: 12px + + .cast-real-time-button + width: 20% + width: -webkit-calc(40px) + width: calc(40px) diff --git a/app/templates/play/level/tome/cast_button.jade b/app/templates/play/level/tome/cast_button.jade index cbaf3079b..a94b388ac 100644 --- a/app/templates/play/level/tome/cast_button.jade +++ b/app/templates/play/level/tome/cast_button.jade @@ -1,3 +1,5 @@ -div.btn-group.btn-group-lg.cast-button-group.dropup +div.btn-group.btn-group-lg.cast-button-group .button-progress-overlay button.btn.btn-inverse.banner.cast-button(title=castShortcutVerbose + ": Cast current spell", data-i18n="play_level.tome_cast_button_cast") Spell Cast + button.btn.btn-inverse.banner.cast-real-time-button(title=castRealTimeShortcutVerbose + ": Cast in real time") + i.glyphicon.glyphicon-play \ No newline at end of file diff --git a/app/views/play/level/tome/CastButtonView.coffee b/app/views/play/level/tome/CastButtonView.coffee index fe82e4c28..5a426f92d 100644 --- a/app/views/play/level/tome/CastButtonView.coffee +++ b/app/views/play/level/tome/CastButtonView.coffee @@ -8,7 +8,7 @@ module.exports = class CastButtonView extends CocoView events: 'click .cast-button': 'onCastButtonClick' - 'click .autocast-delays a': 'onCastOptionsClick' + 'click .cast-real-time-button': 'onCastRealTimeButtonClick' subscriptions: 'tome:spell-changed': 'onSpellChanged' @@ -22,10 +22,12 @@ module.exports = class CastButtonView extends CocoView @levelID = options.levelID @castShortcut = '⇧↵' @castShortcutVerbose = 'Shift+Enter' + @castRealTimeShortcutVerbose = 'Ctrl+Shift+Enter' getRenderData: (context={}) -> context = super context context.castShortcutVerbose = @castShortcutVerbose + context.castRealTimeShortcutVerbose = @castRealTimeShortcutVerbose context afterRender: -> @@ -34,17 +36,20 @@ module.exports = class CastButtonView extends CocoView @castButtonGroup = $('.cast-button-group', @$el) @castOptions = $('.autocast-delays', @$el) delay = me.get('autocastDelay') - delay ?= 5000 - unless @levelID in ['rescue-mission', 'grab-the-mushroom', 'drink-me', 'its-a-trap', 'break-the-prison', 'taunt', 'cowardly-taunt', 'commanding-followers', 'mobile-artillery'] - delay = 90019001 + delay ?= 90019001 @setAutocastDelay delay attachTo: (spellView) -> @$el.detach().prependTo(spellView.toolbarView.$el).show() onCastButtonClick: (e) -> + console.log "cas fast yo" Backbone.Mediator.publish 'tome:manual-cast', {} + onCastRealTimeButtonClick: (e) -> + console.log "cas real time yo" + Backbone.Mediator.publish 'tome:manual-cast', {realTime: true} + onCastOptionsClick: (e) => Backbone.Mediator.publish 'tome:focus-editor' @castButtonGroup.removeClass 'open' diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index fed8a313a..deb831a5e 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -305,11 +305,14 @@ module.exports = class SpellView extends CocoView recompile: (cast=true, realTime=false) -> @setRecompileNeeded false - return if @spell.source is @getSource() - @spell.transpile @getSource() - @updateAether true, false - @cast(false, realTime) if cast - @notifySpellChanged() + hasChanged = @spell.source isnt @getSource() + if hasChanged + @spell.transpile @getSource() + @updateAether true, false + if cast and (hasChanged or realTime) + @cast(false, realTime) + if hasChanged + @notifySpellChanged() updateACEText: (source) -> @eventsSuppressed = true