添加服务器心跳包消息处理
							parent
							
								
									f217a3ad6c
								
							
						
					
					
						commit
						5f06a17ee3
					
				|  | @ -98,6 +98,11 @@ namespace DofLibrary | |||
|                 //Debug.Log("[ProcessMessage]GameFinish"); | ||||
|                 _receiver.OnGameFinish(serverMessage.GameFinish); | ||||
|             } | ||||
|             else if (serverMessage.Heartbeat != null) | ||||
|             { | ||||
|                 //Debug.Log("[ProcessMessage]Heartbeat"); | ||||
|                 _receiver.OnHeartbeat(serverMessage.Heartbeat); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  |  | |||
|  | @ -41,5 +41,10 @@ namespace DofLibrary | |||
|         /// </summary> | ||||
|         /// <param name="gameFinish">两个玩家的得分</param> | ||||
|         void OnGameFinish(GameFinish gameFinish); | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 心跳包 | ||||
|         /// </summary> | ||||
|         void OnHeartbeat(Heartbeat heartbeat); | ||||
|     } | ||||
| } | ||||
|  | @ -137,6 +137,15 @@ namespace Dof | |||
|         public bool ShouldSerializeGameFinish() => __pbn__actual.Is(5); | ||||
|         public void ResetGameFinish() => global::ProtoBuf.DiscriminatedUnionObject.Reset(ref __pbn__actual, 5); | ||||
| 
 | ||||
|         [global::ProtoBuf.ProtoMember(21, Name = @"heartbeat")] | ||||
|         public Heartbeat Heartbeat | ||||
|         { | ||||
|             get => __pbn__actual.Is(21) ? ((Heartbeat)__pbn__actual.Object) : default; | ||||
|             set => __pbn__actual = new global::ProtoBuf.DiscriminatedUnionObject(21, value); | ||||
|         } | ||||
|         public bool ShouldSerializeHeartbeat() => __pbn__actual.Is(21); | ||||
|         public void ResetHeartbeat() => global::ProtoBuf.DiscriminatedUnionObject.Reset(ref __pbn__actual, 21); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     [global::ProtoBuf.ProtoContract()] | ||||
|  | @ -191,6 +200,9 @@ namespace Dof | |||
|         [global::System.ComponentModel.DefaultValue("")] | ||||
|         public string IosGeneration { get; set; } = ""; | ||||
| 
 | ||||
|         [global::ProtoBuf.ProtoMember(4, Name = @"diff_count")] | ||||
|         public int DiffCount { get; set; } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     [global::ProtoBuf.ProtoContract()] | ||||
|  |  | |||
|  | @ -24,6 +24,8 @@ message ServerMessage { | |||
|     LevelStart level_start = 3; | ||||
|     PointFound point_found = 4; | ||||
|     GameFinish game_finish = 5; | ||||
| 
 | ||||
|     Heartbeat heartbeat = 21; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  | @ -41,6 +43,7 @@ message LevelResource { | |||
|   string level_id = 1; | ||||
|   string android_generation = 2; | ||||
|   string ios_generation = 3; | ||||
|   int32 diff_count = 4; | ||||
| } | ||||
| 
 | ||||
| // PlayerEntered 服务端接收到 PlayerEnter 消息后发还给客户端的回执 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 xiaohang
						xiaohang