-
This commit is contained in:
@@ -22,21 +22,12 @@ class GameFrame extends VGroupView {
|
||||
private var render:IRender;
|
||||
private var game:ITankz;
|
||||
|
||||
private var config:TankzConfig;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
game = new Tankz();
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
render = findViewById("render");
|
||||
findViewById("logout", ButtonView).onPress = this;
|
||||
}
|
||||
|
||||
public function onShow():Void {
|
||||
var person = Provider.get(GameData).person;
|
||||
findViewById("name", LabelView).text = person.name;
|
||||
|
||||
var config:TankzConfig = {
|
||||
config = {
|
||||
map: {
|
||||
cellWidth: 20,
|
||||
cellHeight: 20,
|
||||
@@ -44,6 +35,17 @@ class GameFrame extends VGroupView {
|
||||
gridHeight: 26
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
render = findViewById("render");
|
||||
findViewById("logout", ButtonView).onPress = this;
|
||||
findViewById("restart", ButtonView).onPress = this;
|
||||
}
|
||||
|
||||
public function onShow():Void {
|
||||
var person = Provider.get(GameData).person;
|
||||
findViewById("name", LabelView).text = person.name;
|
||||
game.init(config);
|
||||
content.addEventListener(Event.ENTER_FRAME, updateGame);
|
||||
}
|
||||
@@ -62,6 +64,9 @@ class GameFrame extends VGroupView {
|
||||
switch (view.id) {
|
||||
case "logout":
|
||||
Provider.get(IConnection).disconnect();
|
||||
case "restart":
|
||||
game.clear();
|
||||
game.init(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user