[client] update ui
@@ -68,6 +68,7 @@ const client = new Project(
|
|||||||
sources: ['src/client/haxe'],
|
sources: ['src/client/haxe'],
|
||||||
main: 'ru.m.tankz.Client',
|
main: 'ru.m.tankz.Client',
|
||||||
assets: ['src/client/resources'],
|
assets: ['src/client/resources'],
|
||||||
|
flags: ['bitmap_text'],
|
||||||
}),
|
}),
|
||||||
module.exports.generate
|
module.exports.generate
|
||||||
).bind(module, gulp);
|
).bind(module, gulp);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class SimpleButtonSkin extends ButtonColorSkin {
|
|||||||
|
|
||||||
public var borderColor(default, default):Int;
|
public var borderColor(default, default):Int;
|
||||||
|
|
||||||
public function new(color:Int = 0xffffff, borderColor:Int = 0x95937D) {
|
public function new(color:Int = 0xffffff, borderColor:Int = 0xffffff) {
|
||||||
super(color, 0.6);
|
super(color, 0.6);
|
||||||
this.borderColor = borderColor;
|
this.borderColor = borderColor;
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,8 @@ class SimpleButtonSkin extends ButtonColorSkin {
|
|||||||
graphics.clear();
|
graphics.clear();
|
||||||
graphics.beginFill(color, alpha);
|
graphics.beginFill(color, alpha);
|
||||||
graphics.lineStyle(2, borderColor);
|
graphics.lineStyle(2, borderColor);
|
||||||
graphics.drawRoundRect(0, 0, view.width, view.height, 10, 10);
|
//graphics.drawRoundRect(0, 0, view.width, view.height, 10, 10);
|
||||||
|
graphics.drawRect(0, 0, view.width, view.height);
|
||||||
graphics.endFill();
|
graphics.endFill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ pWidth: 100
|
|||||||
pHeight: 100
|
pHeight: 100
|
||||||
skin:
|
skin:
|
||||||
$type: haxework.gui.skin.ColorSkin
|
$type: haxework.gui.skin.ColorSkin
|
||||||
color: "0x95937D"
|
color: 0x95937D
|
||||||
views:
|
views:
|
||||||
- id: switcher
|
- id: switcher
|
||||||
$type: haxework.gui.frame.FrameSwitcher
|
$type: haxework.gui.frame.FrameSwitcher
|
||||||
width: 960
|
width: 960
|
||||||
height: 720
|
height: 720
|
||||||
skin:
|
skin:
|
||||||
$type: haxework.gui.skin.BitmapSkin
|
$type: haxework.gui.skin.ColorSkin
|
||||||
image: "@asset:image:resources/image/ui/background.png"
|
color: 0x777564
|
||||||
fillType: REPEAT
|
|
||||||
views:
|
views:
|
||||||
- id: start
|
- id: start
|
||||||
$type: ru.m.tankz.frame.StartFrame
|
$type: ru.m.tankz.frame.StartFrame
|
||||||
|
|||||||
@@ -8,24 +8,22 @@ button:
|
|||||||
downImage: "@asset:image:resources/image/ui/button/down.png"
|
downImage: "@asset:image:resources/image/ui/button/down.png"
|
||||||
overImage: "@asset:image:resources/image/ui/button/over.png"
|
overImage: "@asset:image:resources/image/ui/button/over.png"
|
||||||
fillType: NINEPATH
|
fillType: NINEPATH
|
||||||
fontFamily: "@res:text:font"
|
fontFamily: Courirer New
|
||||||
fontEmbed: true
|
fontColor: 0xE7E0BB
|
||||||
fontColor: "#E7E0BB"
|
fontSize: 18
|
||||||
fontSize: 20
|
|
||||||
|
|
||||||
button_simple:
|
button_simple:
|
||||||
width: 100
|
width: 100
|
||||||
height: 36
|
height: 36
|
||||||
skin:
|
skin:
|
||||||
$type: ru.m.skin.SimpleButtonSkin
|
$type: ru.m.skin.SimpleButtonSkin
|
||||||
fontFamily: "@res:text:font"
|
fontFamily: Courirer New
|
||||||
fontEmbed: true
|
fontColor: 0xffffff
|
||||||
fontColor: "#95937D"
|
fontSize: 18
|
||||||
fontSize: 20
|
shadowColor: 0x000000
|
||||||
|
|
||||||
label:
|
label:
|
||||||
fontColor: "#ffffff"
|
fontColor: 0xffffff
|
||||||
fontEmbed: false
|
|
||||||
fontFamily: Courirer New
|
fontFamily: Courirer New
|
||||||
fontSize: 16
|
fontSize: 16
|
||||||
shadowColor: 0x000000
|
shadowColor: 0x000000
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import haxework.provider.Provider;
|
|||||||
import ru.m.tankz.bundle.IConfigBundle;
|
import ru.m.tankz.bundle.IConfigBundle;
|
||||||
import ru.m.tankz.config.Config;
|
import ru.m.tankz.config.Config;
|
||||||
import ru.m.tankz.control.Control;
|
import ru.m.tankz.control.Control;
|
||||||
import ru.m.tankz.frame.level.PresetsView;
|
import ru.m.tankz.frame.start.PresetsView;
|
||||||
import ru.m.tankz.game.GameState;
|
import ru.m.tankz.game.GameState;
|
||||||
import ru.m.tankz.storage.SaveStorage;
|
import ru.m.tankz.storage.SaveStorage;
|
||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
@@ -57,9 +57,8 @@ import ru.m.tankz.Type;
|
|||||||
if (presetId != null) {
|
if (presetId != null) {
|
||||||
preset = config.getPreset(presetId);
|
preset = config.getPreset(presetId);
|
||||||
var players:Array<PlayerId> = [];
|
var players:Array<PlayerId> = [];
|
||||||
|
var human = true;
|
||||||
for (team in preset.teams) {
|
for (team in preset.teams) {
|
||||||
var human = true;
|
|
||||||
players.push(new PlayerId(team.id, -1));
|
|
||||||
for (player in team.players) {
|
for (player in team.players) {
|
||||||
var playerId = new PlayerId(team.id, player.index);
|
var playerId = new PlayerId(team.id, player.index);
|
||||||
state.control.set(playerId, human ? Control.HUMAN : Control.BOT);
|
state.control.set(playerId, human ? Control.HUMAN : Control.BOT);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ pWidth: 100
|
|||||||
pHeight: 100
|
pHeight: 100
|
||||||
views:
|
views:
|
||||||
- id: presets
|
- id: presets
|
||||||
$type: ru.m.tankz.frame.level.PresetsView
|
$type: ru.m.tankz.frame.start.PresetsView
|
||||||
contentSize: true
|
contentSize: true
|
||||||
topMargin: 10
|
topMargin: 10
|
||||||
- $type: haxework.gui.HGroupView
|
- $type: haxework.gui.HGroupView
|
||||||
@@ -12,7 +12,7 @@ views:
|
|||||||
views:
|
views:
|
||||||
- id: players
|
- id: players
|
||||||
$type: haxework.gui.list.VListView<PlayerId>
|
$type: haxework.gui.list.VListView<PlayerId>
|
||||||
factory: "@class:ru.m.tankz.frame.level.PlayerView"
|
factory: "@class:ru.m.tankz.frame.start.PlayerView"
|
||||||
pWidth: 50
|
pWidth: 50
|
||||||
pHeight: 100
|
pHeight: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
@@ -28,7 +28,7 @@ views:
|
|||||||
alpha: 0
|
alpha: 0
|
||||||
- id: levels
|
- id: levels
|
||||||
$type: haxework.gui.list.VListView<Int>
|
$type: haxework.gui.list.VListView<Int>
|
||||||
factory: "@class:ru.m.tankz.frame.level.LevelView"
|
factory: "@class:ru.m.tankz.frame.start.LevelView"
|
||||||
pWidth: 50
|
pWidth: 50
|
||||||
pHeight: 100
|
pHeight: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package ru.m.tankz.frame.level;
|
|
||||||
|
|
||||||
import haxework.gui.ButtonView;
|
|
||||||
import haxework.gui.HGroupView;
|
|
||||||
import haxework.gui.LabelView;
|
|
||||||
import haxework.gui.list.ListView.IListItemView;
|
|
||||||
import ru.m.tankz.control.Control;
|
|
||||||
import ru.m.tankz.game.GameState;
|
|
||||||
import ru.m.tankz.Type;
|
|
||||||
|
|
||||||
|
|
||||||
@:template class PlayerView extends HGroupView implements IListItemView<PlayerId> {
|
|
||||||
|
|
||||||
public var item_index(default, default):Int;
|
|
||||||
public var data(default, set):PlayerId;
|
|
||||||
|
|
||||||
@:view("index") var indexLabel(default, null):LabelView;
|
|
||||||
@:view var control(default, null):ButtonView;
|
|
||||||
|
|
||||||
@:provide var state:GameState;
|
|
||||||
|
|
||||||
private function init():Void {
|
|
||||||
control.onPress = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function set_data(value:PlayerId):PlayerId {
|
|
||||||
data = value;
|
|
||||||
if (data.index == -1) {
|
|
||||||
indexLabel.text = "";
|
|
||||||
control.text = data.team;
|
|
||||||
control.fontColor = 0x00ff00;
|
|
||||||
} else {
|
|
||||||
indexLabel.text = Std.string(data.index);
|
|
||||||
var controlType = state.control.get(value);
|
|
||||||
control.text = controlType;
|
|
||||||
control.fontColor = switch controlType {
|
|
||||||
case Control.HUMAN: 0xffff00;
|
|
||||||
case _: 0xffffff;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onPress(view:ButtonView):Void {
|
|
||||||
if (data != null && data.index > -1) {
|
|
||||||
var controlType = switch state.control.get(data) {
|
|
||||||
case Control.BOT: Control.HUMAN;
|
|
||||||
case Control.HUMAN: Control.BOT;
|
|
||||||
case _: Control.BOT;
|
|
||||||
}
|
|
||||||
state.control.set(data, controlType);
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ru.m.tankz.frame.level;
|
package ru.m.tankz.frame.start;
|
||||||
|
|
||||||
import haxework.gui.HGroupView;
|
import haxework.gui.HGroupView;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
@@ -11,5 +11,5 @@ views:
|
|||||||
text: ""
|
text: ""
|
||||||
skin:
|
skin:
|
||||||
$type: haxework.gui.skin.ColorSkin
|
$type: haxework.gui.skin.ColorSkin
|
||||||
color: "#000000"
|
color: 0x000000
|
||||||
alpha: 0.2
|
alpha: 0.2
|
||||||
69
src/client/haxe/ru/m/tankz/frame/start/PlayerView.hx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package ru.m.tankz.frame.start;
|
||||||
|
|
||||||
|
import ru.m.draw.Color;
|
||||||
|
import ru.m.tankz.bundle.IConfigBundle;
|
||||||
|
import haxework.gui.skin.ColorSkin;
|
||||||
|
import haxework.gui.ButtonView;
|
||||||
|
import haxework.gui.HGroupView;
|
||||||
|
import haxework.gui.LabelView;
|
||||||
|
import haxework.gui.list.ListView;
|
||||||
|
import haxework.gui.skin.ButtonBitmapSkin;
|
||||||
|
import openfl.Assets;
|
||||||
|
import ru.m.tankz.control.Control;
|
||||||
|
import ru.m.tankz.game.GameState;
|
||||||
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
|
|
||||||
|
@:template class PlayerView extends HGroupView implements IListItemView<PlayerId> {
|
||||||
|
|
||||||
|
public var item_index(default, default):Int;
|
||||||
|
public var data(default, set):PlayerId;
|
||||||
|
|
||||||
|
@:view("index") var indexLabel(default, null):LabelView;
|
||||||
|
@:view var control(default, null):ButtonView;
|
||||||
|
|
||||||
|
@:provide var state:GameState;
|
||||||
|
@:provide var configBundle:IConfigBundle;
|
||||||
|
|
||||||
|
private function init():Void {
|
||||||
|
control.onPress = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function set_data(value:PlayerId):PlayerId {
|
||||||
|
data = value;
|
||||||
|
indexLabel.text = '${value.team} ${Std.string(data.index + 1)}';
|
||||||
|
var color:Color = 0xffffff;
|
||||||
|
var config = configBundle.get(state.type);
|
||||||
|
var preset = config.getPreset(state.presetId);
|
||||||
|
for (team in preset.teams) {
|
||||||
|
if (team.id == data.team) {
|
||||||
|
color = team.color;
|
||||||
|
for (player in team.players) {
|
||||||
|
if (player.index == data.index) {
|
||||||
|
if (!player.color.zero) {
|
||||||
|
color = player.color;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
preset.teams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
indexLabel.fontColor = cast color;
|
||||||
|
var controlType = state.control.get(value);
|
||||||
|
control.skin = new ButtonBitmapSkin(Assets.getBitmapData('resources/image/ui/control/${controlType}.png'));
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onPress(view:ButtonView):Void {
|
||||||
|
if (data != null && data.index > -1) {
|
||||||
|
var controlType = switch state.control.get(data) {
|
||||||
|
case Control.BOT: Control.HUMAN;
|
||||||
|
case Control.HUMAN: Control.BOT;
|
||||||
|
case _: Control.BOT;
|
||||||
|
}
|
||||||
|
state.control.set(data, controlType);
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,20 @@
|
|||||||
---
|
---
|
||||||
pWidth: 100
|
pWidth: 50
|
||||||
height: 44
|
height: 44
|
||||||
margins: 5
|
margins: 5
|
||||||
|
layoutMargin: 10
|
||||||
views:
|
views:
|
||||||
- id: index
|
- id: index
|
||||||
$type: haxework.gui.LabelView
|
$type: haxework.gui.LabelView
|
||||||
$style: label
|
$style: label
|
||||||
pHeight: 100
|
pHeight: 100
|
||||||
width: 50
|
pWidth: 100
|
||||||
|
skin:
|
||||||
|
$type: haxework.gui.skin.ColorSkin
|
||||||
|
color: 0x000000
|
||||||
|
alpha: 0.2
|
||||||
|
shadow: true
|
||||||
|
shadowColor: 0x000000
|
||||||
- id: control
|
- id: control
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
$style: label
|
contentSize: true
|
||||||
pHeight: 100
|
|
||||||
pWidth: 100
|
|
||||||
skin:
|
|
||||||
$type: haxework.gui.skin.ColorSkin
|
|
||||||
color: "#000000"
|
|
||||||
alpha: 0.2
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ru.m.tankz.frame.level;
|
package ru.m.tankz.frame.start;
|
||||||
|
|
||||||
import haxework.resources.IResources;
|
import haxework.resources.IResources;
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
@@ -34,10 +34,10 @@ class PresetsView extends HGroupView {
|
|||||||
view.text = item.id;
|
view.text = item.id;
|
||||||
view.width = 250;
|
view.width = 250;
|
||||||
view.height = 36;
|
view.height = 36;
|
||||||
view.fontFamily = Provider.get(IResources).text.get("font");
|
view.fontFamily = "Courirer New";
|
||||||
view.fontEmbed = true;
|
view.fontColor = 0xffffff;
|
||||||
view.fontColor = 0x95937D;
|
view.fontSize = 18;
|
||||||
view.fontSize = 20;
|
view.shadowColor = 0x000000;
|
||||||
view.onPress = this;
|
view.onPress = this;
|
||||||
view.update();
|
view.update();
|
||||||
addView(view);
|
addView(view);
|
||||||
|
Before Width: | Height: | Size: 7.1 KiB |
BIN
src/client/resources/image/ui/control/bot.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src/client/resources/image/ui/control/human.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/client/resources/image/ui/control/null.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -39,9 +39,11 @@ class Game {
|
|||||||
private var deferred:Deferred<GameState>;
|
private var deferred:Deferred<GameState>;
|
||||||
private var stream:Stream<GameState>;
|
private var stream:Stream<GameState>;
|
||||||
|
|
||||||
|
@:provide var configBundle:IConfigBundle;
|
||||||
|
|
||||||
public function new(type:GameType) {
|
public function new(type:GameType) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.config = Provider.get(IConfigBundle).get(type);
|
this.config = configBundle.get(type);
|
||||||
this.engine = new Engine(config);
|
this.engine = new Engine(config);
|
||||||
engine.connect(this);
|
engine.connect(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ team:
|
|||||||
<<: *team
|
<<: *team
|
||||||
dire: &dire
|
dire: &dire
|
||||||
id: dire
|
id: dire
|
||||||
color: 0x2244ff
|
color: 0x3284ff
|
||||||
<<: *team
|
<<: *team
|
||||||
|
|
||||||
presets:
|
presets:
|
||||||
|
|||||||