-
-
Save xatest/4345745 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Match Stick Man Game Network Protocol | |
# Defined in Thrift 0.9.0, for syntax: http://thrift.apache.org/ | |
#Common | |
struct CommonResponse{ | |
1: required i16 ret, # 0=OK | |
2: required string errmsg # ""=OK | |
} | |
struct Position{ | |
1: required double x, | |
2: required double y | |
} | |
enum PropType{ | |
NONE = 0, | |
FIRE = 1, | |
ICE = 2, | |
BOMB = 3, | |
PROTECT = 4 | |
} | |
enum PlayerStatus{ | |
NONE = 0, | |
FINISHED = 1, | |
} | |
struct PlayerGameInfo{ | |
1: required i16 uid, | |
2: required Position position, | |
3: optional PropType usePropType, | |
4: optional PropType hitPropType, | |
4: optional string time, # position time | |
5: optional i16 direction, | |
6: optional PlayerStatus status | |
} | |
# Join Game | |
struct JoinGameRequest{ | |
1: required string username, | |
2: optional string mapName, | |
3: required string nowTime | |
} | |
struct JoinGameResponse{ | |
1: required CommonResponse com, | |
2: required i16 roomNumber, | |
3: required string startTime, | |
4: required list<string> players | |
} | |
# Game is on | |
struct SyncGameInfoRequest{ | |
1: required PlayerGameInfo playerInfo, | |
2: required i16 propCount # logical timestamp for opponents' props using counts, start from 0 | |
} | |
struct SyncGameInfoResponse{ | |
1: required CommonResponse com, | |
2: optional list<PlayerGameInfo> players, | |
3: optional i16 propCount, | |
4: optinnal bool isFinish # true=finish received | |
} | |
# Game is over | |
struct GameOverRequest{ | |
1: required string uid, | |
} | |
struct GameOverResponse{ | |
1: required bool isOver, # all finished | |
2: list<PlayerGameInfo> players | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment