[common] add GameEvent.MOVE

This commit is contained in:
2019-05-15 15:15:07 +03:00
parent 686c659c84
commit cd7dd1984b
8 changed files with 41 additions and 22 deletions

View File

@@ -175,6 +175,14 @@ class Render extends SpriteView implements IRender {
showScore(rect.center, shot.score);
}
}
case MOVE(TANK(id, position)) | MOVE(BULLET(id, position)):
if (items.exists(id)) {
var item = items[id];
item.value.rect.x = position.x;
item.value.rect.y = position.y;
item.value.rect.direction = position.direction;
item.update();
}
case _:
}
}

View File

@@ -24,6 +24,7 @@ import ru.m.tankz.game.record.GameRecord;
@yield return read(id);
} catch (error:Dynamic) {
L.w("RecordStorage", 'read ', error);
delete(id);
}
}
}

View File

@@ -1,7 +1,7 @@
package ru.m.tankz.view;
import haxework.view.frame.FrameSwitcher;
import haxework.view.list.ListView.IListItemView;
import haxework.view.list.ListView;
import haxework.view.list.VListView;
import haxework.view.VGroupView;
import ru.m.tankz.game.record.GameRecord;
@@ -18,7 +18,7 @@ import ru.m.tankz.storage.RecordStorage;
public function onShow():Void {
var data = Lambda.array(recordStorage);
data.sort(function(a:GameRecord, b:GameRecord) return Std.int(a.date.getTime() - b.date.getTime()));
data.sort(function(a:GameRecord, b:GameRecord) return Std.int(b.date.getTime() - a.date.getTime()));
this.data.data = data;
}