This commit is contained in:
Nick Winter 2014-03-16 20:36:18 -07:00
commit ffb9ec2908
7 changed files with 72 additions and 45 deletions

View file

@ -64,6 +64,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
@labels = {}
@handledAoEs = {}
@age = 0
@scaleFactor = @targetScaleFactor = 1
@displayObject = new createjs.Container()
if @thangType.get('actions')
@setupSprite()
@ -249,12 +250,16 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
return
scaleX = if @getActionProp 'flipX' then -1 else 1
scaleY = if @getActionProp 'flipY' then -1 else 1
scaleFactor = @thang.scaleFactor ? 1
scaleFactorX = @thang.scaleFactorX ? scaleFactor
scaleFactorY = @thang.scaleFactorY ? scaleFactor
scaleFactorX = @thang.scaleFactorX ? @scaleFactor
scaleFactorY = @thang.scaleFactorY ? @scaleFactor
@imageObject.scaleX = @originalScaleX * scaleX * scaleFactorX
@imageObject.scaleY = @originalScaleY * scaleY * scaleFactorY
if (@thang.scaleFactor or 1) isnt @targetScaleFactor
createjs.Tween.removeTweens(@)
createjs.Tween.get(@).to({scaleFactor:@thang.scaleFactor or 1}, 2000, createjs.Ease.elasticOut)
@targetScaleFactor = @thang.scaleFactor
updateAlpha: ->
@imageObject.alpha = if @hiding then 0 else 1
return unless @thang?.alpha?

View file

@ -12,6 +12,10 @@
margin-bottom: 10px
background-image: none
.spectate-button-container
margin-top: 10px
text-align: center
.name-col-cell
max-width: 300px
text-overflow: ellipsis

View file

@ -6,7 +6,11 @@ block modal-header-content
block modal-body-content
.modal-content
.modal-body
p(data-i18n="signup.description") It's free. Just need a couple things and you'll be good to go:
if showRequiredError
.alert.alert-success
span(data-i18n="signup.required") You need to sign up first before you can go over there. Luckily, it's really easy.
else
p(data-i18n="signup.description") It's free. Just need a couple things and you'll be good to go:
.form
.form-group
label.control-label(for="signup-email", data-i18n="general.email") Email

View file

@ -7,50 +7,43 @@ block content
else
h1= level.get('name')
if me.get('anonymous')
div#must-log-in
p
strong(data-i18n="ladder.please_login") Please log in first before playing a ladder game.
button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/login", data-i18n="login.log_in") Log In
button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/signup", data-i18n="login.sign_up") Create Account
else
div#columns.row
div.column.col-md-2
for team in teams
div.column.col-md-4
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
span(data-i18n="play.play_as") Play As
span= team.name
div.column.col-md-2
a(href="/play/spectate/#{level.get('slug')}").play-button.btn.btn-primary.center
div#columns.row
div.column.col-md-2
for team in teams
div.column.col-md-4
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
span(data-i18n="play.play_as") Play As
span= team.name
div.column.col-md-2
.spectate-button-container
a(href="/play/spectate/#{level.get('slug')}").spectate-button.btn.btn-primary.center
span(data-i18n="play.spectate") Spectate
hr
ul.nav.nav-pills
li.active
a(href="#ladder", data-toggle="tab", data-i18n="general.ladder") Ladder
hr
ul.nav.nav-pills
li.active
a(href="#ladder", data-toggle="tab", data-i18n="general.ladder") Ladder
if !me.get('anonymous')
li
a(href="#my-matches", data-toggle="tab", data-i18n="ladder.my_matches") My Matches
li
a(href="#simulate", data-toggle="tab", data-i18n="ladder.simulate") Simulate
div.tab-content
.tab-pane.active.well#ladder
#ladder-tab-view
.tab-pane.well#my-matches
#my-matches-tab-view
.tab-pane.well#simulate
p(id="simulation-status-text")
if simulationStatus
| #{simulationStatus}
else
span(data-i18n="ladder.simulation_explanation") By simulating games you can get your game ranked faster!
div.tab-content
.tab-pane.active.well#ladder
#ladder-tab-view
.tab-pane.well#my-matches
#my-matches-tab-view
.tab-pane.well#simulate
p(id="simulation-status-text")
if simulationStatus
| #{simulationStatus}
else
span(data-i18n="ladder.simulation_explanation") By simulating games you can get your game ranked faster!
p
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
if me.isAdmin()
p
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
if me.isAdmin()
p
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES

View file

@ -20,8 +20,10 @@ div#columns.row
|#{team.losses}
span(data-i18n="ladder.summary_losses") Losses
if team.session
button.btn.btn-sm.btn-warning.pull-right.rank-button(data-session-id=team.session.id)
if team.session
tr
th(colspan=4)
button.btn.btn-warning.btn-block.rank-button(data-session-id=team.session.id)
span(data-i18n="ladder.rank_no_code").unavailable.hidden No New Code to Rank
span(data-i18n="ladder.rank_my_game").rank.hidden Rank My Game!
span(data-i18n="ladder.rank_submitting").submitting.hidden Submitting...

View file

@ -37,6 +37,11 @@ module.exports = class SignupModalView extends View
checkAge: (e) ->
$("#signup-button", @$el).prop 'disabled', not $(e.target).prop('checked')
getRenderData: ->
c = super()
c.showRequiredError = @options.showRequiredError
c
createAccount: (e) =>
forms.clearFormAlerts(@$el)

View file

@ -4,6 +4,7 @@ Simulator = require 'lib/simulator/Simulator'
LevelSession = require 'models/LevelSession'
CocoCollection = require 'models/CocoCollection'
{teamDataFromLevel} = require './ladder/utils'
{me} = require 'lib/auth'
application = require 'application'
LadderTabView = require './ladder/ladder_tab'
@ -32,6 +33,7 @@ module.exports = class LadderView extends RootView
'click #simulate-button': 'onSimulateButtonClick'
'click #simulate-all-button': 'onSimulateAllButtonClick'
'click .play-button': 'onClickPlayButton'
'click a': 'onClickedLink'
constructor: (options, @levelID) ->
super(options)
@ -121,10 +123,22 @@ module.exports = class LadderView extends RootView
@showPlayModal($(e.target).closest('.play-button').data('team'))
showPlayModal: (teamID) ->
return @showApologeticSignupModal() if me.get('anonymous')
session = (s for s in @sessions.models when s.get('team') is teamID)[0]
modal = new LadderPlayModal({}, @level, session, teamID)
@openModalView modal
showApologeticSignupModal: ->
SignupModal = require 'views/modal/signup_modal'
@openModalView(new SignupModal({showRequiredError:true}))
onClickedLink: (e) ->
link = $(e.target).closest('a').attr('href')
if link?.startsWith '/play/level'
e.stopPropagation()
e.preventDefault()
@showApologeticSignupModal()
destroy: ->
clearInterval @refreshInterval
@simulator.destroy()