-
This commit is contained in:
@@ -84,6 +84,12 @@
|
|||||||
"skin":{"type":"haxework.gui.skin.ButtonColorSkin"},
|
"skin":{"type":"haxework.gui.skin.ButtonColorSkin"},
|
||||||
"text":"Logout"
|
"text":"Logout"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id":"restart", "type":"haxework.gui.ButtonView",
|
||||||
|
"width":100, "height":30,
|
||||||
|
"skin":{"type":"haxework.gui.skin.ButtonColorSkin"},
|
||||||
|
"text":"Restart"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id":"render", "type":"ru.m.tankz.render.Render",
|
"id":"render", "type":"ru.m.tankz.render.Render",
|
||||||
"contentSize":true
|
"contentSize":true
|
||||||
|
|||||||
@@ -22,21 +22,12 @@ class GameFrame extends VGroupView {
|
|||||||
private var render:IRender;
|
private var render:IRender;
|
||||||
private var game:ITankz;
|
private var game:ITankz;
|
||||||
|
|
||||||
|
private var config:TankzConfig;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
game = new Tankz();
|
game = new Tankz();
|
||||||
}
|
config = {
|
||||||
|
|
||||||
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 = {
|
|
||||||
map: {
|
map: {
|
||||||
cellWidth: 20,
|
cellWidth: 20,
|
||||||
cellHeight: 20,
|
cellHeight: 20,
|
||||||
@@ -44,6 +35,17 @@ class GameFrame extends VGroupView {
|
|||||||
gridHeight: 26
|
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);
|
game.init(config);
|
||||||
content.addEventListener(Event.ENTER_FRAME, updateGame);
|
content.addEventListener(Event.ENTER_FRAME, updateGame);
|
||||||
}
|
}
|
||||||
@@ -62,6 +64,9 @@ class GameFrame extends VGroupView {
|
|||||||
switch (view.id) {
|
switch (view.id) {
|
||||||
case "logout":
|
case "logout":
|
||||||
Provider.get(IConnection).disconnect();
|
Provider.get(IConnection).disconnect();
|
||||||
|
case "restart":
|
||||||
|
game.clear();
|
||||||
|
game.init(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user