Skip to content

Commit dd6b136

Browse files
committed
C2M_Reload消息不需要发送一个AppType的数组了
1 parent 97dd115 commit dd6b136

8 files changed

Lines changed: 12 additions & 33 deletions

File tree

Server/Controller/Message/C2M_ReloadHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected override async void Run(Session session, C2M_Reload message, Action<M2
1616
NetInnerComponent netInnerComponent = Game.Scene.GetComponent<NetInnerComponent>();
1717
foreach (StartConfig startConfig in startConfigComponent.GetAll())
1818
{
19-
if (!message.AppType.Contains(startConfig.AppType))
19+
if (!message.AppType.Is(startConfig.AppType))
2020
{
2121
continue;
2222
}

Unity/Assets/Editor/ServerCommandLineEditor/Component.meta

Lines changed: 0 additions & 9 deletions
This file was deleted.

Unity/Assets/Editor/ServerManagerEditor/ServerManagerEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ private void OnGUI()
3434
return;
3535
}
3636

37-
38-
List<AppType> selected = new List<AppType>();
37+
38+
AppType reloadType = AppType.None;
3939
this.isAll = GUILayout.Toggle(this.isAll, "All");
4040
if (this.isAll)
4141
{
@@ -62,14 +62,14 @@ private void OnGUI()
6262
{
6363
if (this.isCheck[i])
6464
{
65-
selected.Add(this.serverTypes[i]);
65+
reloadType = reloadType | this.serverTypes[i];
6666
}
6767
}
6868
NetworkComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
6969
Session session = networkComponent.Get($"{this.managerAddress}");
7070
try
7171
{
72-
session.Call<C2M_Reload, M2C_Reload>(new C2M_Reload { AppType = selected });
72+
session.Call<C2M_Reload, M2C_Reload>(new C2M_Reload { AppType = reloadType });
7373
}
7474
catch (RpcException e)
7575
{

Unity/Assets/Scripts/Component/MessageDispatherComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class MessageDispatherComponent: Component
2828
{
2929
private AppType AppType;
3030
private Dictionary<ushort, List<IMHandler>> handlers;
31-
private Dictionary<Type, MessageAttribute> messageOpcode { get; set; } = new Dictionary<Type, MessageAttribute>();
31+
private Dictionary<Type, MessageAttribute> messageOpcode { get; set; }
3232

3333
public void Awake(AppType appType)
3434
{
@@ -71,7 +71,7 @@ public void Load()
7171
}
7272

7373
MessageHandlerAttribute messageHandlerAttribute = (MessageHandlerAttribute)attrs[0];
74-
if (!messageHandlerAttribute.Contains(this.AppType))
74+
if (!messageHandlerAttribute.Type.Is(this.AppType))
7575
{
7676
continue;
7777
}

Unity/Assets/Scripts/Message/AppType.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
namespace Model
55
{
6-
public class ServerType: Attribute
7-
{
8-
9-
}
10-
116
[Flags]
127
public enum AppType
138
{
9+
None = 0,
1410
Manager = 1,
1511
Realm = 2,
1612
Gate = 4,

Unity/Assets/Scripts/Message/Message.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class G2C_LoginGate : AResponse
9191
[BsonIgnoreExtraElements]
9292
public class C2M_Reload : ARequest
9393
{
94-
public List<AppType> AppType = new List<AppType>();
94+
public AppType AppType;
9595
}
9696

9797
[Message(11)]
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32

43
namespace Model
54
{
@@ -8,16 +7,11 @@ namespace Model
87
/// </summary>
98
public class MessageHandlerAttribute : Attribute
109
{
11-
private readonly AppType type;
10+
public AppType Type { get; }
1211

1312
public MessageHandlerAttribute(AppType appType)
1413
{
15-
this.type = appType;
16-
}
17-
18-
public bool Contains(AppType appType)
19-
{
20-
return this.type.Is(appType);
14+
this.Type = appType;
2115
}
2216
}
2317
}

Unity/Unity.sln

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
5-
MinimumVisualStudioVersion = 10.0.40219.1
3+
# Visual Studio 2015
64
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.CSharp.Plugins", "Unity.CSharp.Plugins.csproj", "{1AA60596-6964-87F6-2427-6CA85BBAF27D}"
75
EndProject
86
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.CSharp", "Unity.CSharp.csproj", "{4123F183-8F61-27AE-EA27-294DDE0CC7EB}"

0 commit comments

Comments
 (0)