From ed303ffbe941a9b62f8f1324f92d42d5b797024f Mon Sep 17 00:00:00 2001 From: tanghai Date: Tue, 18 Jul 2023 18:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DStaticField=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E7=9E=AC=E9=97=B4=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=87=BASession.RpcId=E8=BF=99=E4=B8=AA=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E7=AB=9E=E4=BA=89=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Unity/Assets/Scripts/Core/World/Singleton.cs | 1 + Unity/Assets/Scripts/Core/World/World.cs | 1 + Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Unity/Assets/Scripts/Core/World/Singleton.cs b/Unity/Assets/Scripts/Core/World/Singleton.cs index 51aacbdb1d6..bfd400ac61f 100644 --- a/Unity/Assets/Scripts/Core/World/Singleton.cs +++ b/Unity/Assets/Scripts/Core/World/Singleton.cs @@ -17,6 +17,7 @@ public abstract class Singleton: ASingleton where T: Singleton [StaticField] private static T instance; + [StaticField] public static T Instance { get diff --git a/Unity/Assets/Scripts/Core/World/World.cs b/Unity/Assets/Scripts/Core/World/World.cs index 0eac1af6310..f7bd51d7fe0 100644 --- a/Unity/Assets/Scripts/Core/World/World.cs +++ b/Unity/Assets/Scripts/Core/World/World.cs @@ -8,6 +8,7 @@ public class World: IDisposable [StaticField] private static World instance; + [StaticField] public static World Instance { get diff --git a/Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs b/Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs index 829e68cddf3..aa5f59ff61e 100644 --- a/Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs +++ b/Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs @@ -66,7 +66,7 @@ public static void OnResponse(this Session self, IResponse response) public static async ETTask Call(this Session self, IRequest request, ETCancellationToken cancellationToken) { - int rpcId = ++Session.RpcId; + int rpcId = ++self.RpcId; RpcInfo rpcInfo = new RpcInfo(request); self.requestCallbacks[rpcId] = rpcInfo; request.RpcId = rpcId; @@ -102,7 +102,7 @@ void CancelAction() public static async ETTask Call(this Session self, IRequest request, int time = 0) { - int rpcId = ++Session.RpcId; + int rpcId = ++self.RpcId; RpcInfo rpcInfo = new(request); self.requestCallbacks[rpcId] = rpcInfo; request.RpcId = rpcId; @@ -150,7 +150,7 @@ public sealed class Session: Entity, IAwake, IDestroy { public AService AService { get; set; } - public static int RpcId + public int RpcId { get; set;