[common] PlayerControl update

This commit is contained in:
2019-06-28 16:42:39 +03:00
parent fbc9238d2f
commit b7bc1d244f
19 changed files with 221 additions and 194 deletions

View File

@@ -0,0 +1,29 @@
package ru.m.tankz.view.common;
import haxework.view.ButtonView;
import haxework.view.HGroupView;
import haxework.view.LabelView;
import ru.m.tankz.control.Controller;
import ru.m.tankz.control.PlayerControl;
@:template class SlotView extends HGroupView {
@:view("slot") var slotLabel:LabelView;
@:view("player") var playerButton:ButtonView;
public var control(default, set):PlayerControl;
private function set_control(value:PlayerControl):PlayerControl {
control = value;
slotLabel.text = '${control.playerId.team}(${control.playerId.index})';
playerButton.skinId = switch control.controller {
case HUMAN(_): "button.simple.active";
case _: "button.simple";
}
var name = ControllerParser.defaultName(control.controller);
playerButton.text = name != null ? name : "None";
slotLabel.skin = Style.textBox(value.color != null ? value.color : Style.textColor);
return control;
}
}