提交 5811ca14 编写于 作者: T tanghai

网络调试通过,暂时外网内网全部使用TCP

上级 2a35bf6e
...@@ -4,6 +4,7 @@ package ET; ...@@ -4,6 +4,7 @@ package ET;
/// <summary> /// <summary>
/// 传送unit /// 传送unit
/// </summary> /// </summary>
//ResponseType M2M_TrasferUnitResponse
message M2M_TrasferUnitRequest // IActorRequest message M2M_TrasferUnitRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -20,6 +21,7 @@ message M2M_TrasferUnitResponse // IActorResponse ...@@ -20,6 +21,7 @@ message M2M_TrasferUnitResponse // IActorResponse
int64 InstanceId = 1; int64 InstanceId = 1;
} }
//ResponseType A2M_Reload
message M2A_Reload // IActorRequest message M2A_Reload // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -33,6 +35,7 @@ message A2M_Reload // IActorResponse ...@@ -33,6 +35,7 @@ message A2M_Reload // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType G2G_LockResponse
message G2G_LockRequest // IActorRequest message G2G_LockRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -48,6 +51,7 @@ message G2G_LockResponse // IActorResponse ...@@ -48,6 +51,7 @@ message G2G_LockResponse // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType G2G_LockReleaseResponse
message G2G_LockReleaseRequest // IActorRequest message G2G_LockReleaseRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -63,6 +67,7 @@ message G2G_LockReleaseResponse // IActorResponse ...@@ -63,6 +67,7 @@ message G2G_LockReleaseResponse // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType ObjectAddResponse
message ObjectAddRequest // IActorRequest message ObjectAddRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -77,6 +82,8 @@ message ObjectAddResponse // IActorResponse ...@@ -77,6 +82,8 @@ message ObjectAddResponse // IActorResponse
int32 Error = 91; int32 Error = 91;
string Message = 92; string Message = 92;
} }
//ResponseType ObjectLockResponse
message ObjectLockRequest // IActorRequest message ObjectLockRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -92,6 +99,7 @@ message ObjectLockResponse // IActorResponse ...@@ -92,6 +99,7 @@ message ObjectLockResponse // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType ObjectUnLockResponse
message ObjectUnLockRequest // IActorRequest message ObjectUnLockRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -107,6 +115,7 @@ message ObjectUnLockResponse // IActorResponse ...@@ -107,6 +115,7 @@ message ObjectUnLockResponse // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType ObjectRemoveResponse
message ObjectRemoveRequest // IActorRequest message ObjectRemoveRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -120,6 +129,7 @@ message ObjectRemoveResponse // IActorResponse ...@@ -120,6 +129,7 @@ message ObjectRemoveResponse // IActorResponse
string Message = 92; string Message = 92;
} }
//ResponseType ObjectGetResponse
message ObjectGetRequest // IActorRequest message ObjectGetRequest // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -135,6 +145,7 @@ message ObjectGetResponse // IActorResponse ...@@ -135,6 +145,7 @@ message ObjectGetResponse // IActorResponse
int64 InstanceId = 1; int64 InstanceId = 1;
} }
//ResponseType G2R_GetLoginKey
message R2G_GetLoginKey // IActorRequest message R2G_GetLoginKey // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -152,6 +163,7 @@ message G2R_GetLoginKey // IActorResponse ...@@ -152,6 +163,7 @@ message G2R_GetLoginKey // IActorResponse
int64 GateId = 2; int64 GateId = 2;
} }
//ResponseType M2G_CreateUnit
message G2M_CreateUnit // IActorRequest message G2M_CreateUnit // IActorRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
......
syntax = "proto3"; syntax = "proto3";
package ET; package ET;
//ResponseType M2C_TestResponse
message C2M_TestRequest // IActorLocationRequest message C2M_TestRequest // IActorLocationRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -16,6 +17,7 @@ message M2C_TestResponse // IActorLocationResponse ...@@ -16,6 +17,7 @@ message M2C_TestResponse // IActorLocationResponse
string response = 1; string response = 1;
} }
//ResponseType Actor_TransferResponse
message Actor_TransferRequest // IActorLocationRequest message Actor_TransferRequest // IActorLocationRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -30,6 +32,7 @@ message Actor_TransferResponse // IActorLocationResponse ...@@ -30,6 +32,7 @@ message Actor_TransferResponse // IActorLocationResponse
string Message = 92; string Message = 92;
} }
//ResponseType G2C_EnterMap
message C2G_EnterMap // IRequest message C2G_EnterMap // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -88,23 +91,27 @@ message M2C_PathfindingResult // IActorMessage ...@@ -88,23 +91,27 @@ message M2C_PathfindingResult // IActorMessage
repeated float Zs = 7; repeated float Zs = 7;
} }
//ResponseType G2C_Ping
message C2R_Ping // IRequest message C2G_Ping // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
} }
message R2C_Ping // IResponse message G2C_Ping // IResponse
{ {
int32 RpcId = 90; int32 RpcId = 90;
int32 Error = 91; int32 Error = 91;
string Message = 92; string Message = 92;
int64 Time = 1;
} }
message G2C_Test // IMessage message G2C_Test // IMessage
{ {
} }
//ResponseType M2C_Reload
message C2M_Reload // IRequest message C2M_Reload // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -119,6 +126,7 @@ message M2C_Reload // IResponse ...@@ -119,6 +126,7 @@ message M2C_Reload // IResponse
string Message = 92; string Message = 92;
} }
//ResponseType R2C_Login
message C2R_Login // IRequest message C2R_Login // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -136,6 +144,7 @@ message R2C_Login // IResponse ...@@ -136,6 +144,7 @@ message R2C_Login // IResponse
int64 GateId = 3; int64 GateId = 3;
} }
//ResponseType G2C_LoginGate
message C2G_LoginGate // IRequest message C2G_LoginGate // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -156,6 +165,7 @@ message G2C_TestHotfixMessage // IMessage ...@@ -156,6 +165,7 @@ message G2C_TestHotfixMessage // IMessage
string Info = 1; string Info = 1;
} }
//ResponseType M2C_TestActorResponse
message C2M_TestActorRequest // IActorLocationRequest message C2M_TestActorRequest // IActorLocationRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
...@@ -176,6 +186,7 @@ message PlayerInfo // IMessage ...@@ -176,6 +186,7 @@ message PlayerInfo // IMessage
int32 RpcId = 90; int32 RpcId = 90;
} }
//ResponseType G2C_PlayerInfo
message C2G_PlayerInfo // IRequest message C2G_PlayerInfo // IRequest
{ {
int32 RpcId = 90; int32 RpcId = 90;
......
...@@ -42,7 +42,9 @@ namespace ET ...@@ -42,7 +42,9 @@ namespace ET
{ {
Thread.Sleep(1); Thread.Sleep(1);
ThreadSynchronizationContext.Instance.Update(); ThreadSynchronizationContext.Instance.Update();
Game.EventSystem.Update(); Game.Update();
Game.LateUpdate();
Game.FrameFinish();
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
namespace ET namespace ET
{ {
[MessageHandler] [MessageHandler]
public class C2R_PingHandler : AMRpcHandler<C2R_Ping, R2C_Ping> public class C2G_PingHandler : AMRpcHandler<C2G_Ping, G2C_Ping>
{ {
protected override async ETTask Run(Session session, C2R_Ping request, R2C_Ping response, Action reply) protected override async ETTask Run(Session session, C2G_Ping request, G2C_Ping response, Action reply)
{ {
response.Time = TimeHelper.ServerNow();
reply(); reply();
await ETTask.CompletedTask; await ETTask.CompletedTask;
} }
......
namespace ET
{
public static partial class InnerOpcode
{
public const ushort M2M_TrasferUnitRequest = 10001;
public const ushort M2M_TrasferUnitResponse = 10002;
public const ushort M2A_Reload = 10003;
public const ushort A2M_Reload = 10004;
public const ushort G2G_LockRequest = 10005;
public const ushort G2G_LockResponse = 10006;
public const ushort G2G_LockReleaseRequest = 10007;
public const ushort G2G_LockReleaseResponse = 10008;
public const ushort ObjectAddRequest = 10009;
public const ushort ObjectAddResponse = 10010;
public const ushort ObjectLockRequest = 10011;
public const ushort ObjectLockResponse = 10012;
public const ushort ObjectUnLockRequest = 10013;
public const ushort ObjectUnLockResponse = 10014;
public const ushort ObjectRemoveRequest = 10015;
public const ushort ObjectRemoveResponse = 10016;
public const ushort ObjectGetRequest = 10017;
public const ushort ObjectGetResponse = 10018;
public const ushort R2G_GetLoginKey = 10019;
public const ushort G2R_GetLoginKey = 10020;
public const ushort G2M_CreateUnit = 10021;
public const ushort M2G_CreateUnit = 10022;
public const ushort G2M_SessionDisconnect = 10023;
}
}
\ No newline at end of file
...@@ -6,6 +6,7 @@ namespace ET ...@@ -6,6 +6,7 @@ namespace ET
/// <summary> /// <summary>
/// 传送unit /// 传送unit
/// </summary> /// </summary>
[ResponseType(typeof(M2M_TrasferUnitResponse))]
[Message(InnerOpcode.M2M_TrasferUnitRequest)] [Message(InnerOpcode.M2M_TrasferUnitRequest)]
[ProtoContract] [ProtoContract]
public partial class M2M_TrasferUnitRequest: IActorRequest public partial class M2M_TrasferUnitRequest: IActorRequest
...@@ -39,6 +40,7 @@ namespace ET ...@@ -39,6 +40,7 @@ namespace ET
} }
[ResponseType(typeof(A2M_Reload))]
[Message(InnerOpcode.M2A_Reload)] [Message(InnerOpcode.M2A_Reload)]
[ProtoContract] [ProtoContract]
public partial class M2A_Reload: IActorRequest public partial class M2A_Reload: IActorRequest
...@@ -66,6 +68,7 @@ namespace ET ...@@ -66,6 +68,7 @@ namespace ET
} }
[ResponseType(typeof(G2G_LockResponse))]
[Message(InnerOpcode.G2G_LockRequest)] [Message(InnerOpcode.G2G_LockRequest)]
[ProtoContract] [ProtoContract]
public partial class G2G_LockRequest: IActorRequest public partial class G2G_LockRequest: IActorRequest
...@@ -99,6 +102,7 @@ namespace ET ...@@ -99,6 +102,7 @@ namespace ET
} }
[ResponseType(typeof(G2G_LockReleaseResponse))]
[Message(InnerOpcode.G2G_LockReleaseRequest)] [Message(InnerOpcode.G2G_LockReleaseRequest)]
[ProtoContract] [ProtoContract]
public partial class G2G_LockReleaseRequest: IActorRequest public partial class G2G_LockReleaseRequest: IActorRequest
...@@ -132,6 +136,7 @@ namespace ET ...@@ -132,6 +136,7 @@ namespace ET
} }
[ResponseType(typeof(ObjectAddResponse))]
[Message(InnerOpcode.ObjectAddRequest)] [Message(InnerOpcode.ObjectAddRequest)]
[ProtoContract] [ProtoContract]
public partial class ObjectAddRequest: IActorRequest public partial class ObjectAddRequest: IActorRequest
...@@ -165,6 +170,7 @@ namespace ET ...@@ -165,6 +170,7 @@ namespace ET
} }
[ResponseType(typeof(ObjectLockResponse))]
[Message(InnerOpcode.ObjectLockRequest)] [Message(InnerOpcode.ObjectLockRequest)]
[ProtoContract] [ProtoContract]
public partial class ObjectLockRequest: IActorRequest public partial class ObjectLockRequest: IActorRequest
...@@ -201,6 +207,7 @@ namespace ET ...@@ -201,6 +207,7 @@ namespace ET
} }
[ResponseType(typeof(ObjectUnLockResponse))]
[Message(InnerOpcode.ObjectUnLockRequest)] [Message(InnerOpcode.ObjectUnLockRequest)]
[ProtoContract] [ProtoContract]
public partial class ObjectUnLockRequest: IActorRequest public partial class ObjectUnLockRequest: IActorRequest
...@@ -237,6 +244,7 @@ namespace ET ...@@ -237,6 +244,7 @@ namespace ET
} }
[ResponseType(typeof(ObjectRemoveResponse))]
[Message(InnerOpcode.ObjectRemoveRequest)] [Message(InnerOpcode.ObjectRemoveRequest)]
[ProtoContract] [ProtoContract]
public partial class ObjectRemoveRequest: IActorRequest public partial class ObjectRemoveRequest: IActorRequest
...@@ -267,6 +275,7 @@ namespace ET ...@@ -267,6 +275,7 @@ namespace ET
} }
[ResponseType(typeof(ObjectGetResponse))]
[Message(InnerOpcode.ObjectGetRequest)] [Message(InnerOpcode.ObjectGetRequest)]
[ProtoContract] [ProtoContract]
public partial class ObjectGetRequest: IActorRequest public partial class ObjectGetRequest: IActorRequest
...@@ -300,6 +309,7 @@ namespace ET ...@@ -300,6 +309,7 @@ namespace ET
} }
[ResponseType(typeof(G2R_GetLoginKey))]
[Message(InnerOpcode.R2G_GetLoginKey)] [Message(InnerOpcode.R2G_GetLoginKey)]
[ProtoContract] [ProtoContract]
public partial class R2G_GetLoginKey: IActorRequest public partial class R2G_GetLoginKey: IActorRequest
...@@ -336,6 +346,7 @@ namespace ET ...@@ -336,6 +346,7 @@ namespace ET
} }
[ResponseType(typeof(M2G_CreateUnit))]
[Message(InnerOpcode.G2M_CreateUnit)] [Message(InnerOpcode.G2M_CreateUnit)]
[ProtoContract] [ProtoContract]
public partial class G2M_CreateUnit: IActorRequest public partial class G2M_CreateUnit: IActorRequest
......
namespace ET
{
public static partial class InnerOpcode
{
public const ushort M2M_TrasferUnitRequest = 10001;
public const ushort M2M_TrasferUnitResponse = 10002;
public const ushort M2A_Reload = 10003;
public const ushort A2M_Reload = 10004;
public const ushort G2G_LockRequest = 10005;
public const ushort G2G_LockResponse = 10006;
public const ushort G2G_LockReleaseRequest = 10007;
public const ushort G2G_LockReleaseResponse = 10008;
public const ushort ObjectAddRequest = 10009;
public const ushort ObjectAddResponse = 10010;
public const ushort ObjectLockRequest = 10011;
public const ushort ObjectLockResponse = 10012;
public const ushort ObjectUnLockRequest = 10013;
public const ushort ObjectUnLockResponse = 10014;
public const ushort ObjectRemoveRequest = 10015;
public const ushort ObjectRemoveResponse = 10016;
public const ushort ObjectGetRequest = 10017;
public const ushort ObjectGetResponse = 10018;
public const ushort R2G_GetLoginKey = 10019;
public const ushort G2R_GetLoginKey = 10020;
public const ushort G2M_CreateUnit = 10021;
public const ushort M2G_CreateUnit = 10022;
public const ushort G2M_SessionDisconnect = 10023;
}
}
...@@ -3,6 +3,7 @@ using ProtoBuf; ...@@ -3,6 +3,7 @@ using ProtoBuf;
using System.Collections.Generic; using System.Collections.Generic;
namespace ET namespace ET
{ {
[ResponseType(typeof(M2C_TestResponse))]
[Message(OuterOpcode.C2M_TestRequest)] [Message(OuterOpcode.C2M_TestRequest)]
[ProtoContract] [ProtoContract]
public partial class C2M_TestRequest: IActorLocationRequest public partial class C2M_TestRequest: IActorLocationRequest
...@@ -36,6 +37,7 @@ namespace ET ...@@ -36,6 +37,7 @@ namespace ET
} }
[ResponseType(typeof(Actor_TransferResponse))]
[Message(OuterOpcode.Actor_TransferRequest)] [Message(OuterOpcode.Actor_TransferRequest)]
[ProtoContract] [ProtoContract]
public partial class Actor_TransferRequest: IActorLocationRequest public partial class Actor_TransferRequest: IActorLocationRequest
...@@ -66,6 +68,7 @@ namespace ET ...@@ -66,6 +68,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_EnterMap))]
[Message(OuterOpcode.C2G_EnterMap)] [Message(OuterOpcode.C2G_EnterMap)]
[ProtoContract] [ProtoContract]
public partial class C2G_EnterMap: IRequest public partial class C2G_EnterMap: IRequest
...@@ -187,18 +190,19 @@ namespace ET ...@@ -187,18 +190,19 @@ namespace ET
} }
[Message(OuterOpcode.C2R_Ping)] [ResponseType(typeof(G2C_Ping))]
[Message(OuterOpcode.C2G_Ping)]
[ProtoContract] [ProtoContract]
public partial class C2R_Ping: IRequest public partial class C2G_Ping: IRequest
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
} }
[Message(OuterOpcode.R2C_Ping)] [Message(OuterOpcode.G2C_Ping)]
[ProtoContract] [ProtoContract]
public partial class R2C_Ping: IResponse public partial class G2C_Ping: IResponse
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
...@@ -209,6 +213,9 @@ namespace ET ...@@ -209,6 +213,9 @@ namespace ET
[ProtoMember(92)] [ProtoMember(92)]
public string Message { get; set; } public string Message { get; set; }
[ProtoMember(1)]
public long Time { get; set; }
} }
[Message(OuterOpcode.G2C_Test)] [Message(OuterOpcode.G2C_Test)]
...@@ -217,6 +224,7 @@ namespace ET ...@@ -217,6 +224,7 @@ namespace ET
{ {
} }
[ResponseType(typeof(M2C_Reload))]
[Message(OuterOpcode.C2M_Reload)] [Message(OuterOpcode.C2M_Reload)]
[ProtoContract] [ProtoContract]
public partial class C2M_Reload: IRequest public partial class C2M_Reload: IRequest
...@@ -247,6 +255,7 @@ namespace ET ...@@ -247,6 +255,7 @@ namespace ET
} }
[ResponseType(typeof(R2C_Login))]
[Message(OuterOpcode.C2R_Login)] [Message(OuterOpcode.C2R_Login)]
[ProtoContract] [ProtoContract]
public partial class C2R_Login: IRequest public partial class C2R_Login: IRequest
...@@ -286,6 +295,7 @@ namespace ET ...@@ -286,6 +295,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_LoginGate))]
[Message(OuterOpcode.C2G_LoginGate)] [Message(OuterOpcode.C2G_LoginGate)]
[ProtoContract] [ProtoContract]
public partial class C2G_LoginGate: IRequest public partial class C2G_LoginGate: IRequest
...@@ -328,6 +338,7 @@ namespace ET ...@@ -328,6 +338,7 @@ namespace ET
} }
[ResponseType(typeof(M2C_TestActorResponse))]
[Message(OuterOpcode.C2M_TestActorRequest)] [Message(OuterOpcode.C2M_TestActorRequest)]
[ProtoContract] [ProtoContract]
public partial class C2M_TestActorRequest: IActorLocationRequest public partial class C2M_TestActorRequest: IActorLocationRequest
...@@ -370,6 +381,7 @@ namespace ET ...@@ -370,6 +381,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_PlayerInfo))]
[Message(OuterOpcode.C2G_PlayerInfo)] [Message(OuterOpcode.C2G_PlayerInfo)]
[ProtoContract] [ProtoContract]
public partial class C2G_PlayerInfo: IRequest public partial class C2G_PlayerInfo: IRequest
......
namespace ET
{
public static partial class OuterOpcode
{
public const ushort C2M_TestRequest = 20001;
public const ushort M2C_TestResponse = 20002;
public const ushort Actor_TransferRequest = 20003;
public const ushort Actor_TransferResponse = 20004;
public const ushort C2G_EnterMap = 20005;
public const ushort G2C_EnterMap = 20006;
public const ushort UnitInfo = 20007;
public const ushort M2C_CreateUnits = 20008;
public const ushort Frame_ClickMap = 20009;
public const ushort M2C_PathfindingResult = 20010;
public const ushort C2G_Ping = 20011;
public const ushort G2C_Ping = 20012;
public const ushort G2C_Test = 20013;
public const ushort C2M_Reload = 20014;
public const ushort M2C_Reload = 20015;
public const ushort C2R_Login = 20016;
public const ushort R2C_Login = 20017;
public const ushort C2G_LoginGate = 20018;
public const ushort G2C_LoginGate = 20019;
public const ushort G2C_TestHotfixMessage = 20020;
public const ushort C2M_TestActorRequest = 20021;
public const ushort M2C_TestActorResponse = 20022;
public const ushort PlayerInfo = 20023;
public const ushort C2G_PlayerInfo = 20024;
public const ushort G2C_PlayerInfo = 20025;
}
}
namespace ET
{
public static partial class OuterOpcode
{
public const ushort C2M_TestRequest = 20001;
public const ushort M2C_TestResponse = 20002;
public const ushort Actor_TransferRequest = 20003;
public const ushort Actor_TransferResponse = 20004;
public const ushort C2G_EnterMap = 20005;
public const ushort G2C_EnterMap = 20006;
public const ushort UnitInfo = 20007;
public const ushort M2C_CreateUnits = 20008;
public const ushort Frame_ClickMap = 20009;
public const ushort M2C_PathfindingResult = 20010;
public const ushort C2R_Ping = 20011;
public const ushort R2C_Ping = 20012;
public const ushort G2C_Test = 20013;
public const ushort C2M_Reload = 20014;
public const ushort M2C_Reload = 20015;
public const ushort C2R_Login = 20016;
public const ushort R2C_Login = 20017;
public const ushort C2G_LoginGate = 20018;
public const ushort G2C_LoginGate = 20019;
public const ushort G2C_TestHotfixMessage = 20020;
public const ushort C2M_TestActorRequest = 20021;
public const ushort M2C_TestActorResponse = 20022;
public const ushort PlayerInfo = 20023;
public const ushort C2G_PlayerInfo = 20024;
public const ushort G2C_PlayerInfo = 20025;
}
}
\ No newline at end of file
...@@ -25,23 +25,33 @@ namespace ET ...@@ -25,23 +25,33 @@ namespace ET
public static class InnerProto2CS public static class InnerProto2CS
{ {
private const string protoPath = "."; private const string protoPath = ".";
private const string clientMessagePath = "../../Unity/Assets/Model/Module/Message/"; private const string clientMessagePath = "../../../Unity/Assets/Model/Generate/Message/";
private const string serverMessagePath = "../../Server/Model/Module/Message/"; private const string serverMessagePath = "../../../Server/Model/Generate/Message/";
private static readonly char[] splitChars = { ' ', '\t' }; private static readonly char[] splitChars = { ' ', '\t' };
private static readonly List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>(); private static readonly List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>();
public static void Proto2CS() public static void Proto2CS()
{ {
msgOpcode.Clear(); msgOpcode.Clear();
Proto2CS("ET", "InnerMessage.proto", serverMessagePath, "InnerOpcode", 10000); Proto2CS("ET", "../../../Proto/InnerMessage.proto", serverMessagePath, "InnerOpcode", 10000);
GenerateOpcode("ET", "InnerOpcode", serverMessagePath); GenerateOpcode("ET", "InnerOpcode", serverMessagePath);
Proto2CS("ET", "OuterMessage.proto", clientMessagePath, "OuterOpcode", 20000); Proto2CS("ET", "../../../Proto/OuterMessage.proto", serverMessagePath, "OuterOpcode", 20000);
GenerateOpcode("ET", "OuterOpcode", serverMessagePath);
Proto2CS("ET", "../../../Proto/OuterMessage.proto", clientMessagePath, "OuterOpcode", 20000);
GenerateOpcode("ET", "OuterOpcode", clientMessagePath); GenerateOpcode("ET", "OuterOpcode", clientMessagePath);
} }
public static void Proto2CS(string ns, string protoName, string outputPath, string opcodeClassName, int startOpcode) public static void Proto2CS(string ns, string protoName, string outputPath, string opcodeClassName, int startOpcode)
{ {
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
msgOpcode.Clear(); msgOpcode.Clear();
string proto = Path.Combine(protoPath, protoName); string proto = Path.Combine(protoPath, protoName);
string csPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(proto) + ".cs"); string csPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(proto) + ".cs");
...@@ -65,6 +75,13 @@ namespace ET ...@@ -65,6 +75,13 @@ namespace ET
{ {
continue; continue;
} }
if (newline.StartsWith("//ResponseType"))
{
string responseType = line.Split(" ")[1];
sb.AppendLine($"\t[ResponseType(typeof({responseType}))]");
continue;
}
if (newline.StartsWith("//")) if (newline.StartsWith("//"))
{ {
...@@ -140,12 +157,17 @@ namespace ET ...@@ -140,12 +157,17 @@ namespace ET
} }
sb.Append("}\n"); sb.Append("}\n");
using FileStream txt = new FileStream(csPath, FileMode.Create, FileAccess.ReadWrite);
File.WriteAllText(csPath, sb.ToString()); using StreamWriter sw = new StreamWriter(txt);
sw.Write(sb.ToString());
} }
private static void GenerateOpcode(string ns, string outputFileName, string outputPath) private static void GenerateOpcode(string ns, string outputFileName, string outputPath)
{ {
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine($"namespace {ns}"); sb.AppendLine($"namespace {ns}");
sb.AppendLine("{"); sb.AppendLine("{");
...@@ -160,7 +182,10 @@ namespace ET ...@@ -160,7 +182,10 @@ namespace ET
sb.AppendLine("}"); sb.AppendLine("}");
string csPath = Path.Combine(outputPath, outputFileName + ".cs"); string csPath = Path.Combine(outputPath, outputFileName + ".cs");
File.WriteAllText(csPath, sb.ToString());
using FileStream txt = new FileStream(csPath, FileMode.Create);
using StreamWriter sw = new StreamWriter(txt);
sw.Write(sb.ToString());
} }
private static void Repeated(StringBuilder sb, string ns, string newline) private static void Repeated(StringBuilder sb, string ns, string newline)
......
...@@ -103,7 +103,7 @@ namespace ET ...@@ -103,7 +103,7 @@ namespace ET
Session session = EntityFactory.CreateWithParentAndId<Session, AService>(self, channelId, self.Service); Session session = EntityFactory.CreateWithParentAndId<Session, AService>(self, channelId, self.Service);
session.RemoteAddress = realIPEndPoint; session.RemoteAddress = realIPEndPoint;
session.AddComponent<SessionIdleCheckerComponent, int>(NetThreadComponent.checkInteral); session.AddComponent<SessionIdleCheckerComponent, int>(NetThreadComponent.checkInteral);
self.Service.GetOrCreate(session.Id, realIPEndPoint); self.Service.GetOrCreate(session.Id, realIPEndPoint);
return session; return session;
......
...@@ -18,6 +18,7 @@ namespace ET ...@@ -18,6 +18,7 @@ namespace ET
// 创建一个gate Session,并且保存到SessionComponent中 // 创建一个gate Session,并且保存到SessionComponent中
Session gateSession = zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(r2CLogin.Address)); Session gateSession = zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(r2CLogin.Address));
gateSession.AddComponent<PingComponent>();
zoneScene.AddComponent<SessionComponent>().Session = gateSession; zoneScene.AddComponent<SessionComponent>().Session = gateSession;
G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call( G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(
......
...@@ -28,7 +28,7 @@ namespace ET ...@@ -28,7 +28,7 @@ namespace ET
public long FrameTime; public long FrameTime;
public TimeInfo() private TimeInfo()
{ {
this.FrameTime = this.ClientNow(); this.FrameTime = this.ClientNow();
} }
...@@ -49,7 +49,7 @@ namespace ET ...@@ -49,7 +49,7 @@ namespace ET
// 线程安全 // 线程安全
public long ClientNow() public long ClientNow()
{ {
return DateTime.Now.Ticks - this.dt1970.Ticks; return (DateTime.Now.Ticks - this.dt1970.Ticks) / 10000;
} }
public long ServerNow() public long ServerNow()
......
fileFormatVersion: 2
guid: b78b87e70906a438ba5b820ca91d645f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -3,17 +3,25 @@ using ProtoBuf; ...@@ -3,17 +3,25 @@ using ProtoBuf;
using System.Collections.Generic; using System.Collections.Generic;
namespace ET namespace ET
{ {
[Message(OuterOpcode.C2G_Ping)] [ResponseType(typeof(M2C_TestResponse))]
[Message(OuterOpcode.C2M_TestRequest)]
[ProtoContract] [ProtoContract]
public partial class C2G_Ping: IRequest public partial class C2M_TestRequest: IActorLocationRequest
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
[ProtoMember(93)]
public long ActorId { get; set; }
[ProtoMember(1)]
public string request { get; set; }
} }
[Message(OuterOpcode.G2C_Ping)] [Message(OuterOpcode.M2C_TestResponse)]
[ProtoContract] [ProtoContract]
public partial class G2C_Ping: IActorLocationResponse public partial class M2C_TestResponse: IActorLocationResponse
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
...@@ -25,10 +33,11 @@ namespace ET ...@@ -25,10 +33,11 @@ namespace ET
public string Message { get; set; } public string Message { get; set; }
[ProtoMember(1)] [ProtoMember(1)]
public long Time { get; set; } public string response { get; set; }
} }
[ResponseType(typeof(Actor_TransferResponse))]
[Message(OuterOpcode.Actor_TransferRequest)] [Message(OuterOpcode.Actor_TransferRequest)]
[ProtoContract] [ProtoContract]
public partial class Actor_TransferRequest: IActorLocationRequest public partial class Actor_TransferRequest: IActorLocationRequest
...@@ -59,6 +68,7 @@ namespace ET ...@@ -59,6 +68,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_EnterMap))]
[Message(OuterOpcode.C2G_EnterMap)] [Message(OuterOpcode.C2G_EnterMap)]
[ProtoContract] [ProtoContract]
public partial class C2G_EnterMap: IRequest public partial class C2G_EnterMap: IRequest
...@@ -180,18 +190,19 @@ namespace ET ...@@ -180,18 +190,19 @@ namespace ET
} }
[Message(OuterOpcode.C2R_Ping)] [ResponseType(typeof(G2C_Ping))]
[Message(OuterOpcode.C2G_Ping)]
[ProtoContract] [ProtoContract]
public partial class C2R_Ping: IRequest public partial class C2G_Ping: IRequest
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
} }
[Message(OuterOpcode.R2C_Ping)] [Message(OuterOpcode.G2C_Ping)]
[ProtoContract] [ProtoContract]
public partial class R2C_Ping: IResponse public partial class G2C_Ping: IResponse
{ {
[ProtoMember(90)] [ProtoMember(90)]
public int RpcId { get; set; } public int RpcId { get; set; }
...@@ -202,6 +213,9 @@ namespace ET ...@@ -202,6 +213,9 @@ namespace ET
[ProtoMember(92)] [ProtoMember(92)]
public string Message { get; set; } public string Message { get; set; }
[ProtoMember(1)]
public long Time { get; set; }
} }
[Message(OuterOpcode.G2C_Test)] [Message(OuterOpcode.G2C_Test)]
...@@ -210,6 +224,7 @@ namespace ET ...@@ -210,6 +224,7 @@ namespace ET
{ {
} }
[ResponseType(typeof(M2C_Reload))]
[Message(OuterOpcode.C2M_Reload)] [Message(OuterOpcode.C2M_Reload)]
[ProtoContract] [ProtoContract]
public partial class C2M_Reload: IRequest public partial class C2M_Reload: IRequest
...@@ -240,6 +255,7 @@ namespace ET ...@@ -240,6 +255,7 @@ namespace ET
} }
[ResponseType(typeof(R2C_Login))]
[Message(OuterOpcode.C2R_Login)] [Message(OuterOpcode.C2R_Login)]
[ProtoContract] [ProtoContract]
public partial class C2R_Login: IRequest public partial class C2R_Login: IRequest
...@@ -279,6 +295,7 @@ namespace ET ...@@ -279,6 +295,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_LoginGate))]
[Message(OuterOpcode.C2G_LoginGate)] [Message(OuterOpcode.C2G_LoginGate)]
[ProtoContract] [ProtoContract]
public partial class C2G_LoginGate: IRequest public partial class C2G_LoginGate: IRequest
...@@ -321,6 +338,7 @@ namespace ET ...@@ -321,6 +338,7 @@ namespace ET
} }
[ResponseType(typeof(M2C_TestActorResponse))]
[Message(OuterOpcode.C2M_TestActorRequest)] [Message(OuterOpcode.C2M_TestActorRequest)]
[ProtoContract] [ProtoContract]
public partial class C2M_TestActorRequest: IActorLocationRequest public partial class C2M_TestActorRequest: IActorLocationRequest
...@@ -363,6 +381,7 @@ namespace ET ...@@ -363,6 +381,7 @@ namespace ET
} }
[ResponseType(typeof(G2C_PlayerInfo))]
[Message(OuterOpcode.C2G_PlayerInfo)] [Message(OuterOpcode.C2G_PlayerInfo)]
[ProtoContract] [ProtoContract]
public partial class C2G_PlayerInfo: IRequest public partial class C2G_PlayerInfo: IRequest
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: b150ee0832ac9442ab93655b90a82caf guid: 044fa867eb79745f4b119b77e4db9c41
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
......
namespace ET
{
public static partial class OuterOpcode
{
public const ushort C2M_TestRequest = 20001;
public const ushort M2C_TestResponse = 20002;
public const ushort Actor_TransferRequest = 20003;
public const ushort Actor_TransferResponse = 20004;
public const ushort C2G_EnterMap = 20005;
public const ushort G2C_EnterMap = 20006;
public const ushort UnitInfo = 20007;
public const ushort M2C_CreateUnits = 20008;
public const ushort Frame_ClickMap = 20009;
public const ushort M2C_PathfindingResult = 20010;
public const ushort C2G_Ping = 20011;
public const ushort G2C_Ping = 20012;
public const ushort G2C_Test = 20013;
public const ushort C2M_Reload = 20014;
public const ushort M2C_Reload = 20015;
public const ushort C2R_Login = 20016;
public const ushort R2C_Login = 20017;
public const ushort C2G_LoginGate = 20018;
public const ushort G2C_LoginGate = 20019;
public const ushort G2C_TestHotfixMessage = 20020;
public const ushort C2M_TestActorRequest = 20021;
public const ushort M2C_TestActorResponse = 20022;
public const ushort PlayerInfo = 20023;
public const ushort C2G_PlayerInfo = 20024;
public const ushort G2C_PlayerInfo = 20025;
}
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: c44825a92c0e84e4087e616edbdd0ac6 guid: 731471567040e43da827c2acfd5c2f7b
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
......
namespace ET
{
public static partial class OuterOpcode
{
public const ushort C2G_Ping = 20001;
public const ushort G2C_Ping = 20002;
public const ushort Actor_TransferRequest = 20003;
public const ushort Actor_TransferResponse = 20004;
public const ushort C2G_EnterMap = 20005;
public const ushort G2C_EnterMap = 20006;
public const ushort UnitInfo = 20007;
public const ushort M2C_CreateUnits = 20008;
public const ushort Frame_ClickMap = 20009;
public const ushort M2C_PathfindingResult = 20010;
public const ushort C2R_Ping = 20011;
public const ushort R2C_Ping = 20012;
public const ushort G2C_Test = 20013;
public const ushort C2M_Reload = 20014;
public const ushort M2C_Reload = 20015;
public const ushort C2R_Login = 20016;
public const ushort R2C_Login = 20017;
public const ushort C2G_LoginGate = 20018;
public const ushort G2C_LoginGate = 20019;
public const ushort G2C_TestHotfixMessage = 20020;
public const ushort C2M_TestActorRequest = 20021;
public const ushort M2C_TestActorResponse = 20022;
public const ushort PlayerInfo = 20023;
public const ushort C2G_PlayerInfo = 20024;
public const ushort G2C_PlayerInfo = 20025;
}
}
\ No newline at end of file
...@@ -63,7 +63,6 @@ namespace ET ...@@ -63,7 +63,6 @@ namespace ET
this.outrActorMessage.Add(messageAttribute.Opcode); this.outrActorMessage.Add(messageAttribute.Opcode);
} }
/*
// 检查request response // 检查request response
if (typeof (IRequest).IsAssignableFrom(type)) if (typeof (IRequest).IsAssignableFrom(type))
{ {
...@@ -83,7 +82,6 @@ namespace ET ...@@ -83,7 +82,6 @@ namespace ET
ResponseTypeAttribute responseTypeAttribute = attrs[0] as ResponseTypeAttribute; ResponseTypeAttribute responseTypeAttribute = attrs[0] as ResponseTypeAttribute;
this.requestResponse.Add(type, responseTypeAttribute.Type); this.requestResponse.Add(type, responseTypeAttribute.Type);
} }
*/
} }
} }
...@@ -106,7 +104,7 @@ namespace ET ...@@ -106,7 +104,7 @@ namespace ET
{ {
if (!this.requestResponse.TryGetValue(request, out Type response)) if (!this.requestResponse.TryGetValue(request, out Type response))
{ {
throw new Exception($"not found response type, request type: {request.GetType()}"); throw new Exception($"not found response type, request type: {request.GetType().Name}");
} }
return response; return response;
} }
......
...@@ -392,7 +392,7 @@ namespace ET ...@@ -392,7 +392,7 @@ namespace ET
private void OnError(int error) private void OnError(int error)
{ {
Log.Debug($"TChannel error: {error} {this.RemoteAddress}"); Log.Error($"TChannel error: {error} {this.RemoteAddress}");
long channelId = this.Id; long channelId = this.Id;
......
...@@ -489,7 +489,7 @@ namespace ET ...@@ -489,7 +489,7 @@ namespace ET
if (isScene) if (isScene)
{ {
p = Path.Combine(Application.dataPath, "../../AssetBundles/Windows_Scene/", assetBundleName); p = Path.Combine(Application.dataPath, "../SceneBundle/", assetBundleName);
if (File.Exists(p)) // 如果场景有预先打包 if (File.Exists(p)) // 如果场景有预先打包
{ {
using (AssetsBundleLoaderAsync assetsBundleLoaderAsync = EntityFactory.CreateWithParent<AssetsBundleLoaderAsync>(this)) using (AssetsBundleLoaderAsync assetsBundleLoaderAsync = EntityFactory.CreateWithParent<AssetsBundleLoaderAsync>(this))
......
...@@ -101,7 +101,6 @@ ...@@ -101,7 +101,6 @@
<Compile Include="Assets\Model\Core\Event\IEvent.cs" /> <Compile Include="Assets\Model\Core\Event\IEvent.cs" />
<Compile Include="Assets\Model\Module\Message\SessionCallbackComponent.cs" /> <Compile Include="Assets\Model\Module\Message\SessionCallbackComponent.cs" />
<Compile Include="Assets\Model\Module\Network\Circularbuffer.cs" /> <Compile Include="Assets\Model\Module\Network\Circularbuffer.cs" />
<Compile Include="Assets\Model\Generate\OuterProtoMessage.cs" />
<Compile Include="Assets\Model\Module\ActorLocation\IActorLocationMessage.cs" /> <Compile Include="Assets\Model\Module\ActorLocation\IActorLocationMessage.cs" />
<Compile Include="Assets\Model\Core\Async\AsyncMethodBuilderAttribute.cs" /> <Compile Include="Assets\Model\Core\Async\AsyncMethodBuilderAttribute.cs" />
<Compile Include="Assets\Model\Core\MultiDictionary.cs" /> <Compile Include="Assets\Model\Core\MultiDictionary.cs" />
...@@ -173,7 +172,6 @@ ...@@ -173,7 +172,6 @@
<Compile Include="Assets\Model\Module\CoroutineLock\CoroutineLock.cs" /> <Compile Include="Assets\Model\Module\CoroutineLock\CoroutineLock.cs" />
<Compile Include="Assets\Model\Module\Message\ErrorCode.cs" /> <Compile Include="Assets\Model\Module\Message\ErrorCode.cs" />
<Compile Include="Assets\Model\Module\NetworkTCP\PacketParser.cs" /> <Compile Include="Assets\Model\Module\NetworkTCP\PacketParser.cs" />
<Compile Include="Assets\Model\Generate\OuterProtoOpcode.cs" />
<Compile Include="Assets\Model\Core\Object\ProtoObject.cs" /> <Compile Include="Assets\Model\Core\Object\ProtoObject.cs" />
<Compile Include="Assets\Model\Module\Message\ProtobufHelper.cs" /> <Compile Include="Assets\Model\Module\Message\ProtobufHelper.cs" />
<Compile Include="Assets\Model\Generate\Config\StartSceneConfig.cs" /> <Compile Include="Assets\Model\Generate\Config\StartSceneConfig.cs" />
...@@ -199,6 +197,8 @@ ...@@ -199,6 +197,8 @@
<Compile Include="Assets\Model\Core\Async\ETTaskHelper.cs" /> <Compile Include="Assets\Model\Core\Async\ETTaskHelper.cs" />
<Compile Include="Assets\Model\Module\NetworkTCP\TChannel.cs" /> <Compile Include="Assets\Model\Module\NetworkTCP\TChannel.cs" />
<Compile Include="Assets\Model\Module\Network\AChannel.cs" /> <Compile Include="Assets\Model\Module\Network\AChannel.cs" />
<Compile Include="Assets\Model\Generate\Message\OuterOpcode.cs" />
<Compile Include="Assets\Model\Generate\Message\OuterMessage.cs" />
<None Include="Assets\Model\Unity.Model.asmdef" /> <None Include="Assets\Model\Unity.Model.asmdef" />
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath> <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册