2 Commits

Author SHA1 Message Date
e8efe9c26d feat(connection): packet json logging 2026-05-12 16:41:55 +03:00
8f30eff1dd fix(translate): fix provider usage 2024-07-07 15:16:16 +03:00
4 changed files with 15 additions and 15 deletions

View File

@@ -4,7 +4,7 @@
"license": "MIT",
"tags": ["view", "layout", "template"],
"description": "View framework.",
"version": "2.1.0",
"version": "2.1.1",
"releasenote": "Update.",
"contributors": ["shmyga"],
"classPath": "src/main",

View File

@@ -7,6 +7,8 @@ import promhx.Deferred;
import promhx.Promise;
import protohx.Message;
using protohx.MessageUtils;
class BaseConnection<O:Message, I:Message> implements IConnection<O, I> {
public var handler(default, null):Signal<ConnectionEvent>;
public var sendHandler(default, null):Signal<O>;
@@ -41,12 +43,12 @@ class BaseConnection<O:Message, I:Message> implements IConnection<O, I> {
}
public function send(packet:O):Void {
#if proto_debug L.d('Proto', 'send: ${packet}'); #end
#if proto_debug L.d('Proto', 'send: ${packet.toJson()}'); #end
sendHandler.emit(packet);
}
public function receive(packet:I):Void {
#if proto_debug L.d('Proto', 'receive: ${packet}'); #end
#if proto_debug L.d('Proto', 'receive: ${packet.toJson()}'); #end
receiveHandler.emit(packet);
}
}

View File

@@ -3,30 +3,33 @@ package hw.translate;
import hw.provider.Provider;
abstract TranslateString(String) from String to String {
@:provide var translate:ITranslate;
inline public function new(value:String, args:Array<Dynamic> = null) {
if (args != null) {
this = Provider.get(ITranslate).format(value, args);
this = translate.format(value, args);
} else {
this = Provider.get(ITranslate).get(value);
this = translate.get(value);
}
}
}
abstract TranslateArrayString(String) from String to String {
@:provide var translate:ITranslate;
inline public function new(value:String, index:Int) {
this = Provider.get(ITranslate).getArray(value)[index];
this = translate.getArray(value)[index];
}
}
abstract TranslatePluralString(String) from String to String {
@:provide var translate:ITranslate;
inline public function new(value:String, num:Int, args:Array<Dynamic> = null) {
if (args != null) {
this = Provider.get(ITranslate).formatPlurar(value, num, args);
this = translate.formatPlurar(value, num, args);
} else {
this = Provider.get(ITranslate).getPlural(value, num);
this = translate.getPlural(value, num);
}
}
}

View File

@@ -14,20 +14,15 @@ class ButtonImageView extends ButtonView {
public function new(image:BitmapData = null) {
super();
skin = bitmapSkin;
if (image != null) {
this.image = image;
}
}
override private function set_skin(value:SkinSet):SkinSet {
value = value.slice(0);
value.unshift(bitmapSkin);
return super.set_skin(value);
}
private function set_image(value:BitmapData):BitmapData {
if (image != value) {
setContentSize(value.width, value.height, "image");
setSize(value.width, value.height, "image");
image = value;
bitmapSkin.image = image;
toRedraw();