Skip to content

Commit 8f810be

Browse files
committed
feat(proto): 为消息类添加Clear方法实现
为所有Proto消息类添加了Clear方法实现,用于重置消息字段为默认值 同时移除了部分文件的版权声明注释以简化代码
1 parent 5ddde11 commit 8f810be

File tree

9 files changed

+282
-173
lines changed

9 files changed

+282
-173
lines changed

GameFrameX.Proto/BuiltIn/ActorHeartBeat_-1.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public sealed class ReqActorHeartBeat : MessageObject, IRequestMessage, IHeartBe
4747
/// </summary>
4848
[ProtoMember(1)]
4949
public long Timestamp { get; set; }
50+
51+
public override void Clear()
52+
{
53+
Timestamp = default;
54+
}
5055
}
5156

5257
/// <summary>
@@ -61,4 +66,9 @@ public sealed class NotifyActorHeartBeat : MessageObject, INotifyMessage, IHeart
6166
/// </summary>
6267
[ProtoMember(1)]
6368
public long Timestamp { get; set; }
69+
70+
public override void Clear()
71+
{
72+
Timestamp = default;
73+
}
6474
}

GameFrameX.Proto/BuiltIn/ConnectService_-2.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public partial class ReqConnectServer : MessageObject, IRequestMessage
5252
/// </summary>
5353
[ProtoMember(2)]
5454
public long ServerId { get; set; }
55+
56+
public override void Clear()
57+
{
58+
ServerId = default;
59+
ServerType = default;
60+
}
5561
}
5662

5763
/// <summary>
@@ -103,4 +109,14 @@ public bool IsSuccess
103109
/// </summary>
104110
[ProtoMember(888)]
105111
public int ErrorCode { get; set; }
112+
113+
public override void Clear()
114+
{
115+
ServerId = default;
116+
ServerName = default;
117+
ServerType = default;
118+
TargetHost = default;
119+
TargetPort = default;
120+
ErrorCode = default;
121+
}
106122
}

GameFrameX.Proto/BuiltIn/Player_-10.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public partial class ReqPlayerRegister : MessageObject, IRequestMessage
5858
/// </summary>
5959
[ProtoMember(3)]
6060
public long ServerInstanceId { get; set; }
61+
62+
public override void Clear()
63+
{
64+
PlayerId = default;
65+
ServerId = default;
66+
ServerInstanceId = default;
67+
}
6168
}
6269

6370
/// <summary>
@@ -83,6 +90,13 @@ public partial class ReqPlayerUnRegister : MessageObject, IRequestMessage
8390
/// </summary>
8491
[ProtoMember(3)]
8592
public long ServerInstanceId { get; set; }
93+
94+
public override void Clear()
95+
{
96+
PlayerId = default;
97+
ServerId = default;
98+
ServerInstanceId = default;
99+
}
86100
}
87101

88102
/// <summary>
@@ -108,6 +122,13 @@ public partial class NotifyPlayerOnLine : MessageObject, IRequestMessage
108122
/// </summary>
109123
[ProtoMember(3)]
110124
public long ServerInstanceId { get; set; }
125+
126+
public override void Clear()
127+
{
128+
PlayerId = default;
129+
ServerId = default;
130+
ServerInstanceId = default;
131+
}
111132
}
112133

113134
/// <summary>
@@ -133,4 +154,11 @@ public partial class NotifyPlayerOffLine : MessageObject, IRequestMessage
133154
/// </summary>
134155
[ProtoMember(3)]
135156
public long ServerInstanceId { get; set; }
157+
158+
public override void Clear()
159+
{
160+
PlayerId = default;
161+
ServerId = default;
162+
ServerInstanceId = default;
163+
}
136164
}

GameFrameX.Proto/BuiltIn/Service_-3.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ public partial class ReqServiceRegister : MessageObject, IRequestMessage
8888
/// </summary>
8989
[ProtoMember(8)]
9090
public long ServerInstanceId { get; set; }
91+
92+
public override void Clear()
93+
{
94+
this.ServerType = default;
95+
this.ServerName = default;
96+
this.InnerHost = default;
97+
this.InnerPort = default;
98+
this.OuterHost = default;
99+
this.OuterPort = default;
100+
this.ServerId = default;
101+
this.ServerInstanceId = default;
102+
}
91103
}
92104

93105
/// <summary>
@@ -107,6 +119,12 @@ public partial class ReqServiceUnRegister : MessageObject, IRequestMessage
107119
/// </summary>
108120
[ProtoMember(8)]
109121
public long ServerInstanceId { get; set; }
122+
123+
public override void Clear()
124+
{
125+
this.ServerId = default;
126+
this.ServerInstanceId = default;
127+
}
110128
}
111129

112130
/// <summary>
@@ -138,6 +156,14 @@ public partial class NotifyServiceOnLine : MessageObject, IResponseMessage
138156
/// </summary>
139157
[ProtoMember(888)]
140158
public int ErrorCode { get; set; }
159+
160+
public override void Clear()
161+
{
162+
this.ServerType = default;
163+
this.ServerName = default;
164+
this.ServerId = default;
165+
this.ErrorCode = default;
166+
}
141167
}
142168

143169
/// <summary>
@@ -169,4 +195,12 @@ public partial class NotifyServiceOffLine : MessageObject, IResponseMessage
169195
/// </summary>
170196
[ProtoMember(888)]
171197
public int ErrorCode { get; set; }
198+
199+
public override void Clear()
200+
{
201+
this.ServerType = default;
202+
this.ServerName = default;
203+
this.ServerId = default;
204+
this.ErrorCode = default;
205+
}
172206
}

0 commit comments

Comments
 (0)