115 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
			
		
		
	
	
			115 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
| syntax = "proto3";
 | |
| package dof;
 | |
| option go_package = "./;pb";
 | |
| 
 | |
| import "google/protobuf/any.proto";
 | |
| 
 | |
| // ClientMessage 客户端发送给服务端的消息类型
 | |
| message ClientMessage {
 | |
|   oneof actual {
 | |
|     PlayerEnter player_enter = 1;
 | |
|     LevelPrepared level_prepared = 2;
 | |
|     PointFound point_found = 3;
 | |
|     LevelEnd level_end = 4;
 | |
|     AllLevelEnd all_level_end = 5;
 | |
|     PlayerLeave player_leave = 6;
 | |
| 
 | |
|     Heartbeat heartbeat = 21;
 | |
|   }
 | |
| }
 | |
| 
 | |
| // ServerMessage 服务端发送给客户端的消息类型
 | |
| message ServerMessage {
 | |
|   oneof actual {
 | |
|     PlayerEntered player_entered = 1;
 | |
|     GameStart game_start = 2;
 | |
|     LevelStart level_start = 3;
 | |
|     PointFound point_found = 4;
 | |
|     GameFinish game_finish = 5;
 | |
| 
 | |
|     Heartbeat heartbeat = 21;
 | |
|   }
 | |
| }
 | |
| 
 | |
| // PlayerEnter 客户端进入房间
 | |
| message PlayerEnter {
 | |
|   string room_id = 1;
 | |
|   string uid = 2;
 | |
|   string nick_name = 3;
 | |
|   string country = 4;
 | |
|   string app_id = 5;
 | |
|   string token = 6;
 | |
| }
 | |
| 
 | |
| message LevelResource {
 | |
|   string level_id = 1;
 | |
|   string android_generation = 2;
 | |
|   string ios_generation = 3;
 | |
|   int32 diff_count = 4;
 | |
| }
 | |
| 
 | |
| // PlayerEntered 服务端接收到 PlayerEnter 消息后发还给客户端的回执
 | |
| message PlayerEntered {
 | |
|   int64 cid = 1;
 | |
| }
 | |
| 
 | |
| message GameStart {
 | |
|   repeated LevelResource level_resource = 1;
 | |
|   repeated PlayerEnter player_entered = 2;
 | |
| }
 | |
| 
 | |
| message LevelPrepared {
 | |
|   int64 cid = 1;
 | |
|   string level = 2;
 | |
| }
 | |
| 
 | |
| message LevelStart {
 | |
|   string level = 1;
 | |
| }
 | |
| 
 | |
| message PointFound {
 | |
|   int64 cid = 1;
 | |
|   string level = 2;
 | |
|   int32 point_id = 3;
 | |
|   float combo = 4;
 | |
| }
 | |
| 
 | |
| message LevelEnd {
 | |
|   int64 cid = 1;
 | |
|   string level = 2;
 | |
| }
 | |
| 
 | |
| message AllLevelEnd {
 | |
|   int64 cid = 1;
 | |
|   float time_spent = 2;
 | |
| }
 | |
| 
 | |
| message GameScore {
 | |
|   string uid = 1;
 | |
|   int32 score = 2;
 | |
| }
 | |
| 
 | |
| message GameFinish {
 | |
|   repeated GameScore scores = 1;
 | |
| }
 | |
| 
 | |
| message PlayerLeave {
 | |
|   int64 cid = 1;
 | |
| }
 | |
| 
 | |
| message Heartbeat {
 | |
|   int64 timestamp = 1;
 | |
| }
 | |
| 
 | |
| message Assignment {
 | |
|   // Connection information for this Assignment.
 | |
|   string connection = 1;
 | |
| 
 | |
|   // Customized information not inspected by Open Match, to be used by the match
 | |
|   // making function, evaluator, and components making calls to Open Match.
 | |
|   // Optional, depending on the requirements of the connected systems.
 | |
|   map<string, google.protobuf.Any> extensions = 4;
 | |
| 
 | |
|   // Deprecated fields.
 | |
|   reserved 2, 3;
 | |
| } |