This commit is contained in:
Scott Erickson 2014-02-20 14:49:17 -08:00
commit 9c30b9f0d0
13 changed files with 146 additions and 98 deletions

View file

@ -107,6 +107,9 @@ module.exports.thangNames = thangNames =
"Archer M": [
"Brian"
"Cole"
"Roman"
"Hunter"
"Simon"
]
"Ogre Munchkin M": [
"Brack"

View file

@ -1,29 +1,29 @@
module.exports = nativeDescription: "български език", englishDescription: "Bulgarian", translation:
common:
loading: "Loading..."
# saving: "Saving..."
# sending: "Sending..."
# cancel: "Cancel"
# save: "Save"
# delay_1_sec: "1 second"
# delay_3_sec: "3 seconds"
# delay_5_sec: "5 seconds"
loading: "Зареждане..."
saving: "Записване..."
sending: "Изпращане..."
cancel: "Отказ"
save: "Запис"
delay_1_sec: "1 секунда"
delay_3_sec: "3 секунди"
delay_5_sec: "5 секунди"
# manual: "Manual"
# fork: "Fork"
# play: "Play"
# modal:
# close: "Close"
# okay: "Okay"
modal:
close: "Затвори"
okay: "Добре"
# not_found:
# page_not_found: "Page not found"
not_found:
page_not_found: "Страницата не е намерена"
# nav:
# play: "Levels"
# editor: "Editor"
# blog: "Blog"
# forum: "Forum"
nav:
play: "Нива"
editor: "Редактор"
blog: "Блог"
forum: "Форум"
# admin: "Admin"
# home: "Home"
# contribute: "Contribute"
@ -41,34 +41,34 @@ module.exports = nativeDescription: "български език", englishDescri
# cla_suffix: "."
# cla_agree: "I AGREE"
# login:
# sign_up: "Create Account"
# log_in: "Log In"
# log_out: "Log Out"
# recover: "recover account"
login:
sign_up: "Създай Профил"
log_in: "Вход"
log_out: "Изход"
recover: "Възстанови акаунт"
# recover:
# recover_account_title: "Recover Account"
# send_password: "Send Recovery Password"
recover:
recover_account_title: "Възстанови Акаунт"
send_password: "Изпрати парола за възстановяване"
# signup:
signup:
# create_account_title: "Create Account to Save Progress"
# description: "It's free. Just need a couple things and you'll be good to go:"
# email_announcements: "Receive announcements by email"
# coppa: "13+ or non-USA "
# coppa_why: "(Why?)"
# creating: "Creating Account..."
# sign_up: "Sign Up"
# log_in: "log in with password"
coppa_why: "(Защо?)"
creating: "Създаване на профил..."
sign_up: "Регистриране"
log_in: "Вход с парола"
# home:
# slogan: "Learn to Code JavaScript by Playing a Game"
# no_ie: "CodeCombat does not run in Internet Explorer 9 or older. Sorry!"
# no_mobile: "CodeCombat wasn't designed for mobile devices and may not work!"
# play: "Play"
home:
slogan: "Научи се да програмираш на JavaScript, докато играеш игра "
no_ie: "CodeCombat не работи под Internet Explorer 9 или по-стар. Съжалявам!"
no_mobile: "CodeCombat не е направен за мобилни устройства и може да не работи!"
play: "Играй"
# play:
# choose_your_level: "Choose Your Level"
play:
choose_your_level: "Избери своето ниво"
# adventurer_prefix: "You can jump to any level below, or discuss the levels on "
# adventurer_forum: "the Adventurer forum"
# adventurer_suffix: "."
@ -141,12 +141,12 @@ module.exports = nativeDescription: "български език", englishDescri
# saved: "Changes Saved"
# password_mismatch: "Password does not match."
# account_profile:
# edit_settings: "Edit Settings"
account_profile:
edit_settings: "Промени настройките"
# profile_for_prefix: "Profile for "
# profile_for_suffix: ""
# profile: "Profile"
# user_not_found: "No user found. Check the URL?"
user_not_found: "Няма намерен потребител. Провери URL-а?"
# gravatar_not_found_mine: "We couldn't find your profile associated with:"
# gravatar_not_found_email_suffix: "."
# gravatar_signup_prefix: "Sign up at "
@ -157,9 +157,9 @@ module.exports = nativeDescription: "български език", englishDescri
# gravatar_accounts: "As Seen On"
# gravatar_profile_link: "Full Gravatar Profile"
# play_level:
# level_load_error: "Level could not be loaded."
# done: "Done"
play_level:
level_load_error: "Нивото не може да бъде заредено."
done: "Готово"
# grid: "Grid"
# customize_wizard: "Customize Wizard"
# home: "Home"
@ -247,22 +247,22 @@ module.exports = nativeDescription: "български език", englishDescri
# new_component_title: "Create New Component"
# new_component_field_system: "System"
# article:
# edit_btn_preview: "Preview"
# edit_article_title: "Edit Article"
article:
edit_btn_preview: "Преглед"
edit_article_title: "Промени статията"
# general:
# and: "and"
# name: "Name"
general:
and: "и"
name: "Име"
# body: "Body"
# version: "Version"
version: "Версия"
# commit_msg: "Commit Message"
# version_history_for: "Version History for: "
# results: "Results"
# description: "Description"
# or: "or"
# email: "Email"
# message: "Message"
results: "Резултати"
description: "Описание"
or: "или"
email: "Email"
message: "Съобщение"
# about:
# who_is_codecombat: "Who is CodeCombat?"

View file

@ -31,7 +31,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese
about: "关于"
contact: "联系我们"
twitter_follow: "关注"
# employers: "Employers"
employers: "雇佣我们"
# versions:
# save_version_title: "Save New Version"
@ -49,23 +49,23 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese
recover:
recover_account_title: "找回账户"
# send_password: "Send Recovery Password"
send_password: "发送重置链接"
signup:
# create_account_title: "Create Account to Save Progress"
create_account_title: "创建一个账户来保存进度"
description: "这是免费的,简单易学:"
email_announcements: "通过邮件接收通知"
coppa: "13岁以上或非美国用户"
coppa_why: "为什么?"
coppa_why: " 为什么?"
creating: "账户创建中……"
sign_up: "注册"
log_in: "登录"
home:
slogan: "通过玩儿游戏学到Javascript脚本语言"
slogan: "通过游戏学习 Javascript"
no_ie: "抱歉Internet Explorer 9等更旧的预览器打不开此网站。"
no_mobile: "CodeCombat 不是针对手机设备设计的,所以可能不好用"
play: ""
no_mobile: "CodeCombat 不是针对手机设备设计的,所以可能无法达到做好的体验"
play: "开始游戏"
play:
choose_your_level: "选取难度"

View file

@ -78,6 +78,10 @@ a[data-toggle="modal"]
.github-star-button
margin-left: 20px
&>div
display: inline-block
vertical-align: top
.error
left: 8px

View file

@ -4,7 +4,12 @@
.play-button
margin-bottom: 10px
background-image: none
.intro-button
width: 45%
margin: 0 2.5%
#simulation-status-text
display: inline
margin-left: 10px

View file

@ -3,6 +3,5 @@
margin-top: 15px
#competitors-column .well
font-size: 16px
font-weight: bold
padding: 7px
font-size: 18px
padding: 7px

View file

@ -80,7 +80,7 @@
left: 100px
top: 0px
bottom: 0px
right: 100px
right: 125px
.progress
float: left

View file

@ -6,7 +6,7 @@ block content
div#level-description
!{description}
a(href="something").intro-button.btn.btn-primary.btn-lg Watch the Video
a(href="http://www.youtube.com/watch?v=IFvfZiJGDsw&list=HL1392928835&feature=mh_lolz").intro-button.btn.btn-primary.btn-lg Watch the Video
a(href="/play/level/ladder-tutorial").intro-button.btn.btn-primary.btn-lg Play the Tutorial
@ -19,6 +19,7 @@ block content
span= team.name
table.table.table-bordered.table-condensed.table-hover
//(style="background-color: #{team.bgColor}")
tr
th(colspan=3, style="color: #{team.primaryColor}")
span= team.name
@ -34,9 +35,9 @@ block content
td= session.get('creatorName') || "Anonymous"
td
if(!myRow)
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}") Compete!
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}") Battle as #{team.otherTeam}!
else
a(href="/play/ladder/#{levelID}/team/#{team.id}") View details
a(href="/play/ladder/#{levelID}/team/#{team.id}") View your #{team.id} matches.
unless me.attributes.anonymous
hr

View file

@ -11,7 +11,7 @@ block content
p
| In this level, you play against everyone who has ever written strategies for the opposing forces.
| Choose from the suggested players on the right, playing as many and as long as you like,
| and when you're ready to test your grand strategy against the whole ladder, return and click the rank button.
| and when you are ready to test your grand strategy against the whole ladder, return and click the rank button.
p
| After your first submission, your code will also continuously run against other players as they rank themselves.
@ -30,6 +30,10 @@ block content
if matches.length
table.table.table-bordered.table-condensed
tr
th Result
th Opponent
th When
for match in matches
tr
td.state-cell
@ -42,7 +46,8 @@ block content
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!
- var text = match.state === 'win' ? 'Watch your victory' : 'Defeat the ' + otherTeamID
a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{match.sessionID}")= text
else
div.alert.alert-warning
@ -61,7 +66,7 @@ block content
span :
div.col-md-10
a(href="/play/level/#{levelID}?team=#{teamID}")
span.warmup Play vs Default
span.warmup Play #{teamID} vs Default #{otherTeamID}
if challengers.easy
.well
@ -71,8 +76,9 @@ block content
span :
div.col-md-10
a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.easy.sessionID}")
span Play vs
span= challengers.easy.opponentName
span Play #{teamID} vs
strong= challengers.easy.opponentName
span #{otherTeamID}
if challengers.medium
.well
@ -82,8 +88,9 @@ block content
span :
div.col-md-10
a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.medium.sessionID}")
span Play vs
span= challengers.medium.opponentName
span Play #{teamID} vs
strong= challengers.medium.opponentName
span #{otherTeamID}
if challengers.hard
.well
@ -93,5 +100,6 @@ block content
span :
div.col-md-10
a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.hard.sessionID}")
span Play vs
span= challengers.hard.opponentName
span Play #{teamID} vs
strong= challengers.hard.opponentName
span #{otherTeamID}

