This commit is contained in:
Nick Winter 2014-03-30 17:24:07 -07:00
parent 8df80ad1bc
commit cb27124285
6 changed files with 39 additions and 19 deletions
app

View file

@ -125,9 +125,9 @@ module.exports = class GoalManager extends CocoClass
keyFrame: 0 # when it became a 'success' or 'failure'
}
@initGoalState(state, [goal.killThangs, goal.saveThangs], 'killed')
for getTo in goal.getAllToLocations ? []
for getTo in goal.getAllToLocations ? []
@initGoalState(state,[ getTo.getToLocation?.who , [] ], 'arrived')
for keepFrom in goal.keepAllFromLocations ? []
for keepFrom in goal.keepAllFromLocations ? []
@initGoalState(state,[ [] , keepFrom.keepFromLocation?.who], 'arrived')
@initGoalState(state, [goal.getToLocations?.who, goal.keepFromLocations?.who], 'arrived')
@initGoalState(state, [goal.leaveOffSides?.who, goal.keepFromLeavingOffSides?.who], 'left')
@ -146,11 +146,11 @@ module.exports = class GoalManager extends CocoClass
onThangTouchedGoal: (e, frameNumber) ->
for goal in @goals ? []
@checkArrived(goal.id, goal.getToLocations.who, goal.getToLocations.targets, e.actor, e.touched.id, frameNumber) if goal.getToLocations?
if goal.getAllToLocations?
if goal.getAllToLocations?
for getTo in goal.getAllToLocations
@checkArrived(goal.id, getTo.getToLocation.who, getTo.getToLocation.targets, e.actor, e.touched.id, frameNumber)
@checkArrived(goal.id, goal.keepFromLocations.who, goal.keepFromLocations.targets, e.actor, e.touched.id, frameNumber) if goal.keepFromLocations?
if goal.keepAllFromLocations?
if goal.keepAllFromLocations?
for keepFrom in goal.keepAllFromLocations
@checkArrived(goal.id, keepFrom.keepFromLocation.who , keepFrom.keepFromLocation.targets, e.actor, e.touched.id, frameNumber )
@ -200,7 +200,7 @@ module.exports = class GoalManager extends CocoClass
initGoalState: (state, whos, progressObjectName) ->
# 'whos' is an array of goal 'who' values.
# This inits the progress object for the goal tracking.
arrays = (prop for prop in whos when prop?.length)
return unless arrays.length
state[progressObjectName] = {}
@ -221,7 +221,7 @@ module.exports = class GoalManager extends CocoClass
victory = overallStatus is "success"
tentative = overallStatus is "success"
@world.endWorld victory, mostEagerGoal.worldEndsAfter, tentative if mostEagerGoal isnt Infinity
updateGoalState: (goalID, thangID, progressObjectName, frameNumber) ->
# A thang has done something related to the goal!
# Mark it down and update the goal state.
@ -236,7 +236,7 @@ module.exports = class GoalManager extends CocoClass
# 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
numDone = _.filter(stateThangs).length
#console.log "needed", numNeeded, "done", numDone, "of total", _.size(stateThangs), "with how many", goal.howMany
#console.log "needed", numNeeded, "done", numDone, "of total", _.size(stateThangs), "with how many", goal.howMany, "and stateThangs", stateThangs
return unless numDone >= numNeeded
return if state.status and not success # already failed it; don't wipe keyframe
state.status = if success then "success" else "failure"

View file

@ -1,5 +1,6 @@
@import "bootstrap/variables"
@import "bootstrap/mixins"
@import "bootstrap/variables"
html
background-color: #2f261d
@ -191,3 +192,21 @@ table.table
.flag-cursor
cursor: crosshair
// Fonts
.header-font
font-family: $headings-font-family
body[lang='ru'], body[lang|='zh'], body[lang='ja'], body[lang='pl'], body[lang='tr'], body[lang='cs'], body[lang='el'], body[lang='ro'], body[lang='vi'], body[lang='th'], body[lang='ko'], body[lang='sk'], body[lang='sl'], body[lang='bg'], body[lang='he'], body[lang='lt'], body[lang='sr'], body[lang='uk'], body[lang='hi'], body[lang='ur'],
h1, h2, h3, h4, h5, h6
font-family: 'Open Sans Condensed', Impact, "Arial Narrow", "Arial", sans-serif
text-transform: uppercase
letter-spacing: -1px !important
.header-font
font-family: 'Open Sans Condensed', Impact, "Arial Narrow", "Arial", sans-serif !important
text-transform: uppercase
letter-spacing: -1px !important

