diff --git a/src/client/haxe/ru/m/tankz/local/LocalGame.hx b/src/client/haxe/ru/m/tankz/local/LocalGame.hx index 6d2c3af..5aae384 100644 --- a/src/client/haxe/ru/m/tankz/local/LocalGame.hx +++ b/src/client/haxe/ru/m/tankz/local/LocalGame.hx @@ -1,5 +1,6 @@ package ru.m.tankz.local; +import ru.m.tankz.control.HumanControl; import ru.m.tankz.game.GameEvent; import ru.m.tankz.game.GameRunner; import ru.m.tankz.local.LocalControlFactory; @@ -18,20 +19,20 @@ class LocalGame extends GameRunner { override public function onGameEvent(event:GameEvent):Void { super.onGameEvent(event); switch event { - case COMPLETE(result): - updateProgress(result); + case COMPLETE(result): updateProgress(result); case _: } } - private static function updateProgress(result:Result):Void { - var complete = true; - for (rule in result.state.config.game.complete) { - if (rule.team != null && rule.team != result.winner) { - complete = false; + private function updateProgress(result:Result):Void { + var complete = false; + var humansTeams:Array = []; + for (control in controls) { + if (Std.is(HumanControl, control) && humansTeams.indexOf(control.playerId.team) == -1) { + humansTeams.push(control.playerId.team); } } - if (complete) { + if (humansTeams.length == 1 && result.winner == humansTeams[0]) { var progress = gameStorage.get(new PackId(result.state.type)); progress.completeLevel(result.level.id, result.state.presetId); gameStorage.set(progress); diff --git a/src/client/haxe/ru/m/tankz/view/common/SlotView.hx b/src/client/haxe/ru/m/tankz/view/common/SlotView.hx index 5e75ef3..15a2bef 100644 --- a/src/client/haxe/ru/m/tankz/view/common/SlotView.hx +++ b/src/client/haxe/ru/m/tankz/view/common/SlotView.hx @@ -16,10 +16,15 @@ import ru.m.tankz.control.PlayerControl; private function set_control(value:PlayerControl):PlayerControl { control = value; slotLabel.text = '${control.playerId.team}(${control.playerId.index})'; - // ToDo: style - //slotLabel.skin = theme.textBox(value.color != null ? value.color : theme.colors.text); + slotLabel.font.color = value.color; select.selected = control.controller; return control; } + private function onControllerSelect(value:Controller):Void { + select.currentView.style = switch value { + case HUMAN(_): "button.active"; + case _: "button"; + } + } } diff --git a/src/client/haxe/ru/m/tankz/view/common/SlotView.yaml b/src/client/haxe/ru/m/tankz/view/common/SlotView.yaml index 9c116fd..1505560 100644 --- a/src/client/haxe/ru/m/tankz/view/common/SlotView.yaml +++ b/src/client/haxe/ru/m/tankz/view/common/SlotView.yaml @@ -10,6 +10,7 @@ views: geometry.width: 150 - id: select $type: haxework.view.form.SelectView + geometry.width: 150 labelBuilder: | ~function(controller) { var result = ControllerParser.defaultName(controller); @@ -20,3 +21,4 @@ views: - ~ru.m.tankz.control.Controller.HUMAN(0) - ~ru.m.tankz.control.Controller.HUMAN(1) selected: ~ru.m.tankz.control.Controller.NONE + +onSelect: ~onControllerSelect diff --git a/src/client/haxe/ru/m/tankz/view/network/SlotItemView.hx b/src/client/haxe/ru/m/tankz/view/network/SlotItemView.hx index fadaab9..1493387 100644 --- a/src/client/haxe/ru/m/tankz/view/network/SlotItemView.hx +++ b/src/client/haxe/ru/m/tankz/view/network/SlotItemView.hx @@ -29,10 +29,7 @@ import ru.m.tankz.proto.room.RoomSlotProto; userView.style = (value.hasUser() && value.user.uuid == network.user.uuid) ? "text.box.active" : "text.box"; var config = configBundle.get(network.room.game.type); var color = config.getColor([value.slot.team, value.slot.index]); - if (color != null) { - // ToDo: style - //typeView.skin = theme.textBox(color); - } + typeView.font.color = color; return data; } diff --git a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml index 4aff05c..a6eb24c 100644 --- a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml +++ b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml @@ -4,8 +4,10 @@ layout.vAlign: middle view: $type: haxework.view.group.VGroupView layout.hAlign: center - geometry.width: 400 - geometry.height: 400 + geometry.width: 100% + geometry.height: 100% + # geometry.width: 400 + # geometry.height: 400 geometry.margin: 10 style: window views: @@ -30,6 +32,8 @@ view: id: slots $type: haxework.view.data.DataView geometry.padding: 10 + geometry.width: 100% + layout.hAlign: center factory: ~slotViewFactory layout: $type: haxework.view.layout.VerticalLayout diff --git a/src/common/haxe/ru/m/tankz/config/Config.hx b/src/common/haxe/ru/m/tankz/config/Config.hx index 9bceb4e..84bd5bb 100644 --- a/src/common/haxe/ru/m/tankz/config/Config.hx +++ b/src/common/haxe/ru/m/tankz/config/Config.hx @@ -4,14 +4,9 @@ import haxework.color.Color; import ru.m.tankz.control.Controller; import ru.m.tankz.Type; -typedef CompleteRule = { - @:optional var team:TeamId; -} - typedef GameConfig = { var levels: Int; var friendlyFire:Bool; - var complete:Array; } typedef SpawnPoint = { diff --git a/src/common/resources/config/classic.yaml b/src/common/resources/config/classic.yaml index e86d877..8a77ec6 100644 --- a/src/common/resources/config/classic.yaml +++ b/src/common/resources/config/classic.yaml @@ -1,7 +1,5 @@ game: friendlyFire: false - complete: - - team: human map: cell: diff --git a/src/common/resources/config/death.yaml b/src/common/resources/config/death.yaml index d16b239..5f981d6 100644 --- a/src/common/resources/config/death.yaml +++ b/src/common/resources/config/death.yaml @@ -1,7 +1,5 @@ game: friendlyFire: true - complete: - - team: alpha map: cell: diff --git a/src/common/resources/config/dota.yaml b/src/common/resources/config/dota.yaml index 2a6e2b6..b2e3da2 100644 --- a/src/common/resources/config/dota.yaml +++ b/src/common/resources/config/dota.yaml @@ -1,7 +1,5 @@ game: friendlyFire: true - complete: - - team: radiant map: cell: