mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-13 21:44:40 -04:00
Merge branch 'master' into feature/thangload
Conflicts: app/lib/LevelLoader.coffee app/views/play/level_view.coffee
This commit is contained in:
commit
92687b17de
56 changed files with 265 additions and 1719 deletions
app
lib
locale
models
styles/play/level
templates
views
account
editor/level
employers_view.coffeekinds
modal
play
level
level_view.coffeespectate_view.coffeescripts/windows/coco-dev-setup
batch
localisation
localization
scripts
recycle_bin
|
@ -37,7 +37,10 @@ module.exports = class LevelLoader extends CocoClass
|
|||
@loadLevel()
|
||||
@loadAudio()
|
||||
@playJingle()
|
||||
@listenToOnce @supermodel, 'loaded-all', @onSupermodelLoaded
|
||||
if @supermodel.finished()
|
||||
@onSupermodelLoaded()
|
||||
else
|
||||
@listenToOnce @supermodel, 'loaded-all', @onSupermodelLoaded
|
||||
|
||||
playJingle: ->
|
||||
return if @headless
|
||||
|
@ -75,32 +78,34 @@ module.exports = class LevelLoader extends CocoClass
|
|||
else
|
||||
@level = @supermodel.loadModel(@level, 'level').model
|
||||
@listenToOnce @level, 'sync', @onLevelLoaded
|
||||
|
||||
|
||||
onLevelLoaded: ->
|
||||
@populateLevel()
|
||||
|
||||
|
||||
populateLevel: ->
|
||||
thangIDs = []
|
||||
componentVersions = []
|
||||
systemVersions = []
|
||||
articleVersions = []
|
||||
|
||||
|
||||
for thang in @level.get('thangs') or []
|
||||
thangIDs.push thang.thangType
|
||||
for comp in thang.components or []
|
||||
componentVersions.push _.pick(comp, ['original', 'majorVersion'])
|
||||
|
||||
|
||||
for system in @level.get('systems') or []
|
||||
systemVersions.push _.pick(system, ['original', 'majorVersion'])
|
||||
if indieSprites = system?.config?.indieSprites
|
||||
for indieSprite in indieSprites
|
||||
thangIDs.push indieSprite.thangType
|
||||
|
||||
for article in @level.get('articles')?.generalArticles or []
|
||||
articleVersions.push _.pick(article, ['original', 'majorVersion'])
|
||||
|
||||
unless @headless
|
||||
for article in @level.get('documentation')?.generalArticles or []
|
||||
articleVersions.push _.pick(article, ['original', 'majorVersion'])
|
||||
|
||||
objUniq = (array) -> _.uniq array, false, (arg) -> JSON.stringify(arg)
|
||||
|
||||
<<<<<<< HEAD
|
||||
thangNames = new ThangNamesCollection(thangIDs)
|
||||
@supermodel.loadCollection thangNames, 'thang_names'
|
||||
# for thangID in _.uniq thangIDs
|
||||
|
@ -109,6 +114,13 @@ module.exports = class LevelLoader extends CocoClass
|
|||
# res = @maybeLoadURL url, ThangType, 'thang'
|
||||
# @listenToOnce res.model, 'sync', @buildSpriteSheetsForThangType if res
|
||||
|
||||
=======
|
||||
for thangID in _.uniq thangIDs
|
||||
url = "/db/thang.type/#{thangID}/version"
|
||||
url += "?project=true" if @headless and not @editorMode
|
||||
res = @maybeLoadURL url, ThangType, 'thang'
|
||||
@listenToOnce res.model, 'sync', @buildSpriteSheetsForThangType if res
|
||||
>>>>>>> master
|
||||
for obj in objUniq componentVersions
|
||||
url = "/db/level.component/#{obj.original}/version/#{obj.majorVersion}"
|
||||
@maybeLoadURL url, LevelComponent, 'component'
|
||||
|
@ -122,14 +134,15 @@ module.exports = class LevelLoader extends CocoClass
|
|||
url = "/db/level/#{obj.original}/version/#{obj.majorVersion}"
|
||||
@maybeLoadURL url, Level, 'level'
|
||||
|
||||
wizard = ThangType.loadUniversalWizard()
|
||||
@supermodel.loadModel wizard, 'thang'
|
||||
unless @headless and not @editorMode
|
||||
wizard = ThangType.loadUniversalWizard()
|
||||
@supermodel.loadModel wizard, 'thang'
|
||||
|
||||
maybeLoadURL: (url, Model, resourceName) ->
|
||||
return if @supermodel.getModel(url)
|
||||
model = new Model().setURL url
|
||||
@supermodel.loadModel(model, resourceName)
|
||||
|
||||
|
||||
onSupermodelLoaded: ->
|
||||
@loadLevelSounds()
|
||||
@denormalizeSession()
|
||||
|
@ -222,4 +235,4 @@ module.exports = class LevelLoader extends CocoClass
|
|||
|
||||
# everything else sound wise is loaded as needed as worlds are generated
|
||||
|
||||
progress: -> @supermodel.progress
|
||||
progress: -> @supermodel.progress
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
CocoClass = require 'lib/CocoClass'
|
||||
|
||||
module.exports = class LoadingScreen extends CocoClass
|
||||
progress: 0
|
||||
|
||||
constructor: (canvas) ->
|
||||
super()
|
||||
@width = canvas.width
|
||||
@height = canvas.height
|
||||
@stage = new createjs.Stage(canvas)
|
||||
|
||||
subscriptions:
|
||||
'level-loader:progress-changed': 'onLevelLoaderProgressChanged'
|
||||
|
||||
show: ->
|
||||
@stage.removeChild(@screen) if @screen
|
||||
@screen = @makeScreen()
|
||||
@stage.addChild(@screen)
|
||||
@updateProgressBar()
|
||||
|
||||
hide: ->
|
||||
@stage.removeChild(@screen) if @screen
|
||||
@screen = null
|
||||
|
||||
makeScreen: ->
|
||||
c = new createjs.Container()
|
||||
c.addChild(@makeLoadBackground())
|
||||
c.addChild(@makeLoadText())
|
||||
c.addChild(@makeProgressBar())
|
||||
@makeLoadLogo(c)
|
||||
c
|
||||
|
||||
makeLoadBackground: ->
|
||||
g = new createjs.Graphics()
|
||||
g.beginFill(createjs.Graphics.getRGB(30,30,60))
|
||||
g.drawRoundRect(0, 0, @width, @height, 0.0)
|
||||
s = new createjs.Shape(g)
|
||||
s.y = 0
|
||||
s.x = 0
|
||||
s
|
||||
|
||||
makeLoadLogo: (container) ->
|
||||
logoImage = new Image()
|
||||
$(logoImage).load =>
|
||||
@logo = new createjs.Bitmap logoImage
|
||||
@logo.x = @width / 2 - logoImage.width / 2
|
||||
@logo.y = 40
|
||||
container.addChild @logo
|
||||
logoImage.src = "/images/loading_image.png"
|
||||
|
||||
makeLoadText: ->
|
||||
size = @height / 10
|
||||
text = new createjs.Text("LOADING", "#{size}px Monospace", "#ff7700")
|
||||
text.regX = text.getMeasuredWidth() / 2
|
||||
text.regY = text.getMeasuredHeight() / 2
|
||||
text.x = @width / 2
|
||||
text.y = @height / 2
|
||||
@text = text
|
||||
return text
|
||||
|
||||
makeProgressBar: ->
|
||||
BAR_PIXEL_HEIGHT = 20
|
||||
BAR_PCT_WIDTH = .75
|
||||
pixelWidth = parseInt(@width * BAR_PCT_WIDTH)
|
||||
pixelMargin = (@width - (@width * BAR_PCT_WIDTH)) / 2
|
||||
barY = 2 * (@height / 3)
|
||||
|
||||
c = new createjs.Container()
|
||||
c.x = pixelMargin
|
||||
c.y = barY
|
||||
|
||||
g = new createjs.Graphics()
|
||||
g.beginFill(createjs.Graphics.getRGB(255,0,0))
|
||||
g.drawRoundRect(0,0,pixelWidth, BAR_PIXEL_HEIGHT, 5)
|
||||
@progressBar = new createjs.Shape(g)
|
||||
c.addChild(@progressBar)
|
||||
|
||||
g = new createjs.Graphics()
|
||||
g.setStrokeStyle(2)
|
||||
g.beginStroke(createjs.Graphics.getRGB(230,230,230))
|
||||
g.drawRoundRect(0,0,pixelWidth, BAR_PIXEL_HEIGHT, 5)
|
||||
c.addChild(new createjs.Shape(g))
|
||||
c
|
||||
|
||||
onLevelLoaderProgressChanged: (e) ->
|
||||
@progress = e.progress
|
||||
@updateProgressBar()
|
||||
|
||||
updateProgressBar: ->
|
||||
newProg = parseInt((@progress or 0) * 100)
|
||||
newProg = ' '+newProg while newProg.length < 4
|
||||
@lastProg = newProg
|
||||
@text.text = "BUILDING" if @progress is 1
|
||||
@progressBar.scaleX = @progress
|
||||
@stage.update()
|
||||
|
||||
showReady: ->
|
||||
@text.text = 'READY'
|
||||
@text.regX = @text.getMeasuredWidth() / 2
|
||||
@stage.update()
|
||||
|
||||
destroy: ->
|
||||
@stage.canvas = null
|
||||
super()
|
|
@ -56,7 +56,10 @@ module.exports = class Simulator extends CocoClass
|
|||
@god = new God maxWorkerPoolSize: 1, maxAngels: 1 # Start loading worker.
|
||||
|
||||
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: levelID, sessionID: @task.getFirstSessionID(), headless: true
|
||||
@listenToOnce(@levelLoader, 'loaded-all', @simulateGame)
|
||||
if @supermodel.finished()
|
||||
@simulateGame()
|
||||
else
|
||||
@listenToOnce @supermodel, 'loaded-all', @simulateGame
|
||||
|
||||
simulateGame: ->
|
||||
return if @destroyed
|
||||
|
|
|
@ -177,8 +177,9 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
# Gets the sprite to reflect what the current state of the thangs and surface are
|
||||
return if @stillLoading
|
||||
@updatePosition()
|
||||
frameChanged = frameChanged or @targetScaleFactor isnt @scaleFactor
|
||||
if frameChanged
|
||||
@updateScale() # must happen before rotation
|
||||
@updateScale() # must happen before rotation
|
||||
@updateAlpha()
|
||||
@updateRotation()
|
||||
@updateAction()
|
||||
|
@ -234,7 +235,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
return unless @thang?.pos and @options.camera?
|
||||
wop = @getWorldPosition()
|
||||
[p0, p1] = [@lastPos, @thang.pos]
|
||||
return if p0 and p0.x is p1.x and p0.y is p1.y and p0.z is p1.z and not @options.camera.tweeningZoomTo
|
||||
return if p0 and p0.x is p1.x and p0.y is p1.y and p0.z is p1.z and not @options.camera.tweeningZoomTo and not @thang.bobHeight
|
||||
sup = @options.camera.worldToSurface wop
|
||||
[@displayObject.x, @displayObject.y] = [sup.x, sup.y]
|
||||
@lastPos = p1.copy?() or _.clone(p1)
|
||||
|
@ -274,7 +275,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
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
|
||||
@targetScaleFactor = @thang.scaleFactor or 1
|
||||
|
||||
updateAlpha: ->
|
||||
@imageObject.alpha = if @hiding then 0 else 1
|
||||
|
@ -336,7 +337,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
@warnedFor ?= {}
|
||||
console.warn 'Cannot show action', action, 'for', @thangType.get('name'), 'because it DNE' unless @warnedFor[action]
|
||||
@warnedFor[action] = true
|
||||
return null
|
||||
return if @action is 'idle' then null else 'idle'
|
||||
action = 'break' if @actions.break? and @thang?.erroredOut
|
||||
action = 'die' if @actions.die? and thang?.health? and thang.health <= 0
|
||||
@actions[action]
|
||||
|
|
|
@ -35,12 +35,13 @@ module.exports = class Layer extends createjs.Container
|
|||
@transformStyle = options.transform ? Layer.TRANSFORM_CHILD
|
||||
@camera = options.camera
|
||||
console.error @toString(), "needs a camera." unless @camera
|
||||
@updateLayerOrder = _.throttle @updateLayerOrder, 1 # don't call multiple times in one frame
|
||||
@updateLayerOrder = _.throttle @updateLayerOrder, 1000 / 30 # Don't call multiple times in one frame; 30 FPS is probably good enough
|
||||
Backbone.Mediator.subscribe(channel, @[func], @) for channel, func of @subscriptions
|
||||
|
||||
destroy: ->
|
||||
child.destroy?() for child in @children
|
||||
Backbone.Mediator.unsubscribe(channel, @[func], @) for channel, func of @subscriptions
|
||||
delete @updateLayerOrder
|
||||
|
||||
toString: -> "<Layer #{@layerPriority}: #{@name}>"
|
||||
|
||||
|
@ -60,21 +61,30 @@ module.exports = class Layer extends createjs.Container
|
|||
|
||||
updateLayerOrder: =>
|
||||
#console.log @, @toString(), "sorting children", _.clone @children if @name is 'Default'
|
||||
@sortChildren (a, b) ->
|
||||
alp = a.layerPriority ? 0
|
||||
blp = b.layerPriority ? 0
|
||||
return alp - blp if alp isnt blp
|
||||
# TODO: remove this z stuff
|
||||
az = if a.z then a.z else 1000
|
||||
bz = if b.z then b.z else 1000
|
||||
aThang = a.sprite?.thang
|
||||
bThang = b.sprite?.thang
|
||||
az -= 1 if aThang?.health < 0
|
||||
bz -= 1 if bThang?.health < 0
|
||||
if az == bz
|
||||
return 0 unless aThang?.pos and bThang?.pos
|
||||
return (bThang.pos.y - aThang.pos.y) or (bThang.pos.x - aThang.pos.x)
|
||||
return az - bz
|
||||
@sortChildren @layerOrderComparator
|
||||
|
||||
layerOrderComparator: (a, b) ->
|
||||
# Optimize
|
||||
alp = a.layerPriority or 0
|
||||
blp = b.layerPriority or 0
|
||||
return alp - blp if alp isnt blp
|
||||
# TODO: remove this z stuff
|
||||
az = a.z or 1000
|
||||
bz = b.z or 1000
|
||||
if aSprite = a.sprite
|
||||
if aThang = aSprite.thang
|
||||
aPos = aThang.pos
|
||||
if aThang.health < 0
|
||||
--az
|
||||
if bSprite = b.sprite
|
||||
if bThang = bSprite.thang
|
||||
bPos = bThang.pos
|
||||
if bThang.health < 0
|
||||
--bz
|
||||
if az is bz
|
||||
return 0 unless aPos and bPos
|
||||
return (bPos.y - aPos.y) or (bPos.x - aPos.x)
|
||||
return az - bz
|
||||
|
||||
onZoomUpdated: (e) ->
|
||||
return unless e.camera is @camera
|
||||
|
|
|
@ -34,6 +34,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
@world = options.world
|
||||
@options.thangTypes ?= []
|
||||
@sprites = {}
|
||||
@spriteArray = [] # Mirror @sprites, but faster for when we just need to iterate
|
||||
@selfWizardSprite = null
|
||||
@createLayers()
|
||||
@spriteSheetCache = {}
|
||||
|
@ -44,7 +45,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
@selectionMark?.destroy()
|
||||
super()
|
||||
|
||||
toString: -> "<SpriteBoss: #{@sprites.length} sprites>"
|
||||
toString: -> "<SpriteBoss: #{@spriteArray.length} sprites>"
|
||||
|
||||
thangTypeFor: (type) ->
|
||||
_.find @options.thangTypes, (m) -> m.get('original') is type or m.get('name') is type
|
||||
|
@ -77,6 +78,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
id ?= sprite.thang.id
|
||||
console.error "Sprite collision! Already have:", id if @sprites[id]
|
||||
@sprites[id] = sprite
|
||||
@spriteArray.push sprite
|
||||
layer ?= @spriteLayers["Obstacle"] if sprite.thang?.spriteName.search(/(dungeon|indoor).wall/i) isnt -1
|
||||
layer ?= @layerForChild sprite.displayObject, sprite
|
||||
layer.addChild sprite.displayObject
|
||||
|
@ -94,11 +96,8 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
unless @indieSprites
|
||||
@indieSprites = []
|
||||
@indieSprites = (@createIndieSprite indieSprite for indieSprite in indieSprites) if indieSprites
|
||||
unless @selfWizardSprite
|
||||
if withWizards and not @selfWizardSprite
|
||||
@selfWizardSprite = @createWizardSprite thangID: "My Wizard", isSelf: true, sprites: @sprites
|
||||
unless withWizards
|
||||
@selfWizardSprite.displayObject.visible = false
|
||||
@selfWizardSprite.labels.name.setText null
|
||||
|
||||
createIndieSprite: (indieSprite) ->
|
||||
unless thangType = @thangTypeFor indieSprite.thangType
|
||||
|
@ -117,7 +116,6 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
else
|
||||
sprite.targetPos = if opponent.team is 'ogres' then {x:52, y: 28} else {x: 20, y:28}
|
||||
|
||||
|
||||
createWizardSprite: (options) ->
|
||||
sprite = new WizardSprite @thangTypeFor("Wizard"), @createSpriteOptions(options)
|
||||
@addSprite sprite, sprite.thang.id, @spriteLayers["Floating"]
|
||||
|
@ -138,7 +136,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
onSetDebug: (e) ->
|
||||
return if e.debug is @debug
|
||||
@debug = e.debug
|
||||
sprite.setDebug @debug for thangID, sprite of @sprites
|
||||
sprite.setDebug @debug for sprite in @spriteArray
|
||||
|
||||
onHighlightSprites: (e) ->
|
||||
highlightedIDs = e.thangIDs or []
|
||||
|
@ -159,15 +157,16 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
sprite.displayObject.parent.removeChild sprite.displayObject
|
||||
thang = sprite.thang
|
||||
delete @sprites[sprite.thang.id]
|
||||
@spriteArray.splice @spriteArray.indexOf(sprite), 1
|
||||
sprite.destroy()
|
||||
sprite.thang = thang # Keep around so that we know which thang the destroyed thang was for
|
||||
|
||||
updateSounds: ->
|
||||
sprite.playSounds() for thangID, sprite of @sprites # hmm; doesn't work for sprites which we didn't add yet in adjustSpriteExistence
|
||||
sprite.playSounds() for sprite in @spriteArray # hmm; doesn't work for sprites which we didn't add yet in adjustSpriteExistence
|
||||
|
||||
update: (frameChanged) ->
|
||||
@adjustSpriteExistence() if frameChanged
|
||||
sprite.update frameChanged for thangID, sprite of @sprites
|
||||
sprite.update frameChanged for sprite in @spriteArray
|
||||
@updateSelection()
|
||||
@spriteLayers["Default"].updateLayerOrder()
|
||||
@cache()
|
||||
|
@ -197,7 +196,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
|
||||
cache: (update=false) ->
|
||||
return if @cached and not update
|
||||
wallSprites = (sprite for thangID, sprite of @sprites when sprite.thangType?.get('name').search(/(dungeon|indoor).wall/i) isnt -1)
|
||||
wallSprites = (sprite for sprite in @spriteArray when sprite.thangType?.get('name').search(/(dungeon|indoor).wall/i) isnt -1)
|
||||
walls = (sprite.thang for sprite in wallSprites)
|
||||
@world.calculateBounds()
|
||||
wallGrid = new Grid walls, @world.size()...
|
||||
|
@ -222,12 +221,12 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
onCastSpells: -> @stop()
|
||||
|
||||
play: ->
|
||||
sprite.imageObject.play() for thangID, sprite of @sprites
|
||||
sprite.imageObject.play() for sprite in @spriteArray
|
||||
@selectionMark?.play()
|
||||
@targetMark?.play()
|
||||
|
||||
stop: ->
|
||||
sprite.imageObject.stop() for thangID, sprite of @sprites
|
||||
sprite.imageObject.stop() for sprite in @spriteArray
|
||||
@selectionMark?.stop()
|
||||
@targetMark?.stop()
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
coords: true
|
||||
playJingle: false
|
||||
showInvisible: false
|
||||
frameRate: 60 # Best as a divisor of 60, like 15, 30, 60, with RAF_SYNCHED timing.
|
||||
frameRate: 30 # Best as a divisor of 60, like 15, 30, 60, with RAF_SYNCHED timing.
|
||||
|
||||
subscriptions:
|
||||
'level-disable-controls': 'onDisableControls'
|
||||
|
@ -221,8 +221,8 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@currentFrame = tempFrame
|
||||
frame = @world.getFrame(@getCurrentFrame())
|
||||
frame.restoreState()
|
||||
for thangID, sprite of @spriteBoss.sprites
|
||||
sprite.playSounds false, Math.max(0.05, Math.min(1, 1 / @scrubbingPlaybackSpeed))
|
||||
volume = Math.max(0.05, Math.min(1, 1 / @scrubbingPlaybackSpeed))
|
||||
sprite.playSounds false, volume for sprite in @spriteBoss.spriteArray
|
||||
tempFrame += if rising then 1 else -1
|
||||
@currentFrame = actualCurrentFrame
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ module.exports = class ThangState
|
|||
value = thang[prop]
|
||||
if type is 'Vector'
|
||||
@props.push value?.copy() # could try storing [x, y, z] or {x, y, z} here instead if this is expensive
|
||||
else if type is 'object'
|
||||
@props.push = clone(value, true)
|
||||
else if type is 'object' or type is 'array'
|
||||
@props.push clone(value, true)
|
||||
else
|
||||
@props.push value
|
||||
|
||||
|
@ -98,7 +98,7 @@ module.exports = class ThangState
|
|||
storage = @trackedPropertyValues[propIndex]
|
||||
value = @getStoredProp propIndex, type, storage
|
||||
if prop is "pos"
|
||||
if @thang.pos.distanceSquared(value) > 900
|
||||
if @thang.teleport and @thang.pos.distanceSquared(value) > 900
|
||||
# Don't interpolate; it was probably a teleport. https://github.com/codecombat/codecombat/issues/738
|
||||
@thang.pos = value
|
||||
else
|
||||
|
@ -144,6 +144,8 @@ module.exports = class ThangState
|
|||
# We make sure the array keys won't collide with any string keys by using some unprintable characters.
|
||||
stringPieces = ['\x1D'] # Group Separator
|
||||
for element in value
|
||||
if element and element.isThang
|
||||
element = element.id
|
||||
stringPieces.push element, '\x1E' # Record Separator(s)
|
||||
value = stringPieces.join('')
|
||||
specialKey = specialValuesToKeys[value]
|
||||
|
|
|
@ -42,12 +42,15 @@ module.exports.clone = clone = (obj, skipThangs=false) ->
|
|||
if skipThangs and obj.isThang
|
||||
return obj
|
||||
|
||||
if _.isArray obj
|
||||
return obj.slice()
|
||||
|
||||
if ArrayBufferView and obj instanceof ArrayBufferView
|
||||
newInstance = new obj.constructor obj
|
||||
else
|
||||
newInstance = new obj.constructor()
|
||||
for key of obj
|
||||
newInstance[key] = clone obj[key]
|
||||
return new obj.constructor obj
|
||||
|
||||
newInstance = new obj.constructor()
|
||||
for key of obj
|
||||
newInstance[key] = clone obj[key], skipThangs
|
||||
|
||||
newInstance
|
||||
|
||||
|
|
|
@ -3,29 +3,29 @@ module.exports = nativeDescription: "中文", englishDescription: "Chinese", tra
|
|||
loading: "加载中..."
|
||||
saving: "正在保存..."
|
||||
sending: "在发送中。。。"
|
||||
# send: "Send"
|
||||
send: "发送"
|
||||
cancel: "退出"
|
||||
save: "保存"
|
||||
# publish: "Publish"
|
||||
# create: "Create"
|
||||
# delay_1_sec: "1 second"
|
||||
# delay_3_sec: "3 seconds"
|
||||
# delay_5_sec: "5 seconds"
|
||||
create: "创建"
|
||||
delay_1_sec: "1 秒"
|
||||
delay_3_sec: "3 秒"
|
||||
delay_5_sec: "5 秒"
|
||||
# manual: "Manual"
|
||||
fork: "Fork"
|
||||
play: "玩"
|
||||
# retry: "Retry"
|
||||
retry: "重试"
|
||||
# watch: "Watch"
|
||||
# unwatch: "Unwatch"
|
||||
# submit_patch: "Submit Patch"
|
||||
|
||||
# units:
|
||||
# second: "second"
|
||||
# seconds: "seconds"
|
||||
# minute: "minute"
|
||||
# minutes: "minutes"
|
||||
# hour: "hour"
|
||||
# hours: "hours"
|
||||
units:
|
||||
second: "秒"
|
||||
seconds: "秒"
|
||||
minute: "分"
|
||||
minutes: "分"
|
||||
hour: "时"
|
||||
hours: "时"
|
||||
|
||||
modal:
|
||||
close: "关闭"
|
||||
|
@ -39,23 +39,23 @@ module.exports = nativeDescription: "中文", englishDescription: "Chinese", tra
|
|||
editor: "编辑"
|
||||
blog: "博客"
|
||||
forum: "论坛"
|
||||
# account: "Account"
|
||||
account: "账号"
|
||||
admin: "超级管理员"
|
||||
home: "首页"
|
||||
# contribute: "Contribute"
|
||||
contribute: "贡献"
|
||||
legal: "法律"
|
||||
about: "关于"
|
||||
contact: "联系我们"
|
||||
twitter_follow: "关注"
|
||||
# employers: "Employers"
|
||||
|
||||
# versions:
|
||||
# save_version_title: "Save New Version"
|
||||
# new_major_version: "New Major Version"
|
||||
versions:
|
||||
save_version_title: "保存新版本"
|
||||
new_major_version: "最新主要版本"
|
||||
# cla_prefix: "To save changes, first you must agree to our"
|
||||
# cla_url: "CLA"
|
||||
# cla_suffix: "."
|
||||
# cla_agree: "I AGREE"
|
||||
cla_agree: "我同意"
|
||||
|
||||
login:
|
||||
sign_up: "注册"
|
||||
|
@ -72,7 +72,7 @@ module.exports = nativeDescription: "中文", englishDescription: "Chinese", tra
|
|||
create_account_title: "创建新帐户保存游戏进度"
|
||||
description: "免费啊。先跟你讲两点你就可以开始了"
|
||||
email_announcements: "收到邮件宣告"
|
||||
# coppa: "13+ or non-USA "
|
||||
coppa: "13岁+ 或 非美国国籍 "
|
||||
coppa_why: "为什么?"
|
||||
creating: "账户在创新中"
|
||||
sign_up: "注册"
|
||||
|
@ -80,7 +80,7 @@ module.exports = nativeDescription: "中文", englishDescription: "Chinese", tra
|
|||
# social_signup: "Or, you can sign up through Facebook or G+:"
|
||||
|
||||
home:
|
||||
slogan: "通过玩儿游戏学到Javascript脚本语言"
|
||||
slogan: "通过游戏学习Javascript脚本语言"
|
||||
no_ie: "抱歉!Internet Explorer 9等更旧的预览器打不开此网站"
|
||||
no_mobile: "CodeCombat暂时没有手机版本,可能无法运行!"
|
||||
play: "玩"
|
||||
|
|
|
@ -8,14 +8,14 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
|
||||
@models = {}
|
||||
@collections = {}
|
||||
|
||||
|
||||
# Since the supermodel has undergone some changes into being a loader and a cache interface,
|
||||
# it's a bit wonky to use. The next couple functions are meant to cover the majority of
|
||||
# use cases across the site. If they are used, the view will automatically handle errors,
|
||||
# retries, progress, and filling the cache. Note that the resource it passes back will not
|
||||
# necessarily have the same model or collection that was passed in, if it was fetched from
|
||||
# the cache.
|
||||
|
||||
|
||||
loadModel: (model, name, fetchOptions, value=1) ->
|
||||
cachedModel = @getModelByURL(model.getURL())
|
||||
if cachedModel
|
||||
|
@ -28,12 +28,12 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
res = @addModelResource(cachedModel, name, fetchOptions, value)
|
||||
res.markLoading()
|
||||
return res
|
||||
|
||||
|
||||
else
|
||||
@registerModel(model)
|
||||
console.debug 'Registering model', model.getURL()
|
||||
return @addModelResource(model, name, fetchOptions, value).load()
|
||||
|
||||
|
||||
loadCollection: (collection, name, fetchOptions, value=1) ->
|
||||
url = collection.getURL()
|
||||
if cachedCollection = @collections[url]
|
||||
|
@ -46,7 +46,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
res = @addModelResource(cachedCollection, name, fetchOptions, value)
|
||||
res.markLoading()
|
||||
return res
|
||||
|
||||
|
||||
else
|
||||
@addCollection collection
|
||||
@listenToOnce collection, 'sync', (c) ->
|
||||
|
@ -56,7 +56,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
|
||||
# replace or overwrite
|
||||
shouldSaveBackups: (model) -> false
|
||||
|
||||
|
||||
# Caching logic
|
||||
|
||||
getModel: (ModelClass_or_url, id) ->
|
||||
|
@ -102,7 +102,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
else
|
||||
@registerModel(model)
|
||||
collection
|
||||
|
||||
|
||||
# Tracking resources being loaded for this supermodel
|
||||
|
||||
finished: ->
|
||||
|
@ -148,7 +148,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
@trigger('failed', source)
|
||||
|
||||
updateProgress: =>
|
||||
# Because this is _.defer'd, this might end up getting called after
|
||||
# Because this is _.defer'd, this might end up getting called after
|
||||
# a bunch of things load all at once.
|
||||
# So make sure we only emit events if @progress has changed.
|
||||
newProg = if @denom then @num / @denom else 1
|
||||
|
@ -161,8 +161,8 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
|
||||
getResource: (rid) ->
|
||||
return @resources[rid]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Resource extends Backbone.Model
|
||||
constructor: (name, value=1) ->
|
||||
|
@ -185,11 +185,11 @@ class Resource extends Backbone.Model
|
|||
@trigger('failed', {resource: @})
|
||||
@isLoaded = @isLoading = false
|
||||
@isFailed = true
|
||||
|
||||
|
||||
markLoading: ->
|
||||
@isLoaded = @isFailed = false
|
||||
@isLoading = true
|
||||
|
||||
|
||||
load: -> @
|
||||
|
||||
|
||||
|
|
|
@ -40,3 +40,6 @@
|
|||
font-size: 13px
|
||||
height: 24px
|
||||
|
||||
|
||||
#level-done-button
|
||||
display: none
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
#docs-modal .modal-dialog
|
||||
width: 800px
|
||||
width: 800px
|
||||
|
||||
li:not(.active) a[data-toggle="tab"]
|
||||
cursor: pointer
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@import "../../../bootstrap/mixins"
|
||||
@import "app/styles/bootstrap/mixins"
|
||||
|
||||
@mixin editor-height($extraHeight)
|
||||
@include box-sizing(border-box)
|
||||
|
@ -42,6 +42,9 @@
|
|||
width: 100%
|
||||
height: 100%
|
||||
|
||||
.powered-by-firepad
|
||||
display: none
|
||||
|
||||
.ace_editor
|
||||
// When Firepad isn't active, .ace_editor needs the width/height set itself.
|
||||
@include editor-height(0px)
|
||||
|
@ -109,8 +112,9 @@
|
|||
// Override faint gray
|
||||
border-color: #BFF
|
||||
|
||||
.ace_identifier
|
||||
border-bottom: 1px dotted rgba(255, 128, 128, 0.45)
|
||||
// Decided it wasn't useful to show what can be hovered, since almost anything can, so we have to make it too faint to be useful if we don't want it to be really distracting.
|
||||
//.ace_identifier
|
||||
// border-bottom: 1px dotted rgba(0, 51, 255, 0.25)
|
||||
|
||||
.ace_text-layer .ace_comment
|
||||
color: darken(rgb(103, 164, 200), 5%)
|
||||
|
@ -119,3 +123,13 @@
|
|||
// https://github.com/codecombat/codecombat/issues/6
|
||||
color: rgb(145, 48, 50)
|
||||
|
||||
.ace_search
|
||||
background-color: rgba(216, 187, 165, 1)
|
||||
border: 0
|
||||
@include box-shadow(1px 2px 1px #444)
|
||||
|
||||
.ace_search_field
|
||||
width: 190px
|
||||
|
||||
.ace_searchbtn, .ace_replacebtn
|
||||
padding: 0px 4px
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
margin: 4px 1%
|
||||
height: 45px
|
||||
width: 97%
|
||||
z-index: 4
|
||||
//background-color: rgba(100, 45, 210, 0.15)
|
||||
|
||||
.flow
|
||||
|
|
|
@ -94,6 +94,7 @@ block content
|
|||
- var notes = user.get('jobProfileNotes') || '';
|
||||
if me.isAdmin()
|
||||
textarea#job-profile-notes!= notes
|
||||
button.btn.btn-primary#save-notes-button Save Notes
|
||||
else
|
||||
div!= marked(notes)
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@ block content
|
|||
for candidate, index in candidates
|
||||
- var profile = candidate.get('jobProfile');
|
||||
- var authorized = candidate.id; // If we have the id, then we are authorized.
|
||||
tr(data-candidate-id=candidate.id)
|
||||
tr(data-candidate-id=candidate.id, id=candidate.id)
|
||||
td
|
||||
if authorized
|
||||
img(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, width=50)
|
||||
img(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, height=50)
|
||||
p= profile.name
|
||||
else
|
||||
img(src="/images/pages/contribute/archmage.png", alt="", title="Sign up as an employer to see our candidates", width=50)
|
||||
|
|
|
@ -46,8 +46,7 @@ block modal-footer
|
|||
if userIsAnonymous
|
||||
if !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
b.signin-text Sign in with LinkedIn to complete the registration process.
|
||||
script(type="in/Login" id="linkedInAuthButton" data-onAuth="contractCallback")
|
||||
button.btn.btn-primary(id="create-account-button") Create Account
|
||||
br
|
||||
br
|
||||
| Already have a CodeCombat account?
|
||||
|
@ -57,7 +56,6 @@ block modal-footer
|
|||
a.login-link(data-toggle="coco-modal", data-target="modal/login") Please log in to continue.
|
||||
else if !userIsAnonymous && !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
| We will record your name and work history for verification purposes.
|
||||
else if userIsAuthorized && !userHasSignedContract
|
||||
.modal-footer.linkedin
|
||||
button.btn.btn-primary(id="contract-agreement-button") I agree
|
||||
|
|
|
@ -17,4 +17,4 @@ if spectateGame
|
|||
|
||||
button.btn.btn-xs.btn-inverse.banner#restart-button(title="Reload all custom code to reset level", data-i18n="play_level.restart") Restart
|
||||
|
||||
button.btn.btn-xs.btn-primary.banner.secret#level-done-button(data-i18n="play_level.done") Done
|
||||
button.btn.btn-xs.btn-primary.banner#level-done-button(data-i18n="play_level.done") Done
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = class ProfileView extends View
|
|||
|
||||
events:
|
||||
'click #toggle-job-profile-approved': 'toggleJobProfileApproved'
|
||||
'keyup #job-profile-notes': 'onJobProfileNotesChanged'
|
||||
'click save-notes-button': 'onJobProfileNotesChanged'
|
||||
'click #contact-candidate': 'onContactCandidate'
|
||||
'click #enter-espionage-mode': 'enterEspionageMode'
|
||||
|
||||
|
@ -20,7 +20,9 @@ module.exports = class ProfileView extends View
|
|||
@user = me
|
||||
else
|
||||
@user = User.getByID(@userID)
|
||||
@addResourceToLoad @user, 'user_profile'
|
||||
@user.fetch()
|
||||
@listenTo @user, "sync", =>
|
||||
@render()
|
||||
|
||||
getRenderData: ->
|
||||
context = super()
|
||||
|
|
|
@ -64,7 +64,7 @@ module.exports = class EditorLevelView extends View
|
|||
return unless @supermodel.finished()
|
||||
@$el.find('a[data-toggle="tab"]').on 'shown.bs.tab', (e) =>
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
@thangsTab = @insertSubView new ThangsTabView world: @world, supermodel: @supermodel
|
||||
@thangsTab = @insertSubView new ThangsTabView world: @world, supermodel: @supermodel, level: @level
|
||||
@settingsTab = @insertSubView new SettingsTabView supermodel: @supermodel
|
||||
@scriptsTab = @insertSubView new ScriptsTabView world: @world, supermodel: @supermodel, files: @files
|
||||
@componentsTab = @insertSubView new ComponentsTabView supermodel: @supermodel
|
||||
|
|
|
@ -35,7 +35,6 @@ module.exports = class ThangsTabView extends View
|
|||
'surface:mouse-moved': 'onSurfaceMouseMoved'
|
||||
'surface:mouse-over': 'onSurfaceMouseOver'
|
||||
'surface:mouse-out': 'onSurfaceMouseOut'
|
||||
'level-loaded': 'onLevelLoaded'
|
||||
'edit-level-thang': 'editThang'
|
||||
'level-thang-edited': 'onLevelThangEdited'
|
||||
'level-thang-done-editing': 'onLevelThangDoneEditing'
|
||||
|
@ -68,6 +67,7 @@ module.exports = class ThangsTabView extends View
|
|||
@thangTypes = @supermodel.loadCollection(new ThangTypeSearchCollection(), 'thangs').model
|
||||
# just loading all Components for now: https://github.com/codecombat/codecombat/issues/405
|
||||
@componentCollection = @supermodel.loadCollection(new ComponentsCollection(), 'components').load()
|
||||
@level = options.level
|
||||
|
||||
$(document).bind 'contextmenu', @preventDefaultContextMenu
|
||||
|
||||
|
@ -113,7 +113,7 @@ module.exports = class ThangsTabView extends View
|
|||
@$el.find('#extant-thangs-filter button:first').button('toggle')
|
||||
$(window).resize @onWindowResize
|
||||
@addThangsView = @insertSubView new AddThangsView world: @world, supermodel: @supermodel
|
||||
@onLevelLoaded() # refactor to not have this trigger when this view re-renders?
|
||||
@buildInterface() # refactor to not have this trigger when this view re-renders?
|
||||
|
||||
onFilterExtantThangs: (e) ->
|
||||
@$el.find('#extant-thangs-filter button.active').button('toggle')
|
||||
|
@ -127,7 +127,7 @@ module.exports = class ThangsTabView extends View
|
|||
@scrollTop += (if e.deltaY < 0 then 1 else -1) * 30
|
||||
e.preventDefault()
|
||||
|
||||
onLevelLoaded: (e) ->
|
||||
buildInterface: (e) ->
|
||||
@level = e.level if e
|
||||
|
||||
data = $.extend(true, {}, @level.attributes)
|
||||
|
|
|
@ -20,11 +20,18 @@ module.exports = class EmployersView extends View
|
|||
constructor: (options) ->
|
||||
super options
|
||||
@getCandidates()
|
||||
|
||||
checkForEmployerSignupHash: =>
|
||||
if window.location.hash is "#employerSignupLoggingIn" and not ("employer" in me.get("permissions"))
|
||||
@openModalView application.router.getView("modal/employer_signup","_modal")
|
||||
window.location.hash = ""
|
||||
afterRender: ->
|
||||
super()
|
||||
@sortTable() if @candidates.models.length
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
_.delay @checkForEmployerSignupHash, 500
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.candidates = @candidates.models
|
||||
|
@ -38,7 +45,13 @@ module.exports = class EmployersView extends View
|
|||
@candidates = new CandidatesCollection()
|
||||
@candidates.fetch()
|
||||
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
|
||||
@listenToOnce @candidates, 'all', @render
|
||||
@listenToOnce @candidates, 'all', @renderCandidatesAndSetupScrolling
|
||||
|
||||
renderCandidatesAndSetupScrolling: =>
|
||||
@render()
|
||||
$(".nano").nanoScroller()
|
||||
if window.location.hash.length is 25
|
||||
$(".nano").nanoScroller({scrollTo:$(window.location.hash)})
|
||||
|
||||
sortTable: ->
|
||||
# http://mottie.github.io/tablesorter/docs/example-widget-bootstrap-theme.html
|
||||
|
@ -162,6 +175,7 @@ module.exports = class EmployersView extends View
|
|||
|
||||
onCandidateClicked: (e) ->
|
||||
id = $(e.target).closest('tr').data('candidate-id')
|
||||
window.location.hash = id
|
||||
if id
|
||||
url = "/account/profile/#{id}"
|
||||
app.router.navigate url, {trigger: true}
|
||||
|
|
|
@ -115,7 +115,7 @@ module.exports = class CocoView extends Backbone.View
|
|||
|
||||
afterRender: ->
|
||||
|
||||
updateProgress: (progress)=>
|
||||
updateProgress: (progress) ->
|
||||
@loadProgress.progress = progress if progress > @loadProgress.progress
|
||||
@updateProgressBar(progress)
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@ module.exports = class EmployerSignupView extends View
|
|||
|
||||
subscriptions:
|
||||
"server-error": "onServerError"
|
||||
"created-user-without-reload": "linkedInAuth"
|
||||
'linkedin-loaded': 'onLinkedInLoaded'
|
||||
"created-user-without-reload": 'createdAccount'
|
||||
|
||||
events:
|
||||
"click #contract-agreement-button": "agreeToContract"
|
||||
"click #create-account-button": "createAccount"
|
||||
"click .login-link": "setHashToOpenModalAutomatically"
|
||||
|
||||
|
||||
constructor: (options) ->
|
||||
|
@ -24,20 +27,31 @@ module.exports = class EmployerSignupView extends View
|
|||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
window.tracker?.trackEvent 'Started Employer Signup'
|
||||
@reloadWhenClosed = false
|
||||
@linkedinLoaded = Boolean(IN.parse)
|
||||
@waitingForLinkedIn = false
|
||||
window.contractCallback = =>
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
@render()
|
||||
|
||||
onLinkedInLoaded: =>
|
||||
@linkedinLoaded = true
|
||||
if @waitingForLinkedIn
|
||||
@renderLinkedInButton()
|
||||
|
||||
renderLinkedInButton: =>
|
||||
IN.parse()
|
||||
|
||||
onServerError: (e) ->
|
||||
@disableModalInProgress(@$el)
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
linkedInButtonParentElement = document.getElementById("linkedInAuthButton")?.parentNode
|
||||
linkedInButtonParentElement = document.getElementById("linkedInAuthButton")
|
||||
if linkedInButtonParentElement
|
||||
IN.parse()
|
||||
if me.get('anonymous')
|
||||
$(".IN-widget").get(0).addEventListener('click', @createAccount, true)
|
||||
if @linkedinLoaded
|
||||
@renderLinkedInButton()
|
||||
else
|
||||
@waitingForLinkedIn = true
|
||||
|
||||
getRenderData: ->
|
||||
context = super()
|
||||
|
@ -78,11 +92,16 @@ module.exports = class EmployerSignupView extends View
|
|||
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
||||
@enableModalInProgress(@$el)
|
||||
auth.createUserWithoutReload userObject, null
|
||||
IN.User.authorize @render, @
|
||||
|
||||
linkedInAuth: (e) ->
|
||||
me.fetch()
|
||||
setHashToOpenModalAutomatically: (e) ->
|
||||
window.location.hash = "employerSignupLoggingIn"
|
||||
|
||||
createdAccount: ->
|
||||
@reloadWhenClosed = true
|
||||
@listenTo me,"sync", =>
|
||||
@render()
|
||||
IN.parse()
|
||||
me.fetch()
|
||||
|
||||
destroy: ->
|
||||
reloadWhenClosed = @reloadWhenClosed
|
||||
|
|
|
@ -306,10 +306,11 @@ module.exports = class HUDView extends View
|
|||
for actionName, action of @thang.actions
|
||||
@updateActionElement(actionName, @timespans[actionName], @thang.action is actionName)
|
||||
tableContainer = @$el.find('.table-container')
|
||||
timelineWidth = tableContainer.find('tr:not(.secret) .action-timeline').width()
|
||||
right = (1 - (@timeProgress ? 0)) * timelineWidth
|
||||
arrow = tableContainer.find('.progress-arrow')
|
||||
arrow.css 'right', right - arrow.width() / 2
|
||||
@timelineWidth ||= tableContainer.find('tr:not(.secret) .action-timeline').width()
|
||||
@actionArrowWidth ||= arrow.width()
|
||||
right = (1 - (@timeProgress ? 0)) * @timelineWidth
|
||||
arrow.css 'right', right - @actionArrowWidth / 2
|
||||
tableContainer.find('.progress-line').css 'right', right
|
||||
|
||||
buildActionTimespans: ->
|
||||
|
|
|
@ -6,9 +6,6 @@ module.exports = class LevelLoadingView extends View
|
|||
id: "level-loading-view"
|
||||
template: template
|
||||
|
||||
subscriptions:
|
||||
'level-loader:progress-changed': 'onLevelLoaderProgressChanged'
|
||||
|
||||
onLoaded: ->
|
||||
afterRender: ->
|
||||
@$el.find('.tip.rare').remove() if _.random(1, 10) < 9
|
||||
|
@ -17,25 +14,16 @@ module.exports = class LevelLoadingView extends View
|
|||
$(tip).removeClass('to-remove')
|
||||
@$el.find('.to-remove').remove()
|
||||
|
||||
onLevelLoaderProgressChanged: (e) ->
|
||||
return if @destroyed
|
||||
@progress = e.progress
|
||||
@progress = 0.01 if @progress < 0.01
|
||||
@updateProgressBar()
|
||||
|
||||
updateProgressBar: ->
|
||||
@$el.find('.progress-bar').css('width', (100 * @progress) + '%')
|
||||
|
||||
showReady: ->
|
||||
ready = $.i18n.t('play_level.loading_ready', defaultValue: 'Ready!')
|
||||
@$el.find('#tip-wrapper .tip').addClass('ready').text ready
|
||||
Backbone.Mediator.publish 'play-sound', trigger: 'loading_ready', volume: 0.75
|
||||
Backbone.Mediator.publish 'play-sound', trigger: 'level_loaded', volume: 0.75 # old: loading_ready
|
||||
|
||||
unveil: ->
|
||||
_.delay @reallyUnveil, 1000
|
||||
|
||||
reallyUnveil: =>
|
||||
return if @destroyed or @progress < 1
|
||||
return if @destroyed
|
||||
@$el.addClass 'unveiled'
|
||||
loadingDetails = @$el.find('.loading-details')
|
||||
duration = parseFloat loadingDetails.css 'transition-duration'
|
||||
|
|
|
@ -238,7 +238,7 @@ module.exports = class PlaybackView extends View
|
|||
@currentTime = e.frame / e.world.frameRate
|
||||
# Game will sometimes stop at 29.97, but with only one digit, this is unnecesary.
|
||||
# @currentTime = @totalTime if Math.abs(@totalTime - @currentTime) < 0.04
|
||||
@updatePopupContent()
|
||||
@updatePopupContent() if @timePopup?.shown
|
||||
|
||||
@updateProgress(e.progress)
|
||||
@updatePlayButton(e.progress)
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports = class ProblemAlertView extends View
|
|||
|
||||
getRenderData: (context={}) ->
|
||||
context = super context
|
||||
format = (s) -> s?.replace("\n", "<br>").replace('<', '<').replace('>', '>')
|
||||
format = (s) -> s?.replace('<', '<').replace('>', '>').replace("\n", "<br>")
|
||||
context.message = format @problem.aetherProblem.message
|
||||
context.hint = format @problem.aetherProblem.hint
|
||||
context
|
||||
|
|
|
@ -92,7 +92,7 @@ module.exports = class Spell
|
|||
@worker.addEventListener "message", (e) =>
|
||||
workerData = JSON.parse e.data
|
||||
if workerData.function is "hasChangedSignificantly" and workerData.spellKey is @spellKey
|
||||
@worker.removeEventListener("message",arguments.callee, false)
|
||||
@worker.removeEventListener "message", arguments.callee, false
|
||||
cb(workerData.hasChanged)
|
||||
@worker.postMessage JSON.stringify(workerMessage)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = class DebugView extends View
|
|||
@ace = options.ace
|
||||
@thang = options.thang
|
||||
@variableStates = {}
|
||||
@globals = {Math: Math, _: _} # ... add more as documented
|
||||
@globals = {Math: Math, _: _, String: String, Number: Number, Array: Array, Object: Object} # ... add more as documented
|
||||
for className, klass of serializedClasses
|
||||
@globals[className] = klass
|
||||
@onMouseMove = _.throttle @onMouseMove, 25
|
||||
|
@ -33,17 +33,18 @@ module.exports = class DebugView extends View
|
|||
setVariableStates: (@variableStates) ->
|
||||
@update()
|
||||
|
||||
isIdentifier: (t) ->
|
||||
t and (t.type is 'identifier' or t.value is 'this' or @globals[t.value])
|
||||
|
||||
onMouseMove: (e) =>
|
||||
return if @destroyed
|
||||
pos = e.getDocumentPosition()
|
||||
endOfDoc = pos.row is @ace.getSession().getDocument().getLength() - 1
|
||||
it = new TokenIterator e.editor.session, pos.row, pos.column
|
||||
isIdentifier = (t) => t and (t.type is 'identifier' or t.value is 'this' or @globals[t.value])
|
||||
while it.getCurrentTokenRow() is pos.row and not isIdentifier(token = it.getCurrentToken())
|
||||
endOfLine = it.getCurrentToken()?.index is it.$rowTokens.length - 1
|
||||
while it.getCurrentTokenRow() is pos.row and not @isIdentifier(token = it.getCurrentToken())
|
||||
break if endOfLine or not token # Don't iterate beyond end or beginning of line
|
||||
it.stepBackward()
|
||||
break unless token
|
||||
break if endOfDoc # Don't iterate backward on last line, since we might be way below.
|
||||
if isIdentifier token
|
||||
if @isIdentifier token
|
||||
# This could be a property access, like "enemy.target.pos" or "this.spawnedRectangles".
|
||||
# We have to realize this and dig into the nesting of the objects.
|
||||
start = it.getCurrentTokenColumn()
|
||||
|
@ -53,7 +54,7 @@ module.exports = class DebugView extends View
|
|||
break unless it.getCurrentToken()?.value is "."
|
||||
it.stepBackward()
|
||||
token = null # If we're doing a complex access like this.getEnemies().length, then length isn't a valid var.
|
||||
break unless isIdentifier(prev = it.getCurrentToken())
|
||||
break unless @isIdentifier(prev = it.getCurrentToken())
|
||||
token = prev
|
||||
start = it.getCurrentTokenColumn()
|
||||
chain.unshift token.value
|
||||
|
|
|
@ -324,7 +324,7 @@ module.exports = class SpellView extends View
|
|||
needsUpdate = codeHasChangedSignificantly or @spellThang isnt @lastUpdatedAetherSpellThang
|
||||
return if not needsUpdate and aether is @displayedAether
|
||||
castAether = @spellThang.castAether
|
||||
codeIsAsCast = castAether and not hasChanged
|
||||
codeIsAsCast = castAether and source is castAether.raw
|
||||
aether = castAether if codeIsAsCast
|
||||
return if not needsUpdate and aether is @displayedAether
|
||||
|
||||
|
@ -345,7 +345,7 @@ module.exports = class SpellView extends View
|
|||
@worker.addEventListener "message", (e) =>
|
||||
workerData = JSON.parse e.data
|
||||
if workerData.function is "transpile" and workerData.spellKey is @spell.spellKey
|
||||
@worker.removeEventListener("message",arguments.callee, false)
|
||||
@worker.removeEventListener "message", arguments.callee, false
|
||||
aether.problems = workerData.problems
|
||||
aether.raw = source
|
||||
finishUpdatingAether(aether)
|
||||
|
@ -353,7 +353,6 @@ module.exports = class SpellView extends View
|
|||
else
|
||||
finishUpdatingAether(aether)
|
||||
|
||||
|
||||
clearAetherDisplay: ->
|
||||
problem.destroy() for problem in @problems
|
||||
@problems = []
|
||||
|
@ -384,7 +383,7 @@ module.exports = class SpellView extends View
|
|||
|
||||
# Autocast:
|
||||
# Goes immediately if the code is a) changed and b) complete/valid and c) the cursor is at beginning or end of a line
|
||||
# We originall thought it would:
|
||||
# We originally thought it would:
|
||||
# - Go after specified delay if a) and b) but not c)
|
||||
# - Go only when manually cast or deselecting a Thang when there are errors
|
||||
# But the error message display was delayed, so now trying:
|
||||
|
|
|
@ -156,9 +156,16 @@ module.exports = class ThangListEntryView extends View
|
|||
@$el.toggleClass('disabled', not enabled)
|
||||
|
||||
onFrameChanged: (e) ->
|
||||
# Optimize
|
||||
return unless currentThang = e.world.thangMap[@thang.id]
|
||||
@$el.toggle Boolean(currentThang.exists)
|
||||
@$el.toggleClass 'dead', currentThang.health <= 0 if currentThang.exists
|
||||
exists = Boolean currentThang.exists
|
||||
if @thangDidExist isnt exists
|
||||
@$el.toggle exists
|
||||
@thangDidExist = exists
|
||||
dead = exists and currentThang.health <= 0
|
||||
if @thangWasDead isnt dead
|
||||
@$el.toggleClass 'dead', dead
|
||||
@thangWasDead = dead
|
||||
|
||||
destroy: ->
|
||||
@avatar?.destroy()
|
||||
|
|
|
@ -119,7 +119,7 @@ module.exports = class TomeView extends View
|
|||
spellKey = pathComponents.join '/'
|
||||
@thangSpells[thang.id].push spellKey
|
||||
unless method.cloneOf
|
||||
skipProtectAPI = @getQueryVariable "skip_protect_api", not @options.ladderGame and not (@options.levelID in ['find-the-spy'])
|
||||
skipProtectAPI = @getQueryVariable "skip_protect_api", (@options.levelID in ['gridmancer'])
|
||||
skipFlow = @getQueryVariable "skip_flow", (@options.levelID in ['brawlwood', 'greed', 'gold-rush'])
|
||||
spell = @spells[spellKey] = new Spell programmableMethod: method, spellKey: spellKey, pathComponents: pathPrefixComponents.concat(pathComponents), session: @options.session, supermodel: @supermodel, skipFlow: skipFlow, skipProtectAPI: skipProtectAPI, worker: @worker
|
||||
for thangID, spellKeys of @thangSpells
|
||||
|
|
|
@ -86,16 +86,26 @@ module.exports = class PlayLevelView extends View
|
|||
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
||||
|
||||
if @isEditorPreview
|
||||
f = =>
|
||||
@supermodel.shouldSaveBackups = (model) ->
|
||||
model.constructor.className in ['Level', 'LevelComponent', 'LevelSystem']
|
||||
@load() unless @levelLoader
|
||||
# wait to see if it's just given to us through setLevel
|
||||
f = => @load() unless @levelLoader
|
||||
setTimeout f, 100
|
||||
else
|
||||
@load()
|
||||
application.tracker?.trackEvent 'Started Level Load', level: @levelID, label: @levelID
|
||||
|
||||
<<<<<<< HEAD
|
||||
setLevel: (@level, @supermodel) ->
|
||||
=======
|
||||
onLevelLoadError: (e) ->
|
||||
# TODO NOW: remove this in favor of the supermodel handling it
|
||||
application.router.navigate "/play?not_found=#{@levelID}", {trigger: true}
|
||||
|
||||
setLevel: (@level, givenSupermodel) ->
|
||||
@supermodel.models = givenSupermodel.models
|
||||
@supermodel.collections = givenSupermodel.collections
|
||||
@supermodel.shouldSaveBackups = givenSupermodel.shouldSaveBackups
|
||||
|
||||
>>>>>>> master
|
||||
@god?.level = @level.serialize @supermodel
|
||||
if @world
|
||||
serializedLevel = @level.serialize(@supermodel)
|
||||
|
@ -124,7 +134,8 @@ module.exports = class PlayLevelView extends View
|
|||
@$el.find('#level-done-button').hide()
|
||||
$('body').addClass('is-playing')
|
||||
|
||||
onLevelLoaderProgressChanged: ->
|
||||
updateProgress: (progress) ->
|
||||
super(progress)
|
||||
return if @seenDocs
|
||||
return unless @levelLoader.session.loaded and @levelLoader.level.loaded
|
||||
return unless showFrequency = @levelLoader.level.get('showsGuide')
|
||||
|
@ -141,7 +152,7 @@ module.exports = class PlayLevelView extends View
|
|||
DocsModal = require './level/modal/docs_modal'
|
||||
options = {docs: @levelLoader.level.get('documentation'), supermodel: @supermodel}
|
||||
@openModalView(new DocsModal(options), true)
|
||||
Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
|
||||
Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaded, @
|
||||
return true
|
||||
|
||||
onLoaded: ->
|
||||
|
@ -151,7 +162,7 @@ module.exports = class PlayLevelView extends View
|
|||
return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early
|
||||
@loadingView.showReady()
|
||||
if window.currentModal and not window.currentModal.destroyed
|
||||
return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
|
||||
return Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaded, @
|
||||
|
||||
# Save latest level played in local storage
|
||||
if not (@levelLoader.level.get('type') in ['ladder', 'ladder-tutorial'])
|
||||
|
@ -290,7 +301,7 @@ module.exports = class PlayLevelView extends View
|
|||
docs = new VictoryModal(options)
|
||||
@openModalView(docs)
|
||||
if me.get('anonymous')
|
||||
window.nextLevelURL = @getNextLevelID() # Signup will go here on completion instead of reloading.
|
||||
window.nextLevelURL = @getNextLevelURL() # Signup will go here on completion instead of reloading.
|
||||
|
||||
onRestartLevel: ->
|
||||
@tome.reloadAllCode()
|
||||
|
@ -315,15 +326,17 @@ module.exports = class PlayLevelView extends View
|
|||
viewArgs: [{supermodel:@supermodel}, nextLevelID]}
|
||||
|
||||
getNextLevel: ->
|
||||
nextLevelOriginal = @level.get('nextLevel')?.original
|
||||
return null unless nextLevelOriginal = @level.get('nextLevel')?.original
|
||||
levels = @supermodel.getModels(Level)
|
||||
return l for l in levels when l.get('original') is nextLevelOriginal
|
||||
|
||||
getNextLevelID: ->
|
||||
nextLevel = @getNextLevel()
|
||||
return null unless nextLevel = @getNextLevel()
|
||||
nextLevelID = nextLevel.get('slug') or nextLevel.id
|
||||
|
||||
getNextLevelURL: -> "/play/level/#{@getNextLevelID()}"
|
||||
getNextLevelURL: ->
|
||||
return null unless @getNextLevelID()
|
||||
"/play/level/#{@getNextLevelID()}"
|
||||
|
||||
onHighlightDom: (e) ->
|
||||
if e.delay
|
||||
|
|
|
@ -106,7 +106,6 @@ module.exports = class SpectateLevelView extends View
|
|||
spectateMode: true
|
||||
team: @getQueryVariable("team")
|
||||
@listenToOnce(@levelLoader, 'loaded-all', @onLevelLoaderLoaded)
|
||||
@listenTo(@levelLoader, 'progress', @onLevelLoaderProgressChanged)
|
||||
@god = new God maxWorkerPoolSize: 1, maxAngels: 1
|
||||
|
||||
getRenderData: ->
|
||||
|
@ -121,7 +120,8 @@ module.exports = class SpectateLevelView extends View
|
|||
super()
|
||||
$('body').addClass('is-playing')
|
||||
|
||||
onLevelLoaderProgressChanged: ->
|
||||
updateProgress: (progress) ->
|
||||
super(progress)
|
||||
return if @seenDocs
|
||||
return unless showFrequency = @levelLoader.level.get('showGuide')
|
||||
session = @levelLoader.session
|
||||
|
@ -141,7 +141,10 @@ module.exports = class SpectateLevelView extends View
|
|||
Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelLoaderLoaded, @
|
||||
return true
|
||||
|
||||
onLevelLoaderLoaded: ->
|
||||
onLoaded: ->
|
||||
_.defer => @onLevelLoaded()
|
||||
|
||||
onLevelLoaded: ->
|
||||
return unless @levelLoader.progress() is 1 # double check, since closing the guide may trigger this early
|
||||
# Save latest level played in local storage
|
||||
if window.currentModal and not window.currentModal.destroyed
|
||||
|
|
|
@ -230,7 +230,7 @@ module.exports = class PlayView extends View
|
|||
{
|
||||
name: 'Harvest Time'
|
||||
difficulty: 2
|
||||
id: 'find-the-spy'
|
||||
id: 'harvest-time'
|
||||
image: '/file/db/level/529662dfe0df8f0000000007/grab_the_mushroom_icon.png'
|
||||
description: "Collect a hundred mushrooms in just five lines of code - by Nathan Gossett"
|
||||
}
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
<native>français</native>
|
||||
<intro>From now on we'll send our feedback in English!</intro>
|
||||
</global>
|
||||
<install>
|
||||
<system>
|
||||
<bit>-bit computer detected.</bit>
|
||||
<prefix>The operating system</prefix>
|
||||
<sufix>was detected.</sufix>
|
||||
<xp>We don't support Windows XP, installation cancelled.</xp>
|
||||
</system>
|
||||
<process>
|
||||
<sks>Have you already installed all the software needed for CodeCombat?</sks>
|
||||
<skq>We recommand that you reply negative in case you're not sure.</skq>
|
||||
<skc>Skipping the installation of the software...</skc>
|
||||
<s1>CodeCombat couldn't be developed without third-party software.</s1>
|
||||
<s2>That's why you'll need to install this software,</s2>
|
||||
<s3>in order to start contributing to our community.</s3>
|
||||
<s4>Cancel the installation if you already have the application.</s4>
|
||||
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
|
||||
<prefix>Do you already have the latest version of</prefix>
|
||||
<sufix>installed?</sufix>
|
||||
<downloading>is downloading...</downloading>
|
||||
<installing>is installing...</installing>
|
||||
<unzipping>is unzipping...</unzipping>
|
||||
<cleaning>is cleaning...</cleaning>
|
||||
<mongodbpath>Please define the full path where mongodb should be installed</mongodbpath>
|
||||
</process>
|
||||
</install>
|
||||
<github>
|
||||
<intro>
|
||||
<opensource>CodeCombat is opensource, like you already know.</opensource>
|
||||
<online>All our sourcecode can be found online at Github.</online>
|
||||
<manual>You can choose to do the entire Git setup yourself.</manual>
|
||||
<norec>However we recommend that you instead let us handle it instead.</norec>
|
||||
</intro>
|
||||
<skip>
|
||||
<question>Do you want to do the Local Git setup manually yourself?</question>
|
||||
<consequence>Make sure you have correctly setup your repository before processing.</consequence>
|
||||
<donotclose>Do not close this window please.</donotclose>
|
||||
<wait>When you're ready, press any key to continue...</wait>
|
||||
</skip>
|
||||
<process>
|
||||
<path>Please give the full path of your CodeCombat git repository: </path>
|
||||
<checkout>Please enter the full path where you want to install your CodeCombat environment</checkout>
|
||||
<bashi>This installation requires Git Bash.</bashi>
|
||||
<bashp64>Git bash is by default installed at 'C:\Program Files (x86)\Git'.</bashp64>
|
||||
<bashp32>Git bash is by default installed at 'C:\Program Files\Git'.</bashp32>
|
||||
<bashq>Please enter the full path where git bash is installed or just press enter if it's in the default location</bashq>
|
||||
<ssh>Do you want to checkout the repository via ssh?</ssh>
|
||||
</process>
|
||||
</github>
|
||||
<npm>
|
||||
<install>Installing bower, brunch, nodemon and sendwithus...</install>
|
||||
<binstall>Installing bower packages...</binstall>
|
||||
<sass>Installing sass...</sass>
|
||||
<npm>Installing npm...</npm>
|
||||
<brnch>Starting brunch....</brnch>
|
||||
<mongodb>Setting up a MongoDB database for you...</mongodb>
|
||||
<db>Downloading the last version of the CodeCombat database...</db>
|
||||
<script>Preparing the automatic startup script for you...</script>
|
||||
</npm>
|
||||
<error>
|
||||
<path>That path already exists, are you sure you want to overwrite it?</path>
|
||||
<exist>That path doesn't exist. Please try again...</exist>
|
||||
</error>
|
||||
<end>
|
||||
<succesfull>The setup of the CodeCombat Dev. Environment was succesfull.</succesfull>
|
||||
<thankyou>Thank you already for your contribution and see you soon.</thankyou>
|
||||
<readme>Do you want to read the README for more information?</readme>
|
||||
</end>
|
||||
<start>
|
||||
<s1>From now on you can start the dev. environment at</s1>
|
||||
<s2>the touch of a single mouse click.</s2>
|
||||
<s3> 1) Just double click</s3>
|
||||
<s4> and let the environment start up.</s4>
|
||||
<s5> 2) Now just open 'localhost:3000' in your prefered browser.</s5>
|
||||
<s6>That's it, you're now ready to start working on CodeCombat!</s6>
|
||||
</start>
|
||||
</variables>
|
|
@ -1,7 +0,0 @@
|
|||
en
|
||||
nl
|
||||
de
|
||||
fr
|
||||
zh
|
||||
zh-HANT
|
||||
zh-HANS
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
<native>中文</native>
|
||||
<intro>From now on we'll send our feedback in English!</intro>
|
||||
</global>
|
||||
<install>
|
||||
<system>
|
||||
<bit>-bit computer detected.</bit>
|
||||
<prefix>The operating system</prefix>
|
||||
<sufix>was detected.</sufix>
|
||||
<xp>We don't support Windows XP, installation cancelled.</xp>
|
||||
</system>
|
||||
<process>
|
||||
<sks>Have you already installed all the software needed for CodeCombat?</sks>
|
||||
<skq>We recommand that you reply negative in case you're not sure.</skq>
|
||||
<skc>Skipping the installation of the software...</skc>
|
||||
<s1>CodeCombat couldn't be developed without third-party software.</s1>
|
||||
<s2>That's why you'll need to install this software,</s2>
|
||||
<s3>in order to start contributing to our community.</s3>
|
||||
<s4>Cancel the installation if you already have the application.</s4>
|
||||
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
|
||||
<prefix>Do you already have the latest version of</prefix>
|
||||
<sufix>installed?</sufix>
|
||||
<downloading>is downloading...</downloading>
|
||||
<installing>is installing...</installing>
|
||||
<unzipping>is unzipping...</unzipping>
|
||||
<cleaning>is cleaning...</cleaning>
|
||||
<mongodbpath>Please define the full path where mongodb should be installed</mongodbpath>
|
||||
</process>
|
||||
</install>
|
||||
<github>
|
||||
<intro>
|
||||
<opensource>CodeCombat is opensource, like you already know.</opensource>
|
||||
<online>All our sourcecode can be found online at Github.</online>
|
||||
<manual>You can choose to do the entire Git setup yourself.</manual>
|
||||
<norec>However we recommend that you instead let us handle it instead.</norec>
|
||||
</intro>
|
||||
<skip>
|
||||
<question>Do you want to do the Local Git setup manually yourself?</question>
|
||||
<consequence>Make sure you have correctly setup your repository before processing.</consequence>
|
||||
<donotclose>Do not close this window please.</donotclose>
|
||||
<wait>When you're ready, press any key to continue...</wait>
|
||||
</skip>
|
||||
<process>
|
||||
<path>Please give the full path of your CodeCombat git repository: </path>
|
||||
<checkout>Please enter the full path where you want to install your CodeCombat environment</checkout>
|
||||
<bashi>This installation requires Git Bash.</bashi>
|
||||
<bashp64>Git bash is by default installed at 'C:\Program Files (x86)\Git'.</bashp64>
|
||||
<bashp32>Git bash is by default installed at 'C:\Program Files\Git'.</bashp32>
|
||||
<bashq>Please enter the full path where git bash is installed or just press enter if it's in the default location</bashq>
|
||||
<ssh>Do you want to checkout the repository via ssh?</ssh>
|
||||
</process>
|
||||
</github>
|
||||
<npm>
|
||||
<install>Installing bower, brunch, nodemon and sendwithus...</install>
|
||||
<binstall>Installing bower packages...</binstall>
|
||||
<sass>Installing sass...</sass>
|
||||
<npm>Installing npm...</npm>
|
||||
<brnch>Starting brunch....</brnch>
|
||||
<mongodb>Setting up a MongoDB database for you...</mongodb>
|
||||
<db>Downloading the last version of the CodeCombat database...</db>
|
||||
<script>Preparing the automatic startup script for you...</script>
|
||||
</npm>
|
||||
<error>
|
||||
<path>That path already exists, are you sure you want to overwrite it?</path>
|
||||
<exist>That path doesn't exist. Please try again...</exist>
|
||||
</error>
|
||||
<end>
|
||||
<succesfull>The setup of the CodeCombat Dev. Environment was succesfull.</succesfull>
|
||||
<thankyou>Thank you already for your contribution and see you soon.</thankyou>
|
||||
<readme>Do you want to read the README for more information?</readme>
|
||||
</end>
|
||||
<start>
|
||||
<s1>From now on you can start the dev. environment at</s1>
|
||||
<s2>the touch of a single mouse click.</s2>
|
||||
<s3> 1) Just double click</s3>
|
||||
<s4> and let the environment start up.</s4>
|
||||
<s5> 2) Now just open 'localhost:3000' in your prefered browser.</s5>
|
||||
<s6>That's it, you're now ready to start working on CodeCombat!</s6>
|
||||
</start>
|
||||
</variables>
|
|
@ -1,86 +1,3 @@
|
|||
<<<<<<< HEAD:scripts/windows/coco-dev-setup/batch/localisation/de.coco
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
<native>Deutsch</native>
|
||||
<intro>Ab jetzt senden wir unser Feedback in Englisch!</intro>
|
||||
</global>
|
||||
<install>
|
||||
<system>
|
||||
<bit>-Bit System erkannt.</bit>
|
||||
<prefix>Es wurde das Betriebssystem</prefix>
|
||||
<sufix>erkannt.</sufix>
|
||||
<xp>Windows XP wird nicht unterstützt. Installation abgebrochen.</xp>
|
||||
</system>
|
||||
<process>
|
||||
<sks>Sind die für CodeCombat benötigten Programme bereits installiert?</sks>
|
||||
<skq>Wir empfehlen Ihnen, mit „Nein“ zu antorten, falls Sie unsicher sind.</skq>
|
||||
<skc>Überspringe Installation der Programme...</skc>
|
||||
<s1>Ohne Software von Drittanbietern könnte CodeCombat nicht entwickelt werden.</s1>
|
||||
<s2>Aus diesem Grund müssen Sie diese Software installieren,</s2>
|
||||
<s3>um sich in der Community zu engagieren.</s3>
|
||||
<s4>Wenn Sie ein Programm bereits installiert haben, brechen Sie die Installation bitte ab.</s4>
|
||||
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
|
||||
<prefix>Haben Sie bereits die aktuellste Version von</prefix>
|
||||
<sufix>installiert?</sufix>
|
||||
<downloading>wird heruntergeladen...</downloading>
|
||||
<installing>wird installiert...</installing>
|
||||
<unzipping>wird entpackt...</unzipping>
|
||||
<cleaning>wird aufgeräumt...</cleaning>
|
||||
<mongodbpath>Bitte geben Sie den kompletten Pfad an, an dem MongoDB installiert werden soll</mongodbpath>
|
||||
</process>
|
||||
</install>
|
||||
<github>
|
||||
<intro>
|
||||
<opensource>Wie Du bereits weißt, ist CodeCombat Open Source.</opensource>
|
||||
<online>Unser Quellcode ist komplett auf Github.</online>
|
||||
<manual>Wenn Du möchtest, kannst du das komplette Git Repository selbst herunterladen und nach deinen wünschen einrichten.</manual>
|
||||
<norec>Allerdings empfehlen wir, dass du den Prozess statt dessen uns überlässt.</norec>
|
||||
</intro>
|
||||
<skip>
|
||||
<question>Willst du das lokale Git Setup selbst vornehmen?</question>
|
||||
<consequence>Bit vergewissere dich, dass das Repository korrekt heruntergeladen wurde, bevor du fortfährst.</consequence>
|
||||
<donotclose>Bitte schließe dieses Fenster nicht.</donotclose>
|
||||
<wait>Wenn du fertig bist, drücke eine beliebige Taste zum Fortfahren...</wait>
|
||||
</skip>
|
||||
<process>
|
||||
<path>Gebe bitte den kompletten Pfad zu deinem CodeCombat Git Repository ein: </path>
|
||||
<checkout>Bitte gib den kompletten Pfad ein, an dem du die CodeCombat Umgebung einrichten willst</checkout>
|
||||
<bashi>Diese Installation benötigt die Git Bash.</bashi>
|
||||
<bashp64>Die Git Bash ist standardmäßig in 'C:\Program Files (x86)\Git' installiert.</bashp64>
|
||||
<bashp32>Die Git Bash ist standardmäßig in 'C:\Program Files\Git' installiert.</bashp32>
|
||||
<bashq>Bitte gebe den kompletten Pfad zur Git Bash ein, oder drücke Enter, um den Standardpfad zu verwenden</bashq>
|
||||
<ssh>Willst du das Repository via SSH auschecken?</ssh>
|
||||
</process>
|
||||
</github>
|
||||
<npm>
|
||||
<install>Installing bower, brunch, nodemon and sendwithus...</install>
|
||||
<binstall>Installing bower packages...</binstall>
|
||||
<sass>Installing sass...</sass>
|
||||
<npm>Installing npm...</npm>
|
||||
<brnch>Starting brunch....</brnch>
|
||||
<mongodb>Setting up a MongoDB database for you...</mongodb>
|
||||
<database>Downloading the last version of the CodeCombat database...</database>
|
||||
<script>Preparing the automatic startup script for you...</script>
|
||||
</npm>
|
||||
<error>
|
||||
<path>Dieser Pfad existiert bereits. Willst du ihn wirklich überschreiben?</path>
|
||||
<exist>Dieser Pfad exisitert nicht. Bitte versuche es erneut...</exist>
|
||||
</error>
|
||||
<end>
|
||||
<succesfull>Die CodeCombat Entwicklungsumgebung wurde erfoglreich installiert.</succesfull>
|
||||
<thankyou>Vielen Dank für die Unterstützung und bis bald.</thankyou>
|
||||
<readme>Willst du das README lesen, um weitere Informationen zu erhalten?</readme>
|
||||
</end>
|
||||
<start>
|
||||
<s1>Von nun an kannst du die Entwicklungsumgebung starten unter</s1>
|
||||
<s2>einmal mit der Maus klicken.</s2>
|
||||
<s3> 1) Einfach Doppelklicken</s3>
|
||||
<s4>und warten bis die Entwicklungsumgebung fertig geladen hat.</s4>
|
||||
<s5> 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen.</s5>
|
||||
<s6>Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten!</s6>
|
||||
</start>
|
||||
=======
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
|
@ -188,5 +105,4 @@
|
|||
<s5> 2) Jetzt 'localhost:3000' in deinem bevorzugten Browser aufrufen.</s5>
|
||||
<s6>Fertig. Du bist nun bereit, bei CodeCombat mitzuarbeiten!</s6>
|
||||
</start>
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7:scripts/windows/coco-dev-setup/batch/localization/de.coco
|
||||
</variables>
|
|
@ -1,87 +1,3 @@
|
|||
<<<<<<< HEAD:scripts/windows/coco-dev-setup/batch/localisation/zh-HANS.coco
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
<native>简体中文</native>
|
||||
<intro>目前我们只能用英文给你反馈!</intro>
|
||||
</global>
|
||||
<install>
|
||||
<system>
|
||||
<bit>-位系统.</bit>
|
||||
<prefix>操作系统</prefix>
|
||||
<sufix>被侦测到.</sufix>
|
||||
<xp>我们不支持 Windows XP, 安装取消.</xp>
|
||||
</system>
|
||||
<process>
|
||||
<sks>你是否已经安装好运行 CodeCombat 所需的所有软件?</sks>
|
||||
<skq>如果你不确定的话请回答 No.</skq>
|
||||
<skc>正在跳过此软件的安装...</skc>
|
||||
<s1>CodeCombat 无法在不使用第三方服务的情况下开发.</s1>
|
||||
<s2>这就是为什么你需要安装这些软件,</s2>
|
||||
<s3>为了开始给我们的开源社区做贡献.</s3>
|
||||
<s4>如果你已经有了这些软件 请取消安装.</s4>
|
||||
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
|
||||
<prefix>你是否已经安装了最新版本的</prefix>
|
||||
<sufix>?</sufix>
|
||||
<downloading>正在下载...</downloading>
|
||||
<installing>正在安装...</installing>
|
||||
<unzipping>正在解压...</unzipping>
|
||||
<cleaning>正在清理...</cleaning>
|
||||
<mongodbpath>请输入你希望安装 mongodb 的文件夹的全路径<mongodbpath>
|
||||
</process>
|
||||
</install>
|
||||
<github>
|
||||
<intro>
|
||||
<opensource>CodeCombat 是开源的.</opensource>
|
||||
<online>我们的所有源代码都放在了 Github.</online>
|
||||
<manual>你可以选择自己手工安装 Git.</manual>
|
||||
<norec>但我们仍然建议让程序自动替你完成.</norec>
|
||||
</intro>
|
||||
<skip>
|
||||
<question>你是否想自己手工安装本地 Git 安装?</question>
|
||||
<consequence>请确保在开始处理前, 你有正确设置好你的库.</consequence>
|
||||
<donotclose>请不要关闭此窗口.</donotclose>
|
||||
<wait>如果你准备好了, 请按任意键继续...</wait>
|
||||
</skip>
|
||||
<process>
|
||||
<path>请输入你 CodeCombat git库的全路径: </path>
|
||||
<checkout>请输入你想安装 CodeCombat 环境的全路径</checkout>
|
||||
<bashi>这项安装需要 Git Bash.</bashi>
|
||||
<bashp64>Git bash 默认安装在 'C:\Program Files (x86)\Git'.</bashp64>
|
||||
<bashp32>Git bash 默认安装在 'C:\Program Files\Git'.</bashp32>
|
||||
<bashq>请输入 git bash 的安装全路径, 如果你安装的是默认路径, 那么直接输入回车即可</bashq>
|
||||
<ssh>你是否想使用 ssh 来检出(checkout)库(repository)?</ssh>
|
||||
</process>
|
||||
</github>
|
||||
<npm>
|
||||
<install>正在安装 bower, brunch, nodemon 和 sendwithus...</install>
|
||||
<binstall>正在用 bower 安装依赖包...</binstall>
|
||||
<sass>正在安装 sass...</sass>
|
||||
<npm>正在安装 npm...</npm>
|
||||
<brnch>正在开启 brunch....</brnch>
|
||||
<mongodb>正在为你设置 MongoDB 数据库...</mongodb>
|
||||
<db>正在下载 CodeCombat 数据库的最新版本...</db>
|
||||
<script>Preparing the automatic startup script for you...</script>
|
||||
</npm>
|
||||
<error>
|
||||
<path>这个路径已经存在, 你想要覆盖它吗?</path>
|
||||
<exist>这个路径不存在, 请再次尝试...</exist>
|
||||
</error>
|
||||
<end>
|
||||
<succesfull>CodeCombat 开发环境的搭建已成功.</succesfull>
|
||||
<thankyou>感谢~ 我们会很快再次见面的 :)</thankyou>
|
||||
<readme>你是否想阅读 README 文件以了解更多信息?</readme>
|
||||
</end>
|
||||
<start>
|
||||
<s1>From now on you can start the dev. environment at</s1>
|
||||
<s2>the touch of a single mouse click.</s2>
|
||||
<s3> 1) 双击文件</s3>
|
||||
<s4> 启动开发环境.</s4>
|
||||
<s5> 2) 在浏览器里访问 'localhost:3000' </s5>
|
||||
<s6>好了,你现在可以开始开发 CodeCombat 了!</s6>
|
||||
</start>
|
||||
</variables>
|
||||
=======
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
|
@ -189,5 +105,4 @@
|
|||
<s5> 2) 在浏览器里访问 'localhost:3000' </s5>
|
||||
<s6>好了,你现在可以开始开发 CodeCombat 了!</s6>
|
||||
</start>
|
||||
</variables>
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7:scripts/windows/coco-dev-setup/batch/localization/zh-HANS.coco
|
||||
</variables>
|
|
@ -1,86 +1,3 @@
|
|||
<<<<<<< HEAD:scripts/windows/coco-dev-setup/batch/localisation/zh-HANT.coco
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
<native>繁体中文</native>
|
||||
<intro>From now on we'll send our feedback in English!</intro>
|
||||
</global>
|
||||
<install>
|
||||
<system>
|
||||
<bit>-bit computer detected.</bit>
|
||||
<prefix>The operating system</prefix>
|
||||
<sufix>was detected.</sufix>
|
||||
<xp>We don't support Windows XP, installation cancelled.</xp>
|
||||
</system>
|
||||
<process>
|
||||
<sks>Have you already installed all the software needed for CodeCombat?</sks>
|
||||
<skq>We recommand that you reply negative in case you're not sure.</skq>
|
||||
<skc>Skipping the installation of the software...</skc>
|
||||
<s1>CodeCombat couldn't be developed without third-party software.</s1>
|
||||
<s2>That's why you'll need to install this software,</s2>
|
||||
<s3>in order to start contributing to our community.</s3>
|
||||
<s4>Cancel the installation if you already have the application.</s4>
|
||||
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
|
||||
<prefix>Do you already have the latest version of</prefix>
|
||||
<sufix>installed?</sufix>
|
||||
<downloading>is downloading...</downloading>
|
||||
<installing>is installing...</installing>
|
||||
<unzipping>is unzipping...</unzipping>
|
||||
<cleaning>is cleaning...</cleaning>
|
||||
<mongodbpath>Please define the full path where mongodb should be installed</mongodbpath>
|
||||
</process>
|
||||
</install>
|
||||
<github>
|
||||
<intro>
|
||||
<opensource>CodeCombat is opensource, like you already know.</opensource>
|
||||
<online>All our sourcecode can be found online at Github.</online>
|
||||
<manual>You can choose to do the entire Git setup yourself.</manual>
|
||||
<norec>However we recommend that you instead let us handle it instead.</norec>
|
||||
</intro>
|
||||
<skip>
|
||||
<question>Do you want to do the Local Git setup manually yourself?</question>
|
||||
<consequence>Make sure you have correctly setup your repository before processing.</consequence>
|
||||
<donotclose>Do not close this window please.</donotclose>
|
||||
<wait>When you're ready, press any key to continue...</wait>
|
||||
</skip>
|
||||
<process>
|
||||
<path>Please give the full path of your CodeCombat git repository: </path>
|
||||
<checkout>Please enter the full path where you want to install your CodeCombat environment</checkout>
|
||||
<bashi>This installation requires Git Bash.</bashi>
|
||||
<bashp64>Git bash is by default installed at 'C:\Program Files (x86)\Git'.</bashp64>
|
||||
<bashp32>Git bash is by default installed at 'C:\Program Files\Git'.</bashp32>
|
||||
<bashq>Please enter the full path where git bash is installed or just press enter if it's in the default location</bashq>
|
||||
<ssh>Do you want to checkout the repository via ssh?</ssh>
|
||||
</process>
|
||||
</github>
|
||||
<npm>
|
||||
<install>Installing bower, brunch, nodemon and sendwithus...</install>
|
||||
<binstall>Installing bower packages...</binstall>
|
||||
<sass>Installing sass...</sass>
|
||||
<npm>Installing npm...</npm>
|
||||
<brnch>Starting brunch....</brnch>
|
||||
<mongodb>Setting up a MongoDB database for you...</mongodb>
|
||||
<db>Downloading the last version of the CodeCombat database...</db>
|
||||
<script>Preparing the automatic startup script for you...</script>
|
||||
</npm>
|
||||
<error>
|
||||
<path>That path already exists, are you sure you want to overwrite it?</path>
|
||||
<exist>That path doesn't exist. Please try again...</exist>
|
||||
</error>
|
||||
<end>
|
||||
<succesfull>The setup of the CodeCombat Dev. Environment was succesfull.</succesfull>
|
||||
<thankyou>Thank you already for your contribution and see you soon.</thankyou>
|
||||
<readme>Do you want to read the README for more information?</readme>
|
||||
</end>
|
||||
<start>
|
||||
<s1>From now on you can start the dev. environment at</s1>
|
||||
<s2>the touch of a single mouse click.</s2>
|
||||
<s3> 1) Just double click</s3>
|
||||
<s4> and let the environment start up.</s4>
|
||||
<s5> 2) Now just open 'localhost:3000' in your prefered browser.</s5>
|
||||
<s6>That's it, you're now ready to start working on CodeCombat!</s6>
|
||||
</start>
|
||||
=======
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<variables>
|
||||
<global>
|
||||
|
@ -188,5 +105,4 @@
|
|||
<s5> 2) Now just open 'localhost:3000' in your prefered browser.</s5>
|
||||
<s6>That's it, you're now ready to start working on CodeCombat!</s6>
|
||||
</start>
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7:scripts/windows/coco-dev-setup/batch/localization/zh-HANT.coco
|
||||
</variables>
|
|
@ -1,57 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
call print_install_header
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text install_process_sks install process sks
|
||||
echo !install_process_sks!
|
||||
|
||||
call get_local_text install_process_skq install process skq
|
||||
call ask_question "!install_process_skq!"
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
if "%result%"=="true" (
|
||||
call get_local_text install_process_skc install process skc
|
||||
echo !install_process_skc!
|
||||
call print_dashed_seperator
|
||||
goto:exit_setup
|
||||
)
|
||||
|
||||
call get_system_information
|
||||
call print_dashed_seperator
|
||||
|
||||
if %system_info_os% == XP (
|
||||
call get_local_text install_system_xp install system xp
|
||||
echo !install_system_xp!
|
||||
call print_exit
|
||||
)
|
||||
|
||||
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 0 general general
|
||||
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 2 %system_info_os% b%system_info_bit%
|
||||
call get_variables ..\\config\\downloads.coco downloads download_names downloads_count 3 general b%system_info_bit%
|
||||
|
||||
call get_local_text install_process_s1 install process s1
|
||||
call get_local_text install_process_s2 install process s2
|
||||
call get_local_text install_process_s3 install process s3
|
||||
call get_local_text install_process_s4 install process s4
|
||||
call get_local_text install_process_winpath install process winpath
|
||||
|
||||
echo !install_process_s1!
|
||||
echo !install_process_s2!
|
||||
echo !install_process_s3!
|
||||
echo !install_process_s4!
|
||||
echo.
|
||||
echo !install_process_winpath!
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
for /l %%i in (1, 1, !downloads_count!) do (
|
||||
call download_and_install_app !download_names[%%i]! !downloads[%%i]!
|
||||
)
|
||||
|
||||
goto:exit_setup
|
||||
|
||||
=======
|
||||
call print_install_header
|
||||
call print_dashed_seperator
|
||||
|
||||
|
@ -105,5 +51,4 @@ for /l %%i in (1, 1, !downloads_count!) do (
|
|||
|
||||
goto:exit_setup
|
||||
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
:exit_setup
|
|
@ -1,40 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
echo Some feedback is sent in your system's language
|
||||
echo but most feedback is sent and localised by us.
|
||||
echo Here is a list of languages:
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_array ..\\localisation\\languages.coco languages language_count
|
||||
for /l %%i in (1,1,%language_count%) do (
|
||||
call get_text !languages[%%i]! global_native global native
|
||||
echo [%%i] !global_native!
|
||||
)
|
||||
|
||||
goto:get_localisation_id
|
||||
|
||||
:get_localisation_id
|
||||
call print_dashed_seperator
|
||||
set /p "localisation_id=Enter the language ID of your preference and press <ENTER>: "
|
||||
goto:validation_check
|
||||
|
||||
:validation_check
|
||||
set "localisation_is_false="
|
||||
set /a local_id = %localisation_id%
|
||||
if !local_id! EQU 0 set localisation_is_false=1
|
||||
if !local_id! LSS 1 set localisation_is_false=1
|
||||
if !local_id! GTR !language_count! set localisation_is_false=1
|
||||
if defined localisation_is_false (
|
||||
echo The id you entered is invalid, please try again...
|
||||
goto:get_localisation_id
|
||||
) else (
|
||||
set language_id=!languages[%local_id%]!
|
||||
call get_text !language_id! global_native global native
|
||||
call print_dashed_seperator
|
||||
echo You have choosen !global_native! as your language.
|
||||
call get_text !language_id! global_intro global intro
|
||||
echo !global_intro!
|
||||
call print_seperator
|
||||
=======
|
||||
echo Some feedback is sent in your system's language
|
||||
echo but most feedback is sent and localised by us.
|
||||
echo Here is a list of languages:
|
||||
|
@ -73,5 +36,4 @@ goto:get_localization_id
|
|||
echo !language_feedback!
|
||||
|
||||
call print_seperator
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
)
|
|
@ -1,36 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
if exist "%PROGRAMFILES(X86)%" (
|
||||
call:set_bit 64
|
||||
) else (
|
||||
call:set_bit 32
|
||||
)
|
||||
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "5.2" ( call:set_os XP )
|
||||
if "%version%" == "6.0" ( call:set_os Vista )
|
||||
if "%version%" == "6.1" ( call:set_os Win7 )
|
||||
:: we handle win8.0 as win7
|
||||
if "%version%" == "6.2" ( call:set_os Win7 )
|
||||
:: we handle win8.1 as win7
|
||||
if "%version%" == "6.3" ( call:set_os Win7 )
|
||||
|
||||
goto:end
|
||||
|
||||
:set_bit
|
||||
call get_local_text install_system_bit install system bit
|
||||
set system_info_bit=%~1
|
||||
echo %system_info_bit%%install_system_bit%
|
||||
goto:eof
|
||||
|
||||
:set_os
|
||||
set system_info_os=%~1
|
||||
call get_local_text install_system_prefix install system prefix
|
||||
call get_local_text install_system_sufix install system sufix
|
||||
echo %install_system_prefix% %system_info_os% %install_system_sufix%
|
||||
goto:eof
|
||||
|
||||
:end
|
||||
=======
|
||||
if exist "%PROGRAMFILES(X86)%" (
|
||||
call:set_bit 64
|
||||
) else (
|
||||
|
@ -60,4 +27,3 @@ goto:eof
|
|||
goto:eof
|
||||
|
||||
:end
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\localisation\\%1.coco %3 %4 %5 %6') do (
|
||||
set "%2=%%F"
|
||||
=======
|
||||
for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\localization\\%1.coco %3 %4 %5 %6') do (
|
||||
set "%2=%%F"
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
)
|
|
@ -1,119 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
call print_github_header
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text github_intro_opensource github intro opensource
|
||||
call get_local_text github_intro_online github intro online
|
||||
call get_local_text github_intro_manual github intro manual
|
||||
call get_local_text github_intro_norec github intro norec
|
||||
|
||||
echo !github_intro_opensource!
|
||||
echo !github_intro_online!
|
||||
echo !github_intro_manual!
|
||||
echo !github_intro_norec!
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text github_skip_question github skip question
|
||||
call ask_question "!github_skip_question!"
|
||||
call print_dashed_seperator
|
||||
|
||||
if "%result%"=="true" (
|
||||
call get_local_text github_skip_consequence github skip consequence
|
||||
echo !github_skip_consequence!
|
||||
|
||||
call get_local_text github_skip_donotclose github skip donotclose
|
||||
echo !github_skip_donotclose!
|
||||
|
||||
call get_local_text github_skip_wait github skip wait
|
||||
set /p "github_skip_wait=!github_skip_wait!"
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text github_process_path github process path
|
||||
call get_path_safe "!github_process_path!"
|
||||
set "repository_path=!tmp_safe_path!"
|
||||
|
||||
goto:exit_git_setup
|
||||
)
|
||||
|
||||
goto:get_bash_path
|
||||
|
||||
:get_bash_path
|
||||
call get_local_text github_process_bashi github process bashi
|
||||
echo !github_process_bashi!
|
||||
|
||||
if not defined install_system_bit (
|
||||
call print_dashed_seperator
|
||||
call get_system_information
|
||||
call print_dashed_seperator
|
||||
)
|
||||
|
||||
if "%system_info_bit%"=="64" (
|
||||
call get_local_text github_process_bashp64 github process bashp64
|
||||
echo !github_process_bashp64!
|
||||
) else (
|
||||
call get_local_text github_process_bashp32 github process bashp32
|
||||
echo !github_process_bashp32!
|
||||
)
|
||||
|
||||
call get_local_text github_process_bashq github process bashq
|
||||
set /p "git_bash_path=!github_process_bashq!: "
|
||||
|
||||
if not defined git_bash_path (
|
||||
if "%system_info_bit%"=="64" (
|
||||
set "git_bash_path=C:\Program Files (x86)\Git"
|
||||
) else (
|
||||
set "git_bash_path=C:\Program Files\Git"
|
||||
)
|
||||
goto:get_git_path
|
||||
)
|
||||
|
||||
if not exist "%git_bash_path%" (
|
||||
call get_local_text error_exist error exist
|
||||
echo !error_exist!
|
||||
call print_dashed_seperator
|
||||
goto:get_bash_path
|
||||
) else (
|
||||
goto:get_git_path
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:get_git_path
|
||||
call print_dashed_seperator
|
||||
call get_local_text github_process_checkout github process checkout
|
||||
set /p "repository_path=!github_process_checkout!: "
|
||||
if exist !repository_path! (
|
||||
call get_local_text error_path error path
|
||||
call ask_question "!error_path!"
|
||||
if "!result!"=="false" (
|
||||
call print_dashed_seperator
|
||||
goto:get_git_path
|
||||
) else (
|
||||
rmdir /s /q %repository_path%
|
||||
goto:git_checkout
|
||||
)
|
||||
) else (
|
||||
goto:git_checkout
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:git_checkout
|
||||
md "%repository_path%"
|
||||
set "repository_path=%repository_path%\coco"
|
||||
|
||||
call print_dashed_seperator
|
||||
set "git_app_path=%git_bash_path%\bin\git.exe"
|
||||
|
||||
call get_config github_url
|
||||
"%git_app_path%" clone "!github_url!" "%repository_path%"
|
||||
|
||||
goto:exit_git_setup
|
||||
goto:eof
|
||||
|
||||
:exit_git_setup
|
||||
call print_dashed_seperator
|
||||
=======
|
||||
call print_github_header
|
||||
call print_dashed_seperator
|
||||
|
||||
|
@ -262,5 +146,4 @@ goto:eof
|
|||
|
||||
:exit_git_setup
|
||||
call print_dashed_seperator
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
goto:eof
|
|
@ -1,94 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
call print_npm_and_brunch_header
|
||||
call print_dashed_seperator
|
||||
|
||||
set work_directory=%CD%
|
||||
|
||||
set "curl_app=..\utilities\curl.exe"
|
||||
set "zu_app=..\utilities\7za.exe"
|
||||
set "keystuff=..\utilities\keystuff.exe"
|
||||
|
||||
set "coco_root=!repository_path!\coco"
|
||||
|
||||
goto:automatic_script
|
||||
|
||||
call get_local_text npm-install
|
||||
echo !npm_install!
|
||||
|
||||
cd !coco_root!
|
||||
start /wait cmd /c "echo !npm_install! & npm install -g bower brunch nodemon sendwithus"
|
||||
cd !work_directory!
|
||||
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-binstall
|
||||
echo !npm_binstall!
|
||||
|
||||
cd "!coco_root!"
|
||||
start /wait cmd /c "echo !npm_binstall! & bower install"
|
||||
cd "!work_directory!"
|
||||
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-sass
|
||||
echo !npm_sass!
|
||||
|
||||
cd "!coco_root!"
|
||||
start /wait cmd /c "echo !npm_sass! & gem install sass"
|
||||
cd "!work_directory!"
|
||||
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-npm
|
||||
echo !npm_npm!
|
||||
|
||||
cd "!coco_root!"
|
||||
start /wait cmd /c "echo !npm_npm! & npm install"
|
||||
cd "!work_directory!"
|
||||
|
||||
:: --- MONGODB
|
||||
|
||||
:mongodb
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-mongodb
|
||||
echo !npm_mongodb!
|
||||
|
||||
set "mdb_directory=!repository_path!\cocodb"
|
||||
|
||||
if exist mdb_directory (
|
||||
rmdir /s /q "!mdb_directory!"
|
||||
)
|
||||
|
||||
md !mdb_directory!
|
||||
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-db
|
||||
echo !npm_db!
|
||||
|
||||
call get_config database_backup
|
||||
|
||||
cd !mdb_directory!
|
||||
|
||||
start cmd /c "%work_directory%\%keystuff% Alt-Tab && mongod --setParameter textSearchEnabled=true --dbpath !mdb_directory!"
|
||||
|
||||
%curl_app% -k !database_backup! -o dump.tar.gz
|
||||
|
||||
start /wait cmd /c "%work_directory%\%keystuff% Alt-Tab && %zu_app% e dump.tar.gz && del dump.tar.gz && %zu_app% x dump.tar && del dump.tar"
|
||||
|
||||
start /wait cmd /c "mongorestore dump"
|
||||
|
||||
rmdir /s /q db
|
||||
|
||||
:: --- AUTOMATIC SCRIPT
|
||||
|
||||
::automatic_script
|
||||
call print_dashed_seperator
|
||||
call get_local_text npm-script
|
||||
echo !npm_script!
|
||||
|
||||
:: --- END
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
pause
|
||||
=======
|
||||
call print_npm_and_brunch_header
|
||||
call print_dashed_seperator
|
||||
|
||||
|
@ -113,4 +22,3 @@ call nab_install_mongodb %coco_db%
|
|||
call nab_automatic_script.bat %coco_root% %coco_db%
|
||||
|
||||
call print_dashed_seperator
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
echo.
|
||||
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
=======
|
||||
echo.
|
||||
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
echo.
|
|
@ -1,7 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
set /p res="Press any key to exit..."
|
||||
=======
|
||||
call get_local_text global_exit global exit
|
||||
set /p res="%global_exit%"
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
exit
|
|
@ -1,8 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
echo.
|
||||
echo -----------------------------------------------------------------------------
|
||||
=======
|
||||
echo.
|
||||
echo -------------------------------------------------------------------------------
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
echo.
|
|
@ -1,71 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
Color 0A
|
||||
mode con: cols=79 lines=55
|
||||
|
||||
call print_header
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_config.bat version
|
||||
call get_config.bat author
|
||||
call get_config.bat copyright
|
||||
echo Welcome to the automated Installation of the CodeCombat Dev. Environment!
|
||||
echo v%version% authored by %author% and published by %copyright%.
|
||||
call print_seperator
|
||||
|
||||
echo Before we start the installation, here are some tips:
|
||||
call print_tips
|
||||
call print_seperator
|
||||
|
||||
call sign_license
|
||||
|
||||
call get_language
|
||||
|
||||
call download_and_install_applications
|
||||
|
||||
call github_setup
|
||||
|
||||
:: This will be available in v2.0
|
||||
::call npm_and_brunch_setup
|
||||
|
||||
call print_finished_header
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text end_succesfull end succesfull
|
||||
call get_local_text end_thankyou end thankyou
|
||||
echo %end_succesfull%
|
||||
echo %end_thankyou%
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text start_s1 start s1
|
||||
call get_local_text start_s2 start s2
|
||||
call get_local_text start_s3 start s3
|
||||
call get_local_text start_s4 start s4
|
||||
call get_local_text start_s5 start s5
|
||||
call get_local_text start_s6 start s6
|
||||
|
||||
echo !start_s1!
|
||||
echo !start_s2!
|
||||
echo.
|
||||
echo !start_s3! '!repository_path!\coco\SCOCODE.bat'
|
||||
echo !start_s4!
|
||||
echo !start_s5!
|
||||
echo.
|
||||
echo !start_s6!
|
||||
|
||||
call print_dashed_seperator
|
||||
|
||||
call get_local_text end_readme end readme
|
||||
call ask_question "!end_readme!"
|
||||
|
||||
if "%result%"=="true" (
|
||||
call open_readme
|
||||
)
|
||||
|
||||
=======
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
|
@ -94,5 +26,4 @@ call download_and_install_applications
|
|||
|
||||
start cmd /c "setup_p2.bat"
|
||||
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
endlocal
|
|
@ -1,19 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
echo In order to continue the installation of the developers environment
|
||||
echo you will have to read and agree with the following license:
|
||||
call print_dashed_seperator
|
||||
|
||||
call print_license
|
||||
call print_dashed_seperator
|
||||
|
||||
call ask_question "Have you read the license and do you agree with it?"
|
||||
call print_dashed_seperator
|
||||
|
||||
if "%result%"=="false" (
|
||||
echo This setup can't happen without an agreement.
|
||||
echo Installation and Setup of the CodeCombat environment is cancelled.
|
||||
call print_exit
|
||||
=======
|
||||
call get_local_text license_s1 license s1
|
||||
echo !license_s1!
|
||||
|
||||
|
@ -40,5 +24,4 @@ if "%result%"=="false" (
|
|||
echo.
|
||||
|
||||
call print_exit
|
||||
>>>>>>> 072729acc34123c42250d361955438cfd8c210d7
|
||||
)
|
|
@ -1,533 +0,0 @@
|
|||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
Color 0A
|
||||
|
||||
mode con: cols=78 lines=60
|
||||
|
||||
:: Global Variables
|
||||
set "temp-dir=C:\Coco-Temp"
|
||||
set install-log=%temp-dir%\coco-dev-install-log.txt
|
||||
|
||||
:: set correct curl app
|
||||
IF EXIST "%PROGRAMFILES(X86)%" (
|
||||
(set "curl-app=utilities\curl\64bit\curl.exe")
|
||||
) ELSE (
|
||||
set "curl-app=utilities\curl\32bit\curl.exe"
|
||||
)
|
||||
|
||||
set "ZU-app=utilities\7za.exe"
|
||||
|
||||
:: BUGS:
|
||||
:: + DEBUG ALL STEPS UNTILL NOW DONE
|
||||
|
||||
|
||||
:: TODO:
|
||||
:: + Write code to install vs if it's not yet installed on users pc
|
||||
|
||||
:: + Configuraton and installation checklist:
|
||||
:: 1) cd codecombat
|
||||
:: 2) npm install -g bower brunch nodemon sendwithus
|
||||
:: 3) bower install
|
||||
:: 4) gem install sass
|
||||
:: 5) npm install
|
||||
:: 6) brunch -w
|
||||
:: Extra... @ Fail run npm install
|
||||
|
||||
:: + Copy the automated dev batch file to root folder
|
||||
:: => Let user define mongo-db directory
|
||||
:: + Start the dev environment
|
||||
|
||||
:: Create The Temporary Directory
|
||||
IF EXIST %temp-dir% rmdir %temp-dir% /s /q
|
||||
mkdir %temp-dir%
|
||||
|
||||
:: Create Log File
|
||||
copy /y nul %install-log% > nul
|
||||
|
||||
call:parse_aa_and_draw "config\header"
|
||||
call:draw_dss
|
||||
|
||||
call:parse_file_new "config\config" cnfg n
|
||||
|
||||
call:log "Welcome to the automated Installation of the CodeCombat Dev. Environment!"
|
||||
call:log_sse "v%%cnfg[1]%% authored by %%cnfg[2]%% and published by %%cnfg[3]%%."
|
||||
|
||||
:: Language Agreement Stuff
|
||||
|
||||
call:log "In order to continue the installation of the developers environment"
|
||||
call:log "you will have to read and agree with the following license:
|
||||
call:draw_dss
|
||||
echo.
|
||||
call:parse_aa_and_draw "license.txt"
|
||||
echo.
|
||||
call:draw_dss
|
||||
call:strict_user_yn_question "Have you read the license and do you agree with it?"
|
||||
|
||||
if "%res%"=="false" (
|
||||
call:log "Sorry to hear that, have a good day..."
|
||||
call:log_sse "Installation and Setup of the CodeCombat environment is cancelled."
|
||||
GOTO:END
|
||||
)
|
||||
|
||||
:: Tips
|
||||
call:log "Before we start the installation, here are some tips:"
|
||||
echo.
|
||||
|
||||
call:parse_aa_and_draw "config\tips"
|
||||
|
||||
call:draw_ss
|
||||
|
||||
:: Read Language Index
|
||||
call:parse_file_new "localisation\languages" lang lang_c
|
||||
|
||||
:: Read Download URLs
|
||||
call:parse_file_new "config\downloads" downloads n
|
||||
call:parse_file_new "config\downloads_32" downloads_32 n
|
||||
call:parse_file_new "config\downloads_64" downloads_64 n
|
||||
call:parse_file_new "config\downloads_vista_32" downloads_vista_32 n
|
||||
call:parse_file_new "config\downloads_vista_64" downloads_vista_64 n
|
||||
call:parse_file_new "config\downloads_7_32" downloads_7_32 n
|
||||
call:parse_file_new "config\downloads_7_64" downloads_7_64 n
|
||||
|
||||
:: Parse all Localisation Files
|
||||
for /L %%i in (1,1,%lang_c%) do (
|
||||
call:parse_file "localisation\%%lang[%%i]%%" languages languages_c
|
||||
)
|
||||
|
||||
set /A "wc = %languages_c% / %lang_c%"
|
||||
|
||||
:: Start install with language question (Localisation)
|
||||
call:log "Which language do you prefer?"
|
||||
|
||||
set /A c=0
|
||||
for /L %%i in (1,%wc%,%languages_c%) do (
|
||||
set /A "n = %%i - 1"
|
||||
call:log " [%%c%%] %%languages[%%i]%%"
|
||||
set /A c+=1
|
||||
)
|
||||
|
||||
set "lang_id=-1"
|
||||
call:user_enter_language_id
|
||||
goto:user_pick_language
|
||||
|
||||
:user_enter_language_id
|
||||
set /p lang_id= "Enter the language ID and press <ENTER>: "
|
||||
goto:eof
|
||||
|
||||
:user_pick_language
|
||||
set res=false
|
||||
if %lang_id% LSS 0 set res=true
|
||||
if %lang_id% GEQ %lang_c% set res=true
|
||||
if "%res%"=="true" (
|
||||
call:log "Invalid id! Please enter a correct id from the numbers listed above..."
|
||||
call:draw_dss
|
||||
call:user_enter_language_id
|
||||
goto:user_pick_language
|
||||
)
|
||||
|
||||
call:get_lw word 0
|
||||
call:log_ds "You choose '%word%', from now on all feedback will be logged in it."
|
||||
|
||||
call:log_lw 1
|
||||
call:log_lw_sse 2
|
||||
|
||||
:: downloads for all version...
|
||||
|
||||
:: [TODO] The choice between Cygwin && Git ?! Is => HAVE EXTERNAL GIT APPLICATION LIST!!!
|
||||
|
||||
call:log_lw_sse 3
|
||||
|
||||
call:log_lw 6
|
||||
call:log_lw 7
|
||||
call:log_lw 8
|
||||
call:install_software_o "git" "%%downloads[1]%%" exe 9
|
||||
call:draw_dss
|
||||
call:get_lw word 11
|
||||
|
||||
:: [TODO] Add downloads for windows visual studio ?!
|
||||
|
||||
call:user_set_git_path
|
||||
|
||||
:user_set_git_path_fail
|
||||
if not exist "%git_exe_path%" (
|
||||
call:log_lw 27
|
||||
call:draw_dss
|
||||
call:user_set_git_path
|
||||
)
|
||||
:: architecture specific downloads...
|
||||
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
|
||||
goto:eof
|
||||
|
||||
:user_set_git_path
|
||||
set /p git_exe_path="%word%: "
|
||||
call:user_set_git_path_fail
|
||||
goto:eof
|
||||
|
||||
:go_to_platform
|
||||
call:log_ds "Windows %~1 detected..."
|
||||
GOTO %~2
|
||||
goto:eof
|
||||
|
||||
:64BIT
|
||||
call:log_ds "64-bit computer detected..."
|
||||
|
||||
call:install_software_o "node-js" "%%downloads_64[1]%%" msi 12
|
||||
call:draw_dss
|
||||
|
||||
call:get_path_from_user 41 42
|
||||
set "node_js_path=%user_tmp_path%"
|
||||
Call:draw_dss
|
||||
|
||||
call:install_software_o "ruby" "%%downloads_64[2]%%" exe 13
|
||||
call:draw_dss
|
||||
call:install_software_o "python" "%%downloads_64[3]%%" msi 26
|
||||
|
||||
:: Some installations require specific windows versions
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "5.2" ( call:go_to_platform "XP" ver_XP_64 )
|
||||
if "%version%" == "6.0" ( call:go_to_platform "Vista" ver_Vista_64 )
|
||||
if "%version%" == "6.1" ( call:go_to_platform "7" ver_Win7_8_64 )
|
||||
if "%version%" == "6.2" ( call:go_to_platform "8.0" ver_Win7_8_64 )
|
||||
if "%version%" == "6.3" ( call:go_to_platform "8.1" ver_Win7_8_64 )
|
||||
GOTO warn_and_exit
|
||||
GOTO END
|
||||
|
||||
:32BIT
|
||||
call:log_ds "32-bit computer detected..."
|
||||
|
||||
call:install_software_o "node-js" "%%downloads_32[1]%%" msi 12
|
||||
call:draw_dss
|
||||
|
||||
call:get_path_from_user 41 42
|
||||
set "node_js_path=%user_tmp_path%"
|
||||
Call:draw_dss
|
||||
|
||||
call:install_software_o "ruby" "%%downloads_32[2]%%" exe 13
|
||||
call:draw_dss
|
||||
call:install_software_o "python" "%%downloads_32[3]%%" msi 26
|
||||
|
||||
:: Some installations require specific windows versions
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "5.2" ( call:go_to_platform "XP" ver_XP_32 )
|
||||
if "%version%" == "6.0" ( call:go_to_platform "Vista" ver_Vista_32 )
|
||||
if "%version%" == "6.1" ( call:go_to_platform "7" ver_Win7_8_32 )
|
||||
if "%version%" == "6.2" ( call:go_to_platform "8.0" ver_Win7_8_32 )
|
||||
if "%version%" == "6.3" ( call:go_to_platform "8.1" ver_Win7_8_32 )
|
||||
GOTO warn_and_exit
|
||||
GOTO END
|
||||
|
||||
:ver_Win7_8_32
|
||||
call:install_packed_software_o "mongo-db" "%%downloads_7_32[1]%%" 25 14
|
||||
set "mong-db-path = %packed_software_path%"
|
||||
goto git_rep_checkout
|
||||
|
||||
:ver_Vista_32
|
||||
call:install_packed_software_o "mongo-db" "%%downloads_vista_32[1]%%" 25 14
|
||||
set "mong-db-path = %packed_software_path%"
|
||||
goto git_rep_checkout
|
||||
|
||||
:ver_XP_32
|
||||
call:log_lw_ds 15
|
||||
goto END
|
||||
|
||||
:ver_Win7_8_64
|
||||
call:install_packed_software_o "mongo-db" "%%downloads_7_64[1]%%" 25 14
|
||||
set "mong-db-path = %packed_software_path%"
|
||||
goto git_rep_checkout
|
||||
|
||||
:ver_Vista_64
|
||||
call:install_packed_software_o "mongo-db" "%%downloads_vista_64[1]%%" 25 14
|
||||
set "mong-db-path = %packed_software_path%"
|
||||
goto git_rep_checkout
|
||||
|
||||
:ver_XP_64
|
||||
call:log_lw_ds 15
|
||||
goto END
|
||||
|
||||
:git_rep_checkout
|
||||
call:log_lw_ss 16
|
||||
call:log_lw_sse 17
|
||||
|
||||
set "PATH=%PATH%;%git_exe_path%\bin;%git_exe_path%\cmd" /M
|
||||
|
||||
call:log_lw 36
|
||||
call:log_lw 37
|
||||
call:log_lw 38
|
||||
|
||||
call:draw_dss
|
||||
|
||||
call:get_lw word 39
|
||||
set /p git_username="%word% "
|
||||
|
||||
call:draw_dss
|
||||
|
||||
call:get_empty_path_from_user 32
|
||||
set "git_repository_path=%user_tmp_path%"
|
||||
|
||||
goto:git_rep_checkout_auto
|
||||
|
||||
:git_rep_checkout_auto
|
||||
git clone https://github.com/%git_username%/codecombat.git "%git_repository_path%"
|
||||
goto:git_repo_configuration
|
||||
|
||||
:git_repo_configuration
|
||||
call:log_lw_ss 35
|
||||
call:log_lw_sse 36
|
||||
|
||||
SET "PATH=%PATH%;%node_js_path%" /M
|
||||
setx -m git "%git_exe_path%\bin"
|
||||
|
||||
call:log_lw 40
|
||||
start cmd /k "npm install -g bower brunch nodemon sendwithus & exit"
|
||||
|
||||
goto report_ok
|
||||
|
||||
:report_ok
|
||||
call:log_lw 18
|
||||
call:log_lw_sse 19
|
||||
|
||||
:: Open README file
|
||||
call:open_readme
|
||||
|
||||
goto clean_up
|
||||
|
||||
:open_readme
|
||||
call:open_txt_file "config/info"
|
||||
goto:eof
|
||||
|
||||
:warn_and_exit
|
||||
call:log_lw_ss 20
|
||||
call:log_lw_sse 21
|
||||
goto error_report
|
||||
|
||||
:error_report
|
||||
call:log_lw_ds 22
|
||||
goto END
|
||||
|
||||
:clean_up
|
||||
call:log_lw_sse 23
|
||||
rmdir %temp-dir% /s /q
|
||||
goto END
|
||||
|
||||
:: ============================ INSTALL SOFTWARE FUNCTIONS ======================
|
||||
|
||||
:download_software
|
||||
call:get_lw word 4
|
||||
call:log "%word% %~1..."
|
||||
%curl-app% -sS -k %~2 -o %temp-dir%\%~1-setup.%~3
|
||||
goto:eof
|
||||
|
||||
:install_software
|
||||
call:download_software %~1 %~2 %~3
|
||||
call:get_lw word 5
|
||||
call:log "%word% %~1..."
|
||||
START /WAIT %temp-dir%\%~1-setup.%~3
|
||||
goto:eof
|
||||
|
||||
:install_software_o
|
||||
call:get_lw word %~4
|
||||
call:user_yn_question "%word%"
|
||||
if "%res%"=="true" (
|
||||
call:install_software %~1 %~2 %~3
|
||||
) else (
|
||||
call:log_lw 10
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:install_packed_software
|
||||
call:download_software %~1 %~2 zip
|
||||
|
||||
call:draw_dss
|
||||
|
||||
call:get_lw word %~3
|
||||
|
||||
set /p packed_software_path="%word% "
|
||||
|
||||
:: remove chosen directory of user if it already exists (to prevent a window from popping up)
|
||||
IF EXIST %packed_software_path% rmdir %packed_software_path% /s /q
|
||||
|
||||
%ZU-app% x %temp-dir%\%~1-setup.zip -o%packed_software_path%
|
||||
|
||||
call:draw_dss
|
||||
|
||||
for /f "delims=" %%a in ('dir "%packed_software_path%\" /on /ad /b') do @set temp_dir=%%a
|
||||
for /f "delims=" %%a in ('dir "%packed_software_path%\%temp_dir%\" /on /ad /b') do (
|
||||
xcopy %packed_software_path%\%temp_dir% %packed_software_path%\ /S /E
|
||||
)
|
||||
|
||||
call:draw_dss
|
||||
rmdir %packed_software_path%\%temp_dir%\ /s /q
|
||||
goto:eof
|
||||
|
||||
:user_yn_question
|
||||
set /p result="%~1 [Y/N]: "
|
||||
call:draw_dss
|
||||
set "res=false"
|
||||
if "%result%"=="N" (set "res=true")
|
||||
if "%result%"=="n" (set "res=true")
|
||||
goto:eof
|
||||
|
||||
:strict_user_yn_question
|
||||
set /p result="%~1 [Y/N]: "
|
||||
call:draw_dss
|
||||
set "res=unset"
|
||||
if "%result%"=="N" (set "res=false")
|
||||
if "%result%"=="n" (set "res=false")
|
||||
if "%result%"=="Y" (set "res=true")
|
||||
if "%result%"=="y" (set "res=true")
|
||||
|
||||
if "%res%"=="unset" (
|
||||
call:log "Please answer the question with either Y or N..."
|
||||
call:draw_dss
|
||||
call:strict_user_yn_question "%~1"
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:install_packed_software_o
|
||||
call:get_lw word %~4
|
||||
call:user_yn_question "%word%"
|
||||
if "%res%"=="true" (
|
||||
call:install_packed_software %~1 %~2 %~3
|
||||
) else (
|
||||
call:log_lw 10
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:: ===================== USER - INTERACTION - FUNCTIONS ========================
|
||||
|
||||
:get_path_from_user
|
||||
call:get_lw word %~1
|
||||
set /p user_tmp_path="%word% "
|
||||
if not exist "%user_tmp_path%" (
|
||||
call:log_lw 43
|
||||
call:draw_dss
|
||||
call:get_path_from_user %~1 %~2
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:get_empty_path_from_user
|
||||
call:get_lw word %~1
|
||||
set /p user_tmp_path="%word% "
|
||||
if exist "%user_tmp_path%" (
|
||||
call:log_lw 33
|
||||
call:draw_dss
|
||||
call:get_path_from_user %~1
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:: ============================== FUNCTIONS ====================================
|
||||
|
||||
:log
|
||||
echo %~1
|
||||
echo %~1 >> %install-log%
|
||||
goto:eof
|
||||
|
||||
:draw_ss
|
||||
echo.
|
||||
call:log "-----------------------------------------------------------------------------"
|
||||
echo.
|
||||
goto:eof
|
||||
|
||||
:draw_dss
|
||||
echo.
|
||||
call:log "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
||||
echo.
|
||||
goto:eof
|
||||
|
||||
:draw_seperator
|
||||
echo.
|
||||
echo + + + + + + + +
|
||||
echo.
|
||||
goto:eof
|
||||
|
||||
:log_ss
|
||||
call:draw_ss
|
||||
call:log "%~1"
|
||||
goto:eof
|
||||
|
||||
:log_sse
|
||||
call:log "%~1"
|
||||
call:draw_ss
|
||||
goto:eof
|
||||
|
||||
:log_ds
|
||||
call:log_ss "%~1"
|
||||
call:draw_ss
|
||||
goto:eof
|
||||
|
||||
:: ============================== IO FUNCTIONS ====================================
|
||||
|
||||
:open_txt_file
|
||||
start "" notepad.exe %~1
|
||||
goto:eof
|
||||
|
||||
:parse_aa_and_draw
|
||||
set "file=%~1"
|
||||
for /f "usebackq tokens=* delims=;" %%a in ("%file%") do (
|
||||
echo.%%a
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:parse_file
|
||||
set "file=%~1"
|
||||
for /F "usebackq delims=" %%a in ("%file%") do (
|
||||
set /A %~3+=1
|
||||
call set %~2[%%%~3%%]=%%a
|
||||
)
|
||||
goto:eof
|
||||
|
||||
:parse_file_new
|
||||
set /A %~3=0
|
||||
call:parse_file %~1 %~2 %~3
|
||||
goto:eof
|
||||
|
||||
:: ============================== LOCALISATION FUNCTIONS ================
|
||||
|
||||
:get_lw
|
||||
call:get_lw_id %~1 %lang_id% %~2
|
||||
goto:eof
|
||||
|
||||
:get_lw_id
|
||||
set /A count = %~2 * %wc% + %~3 + 1
|
||||
set "%~1=!languages[%count%]!"
|
||||
goto:eof
|
||||
|
||||
:log_lw
|
||||
call:get_lw str %~1
|
||||
call:log "%str%"
|
||||
goto:eof
|
||||
|
||||
:log_lw_prfx
|
||||
call:get_lw str %~1
|
||||
call:log "%~2%str%"
|
||||
goto:eof
|
||||
|
||||
:log_lw_ss
|
||||
call:get_lw str %~1
|
||||
call:log_ss "%str%"
|
||||
goto:eof
|
||||
|
||||
:log_lw_ds
|
||||
call:get_lw str %~1
|
||||
call:log_ds "%str%"
|
||||
goto:eof
|
||||
|
||||
:log_lw_sse
|
||||
call:get_lw str %~1
|
||||
call:log_sse "%str%"
|
||||
goto:eof
|
||||
|
||||
:: ============================== WINDOWS FUNCTIONS ======================
|
||||
|
||||
:set_env_var
|
||||
setx -m %~1 %~2
|
||||
goto:eof
|
||||
|
||||
:: ============================== EOF ====================================
|
||||
|
||||
:END
|
||||
exit
|
||||
goto:eof
|
||||
|
||||
endlocal
|
|
@ -1,50 +0,0 @@
|
|||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
:: + Configuraton and installation checklist:
|
||||
:: 1) cd codecombat
|
||||
:: 2) npm install -g bower brunch nodemon sendwithus
|
||||
:: 3) bower install
|
||||
:: 4) gem install sass
|
||||
:: 5) npm install
|
||||
:: 6) brunch -w
|
||||
:: Extra... @ Fail run npm install
|
||||
|
||||
echo "Moving to your git repository..."
|
||||
C:
|
||||
cd C:\CodeCombat
|
||||
|
||||
PAUSE
|
||||
|
||||
SET "PATH=%PATH%;C:\Program Files\Nodejs" /M
|
||||
setx -m git "C:\Program Files (x86)\Git\bin"
|
||||
SET "PATH=%PATH%;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd" /M
|
||||
|
||||
PAUSE
|
||||
|
||||
echo "Installing bower, brunch, nodemon and sendwithus..."
|
||||
start cmd /k "npm install -g bower brunch nodemon sendwithus & exit"
|
||||
|
||||
PAUSE
|
||||
|
||||
echo "running npm install..."
|
||||
start cmd /k "npm install & exit"
|
||||
|
||||
PAUSE
|
||||
|
||||
echo "Activating bower install..."
|
||||
start cmd /k "bower install & PAUSE & exit"
|
||||
|
||||
PAUSE
|
||||
|
||||
echo "Installing sass via gem..."
|
||||
start cmd /k "install sass & PAUSE & exit"
|
||||
|
||||
PAUSE
|
||||
|
||||
echo "comping repository via brunch..."
|
||||
start cmd /k "brunch -w & exit"
|
||||
|
||||
PAUSE
|
||||
|
||||
endlocal
|
Loading…
Add table
Reference in a new issue