This commit is contained in:
Nick Winter 2014-02-20 11:57:15 -08:00
commit cc8a8cabd5
7 changed files with 18 additions and 12 deletions

View file

@ -142,13 +142,13 @@ module.exports = class GoalManager extends CocoClass
onThangTouchedGoal: (e, frameNumber) ->
for goal in @goals ? []
@checkArrived(goal.id, goal.getToLocations.who, goal.getToLocations.targets, e.actor.id, e.touched.id, frameNumber) if goal.getToLocations?
@checkArrived(goal.id, goal.keepFromLocations.who, goal.keepFromLocations.targets, e.actor.id, e.touched.id, frameNumber) if goal.keepFromLocations?
@checkArrived(goal.id, goal.getToLocations.who, goal.getToLocations.targets, e.actor, e.touched.id, frameNumber) if goal.getToLocations?
@checkArrived(goal.id, goal.keepFromLocations.who, goal.keepFromLocations.targets, e.actor, e.touched.id, frameNumber) if goal.keepFromLocations?
checkArrived: (goalID, who, targets, thangID, touchedID, frameNumber) ->
checkArrived: (goalID, who, targets, thang, touchedID, frameNumber) ->
return unless touchedID in targets
return unless thangID in who
@updateGoalState(goalID, thangID, 'arrived', frameNumber)
return unless thang.id in who or thang.team in who
@updateGoalState(goalID, thang.id, 'arrived', frameNumber)
onThangLeftMap: (e, frameNumber) ->
for goal in @goals ? []
@ -211,7 +211,7 @@ module.exports = class GoalManager extends CocoClass
stateThangs[thangID] = true
success = @goalIsPositive goalID
if success
numNeeded = Math.max((goal.howMany ? 1), _.size stateThangs)
numNeeded = goal.howMany ? Math.max(1, _.size stateThangs)
else
# saveThangs: by default we would want to save all the Thangs, which means that we would want none of them to be "done"
numNeeded = _.size(stateThangs) - Math.min((goal.howMany ? 1), _.size stateThangs) + 1

View file

@ -251,7 +251,7 @@
padding-right: 20px
h3
margin: 0 0 5px
margin: 0
font-size: 16px
line-height: 16px
color: #338

View file

@ -97,4 +97,6 @@
border-bottom: 1px dotted rgba(255, 128, 128, 0.45)
.ace_text-layer .ace_comment
color: #EBFADA
color: darken(rgb(76, 136, 107), 5%)
font-weight: bold

View file

@ -15,7 +15,7 @@ block content
for team in teams
div.column.col-md-6
a(href="/play/ladder/#{levelID}/team/#{team.id}", style="background-color: #{team.primaryColor}").play-button.btn.btn-danger.btn-block.btn-lg
span Play
span Play As
span= team.name
table.table.table-bordered.table-condensed.table-hover

View file

@ -39,7 +39,7 @@ block content
span.loss Loss
if match.state === 'tie'
span.tie Tie
td.name-cell= match.opponentName
td.name-cell= match.opponentName || "Anonymous"
td.time-cell= match.when
td.battle-cell
a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{match.sessionID}") Battle!

View file

@ -33,10 +33,13 @@ module.exports = class LadderView extends RootView
method: 'POST'
data:
session: ID
alert "Simulating all games!"
alert "(do not push more than once pls)"
$("#simulate-all-button").prop "disabled", true
$("#simulate-all-button").text "Submitted all!"
onSimulateButtonClick: (e) ->
$("#simulate-button").prop "disabled",true
$("#simulate-button").text "Simulating..."
@simulator.fetchAndSimulateTask()
updateSimulationStatus: (simulationStatus, sessions)->

View file

@ -19,6 +19,7 @@ LevelHandler = class LevelHandler extends Handler
'name'
'i18n'
'icon'
'goals'
]
postEditableProperties: ['name']