[proto] added GameRequest and GameResponse
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user