Added a clear storage button to the campaign editor.

This commit is contained in:
Nick Winter 2015-02-25 11:09:11 -08:00
parent 075f7630ed
commit 1ab8274c43
5 changed files with 25 additions and 16 deletions

View file

@ -103,6 +103,7 @@ module.exports = Lank = class Lank extends CocoClass
setSprite: (newSprite) ->
if @sprite
@sprite.off 'animationend', @playNextAction
@sprite.destroy?()
if parent = @sprite.parent
parent.removeChild @sprite

View file

@ -780,6 +780,7 @@
level_completion: "Level Completion"
pop_i18n: "Populate I18N"
tasks: "Tasks"
clear_storage: "Clear your local changes"
article:
edit_btn_preview: "Preview"

View file

@ -427,8 +427,7 @@ $gameControlMargin: 30px
&.sorcerer
background-position: (-12 * $spriteSheetSize) 0
#volume-button
.campaign-control-button
position: absolute
right: 1%
top: 1%
@ -439,9 +438,12 @@ $gameControlMargin: 30px
@include opacity(1.0)
.glyphicon
display: none
font-size: 32px
#volume-button
.glyphicon
display: none
&.vol-up .glyphicon.glyphicon-volume-up
display: inline-block
@ -454,20 +456,11 @@ $gameControlMargin: 30px
&.vol-down .glyphicon.glyphicon-volume-down
display: inline-block
#back-button
#back-button, #clear-storage-button
position: absolute
right: 70px
right: -webkit-calc(1% + 55px)
right: calc(1% + 55px)
top: 1%
padding: 3px 8px
@include opacity(0.75)
&:hover
@include opacity(1.0)
.glyphicon
font-size: 32px
#campaign-status
position: absolute

View file

@ -107,15 +107,19 @@ else
button.btn.btn-illustrated.btn-primary(data-i18n="nav.contact", data-toggle="coco-modal", data-target="core/ContactModal") Contact
button.btn.btn-lg.btn-inverse#volume-button(data-i18n="[title]play.adjust_volume", title="Adjust volume")
button.btn.btn-lg.btn-inverse.campaign-control-button#volume-button(data-i18n="[title]play.adjust_volume", title="Adjust volume")
.glyphicon.glyphicon-volume-off
.glyphicon.glyphicon-volume-down
.glyphicon.glyphicon-volume-up
if campaign
button.btn.btn-lg.btn-inverse#back-button(data-i18n="[title]resources.campaigns", title="Campaigns")
if campaign && !editorMode
button.btn.btn-lg.btn-inverse.campaign-control-button#back-button(data-i18n="[title]resources.campaigns", title="Campaigns")
.glyphicon.glyphicon-globe
if editorMode
button.btn.btn-lg.btn-inverse.campaign-control-button#clear-storage-button(data-i18n="[title]editor.clear_storage", title="Clear your local changes")
.glyphicon.glyphicon-refresh
if campaign && campaign.loaded
h1#campaign-status
.campaign-status-background

View file

@ -48,6 +48,7 @@ module.exports = class CampaignView extends RootView
'click .level-info-container .view-solutions': 'onClickViewSolutions'
'click #volume-button': 'onToggleVolume'
'click #back-button': 'onClickBack'
'click #clear-storage-button': 'onClickClearStorage'
'click .portal .campaign': 'onClickPortalCampaign'
'mouseenter .portals': 'onMouseEnterPortals'
'mouseleave .portals': 'onMouseLeavePortals'
@ -531,6 +532,15 @@ module.exports = class CampaignView extends RootView
viewClass: CampaignView
viewArgs: [{supermodel: @supermodel}]
onClickClearStorage: (e) ->
localStorage.clear()
noty {
text: 'Local storage cleared. Reload to view the original campaign.'
layout: 'topCenter'
timeout: 5000
type: 'information'
}
updateHero: ->
return unless hero = me.get('heroConfig')?.thangType
for slug, original of ThangType.heroes when original is hero