[network] added NetworkFrame

This commit is contained in:
2018-02-21 17:46:52 +03:00
parent db2339ab3a
commit dd447656f8
17 changed files with 377 additions and 202 deletions

View File

@@ -0,0 +1,6 @@
package ru.m;
typedef User = {
var uuid:String;
var name:String;
}

View File

@@ -0,0 +1,7 @@
package ru.m.connect.fake;
class FakeConnection extends BaseConnection {
override public function connect():Void {}
override public function disconnect():Void {}
}

View File

@@ -2,19 +2,7 @@ package ru.m.tankz;
import protohx.Message;
import ru.m.connect.IConnection;
import ru.m.tankz.proto.pack.CreateGameRequest;
import ru.m.tankz.proto.pack.CreateGameResponse;
import ru.m.tankz.proto.pack.ErrorResponse;
import ru.m.tankz.proto.pack.GameActionRequest;
import ru.m.tankz.proto.pack.GameListRequest;
import ru.m.tankz.proto.pack.GameListResponse;
import ru.m.tankz.proto.pack.GameUpdateResponse;
import ru.m.tankz.proto.pack.JoinGameRequest;
import ru.m.tankz.proto.pack.JoinGameResponse;
import ru.m.tankz.proto.pack.LeaveGameRequest;
import ru.m.tankz.proto.pack.LeaveGameResponse;
import ru.m.tankz.proto.pack.StartGameRequest;
import ru.m.tankz.proto.pack.StartGameResponse;
import ru.m.tankz.proto.pack.*;
import Type;
@@ -24,9 +12,10 @@ class PacketBuilder implements IPacketBuilder {
0x00 => [
0x0001 => ErrorResponse
],
/*0x01 => [
],*/
0x01 => [
0x0001 => LoginRequest,
0x0002 => LoginResponse,
],
0x02 => [
0x0001 => GameListRequest,
0x0002 => GameListResponse,

View File

@@ -3,15 +3,11 @@ syntax = "proto3";
package ru.m.tankz.proto.core;
message Player {
int32 id = 1;
message User {
string uuid = 1;
string name = 2;
}
enum GameType {
CLASSIC = 0;
}
enum GameState {
READY = 0;
STARTED = 1;
@@ -20,8 +16,8 @@ enum GameState {
message Game {
int32 id = 1;
GameType type = 2;
Player creator = 3;
repeated Player players = 4;
string type = 2;
User creator = 3;
repeated User players = 4;
GameState state = 5;
}

View File

@@ -11,6 +11,17 @@ message ErrorResponse {
string message = 2;
}
// Login
message LoginRequest {
string uuid = 1;
string name = 2;
}
message LoginResponse {
ru.m.tankz.proto.core.User user = 1;
}
message GameListRequest {}
message GameListResponse {
@@ -18,7 +29,7 @@ message GameListResponse {
}
message CreateGameRequest {
ru.m.tankz.proto.core.GameType type = 1;
string type = 1;
}
message CreateGameResponse {