update
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import ru.m.tankz.proto.GamesUnSubscribeRequest;
|
||||
import ru.m.tankz.proto.GamesSubscribeRequest;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.proto.JoinGameResponse;
|
||||
import ru.m.tankz.proto.JoinGameRequest;
|
||||
@@ -9,14 +11,12 @@ import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.LabelView;
|
||||
import ru.m.tankz.proto.GamesResponse;
|
||||
import ru.m.tankz.proto.GamesRequest;
|
||||
import ru.m.tankz.proto.Game;
|
||||
import haxework.gui.list.ListView;
|
||||
import protohx.Message;
|
||||
import ru.m.core.connect.IConnection;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.gui.list.VListView;
|
||||
import haxework.gui.VGroupView;
|
||||
|
||||
@:template("layout/frames/game_list.json", "layout/styles.json")
|
||||
@@ -35,10 +35,11 @@ class GameListFrame extends VGroupView implements ViewBuilder implements IPacket
|
||||
public function onShow() {
|
||||
findViewById("name", LabelView).text = Provider.get(GameData).person.name;
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
Provider.get(IConnection).send(new GamesRequest());
|
||||
Provider.get(IConnection).send(new GamesSubscribeRequest());
|
||||
}
|
||||
|
||||
public function onHide() {
|
||||
Provider.get(IConnection).send(new GamesUnSubscribeRequest());
|
||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import ru.m.tankz.proto.LeaveGameRequest;
|
||||
import ru.m.tankz.proto.LeaveGameResponse;
|
||||
import ru.m.tankz.proto.JoinGameResponse;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.proto.ExitGameResponse;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import ru.m.tankz.proto.GamesResponse;
|
||||
import ru.m.tankz.proto.ExitGameRequest;
|
||||
import ru.m.tankz.proto.StartGameResponse;
|
||||
import ru.m.tankz.proto.StartGameRequest;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import protohx.Message;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.list.VListView;
|
||||
import ru.m.tankz.proto.Person;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.gui.VGroupView;
|
||||
import ru.m.core.connect.IConnection;
|
||||
@@ -53,11 +49,11 @@ class GameReadyFrame extends VGroupView implements ViewBuilder implements IPacke
|
||||
public function onLeaveGameResponse(packet:LeaveGameResponse):Void {
|
||||
Provider.get(GameData).game = packet.game;
|
||||
list.data = Provider.get(GameData).game.persons;
|
||||
}
|
||||
|
||||
public function onExitGameResponse(packet:ExitGameResponse):Void {
|
||||
Provider.get(GameData).game = null;
|
||||
Provider.get(IFrameSwitcher).change(GameListFrame.ID);
|
||||
var person = Provider.get(GameData).person;
|
||||
if (!Lambda.exists(packet.game.persons, function(person) return person.id == person.id)) {
|
||||
Provider.get(GameData).game = null;
|
||||
Provider.get(IFrameSwitcher).change(GameListFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
public function onPacket(packet:Message):Void {}
|
||||
@@ -67,7 +63,7 @@ class GameReadyFrame extends VGroupView implements ViewBuilder implements IPacke
|
||||
case "start":
|
||||
Provider.get(IConnection).send(new StartGameRequest());
|
||||
case "exit":
|
||||
Provider.get(IConnection).send(new ExitGameRequest());
|
||||
Provider.get(IConnection).send(new LeaveGameRequest());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
51
src/client/webapp/index_template.html
Normal file
51
src/client/webapp/index_template.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
<title>::APP_TITLE::</title>
|
||||
|
||||
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
::if linkedLibraries::::foreach (linkedLibraries)::
|
||||
<script type="text/javascript" src="::__current__::"></script>::end::::end::
|
||||
<script type="text/javascript" src="./::APP_FILE::.js"></script>
|
||||
|
||||
<script>
|
||||
window.addEventListener ("touchmove", function (event) { event.preventDefault (); }, false);
|
||||
if (typeof window.devicePixelRatio != 'undefined' && window.devicePixelRatio > 2) {
|
||||
var meta = document.getElementById ("viewport");
|
||||
meta.setAttribute ('content', 'width=device-width, initial-scale=' + (2 / window.devicePixelRatio) + ', user-scalable=no');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html,body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
|
||||
#openfl-content { background: #000000; width: ::WIN_WIDTH::px; height: ::WIN_HEIGHT::px; margin: 0 auto; }
|
||||
::foreach assets::::if (type == "font")::
|
||||
@font-face {
|
||||
font-family: '::fontName::';
|
||||
src: url('::targetPath::.eot');
|
||||
src: url('::targetPath::.eot?#iefix') format('embedded-opentype'),
|
||||
url('::targetPath::.svg#my-font-family') format('svg'),
|
||||
url('::targetPath::.woff') format('woff'),
|
||||
url('::targetPath::.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}::end::::end::
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="openfl-content"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
lime.embed ("openfl-content", ::WIN_WIDTH::, ::WIN_HEIGHT::, "::WIN_FLASHBACKGROUND::");
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user