diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 0be68564c..a54115787 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -557,7 +557,7 @@ grassy: "Grassy" fork_title: "Fork New Version" fork_creating: "Creating Fork..." - randomize: "Randomize" + generate_terrain: "Generate Terrain" more: "More" wiki: "Wiki" live_chat: "Live Chat" diff --git a/app/styles/editor/level/modal/terrain_randomize.sass b/app/styles/editor/level/modal/generate-terrain-modal.sass similarity index 96% rename from app/styles/editor/level/modal/terrain_randomize.sass rename to app/styles/editor/level/modal/generate-terrain-modal.sass index b6d1064e1..e6b0e06ed 100644 --- a/app/styles/editor/level/modal/terrain_randomize.sass +++ b/app/styles/editor/level/modal/generate-terrain-modal.sass @@ -1,13 +1,16 @@ -#terrain-randomize-modal +#generate-terrain-modal .choose-option margin-bottom: 15px - width: 100% + width: 48% + margin-right: 1% + margin-left: 1% height: 200px overflow: hidden background: white border: 1px solid #333 position: relative + float: left -webkit-transition: opacity 0.3s ease-in-out -moz-transition: opacity 0.3s ease-in-out diff --git a/app/styles/editor/level/thangs-tab-view.sass b/app/styles/editor/level/thangs-tab-view.sass index e7fcfd035..9966135fb 100644 --- a/app/styles/editor/level/thangs-tab-view.sass +++ b/app/styles/editor/level/thangs-tab-view.sass @@ -12,6 +12,9 @@ #thangs-container-toggle, #thangs-palette-toggle top: 5px + position: absolute + z-index: 12 + padding: 8px #thangs-container-toggle left: 5px @@ -21,11 +24,6 @@ right: 5px box-shadow: -1px 1px 5px black - .toggle - position: absolute - z-index: 12 - padding: 8px - .thangs-container background: white width: $extantThangsWidth @@ -73,10 +71,10 @@ position: relative text-align: center - #randomize-button + .generate-terrain-button position: absolute top: 45% - height: 40px + //height: 40px diff --git a/app/templates/editor/level/edit.jade b/app/templates/editor/level/edit.jade index 918596422..a19d17eff 100644 --- a/app/templates/editor/level/edit.jade +++ b/app/templates/editor/level/edit.jade @@ -94,7 +94,7 @@ block header li(class=anonymous ? "disabled": "") a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert li(class=anonymous ? "disabled": "") - a(data-toggle="coco-modal", data-target="editor/level/modals/TerrainRandomizeModal", data-i18n="editor.randomize")#randomize-button Randomize + a(data-toggle="coco-modal", data-target="editor/level/modals/GenerateTerrainModal", data-i18n="editor.generate_terrain").generate-terrain-button Generate Terrain li(class=anonymous ? "disabled": "") a(data-i18n="editor.pop_i18n")#pop-level-i18n-button Populate i18n li.divider diff --git a/app/templates/editor/level/modal/terrain_randomize.jade b/app/templates/editor/level/modal/generate-terrain-modal.jade similarity index 98% rename from app/templates/editor/level/modal/terrain_randomize.jade rename to app/templates/editor/level/modal/generate-terrain-modal.jade index a4e45b2f2..e97cd739f 100644 --- a/app/templates/editor/level/modal/terrain_randomize.jade +++ b/app/templates/editor/level/modal/generate-terrain-modal.jade @@ -13,4 +13,5 @@ block modal-body-content span(data-i18n="editor."+size) #{size} div.preset-name.capitalize span(data-i18n="editor."+preset.type) #{preset.type} + .clearfix block modal-footer diff --git a/app/templates/editor/level/thangs-tab-view.jade b/app/templates/editor/level/thangs-tab-view.jade index 0e2a7a228..34fcd3963 100644 --- a/app/templates/editor/level/thangs-tab-view.jade +++ b/app/templates/editor/level/thangs-tab-view.jade @@ -1,6 +1,6 @@ -button.toggle.btn#thangs-container-toggle +button.btn#thangs-container-toggle span.icon-list -button.toggle.btn#thangs-palette-toggle +button.btn#thangs-palette-toggle span.icon-plus .thangs-container.hide#all-thangs h3(data-i18n="editor.level_tab_thangs_title") Current Thangs @@ -8,7 +8,7 @@ button.toggle.btn#thangs-palette-toggle .world-container #canvas-wrapper - button.btn.btn-primary(id="randomize-button", data-toggle="coco-modal", data-target="editor/level/modals/TerrainRandomizeModal", data-i18n="editor.randomize", title="Randomize Terrain") Randomize + button.generate-terrain-button.btn.btn-info.btn-lg(data-toggle="coco-modal", data-target="editor/level/modals/GenerateTerrainModal", data-i18n="editor.generate_terrain", title="Generate Terrain") Generate Terrain ul.dropdown-menu#contextmenu li#delete a(data-i18n="editor.delete") Delete diff --git a/app/views/editor/level/modals/TerrainRandomizeModal.coffee b/app/views/editor/level/modals/GenerateTerrainModal.coffee similarity index 96% rename from app/views/editor/level/modals/TerrainRandomizeModal.coffee rename to app/views/editor/level/modals/GenerateTerrainModal.coffee index 94a772706..c2637bd00 100644 --- a/app/views/editor/level/modals/TerrainRandomizeModal.coffee +++ b/app/views/editor/level/modals/GenerateTerrainModal.coffee @@ -1,5 +1,5 @@ ModalView = require 'views/kinds/ModalView' -template = require 'templates/editor/level/modal/terrain_randomize' +template = require 'templates/editor/level/modal/generate-terrain-modal' CocoModel = require 'models/CocoModel' clusters = { @@ -229,11 +229,14 @@ thangSizes = { }} -module.exports = class TerrainRandomizeModal extends ModalView - id: 'terrain-randomize-modal' +module.exports = class GenerateTerrainModal extends ModalView + id: 'generate-terrain-modal' template: template + plain: true + modalWidthPercent: 90 + events: - 'click .choose-option': 'onRandomize' + 'click .choose-option': 'onGenerate' onRevertModel: (e) -> id = $(e.target).val() @@ -241,25 +244,25 @@ module.exports = class TerrainRandomizeModal extends ModalView $(e.target).closest('tr').remove() @reloadOnClose = true - onRandomize: (e) -> + onGenerate: (e) -> target = $(e.target) presetType = target.attr 'data-preset-type' presetSize = target.attr 'data-preset-size' - @randomizeThangs presetType, presetSize + @generateThangs presetType, presetSize Backbone.Mediator.publish 'editor:random-terrain-generated', thangs: @thangs, terrain: presets[presetType].terrainName @hide() - randomizeThangs: (presetName, presetSize) -> + generateThangs: (presetName, presetSize) -> @falseCount = 0 preset = presets[presetName] presetSize = presetSizes[presetSize] @thangs = [] @rects = [] - @randomizeFloor preset, presetSize - @randomizeBorder preset, presetSize, preset.borderNoise - @randomizeDecorations preset, presetSize + @generateFloor preset, presetSize + @generateBorder preset, presetSize, preset.borderNoise + @generateDecorations preset, presetSize - randomizeFloor: (preset, presetSize) -> + generateFloor: (preset, presetSize) -> for i in _.range(0, presetSize.x, thangSizes.floorSize.x) for j in _.range(0, presetSize.y, thangSizes.floorSize.y) @thangs.push { @@ -271,7 +274,7 @@ module.exports = class TerrainRandomizeModal extends ModalView 'margin': clusters[preset.floors].margin } - randomizeBorder: (preset, presetSize, noiseFactor=1) -> + generateBorder: (preset, presetSize, noiseFactor=1) -> for i in _.range(0, presetSize.x, thangSizes.borderSize.x) for j in _.range(preset.borderThickness) # Bottom wall @@ -349,7 +352,7 @@ module.exports = class TerrainRandomizeModal extends ModalView } continue - randomizeDecorations: (preset, presetSize)-> + generateDecorations: (preset, presetSize)-> for name, decoration of preset.decorations for num in _.range(presetSize.sizeFactor * _.random(decoration.num[0], decoration.num[1])) if @['build'+name] isnt undefined diff --git a/app/views/editor/level/thangs/ThangsTabView.coffee b/app/views/editor/level/thangs/ThangsTabView.coffee index 550e4ce2d..d51c86573 100644 --- a/app/views/editor/level/thangs/ThangsTabView.coffee +++ b/app/views/editor/level/thangs/ThangsTabView.coffee @@ -152,7 +152,7 @@ module.exports = class ThangsTabView extends CocoView oldHeight = $('#thangs-list').height() $('#thangs-list').height(oldHeight - thangsHeaderHeight) if data.thangs?.length - @$el.find('#randomize-button').hide() + @$el.find('.generate-terrain-button').hide() initSurface: -> surfaceCanvas = $('canvas#surface', @$el) @@ -415,7 +415,7 @@ module.exports = class ThangsTabView extends CocoView @thangsBatch = [] addThang: (thangType, pos, batchInsert=false) -> - @$el.find('#randomize-button').hide() + @$el.find('.generate-terrain-button').hide() if batchInsert if thangType.get('name') is 'Hero Placeholder' thangID = 'Hero Placeholder'