(function() { "use strict"; var WeaponBar = function() { this.initialize(); } var p = WeaponBar.prototype = new createjs.Container(); p.Container_initialize = p.initialize; p.initialize = function() { this.Container_initialize(); this.background = new createjs.Shape(); this.txtWeaponName = new createjs.Text('Teste', '14px montserrat-regular', '#030303'); this.imgWeapon = new createjs.Bitmap(); this.imgWeapon.rotation = 90; this.txtScore = new createjs.Text('000000 Points', '14px montserrat-regular', '#030303'); this.txtScore.textAlign = 'right'; this.addChild(this.background); this.addChild(this.txtWeaponName); this.addChild(this.txtScore); this.addChild(this.imgWeapon); this.update(); } p.update = function() { var weapon = registry.levelShipWeapons[registry.levelShipWeapons.length-1]; if (this.txtWeaponName.text !== weapon.name) { this.imgWeapon.image = loader.getResult(weapon.id); this.imgWeapon.regX = this.imgWeapon.image.width/2; this.imgWeapon.regY = this.imgWeapon.image.height/2; } var ammunition = (weapon.ammunition>100?"inf":weapon.ammunition); this.txtWeaponName.text = weapon.name + ' ('+ammunition+')'; var score = paddingString(registry.levelScore, "000000"); this.txtScore.text = score + ' Points'; } p.layout = function(area) { this.background.graphics.clear(); // this.background.graphics.beginFill('#030303'); this.background.graphics.beginFill('#f3f3f3'); this.background.graphics.drawRect(0, 0, area.width, area.height); this.txtWeaponName.x = 5; this.txtWeaponName.y = 2; this.imgWeapon.x = area.width/2; this.imgWeapon.y = area.height/2; var bounds = this.txtScore.getBounds(); this.txtScore.y = 2; this.txtScore.x = area.width-4; } window.WeaponBar = WeaponBar; }());