up version

This commit is contained in:
2019-07-29 21:50:48 +03:00
parent 7125cc1e9f
commit f5af6716d5
8 changed files with 48 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "tankz",
"version": "0.16.2",
"version": "0.16.3",
"private": true,
"devDependencies": {
"dateformat": "^3.0.3",

View File

@@ -12,20 +12,26 @@ using haxework.color.ColorUtil;
@:style(null) private var svg:String;
@:style(0) private var color:Null<Color>;
@:style(false) private var solid:Null<Bool>;
private var svgs:Map<ButtonState, SVG>;
public function new(?svg:String, ?color:Color) {
public function new(?svg:String, ?color:Color, ?solid:Bool) {
this.svg = svg;
this.color = color;
init();
this.solid = solid;
init(solid);
}
private inline function buildSVG(color:Color):SVG {
return new SVG(svg.replace("currentColor", '#${color}'));
}
private function init():Void {
private function init(solid:Bool):Void {
var color = color;
if (solid) {
color = color.multiply(1.5);
}
svgs = new Map();
svgs.set(UP, buildSVG(color));
svgs.set(DOWN, buildSVG(color.diff(-24)));
@@ -39,7 +45,9 @@ using haxework.color.ColorUtil;
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, view.width, view.height);
graphics.beginFill(color);
if (!solid) {
graphics.lineStyle(2, color.multiply(1.5));
}
// ToDo: padding
svg.render(graphics, 0, 0, Std.int(view.width * 0.8), Std.int(view.height * 0.8));
graphics.lineStyle();

View File

@@ -1,5 +1,6 @@
package ru.m.tankz;
import haxework.view.utils.DrawUtil.FillType;
import flash.text.TextFormatAlign;
import haxework.color.Color;
import haxework.view.geometry.Box;
@@ -104,6 +105,12 @@ class AppTheme extends Theme {
"geometry.height" => SizeValue.fromInt(36),
]));
register(new Style("icon.tank", [
"geometry.width" => SizeValue.fromInt(42),
"geometry.height" => SizeValue.fromInt(42),
"skin.fillType" => FillType.DEFAULT,
]));
registerButton("settings", "cog-solid.svg");
registerButton("close", "times-circle-solid.svg");
registerButton("next", "arrow-alt-circle-right-solid.svg");
@@ -112,21 +119,25 @@ class AppTheme extends Theme {
registerButton("login", "sign-in-solid.svg");
registerButton("logout", "sign-out-solid.svg");
registerButton("keyboard", "keyboard-light.svg", true);
registerButton("backspace", "backspace-light.svg", true);
registerButton("tablet-android-alt", "tablet-android-alt-light.svg", true);
register(new Style("gamepad", [
"skin.color" => colors.active,
]));
}
private function registerButton(name:String, resource:String):Void {
private function registerButton(name:String, resource:String, solid:Bool = false):Void {
register(new Style('button.$name', [
"geometry.width" => SizeValue.fromInt(42),
"geometry.height" => SizeValue.fromInt(42),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
]));
register(new Style('button.$name.small', [
"geometry.width" => SizeValue.fromInt(32),
"geometry.height" => SizeValue.fromInt(32),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
]));
}

View File

@@ -5,6 +5,7 @@ layout.vAlign: middle
views:
- id: tank
$type: haxework.view.ImageView
style: icon.tank
- id: slot
$type: haxework.view.form.LabelView
style: text.box

View File

@@ -9,8 +9,7 @@ views:
views:
- id: tank
$type: haxework.view.ImageView
geometry.width: 42
geometry.height: 42
style: icon.tank
- id: life
$type: haxework.view.form.LabelView
style: text.box

View File

@@ -0,0 +1,6 @@
<svg aria-hidden="true" focusable="false" data-prefix="fal" data-icon="backspace" role="img"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" class="svg-inline--fa fa-backspace fa-w-20 fa-5x">
<path fill="currentColor"
d="M469.66 181.65l-11.31-11.31c-3.12-3.12-8.19-3.12-11.31 0L384 233.37l-63.03-63.03c-3.12-3.12-8.19-3.12-11.31 0l-11.31 11.31c-3.12 3.12-3.12 8.19 0 11.31L361.38 256l-63.03 63.03c-3.12 3.12-3.12 8.19 0 11.31l11.31 11.31c3.12 3.12 8.19 3.12 11.31 0L384 278.63l63.03 63.03c3.12 3.12 8.19 3.12 11.31 0l11.31-11.31c3.12-3.12 3.12-8.19 0-11.31L406.63 256l63.03-63.03a8.015 8.015 0 0 0 0-11.32zM576 64H205.26C188.28 64 172 70.74 160 82.74L9.37 233.37c-12.5 12.5-12.5 32.76 0 45.25L160 429.25c12 12 28.28 18.75 45.25 18.75H576c35.35 0 64-28.65 64-64V128c0-35.35-28.65-64-64-64zm32 320c0 17.64-14.36 32-32 32H205.26c-8.55 0-16.58-3.33-22.63-9.37L32 256l150.63-150.63c6.04-6.04 14.08-9.37 22.63-9.37H576c17.64 0 32 14.36 32 32v256z"
class=""></path>
</svg>

After

Width:  |  Height:  |  Size: 1004 B

View File

@@ -0,0 +1,6 @@
<svg aria-hidden="true" focusable="false" data-prefix="fal" data-icon="keyboard" role="img"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-keyboard fa-w-18 fa-5x">
<path fill="currentColor"
d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"
class=""></path>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,7 @@
<svg aria-hidden="true" focusable="false" data-prefix="fal" data-icon="tablet-android-alt" role="img"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"
class="svg-inline--fa fa-tablet-android-alt fa-w-14 fa-3x">
<path fill="currentColor"
d="M352 96v256H96V96h256m48-96H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM48 480c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h352c8.8 0 16 7.2 16 16v416c0 8.8-7.2 16-16 16H48zM372 64H76c-6.6 0-12 5.4-12 12v296c0 6.6 5.4 12 12 12h296c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12zm-96 352H172c-6.6 0-12 5.4-12 12v8c0 6.6 5.4 12 12 12h104c6.6 0 12-5.4 12-12v-8c0-6.6-5.4-12-12-12z"
class=""></path>
</svg>

After

Width:  |  Height:  |  Size: 729 B