[proto] added GameRequest and GameResponse

This commit is contained in:
2018-05-17 17:45:02 +03:00
parent 33b0693a4e
commit 007621c48c
8 changed files with 60 additions and 15 deletions

View File

@@ -12,18 +12,25 @@ typedef PlayerSave = {
var state:PlayerState;
}
enum GameServer {
LOCAL;
NETWORK;
}
class GameSave {
public var state:GameState;
public var players:Array<PlayerSave>;
public var server:GameServer;
public function new(state:GameState, ?players:Array<PlayerSave>) {
public function new(state:GameState, ?players:Array<PlayerSave>, ?server:GameServer) {
this.state = {
type: state.type,
presetId: state.presetId,
level: state.level,
};
this.players = players != null ? players : [];
this.server = server != null ? server : GameServer.LOCAL;
}
public function addPlayerState(id:PlayerId, state:PlayerState):Void {

View File

@@ -8,11 +8,14 @@ import ru.m.tankz.game.Game;
class NetworkGame extends Game {
private static var TAG(default, never):String = 'NetworkGame';
public function new(type:GameType) {
super(type);
}
public function load(proto:GameProto):Void {
L.w(TAG, 'load: ${proto}');
// ToDo:
}
@@ -21,6 +24,6 @@ class NetworkGame extends Game {
}
public function export():GameProto {
return null;
return new GameProto();
}
}