Compare commits

..

2 Commits

Author SHA1 Message Date
xiaohang 962462e0ef 发送信息数据更新 2023-09-15 18:23:02 +08:00
xiaohang 71e9d0da21 proto文件更新,新增心跳包、playerEnter添加AppId和Token等参数 2023-09-15 18:06:10 +08:00
3 changed files with 68 additions and 6 deletions

View File

@ -34,7 +34,7 @@ namespace DofLibrary
set => _cid = value; set => _cid = value;
} }
public void PlayerEnter(string roomId, string uid, string nickName, string country) public void PlayerEnter(string roomId, string uid, string nickName, string country, string appId, string token)
{ {
var playerEnter = new ClientMessage var playerEnter = new ClientMessage
{ {
@ -43,7 +43,9 @@ namespace DofLibrary
RoomId = roomId, RoomId = roomId,
Uid = uid, Uid = uid,
NickName = nickName, NickName = nickName,
Country = country Country = country,
AppId = appId,
Token = token
} }
}; };
Send(playerEnter); Send(playerEnter);
@ -64,7 +66,7 @@ namespace DofLibrary
Debug.Log("LevelPrepared message sent"); Debug.Log("LevelPrepared message sent");
} }
public void PointFound(string levelId, int pointId) public void PointFound(string levelId, int pointId, float combo)
{ {
var message = new ClientMessage var message = new ClientMessage
{ {
@ -72,7 +74,8 @@ namespace DofLibrary
{ {
Cid = _cid, Cid = _cid,
Level = levelId, Level = levelId,
PointId = pointId PointId = pointId,
Combo = combo
} }
}; };
Send(message); Send(message);
@ -93,18 +96,32 @@ namespace DofLibrary
Debug.Log("LevelEnd message sent"); Debug.Log("LevelEnd message sent");
} }
public void AllLevelEnd() public void AllLevelEnd(float timeSpent)
{ {
var message = new ClientMessage var message = new ClientMessage
{ {
AllLevelEnd = new AllLevelEnd AllLevelEnd = new AllLevelEnd
{ {
Cid = _cid Cid = _cid,
TimeSpent = timeSpent
} }
}; };
Send(message); Send(message);
Debug.Log("AllLevelEnd message sent"); Debug.Log("AllLevelEnd message sent");
} }
public void Heartbeat(long timestamp)
{
var message = new ClientMessage
{
Heartbeat = new Heartbeat
{
Timestamp = timestamp
}
};
Send(message);
Debug.Log("Heartbeat message sent");
}
private void Send(ClientMessage message) private void Send(ClientMessage message)
{ {

View File

@ -72,6 +72,15 @@ namespace Dof
public bool ShouldSerializePlayerLeave() => __pbn__actual.Is(6); public bool ShouldSerializePlayerLeave() => __pbn__actual.Is(6);
public void ResetPlayerLeave() => global::ProtoBuf.DiscriminatedUnionObject.Reset(ref __pbn__actual, 6); public void ResetPlayerLeave() => global::ProtoBuf.DiscriminatedUnionObject.Reset(ref __pbn__actual, 6);
[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()]
@ -153,6 +162,14 @@ namespace Dof
[global::System.ComponentModel.DefaultValue("")] [global::System.ComponentModel.DefaultValue("")]
public string Country { get; set; } = ""; public string Country { get; set; } = "";
[global::ProtoBuf.ProtoMember(5, Name = @"app_id")]
[global::System.ComponentModel.DefaultValue("")]
public string AppId { get; set; } = "";
[global::ProtoBuf.ProtoMember(6, Name = @"token")]
[global::System.ComponentModel.DefaultValue("")]
public string Token { get; set; } = "";
} }
[global::ProtoBuf.ProtoContract()] [global::ProtoBuf.ProtoContract()]
@ -249,6 +266,9 @@ namespace Dof
[global::ProtoBuf.ProtoMember(3, Name = @"point_id")] [global::ProtoBuf.ProtoMember(3, Name = @"point_id")]
public int PointId { get; set; } public int PointId { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"combo")]
public float Combo { get; set; }
} }
[global::ProtoBuf.ProtoContract()] [global::ProtoBuf.ProtoContract()]
@ -277,6 +297,9 @@ namespace Dof
[global::ProtoBuf.ProtoMember(1, Name = @"cid")] [global::ProtoBuf.ProtoMember(1, Name = @"cid")]
public long Cid { get; set; } public long Cid { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"time_spent")]
public float TimeSpent { get; set; }
} }
[global::ProtoBuf.ProtoContract()] [global::ProtoBuf.ProtoContract()]
@ -319,6 +342,18 @@ namespace Dof
} }
[global::ProtoBuf.ProtoContract()]
public partial class Heartbeat : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"timestamp")]
public long Timestamp { get; set; }
}
} }
#pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192 #pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192

View File

@ -11,6 +11,8 @@ message ClientMessage {
LevelEnd level_end = 4; LevelEnd level_end = 4;
AllLevelEnd all_level_end = 5; AllLevelEnd all_level_end = 5;
PlayerLeave player_leave = 6; PlayerLeave player_leave = 6;
Heartbeat heartbeat = 21;
} }
} }
@ -31,6 +33,8 @@ message PlayerEnter {
string uid = 2; string uid = 2;
string nick_name = 3; string nick_name = 3;
string country = 4; string country = 4;
string app_id = 5;
string token = 6;
} }
message LevelResource { message LevelResource {
@ -62,6 +66,7 @@ message PointFound {
int64 cid = 1; int64 cid = 1;
string level = 2; string level = 2;
int32 point_id = 3; int32 point_id = 3;
float combo = 4;
} }
message LevelEnd { message LevelEnd {
@ -71,6 +76,7 @@ message LevelEnd {
message AllLevelEnd { message AllLevelEnd {
int64 cid = 1; int64 cid = 1;
float time_spent = 2;
} }
message GameScore { message GameScore {
@ -84,4 +90,8 @@ message GameFinish {
message PlayerLeave { message PlayerLeave {
int64 cid = 1; int64 cid = 1;
}
message Heartbeat {
int64 timestamp = 1;
} }