[common] add GameEvent.MOVE
This commit is contained in:
@@ -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 _:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user