[core] add color to PlayerState
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.frame.common;
|
||||
|
||||
import haxework.color.ColorUtil;
|
||||
import ru.m.tankz.control.Control;
|
||||
import haxework.gui.DataView;
|
||||
import haxework.gui.HGroupView;
|
||||
@@ -88,12 +89,14 @@ class TeamSkin implements ISkin<TeamButton> {
|
||||
private function onTeamSelect(team:TeamId) {
|
||||
if (player != null) {
|
||||
player.control = Control.BOT;
|
||||
player.color = 0;
|
||||
player = null;
|
||||
}
|
||||
for (p in data) {
|
||||
if (p.id.team == team && p.control != Control.HUMAN) {
|
||||
player = p;
|
||||
player.control = Control.HUMAN;
|
||||
player.color = ColorUtil.multiply(state.config.getTeam(team).color, 1.7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.render;
|
||||
|
||||
import promhx.Promise;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Graphics;
|
||||
import flash.display.Sprite;
|
||||
@@ -170,16 +171,17 @@ class Render extends SpriteView {
|
||||
}
|
||||
}
|
||||
|
||||
private function playAnimate(point:Point, animate:OnceAnimate):Void {
|
||||
private function playAnimate(point:Point, animate:OnceAnimate):Promise<Dynamic> {
|
||||
animate.x = point.x - animate.width / 2;
|
||||
animate.y = point.y - animate.height / 2;
|
||||
upperLayer.addChild(animate);
|
||||
animate.play().then(function(animate:Animate):Void {
|
||||
return animate.play().then(function(animate:Animate):Void {
|
||||
// ToDo: clean animates on reset
|
||||
if (upperLayer.contains(animate)) {
|
||||
upperLayer.removeChild(animate);
|
||||
}
|
||||
animate.dispose();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user