mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Move gold display to DuelStatsView for Wakka Maul and remove army power display for non-army ladders
This commit is contained in:
parent
fa21f9ef68
commit
22af180a86
4 changed files with 37 additions and 68 deletions
|
@ -38,7 +38,7 @@
|
|||
&.team-humans
|
||||
padding-right: 10px
|
||||
|
||||
.player-power
|
||||
.player-power, .player-gold
|
||||
margin-right: 5px
|
||||
|
||||
&.team-ogres
|
||||
|
@ -52,7 +52,7 @@
|
|||
.player-name
|
||||
text-align: right
|
||||
|
||||
.player-power
|
||||
.player-power, .player-gold
|
||||
margin-left: 5px
|
||||
flex-direction: row-reverse
|
||||
text-align: right
|
||||
|
@ -85,14 +85,14 @@
|
|||
max-width: 130px
|
||||
|
||||
$iconSize: 16px
|
||||
.health-icon, .power-icon
|
||||
.health-icon, .power-icon, .gold-icon
|
||||
display: inline-block
|
||||
width: $iconSize
|
||||
height: $iconSize
|
||||
background: transparent url(/images/level/hud_info_icons.png) no-repeat
|
||||
background-size: auto $iconSize
|
||||
|
||||
.player-health, .player-power
|
||||
.player-health, .player-power, .player-gold
|
||||
height: 50%
|
||||
display: flex
|
||||
flex-direction: row
|
||||
|
@ -122,37 +122,21 @@
|
|||
vertical-align: top
|
||||
|
||||
.player-power
|
||||
|
||||
|
||||
.power-icon
|
||||
margin-top: 4px
|
||||
background-position: (-5 * $iconSize) 0px
|
||||
|
||||
|
||||
.power-value
|
||||
min-width: 20px
|
||||
margin: 0px 5px
|
||||
|
||||
//&.team-humans .team-gold
|
||||
// color: hsla(4,80%,51%,1)
|
||||
//
|
||||
//&.team-ogres .team-gold
|
||||
// color: hsla(205,100%,51%,1)
|
||||
//
|
||||
//.team-gold
|
||||
// font-size: 1.4vw
|
||||
// line-height: 1.4vw
|
||||
// margin: 0
|
||||
// color: hsla(205,0%,51%,1)
|
||||
// display: inline-block
|
||||
// padding: 0px 4px
|
||||
//
|
||||
// img
|
||||
// width: 1.2vw
|
||||
// height: 1.2vw
|
||||
// border-radius: 2px
|
||||
// padding: 0.1vw
|
||||
// margin-top: -0.2vw
|
||||
// margin-right: 0.1vw
|
||||
//
|
||||
// .gold-amount
|
||||
// display: inline-block
|
||||
// min-width: 20px
|
||||
|
||||
.player-gold
|
||||
|
||||
.gold-icon
|
||||
margin-top: 4px
|
||||
background-position: (-8 * $iconSize) 0px
|
||||
|
||||
.gold-value
|
||||
min-width: 20px
|
||||
margin: 0px 5px
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
for player in players
|
||||
for player in view.players
|
||||
div(class="player-container team-" + player.team)
|
||||
.player-portrait
|
||||
.thang-avatar-placeholder
|
||||
.player-info
|
||||
.name-and-power
|
||||
.player-power
|
||||
.power-icon
|
||||
.power-value
|
||||
if view.showsPower
|
||||
.player-power
|
||||
.power-icon
|
||||
.power-value
|
||||
if view.showsGold
|
||||
.player-gold
|
||||
.gold-icon
|
||||
.gold-value
|
||||
.player-name= player.name || 'Anoner'
|
||||
.player-health
|
||||
.health-icon
|
||||
.health-bar-container
|
||||
.health-bar
|
||||
.health-value
|
||||
//.player-gold
|
||||
// .team-gold
|
||||
// img(src="/images/level/gold_icon.png", alt="", draggable="false")
|
||||
// .gold-amount
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = class DuelStatsView extends CocoView
|
|||
template: template
|
||||
|
||||
subscriptions:
|
||||
#'surface:gold-changed': 'onGoldChanged'
|
||||
'surface:gold-changed': 'onGoldChanged'
|
||||
'god:new-world-created': 'onNewWorld'
|
||||
'god:streaming-world-updated': 'onNewWorld'
|
||||
'surface:frame-changed': 'onFrameChanged'
|
||||
|
@ -29,13 +29,10 @@ module.exports = class DuelStatsView extends CocoView
|
|||
team: if options.session.get('team') is 'humans' then 'ogres' else 'humans'
|
||||
heroConfig: options.session.get('heroConfig')
|
||||
}[prop]
|
||||
#@teamGold = {}
|
||||
#@teamGoldEarned = {}
|
||||
|
||||
getRenderData: (c) ->
|
||||
c = super c
|
||||
c.players = @players = (@formatPlayer team for team in ['humans', 'ogres'])
|
||||
c
|
||||
@showsGold = options.level.get('slug') in ['wakka-maul']
|
||||
@showsPower = options.level.get('slug') not in ['wakka-maul', 'dueling-grounds', 'cavern-survival', 'multiplayer-treasure-grove']
|
||||
@teamGold = {}
|
||||
@players = (@formatPlayer team for team in ['humans', 'ogres'])
|
||||
|
||||
formatPlayer: (team) ->
|
||||
p = team: team
|
||||
|
@ -69,7 +66,7 @@ module.exports = class DuelStatsView extends CocoView
|
|||
for player in @players
|
||||
thang = _.find @options.thangs, id: @avatars[player.team].thang.id
|
||||
@updateHealth thang
|
||||
@updatePower()
|
||||
@updatePower() if @showsPower
|
||||
|
||||
updateHealth: (thang) ->
|
||||
$health = @$find thang.team, '.player-health'
|
||||
|
@ -101,21 +98,8 @@ module.exports = class DuelStatsView extends CocoView
|
|||
avatar.destroy() for team, avatar of @avatars ? {}
|
||||
super()
|
||||
|
||||
#onGoldChanged: (e) ->
|
||||
# return if @teamGold[e.team] is e.gold and @teamGoldEarned[e.team] is e.goldEarned
|
||||
# @teamGold[e.team] = e.gold
|
||||
# @teamGoldEarned[e.team] = e.goldEarned
|
||||
# goldEl = @$find e.team, '.gold-amount'
|
||||
# text = '' + e.gold
|
||||
# if e.goldEarned and e.goldEarned > e.gold
|
||||
# text += " (#{e.goldEarned})"
|
||||
# goldEl.text text
|
||||
# @updateTitle()
|
||||
#
|
||||
#updateTitle: ->
|
||||
# for team, gold of @teamGold
|
||||
# if @teamGoldEarned[team]
|
||||
# title = "Team '#{team}' has #{gold} now of #{@teamGoldEarned[team]} gold earned."
|
||||
# else
|
||||
# title = "Team '#{team}' has #{gold} gold."
|
||||
# @$find(team, '.player-gold').attr 'title', title
|
||||
onGoldChanged: (e) ->
|
||||
return unless @showsGold
|
||||
return if @teamGold[e.team] is e.gold
|
||||
@teamGold[e.team] = e.gold
|
||||
utils.replaceText @$find(e.team, '.gold-value'), '' + e.gold
|
||||
|
|
|
@ -246,7 +246,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
@insertSubView new LevelPlaybackView session: @session, level: @level
|
||||
@insertSubView new GoalsView {}
|
||||
@insertSubView new LevelFlagsView levelID: @levelID, world: @world if @$el.hasClass 'flags'
|
||||
@insertSubView new GoldView {}
|
||||
@insertSubView new GoldView {} unless @level.get('slug') in ['wakka-maul']
|
||||
@insertSubView new HUDView {level: @level}
|
||||
@insertSubView new LevelDialogueView {level: @level, sessionID: @session.id}
|
||||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||
|
|
Loading…
Reference in a new issue