View file

@ -16,6 +16,8 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
.scrubber-handle
.btn-group.dropup#playback-settings
button.btn.btn-xs.btn-inverse.toggle-fullscreen(title="Toggle fullscreen")
i.icon-fullscreen.icon-white
button.btn.btn-xs.btn-inverse#zoom-in-button(title="Zoom In (or scroll down)")
i.icon-zoom-in.icon-white
button.btn.btn-xs.btn-inverse#zoom-out-button(title="Zoom Out (or scroll up)")

View file

@ -16,6 +16,7 @@ module.exports = class RootView extends CocoView
events:
"click #logout-button": "logoutAccount"
'change .language-dropdown': 'showDiplomatSuggestionModal'
'click .toggle-fullscreen': 'toggleFullscreen'
afterRender: ->
super()
@ -72,3 +73,28 @@ module.exports = class RootView extends CocoView
console.warn "Error saving language:", errors
res.success (model, response, options) ->
#console.log "Saved language:", newLang
toggleFullscreen: (e) ->
# https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode?redirectlocale=en-US&redirectslug=Web/Guide/DOM/Using_full_screen_mode
# Whoa, even cooler: https://developer.mozilla.org/en-US/docs/WebAPI/Pointer_Lock
full = document.fullscreenElement or
document.mozFullScreenElement or
document.mozFullscreenElement or
document.webkitFullscreenElement or
document.msFullscreenElement
d = document.documentElement
if not full
req = d.requestFullScreen or
d.mozRequestFullScreen or
d.mozRequestFullscreen or
d.msRequestFullscreen or
(if d.webkitRequestFullscreen then -> d.webkitRequestFullscreen Element.ALLOW_KEYBOARD_INPUT else null)
req?.call d
else
nah = document.exitFullscreen or
document.mozCancelFullScreen or
document.mozCancelFullscreen or
document.msExitFullscreen or
document.webkitExitFullscreen
nah?.call document
return

View file

@ -15,6 +15,7 @@ module.exports = class LadderTeamView extends RootView
constructor: (options, @levelID, @team) ->
super(options)
@otherTeam = if team is 'ogres' then 'humans' else 'ogres'
@level = new Level(_id:@levelID)
@level.fetch()
@level.once 'sync', @onLevelLoaded, @
@ -36,7 +37,7 @@ module.exports = class LadderTeamView extends RootView
if matches?.length then @loadNames() else @loadChallengers()
loadChallengers: ->
@challengers = new ChallengersData(@level, @team, @session)
@challengers = new ChallengersData(@level, @team, @otherTeam, @session)
@challengers.on 'sync', @loadNames, @
# PART 3: Loading the names of the other users
@ -70,6 +71,7 @@ module.exports = class LadderTeamView extends RootView
ctx.levelID = @levelID
ctx.teamName = _.string.titleize @team
ctx.teamID = @team
ctx.otherTeamID = @otherTeam
ctx.challengers = if not @startsLoading then @getChallengers() else {}
ctx.readyToRank = @readyToRank()
@ -166,17 +168,16 @@ module.exports = class LadderTeamView extends RootView
rankButton.toggleClass 'disabled', spanClass isnt 'rank'
class ChallengersData
constructor: (@level, @team, @session) ->
constructor: (@level, @team, @otherTeam, @session) ->
_.extend @, Backbone.Events
score = @session?.get('totalScore') or 25
otherTeam = if @team is 'ogres' then 'humans' else 'ogres'
@easyPlayer = new LeaderboardCollection(@level, {order:1, scoreOffset: score - 5, limit: 1, team: otherTeam})
@easyPlayer = new LeaderboardCollection(@level, {order:1, scoreOffset: score - 5, limit: 1, team: @otherTeam})
@easyPlayer.fetch()
@easyPlayer.once 'sync', @challengerLoaded, @
@mediumPlayer = new LeaderboardCollection(@level, {order:1, scoreOffset: score, limit: 1, team: otherTeam})
@mediumPlayer = new LeaderboardCollection(@level, {order:1, scoreOffset: score, limit: 1, team: @otherTeam})
@mediumPlayer.fetch()
@mediumPlayer.once 'sync', @challengerLoaded, @
@hardPlayer = new LeaderboardCollection(@level, {order:-1, scoreOffset: score + 5, limit: 1, team: otherTeam})
@hardPlayer = new LeaderboardCollection(@level, {order:-1, scoreOffset: score + 5, limit: 1, team: @otherTeam})
@hardPlayer.fetch()
@hardPlayer.once 'sync', @challengerLoaded, @