View file

@ -7,6 +7,7 @@
// -----------------------------------------------------
@import url(//fonts.googleapis.com/css?family=Bangers);
@import url(//fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=latin,latin-ext,cyrillic-ext,greek-ext,greek,vietnamese,cyrillic);
// SCAFFOLDING
// -----------------------------------------------------

View file

@ -6,7 +6,6 @@
margin-left: -20px
.navbuttontext, .fancy-select .trigger
font-family: 'Bangers', cursive
font-size: 20px
font-weight: 400
letter-spacing: 1px
@ -22,7 +21,6 @@
height: 18px
.nav.navbar-link-text, .nav.navbar-link-text > li > a
font-family: 'Bangers', cursive
font-weight: normal
font-size: 25px
letter-spacing: 2px

View file

@ -10,28 +10,28 @@ body
select.language-dropdown
if me.get('anonymous') === false
button.btn.btn-primary.navbuttontext#logout-button(data-i18n="login.log_out") Log Out
a.btn.btn-primary.navbuttontext(href="/account/profile/#{me.id}")
button.btn.btn-primary.navbuttontext.header-font#logout-button(data-i18n="login.log_out") Log Out
a.btn.btn-primary.navbuttontext.header-font(href="/account/profile/#{me.id}")
div.navbuttontext-user-name
| #{me.displayName()}
i.icon-cog.icon-white.big
else
button.btn.btn-primary.navbuttontext(data-toggle="coco-modal", data-target="modal/signup", data-i18n="login.sign_up") Create Account
button.btn.btn-primary.navbuttontext(data-toggle="coco-modal", data-target="modal/login", data-i18n="login.log_in") Log In
button.btn.btn-primary.navbuttontext.header-font(data-toggle="coco-modal", data-target="modal/signup", data-i18n="login.sign_up") Create Account
button.btn.btn-primary.navbuttontext.header-font(data-toggle="coco-modal", data-target="modal/login", data-i18n="login.log_in") Log In
ul(class='navbar-link-text').nav.navbar-nav.pull-right
li.play
a(href='/play', data-i18n="nav.navbar-nav.play") Levels
a.header-font(href='/play', data-i18n="nav.navbar-nav.play") Levels
li.editor
a(href='/editor', data-i18n="nav.navbar-nav.editor") Editor
a.header-font(href='/editor', data-i18n="nav.navbar-nav.editor") Editor
li.blog
a(href='http://blog.codecombat.com/', data-i18n="nav.navbar-nav.blog") Blog
a.header-font(href='http://blog.codecombat.com/', data-i18n="nav.navbar-nav.blog") Blog
li.forum
a(href='http://discourse.codecombat.com/', data-i18n="nav.navbar-nav.forum") Forum
a.header-font(href='http://discourse.codecombat.com/', data-i18n="nav.navbar-nav.forum") Forum
if me.isAdmin()
li.admin
a(href='/admin', data-i18n="nav.navbar-nav.admin") Admin
a.header-font(href='/admin', data-i18n="nav.navbar-nav.admin") Admin
block outer_content
#outer-content-wrapper

View file

@ -62,7 +62,8 @@ module.exports = class RootView extends CocoView
for code, localeInfo of locale when not (code in genericCodes) or code is preferred
$select.append(
$("<option></option>").val(code).text(localeInfo.nativeDescription))
$select.val(preferred).fancySelect()
$select.val(preferred).fancySelect().parent().find('.trigger').addClass('header-font')
$('body').attr('lang', preferred)
onLanguageChanged: ->
newLang = $(".language-dropdown").val()
@ -72,6 +73,7 @@ module.exports = class RootView extends CocoView
@buildLanguages()
unless newLang.split('-')[0] is "en"
@openModalView(application.router.getView("modal/diplomat_suggestion", "_modal"))
$('body').attr('lang', newLang)
saveLanguage: (newLang) ->
me.set('preferredLanguage', newLang)