添加服务器心跳包消息处理

main
xiaohang 2023-09-18 15:55:06 +08:00
parent f217a3ad6c
commit 5f06a17ee3
4 changed files with 25 additions and 0 deletions

View File

@ -98,6 +98,11 @@ namespace DofLibrary
//Debug.Log("[ProcessMessage]GameFinish"); //Debug.Log("[ProcessMessage]GameFinish");
_receiver.OnGameFinish(serverMessage.GameFinish); _receiver.OnGameFinish(serverMessage.GameFinish);
} }
else if (serverMessage.Heartbeat != null)
{
//Debug.Log("[ProcessMessage]Heartbeat");
_receiver.OnHeartbeat(serverMessage.Heartbeat);
}
} }
/// <summary> /// <summary>

View File

@ -41,5 +41,10 @@ namespace DofLibrary
/// </summary> /// </summary>
/// <param name="gameFinish">两个玩家的得分</param> /// <param name="gameFinish">两个玩家的得分</param>
void OnGameFinish(GameFinish gameFinish); void OnGameFinish(GameFinish gameFinish);
/// <summary>
/// 心跳包
/// </summary>
void OnHeartbeat(Heartbeat heartbeat);
} }
} }

View File

@ -137,6 +137,15 @@ namespace Dof
public bool ShouldSerializeGameFinish() => __pbn__actual.Is(5); public bool ShouldSerializeGameFinish() => __pbn__actual.Is(5);
public void ResetGameFinish() => global::ProtoBuf.DiscriminatedUnionObject.Reset(ref __pbn__actual, 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()] [global::ProtoBuf.ProtoContract()]
@ -191,6 +200,9 @@ namespace Dof
[global::System.ComponentModel.DefaultValue("")] [global::System.ComponentModel.DefaultValue("")]
public string IosGeneration { get; set; } = ""; public string IosGeneration { get; set; } = "";
[global::ProtoBuf.ProtoMember(4, Name = @"diff_count")]
public int DiffCount { get; set; }
} }
[global::ProtoBuf.ProtoContract()] [global::ProtoBuf.ProtoContract()]

View File

@ -24,6 +24,8 @@ message ServerMessage {
LevelStart level_start = 3; LevelStart level_start = 3;
PointFound point_found = 4; PointFound point_found = 4;
GameFinish game_finish = 5; GameFinish game_finish = 5;
Heartbeat heartbeat = 21;
} }
} }
@ -41,6 +43,7 @@ message LevelResource {
string level_id = 1; string level_id = 1;
string android_generation = 2; string android_generation = 2;
string ios_generation = 3; string ios_generation = 3;
int32 diff_count = 4;
} }
// PlayerEntered PlayerEnter // PlayerEntered PlayerEnter