mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
b0a74e5b1a
12 changed files with 89 additions and 6 deletions
BIN
app/assets/images/level/prop_gold.png
Normal file
BIN
app/assets/images/level/prop_gold.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -247,9 +247,6 @@ class Angel
|
|||
clearTimeout @abortTimeout
|
||||
@free()
|
||||
@god.angelAborted @
|
||||
if @god.dead
|
||||
@worker.terminate()
|
||||
@worker = null
|
||||
when 'reportIn'
|
||||
clearTimeout @condemnTimeout
|
||||
else
|
||||
|
|
|
@ -4,6 +4,7 @@ Camera = require './Camera'
|
|||
Mark = require './Mark'
|
||||
Label = require './Label'
|
||||
AudioPlayer = require 'lib/AudioPlayer'
|
||||
{me} = require 'lib/auth'
|
||||
|
||||
# We'll get rid of this once level's teams actually have colors
|
||||
healthColors =
|
||||
|
@ -165,6 +166,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
@updateStats()
|
||||
@updateMarks()
|
||||
@updateLabels()
|
||||
@updateGold()
|
||||
|
||||
cache: ->
|
||||
bounds = @imageObject.getBounds()
|
||||
|
@ -429,10 +431,19 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
@notifySpeechUpdated blurb: blurb
|
||||
label.update() for name, label of @labels
|
||||
|
||||
updateGold: ->
|
||||
# TODO: eventually this should be moved into some sort of team-based update
|
||||
# rather than an each-thang-that-shows-gold-per-team thing.
|
||||
return if @thang.gold is @lastGold
|
||||
gold = Math.floor @thang.gold
|
||||
return if gold is @lastGold
|
||||
@lastGold = gold
|
||||
Backbone.Mediator.publish 'surface:gold-changed', {team: @thang.team, gold: gold}
|
||||
|
||||
playSounds: (withDelay=true, volume=1.0) ->
|
||||
for event in @thang.currentEvents ? []
|
||||
@playSound event, withDelay, volume
|
||||
if event is 'pay-bounty-gold' and @thang.bountyGold > 25
|
||||
if event is 'pay-bounty-gold' and @thang.bountyGold > 25 and @thang.team isnt me.team
|
||||
AudioPlayer.playInterfaceSound 'coin_1', 0.25
|
||||
if @thang.actionActivated and (action = @thang.getActionName()) isnt 'say'
|
||||
@playSound action, withDelay, volume
|
||||
|
|
44
app/styles/play/level/gold.sass
Normal file
44
app/styles/play/level/gold.sass
Normal file
|
@ -0,0 +1,44 @@
|
|||
@import "app/styles/mixins"
|
||||
|
||||
#gold-view
|
||||
position: absolute
|
||||
right: 46%
|
||||
top: 42px
|
||||
user-select: none
|
||||
-webkit-user-select: none
|
||||
|
||||
h3
|
||||
font-size: 16px
|
||||
margin: 0
|
||||
line-height: 20px
|
||||
color: hsla(205,0%,31%,1)
|
||||
text-shadow: 0px 1px 1px white, 0px -1px 1px white, 1px 0px 1px white, -1px 0px 1px white
|
||||
|
||||
&.team-humans
|
||||
color: hsla(4,80%,51%,1)
|
||||
|
||||
&.team-ogres
|
||||
color: hsla(205,100%,31%,1)
|
||||
|
||||
&.team-allies, &.team-minions
|
||||
color: hsla(116,80%,31%,1)
|
||||
|
||||
img
|
||||
width: 16px
|
||||
height: 16px
|
||||
border-radius: 2px
|
||||
padding: 2px
|
||||
@include gradient-radial-custom-stops(hsla(205,0%,74%,1), 20%, hsla(205,0%,31%,1), 70%)
|
||||
|
||||
&.team-humans img
|
||||
@include gradient-radial-custom-stops(hsla(4,80%,74%,1), 20%, hsla(4,80%,51%,1), 70%)
|
||||
|
||||
&.team-ogres img
|
||||
@include gradient-radial-custom-stops(hsla(205,100%,74%,1), 20%, hsla(205,100%,31%,1), 70%)
|
||||
|
||||
&.team-allies img, &.team-minions img
|
||||
@include gradient-radial-custom-stops(hsla(116,80%,74%,1), 20%, hsla(116,80%,31%,1), 70%)
|
||||
|
||||
.gold-amount
|
||||
display: inline-block
|
||||
width: 20px
|
|
@ -93,6 +93,8 @@
|
|||
.prop
|
||||
img
|
||||
margin-right: 5px
|
||||
width: 16px
|
||||
height: 16px
|
||||
|
||||
.text-prop
|
||||
width: 50%
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#goals-view.hide
|
||||
|
||||
#gold-view.hide.expanded
|
||||
|
||||
#level-chat-view
|
||||
|
||||
#playback-view
|
||||
|
|
0
app/templates/play/level/gold.jade
Normal file
0
app/templates/play/level/gold.jade
Normal file
|
@ -18,7 +18,7 @@ module.exports = class GoalsView extends View
|
|||
events:
|
||||
'click': 'toggleCollapse'
|
||||
|
||||
toggleCollapse: (e) =>
|
||||
toggleCollapse: (e) ->
|
||||
@$el.toggleClass('expanded').toggleClass('collapsed')
|
||||
|
||||
onNewGoalStates: (e) ->
|
||||
|
|
22
app/views/play/level/gold_view.coffee
Normal file
22
app/views/play/level/gold_view.coffee
Normal file
|
@ -0,0 +1,22 @@
|
|||
View = require 'views/kinds/CocoView'
|
||||
template = require 'templates/play/level/gold'
|
||||
|
||||
module.exports = class GoldView extends View
|
||||
id: "gold-view"
|
||||
template: template
|
||||
|
||||
subscriptions:
|
||||
'surface:gold-changed': 'onGoldChanged'
|
||||
'level-set-letterbox': 'onSetLetterbox'
|
||||
|
||||
onGoldChanged: (e) ->
|
||||
@$el.show()
|
||||
goldEl = @$el.find('.gold-amount.team-' + e.team)
|
||||
unless goldEl.length
|
||||
teamEl = $("<h3 class='team-#{e.team}' title='Gold: #{e.team}'><img src='/images/level/prop_gold.png'> <div class='gold-amount team-#{e.team}'></div>")
|
||||
@$el.append(teamEl)
|
||||
goldEl = teamEl.find('.gold-amount.team-' + e.team)
|
||||
goldEl.text(e.gold)
|
||||
|
||||
onSetLetterbox: (e) ->
|
||||
if e.on then @$el.hide() else @$el.show()
|
|
@ -235,7 +235,7 @@ module.exports = class HUDView extends View
|
|||
return null # included in the bar
|
||||
context =
|
||||
prop: prop
|
||||
hasIcon: prop in ["health", "pos", "target", "inventory"]
|
||||
hasIcon: prop in ["health", "pos", "target", "inventory", "gold"]
|
||||
hasBar: prop in ["health"]
|
||||
$(prop_template(context))
|
||||
|
||||
|
|
|
@ -112,6 +112,9 @@ module.exports = class TomeView extends View
|
|||
@cast()
|
||||
|
||||
cast: ->
|
||||
for spellKey, spell of @spells
|
||||
for thangID, spellThang of spell.thangs
|
||||
spellThang.aether.options.includeFlow = spellThang.aether.originalOptions.includeFlow = spellThang is @spellView?.spellThang
|
||||
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells
|
||||
|
||||
onToggleSpellList: (e) ->
|
||||
|
|
|
@ -26,6 +26,7 @@ HUDView = require './level/hud_view'
|
|||
ControlBarView = require './level/control_bar_view'
|
||||
PlaybackView = require './level/playback_view'
|
||||
GoalsView = require './level/goals_view'
|
||||
GoldView = require './level/gold_view'
|
||||
VictoryModal = require './level/modal/victory_modal'
|
||||
InfiniteLoopModal = require './level/modal/infinite_loop_modal'
|
||||
|
||||
|
@ -157,6 +158,7 @@ module.exports = class PlayLevelView extends View
|
|||
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel
|
||||
@insertSubView new PlaybackView {}
|
||||
@insertSubView new GoalsView {}
|
||||
@insertSubView new GoldView {}
|
||||
@insertSubView new HUDView {}
|
||||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||
worldName = @level.get('i18n')?[me.lang()]?.name ? @level.get('name')
|
||||
|
|
Loading…
Reference in a new issue