From c40da260f04d68e4fc185404a3a42b1788addfe5 Mon Sep 17 00:00:00 2001 From: Jayant Jain Date: Tue, 24 Jun 2014 16:00:29 +0530 Subject: [PATCH] Adds initial modal and view for terrain generator --- app/styles/terrain_randomise.sass | 148 ++++++++++++++++++ app/templates/modal/terrain_randomise.jade | 14 ++ .../modal/terrain_randomise_modal.coffee | 29 ++++ 3 files changed, 191 insertions(+) create mode 100644 app/styles/terrain_randomise.sass create mode 100644 app/templates/modal/terrain_randomise.jade create mode 100644 app/views/modal/terrain_randomise_modal.coffee diff --git a/app/styles/terrain_randomise.sass b/app/styles/terrain_randomise.sass new file mode 100644 index 000000000..3022f10c1 --- /dev/null +++ b/app/styles/terrain_randomise.sass @@ -0,0 +1,148 @@ +#terrain-randomise-modal + #noob-view p + font-size: 30px + + #skip-tutorial-button + font-size: 16px + + .tutorial-suggestion + text-align: center + font-size: 18px + margin: 10px 0 30px + + .play-option + margin-bottom: 15px + width: 100% + height: 100px + overflow: hidden + background: white + border: 1px solid #333 + position: relative + + -webkit-transition: opacity 0.3s ease-in-out + -moz-transition: opacity 0.3s ease-in-out + -ms-transition: opacity 0.3s ease-in-out + -o-transition: opacity 0.3s ease-in-out + transition: opacity 0.3s ease-in-out + + opacity: 0.4 + + border-radius: 5px + .only-one + -webkit-transition: opacity 0.3s ease-in-out + -moz-transition: opacity 0.3s ease-in-out + -ms-transition: opacity 0.3s ease-in-out + -o-transition: opacity 0.3s ease-in-out + transition: opacity 0.3s ease-in-out + opacity: 0 + + .play-option:hover + opacity: 1 + .only-one + opacity: 1 + + .my-icon + position: relative + left: 0 + top: -10px + z-index: 1 + + .my-team-icon + height: 60px + position: relative + top: -10px + left: 10px + z-index: 0 + + .opponent-team-icon + height: 60px + position: relative + top: 10px + right: 10px + z-index: 0 + float: right + -moz-transform: scaleX(-1) + -o-transform: scaleX(-1) + -webkit-transform: scaleX(-1) + transform: scaleX(-1) + filter: FlipH + -ms-filter: "FlipH" + + .opponent-icon + position: relative + float: right + right: 0 + top: -10px + -moz-transform: scaleX(-1) + -o-transform: scaleX(-1) + -webkit-transform: scaleX(-1) + transform: scaleX(-1) + filter: FlipH + -ms-filter: "FlipH" + z-index: 1 + + .name-label + border-bottom: 20px solid lightslategray + height: 0 + width: 40% + position: absolute + bottom: 0 + color: black + font-weight: bold + text-align: center + z-index: 2 + + span + position: relative + top: 1px + + .my-name + border-right: 15px solid transparent + left: 0 + span + left: 3px + + .preset-size + border-left: 15px solid transparent + right: 0 + //text-align: right + span + right: 3px + + .preset-name + border-top: 25px solid darkgray + border-left: 20px solid transparent + border-right: 20px solid transparent + height: 0 + width: 30% + position: absolute + left: 35% + top: 0 + color: black + text-align: center + font-size: 18px + font-weight: bold + + span + position: relative + top: -25px + + .easy-option .preset-name + border-top: 25px solid limegreen + + .medium-option .preset-name + border-top: 25px solid darkorange + + .hard-option .preset-name + border-top: 25px solid black + color: white + + .vs + position: absolute + left: 40% + right: 40% + text-align: center + top: 35px + font-size: 40px + font-weight: bolder + color: black \ No newline at end of file diff --git a/app/templates/modal/terrain_randomise.jade b/app/templates/modal/terrain_randomise.jade new file mode 100644 index 000000000..e2bbd23f6 --- /dev/null +++ b/app/templates/modal/terrain_randomise.jade @@ -0,0 +1,14 @@ +extends /templates/modal/modal_base + +block modal-header-content + h3(data-i18n="editor.pick_a_terrain") Pick a Terrain + +block modal-body-content + div#normal-view + a(href="#") + div.play-option(data-preset-type="grassy", data-preset-size="small") + div.preset-size.name-label + span(data-i18n="ladder.small") Small + div.preset-name + span(data-i18n="ladder.grassy") Grassy + //- for model in models \ No newline at end of file diff --git a/app/views/modal/terrain_randomise_modal.coffee b/app/views/modal/terrain_randomise_modal.coffee new file mode 100644 index 000000000..6dba35042 --- /dev/null +++ b/app/views/modal/terrain_randomise_modal.coffee @@ -0,0 +1,29 @@ +ModalView = require 'views/kinds/ModalView' +template = require 'templates/modal/terrain_randomise' +CocoModel = require 'models/CocoModel' + +module.exports = class TerrainRandomiseModal extends ModalView + id: 'terrain-randomise-modal' + template: template + thangs = [] + + events: + 'click .play-option': 'onRandomise' + + onRevertModel: (e) -> + id = $(e.target).val() + CocoModel.backedUp[id].revert() + $(e.target).closest('tr').remove() + @reloadOnClose = true + + onRandomise: (e) -> + + getRenderData: -> + c = super() + models = _.values CocoModel.backedUp + models = (m for m in models when m.hasLocalChanges()) + c.models = models + c + + onHidden: -> + location.reload() if @reloadOnClose