View file

@ -11,7 +11,7 @@ HIGHEST_SCORE = 1000000
class LevelSessionsCollection extends CocoCollection
url: ''
model: LevelSession
constructor: (levelID) ->
super()
@url = "/db/level/#{levelID}/all_sessions"
@ -56,7 +56,7 @@ module.exports = class LadderView extends RootView
@simulationStatus += "..."
catch e
console.log "There was a problem with the named simulation status: #{e}"
$("#simulationStatusText").text @simulationStatus
$("#simulation-status-text").text @simulationStatus
constructor: (options, @levelID) ->
@ -66,7 +66,7 @@ module.exports = class LadderView extends RootView
@level.once 'sync', @onLevelLoaded, @
@simulator = new Simulator()
@simulator.on 'statusUpdate', @updateSimulationStatus, @
# @sessions = new LevelSessionsCollection(levelID)
# @sessions.fetch({})
# @sessions.once 'sync', @onMySessionsLoaded, @
@ -78,7 +78,7 @@ module.exports = class LadderView extends RootView
startLoadingPhaseTwoMaybe: ->
return unless @level.loaded # and @sessions.loaded
@loadPhaseTwo()
loadPhaseTwo: ->
alliedSystem = _.find @level.get('systems'), (value) -> value.config?.teams?
teams = []
@ -87,7 +87,7 @@ module.exports = class LadderView extends RootView
teams.push teamName
@teams = teams
@teamConfigs = alliedSystem.config.teams
@leaderboards = {}
@challengers = {}
for team in teams
@ -96,7 +96,7 @@ module.exports = class LadderView extends RootView
console.log "Team session: #{JSON.stringify teamSession}"
@leaderboards[team] = new LeaderboardData(@level, team, teamSession)
@leaderboards[team].once 'sync', @onLeaderboardLoaded, @
onChallengersLoaded: -> @renderMaybe()
onLeaderboardLoaded: -> @renderMaybe()
@ -105,7 +105,7 @@ module.exports = class LadderView extends RootView
return unless _.every loaders, (loader) -> loader.loaded
@startsLoading = false
@render()
getRenderData: ->
ctx = super()
ctx.level = @level
@ -129,7 +129,7 @@ module.exports = class LadderView extends RootView
primaryColor: primaryColor
})
ctx
class LeaderboardData
constructor: (@level, @team, @session) ->
_.extend @, Backbone.Events
@ -140,7 +140,7 @@ class LeaderboardData
@topPlayers.sort()
@topPlayers.once 'sync', @leaderboardPartLoaded, @
# if @session
# score = @session.get('totalScore') or 25
# @playersAbove = new LeaderboardCollection(@level, {order:1, scoreOffset: score, limit: 4, team: @team})
@ -158,19 +158,19 @@ class LeaderboardData
else
@loaded = true
@fetchNames()
fetchNames: ->
sessionCollections = [@topPlayers, @playersAbove, @playersBelow]
sessionCollections = (s for s in sessionCollections when s)
ids = []
for collection in sessionCollections
ids.push model.get('creator') for model in collection.models
success = (nameMap) =>
for collection in sessionCollections
session.set('creatorName', nameMap[session.get('creator')]) for session in collection.models
@trigger 'sync'
$.ajax('/db/user/-/names', {
data: {ids: ids}
type: 'POST'
@ -195,4 +195,3 @@ class ChallengersData
if @easyPlayer.loaded and @mediumPlayer.loaded and @hardPlayer.loaded
@loaded = true
@trigger 'sync'