Skip to content

Commit 4ed67b3

Browse files
committed
fix
1 parent 8f9dc70 commit 4ed67b3

File tree

8 files changed

+39482
-10
lines changed

8 files changed

+39482
-10
lines changed

Assets/Game/HotFix/HotFix.dll.bytes

0 Bytes
Binary file not shown.

Assets/Game/HotFix/HotFix.pdb.bytes

2 KB
Binary file not shown.

HotFix/HotFix/Game/State/HotFixTestState.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ private async void NetworkMessageCallTest()
5151
S2C_TestInfo s2C_TestInfo = await HotFixMode.Network.Call<S2C_TestInfo>(
5252
new C2S_TestInfo() {Message = "HotFixTestState -- C2S" },
5353
new System.Net.IPEndPoint(System.Net.IPAddress.Parse("255.255.255.255"), 35120));
54+
55+
Debug.Log("Hotfix call:"+ s2C_TestInfo.Message);
5456
}
5557
}
5658
}

HotFix/HotFix/GameFramework/Network/NetworkManager.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public void SendMessage(object message, IPEndPoint endPoint)
4949
object[] attribute = message.GetType().GetCustomAttributes(typeof(MessageAttribute), false);
5050
if (attribute.Length <= 0)
5151
throw new GT.GamekException("class not found MessageAttribute");
52-
MessageAttribute mgAttribute = attribute[0] as MessageAttribute;
53-
if(mgAttribute!=null)
52+
if(attribute[0] is MessageAttribute mgAttribute)
5453
GT.GameMode.Network.SendMessage(mgAttribute.TypeCode, messageData, endPoint);
5554
}
5655

@@ -76,23 +75,24 @@ private void LoadMessageAttribute()
7675
object[] attribute = item.GetCustomAttributes(typeof(MessageHandlerAttribute), false);
7776
if (attribute.Length > 0 && !item.IsAbstract)
7877
{
79-
MessageHandlerAttribute msHanderAttibute = attribute[0] as MessageHandlerAttribute;
80-
if(msHanderAttibute!=null)
78+
if(attribute[0] is MessageHandlerAttribute msHanderAttibute)
8179
{
8280
Type handType = Type.GetType(msHanderAttibute.TypeMessage);
83-
if (!_messageHandler.ContainsKey(handType))
84-
_messageHandler[handType] = new List<MessageHandlerBase>();
85-
_messageHandler[handType]
86-
.Add((MessageHandlerBase) Activator.CreateInstance(item));
81+
if (handType != null)
82+
{
83+
if (!_messageHandler.ContainsKey(handType))
84+
_messageHandler[handType] = new List<MessageHandlerBase>();
85+
_messageHandler[handType]
86+
.Add((MessageHandlerBase) Activator.CreateInstance(item));
87+
}
8788
}
8889
}
8990

9091
//get message
9192
attribute = item.GetCustomAttributes(typeof(MessageAttribute), false);
9293
if (attribute.Length > 0 && !item.IsAbstract)
9394
{
94-
MessageAttribute msAttibute = attribute[0] as MessageAttribute;
95-
if(msAttibute!=null)
95+
if(attribute[0] is MessageAttribute msAttibute)
9696
_messageCodeType[msAttibute.TypeCode] = item;
9797
}
9898

HotFix/HotFix/bin/Debug/HotFix.dll

0 Bytes
Binary file not shown.

HotFix/HotFix/bin/Debug/HotFix.pdb

2 KB
Binary file not shown.

HotFix/HotFix/bin/Debug/UnityEngine.CoreModule.xml

Lines changed: 33325 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)