饭太稀
This commit is contained in:
41
Entity/AssemblyHelper.cs
Normal file
41
Entity/AssemblyHelper.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
public static class AssemblyHelper
|
||||
{
|
||||
private const string HotfixDll = "Hotfix";
|
||||
private static AssemblyLoadContext? _assemblyLoadContext = null;
|
||||
|
||||
public static System.Reflection.Assembly[] Assemblies
|
||||
{
|
||||
get
|
||||
{
|
||||
var assemblies = new System.Reflection.Assembly[2];
|
||||
assemblies[0] = LoadEntityAssembly();
|
||||
assemblies[1] = LoadHotfixAssembly();
|
||||
return assemblies;
|
||||
}
|
||||
}
|
||||
|
||||
private static System.Reflection.Assembly LoadEntityAssembly()
|
||||
{
|
||||
return typeof(AssemblyHelper).Assembly;
|
||||
}
|
||||
|
||||
private static System.Reflection.Assembly LoadHotfixAssembly()
|
||||
{
|
||||
if (_assemblyLoadContext != null)
|
||||
{
|
||||
_assemblyLoadContext.Unload();
|
||||
System.GC.Collect();
|
||||
}
|
||||
|
||||
_assemblyLoadContext = new AssemblyLoadContext(HotfixDll, true);
|
||||
var dllBytes = File.ReadAllBytes(Path.Combine(Environment.CurrentDirectory, $"{HotfixDll}.dll"));
|
||||
var pdbBytes = File.ReadAllBytes(Path.Combine(Environment.CurrentDirectory, $"{HotfixDll}.pdb"));
|
||||
return _assemblyLoadContext.LoadFromStream(new MemoryStream(dllBytes), new MemoryStream(pdbBytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Entity/Entity.csproj
Normal file
24
Entity/Entity.csproj
Normal file
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||
<LangVersion>default</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;FANTASY_NET</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE;FANTASY_NET</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Fantasy.Net\Fantasy.Net\Fantasy.Net.csproj" />
|
||||
<ProjectReference Include="..\..\..\Fantasy.Packages\Fantasy.ConfigTable\Net\Fantasy.ConfigTable.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
99
Entity/Generate/ConfigTable/Entity/UnitConfig.cs
Normal file
99
Entity/Generate/ConfigTable/Entity/UnitConfig.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class UnitConfigData : ASerialize, IConfigTable, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<UnitConfig> List { get; set; } = new List<UnitConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, UnitConfig> _configs = new ConcurrentDictionary<uint, UnitConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, UnitConfig> _configs = new Dictionary<uint, UnitConfig>();
|
||||
#endif
|
||||
private static UnitConfigData _instance = null;
|
||||
|
||||
public static UnitConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<UnitConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public UnitConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"UnitConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out UnitConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class UnitConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public string Name { get; set; } // 名称
|
||||
[ProtoMember(3)]
|
||||
public string Model { get; set; } // 数据库类型
|
||||
[ProtoMember(4)]
|
||||
public StringDictionaryConfig Dic { get; set; } // 字典类型
|
||||
}
|
||||
}
|
||||
10
Entity/Generate/ConfigTable/Partial/UnitConfigData.cs
Normal file
10
Entity/Generate/ConfigTable/Partial/UnitConfigData.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed partial class UnitConfigData
|
||||
{
|
||||
public override void EndInit()
|
||||
{
|
||||
Log.Debug("UnitConfigData EndInit");
|
||||
base.EndInit();
|
||||
}
|
||||
}
|
||||
27
Entity/Generate/CustomExport/SceneType.cs
Normal file
27
Entity/Generate/CustomExport/SceneType.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// 生成器自动生成,请不要手动编辑。
|
||||
public static class SceneType
|
||||
{
|
||||
public const int Authentication = 1;
|
||||
public const int Addressable = 2;
|
||||
public const int Gate = 3;
|
||||
public const int Map = 4;
|
||||
public const int CopyDispatcher = 5;
|
||||
public const int CopyManager = 6;
|
||||
public const int Copy = 7;
|
||||
public const int Chat = 8;
|
||||
|
||||
public static readonly Dictionary<string, int> SceneTypeDic = new Dictionary<string, int>()
|
||||
{
|
||||
{ "Authentication", 1 },
|
||||
{ "Addressable", 2 },
|
||||
{ "Gate", 3 },
|
||||
{ "Map", 4 },
|
||||
{ "CopyDispatcher", 5 },
|
||||
{ "CopyManager", 6 },
|
||||
{ "Copy", 7 },
|
||||
{ "Chat", 8 },
|
||||
};
|
||||
}
|
||||
}
|
||||
333
Entity/Generate/NetworkProtocol/InnerMessage.cs
Normal file
333
Entity/Generate/NetworkProtocol/InnerMessage.cs
Normal file
@@ -0,0 +1,333 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Fantasy;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
// ReSharper disable RedundantOverriddenMember
|
||||
// ReSharper disable PartialTypeWithSinglePart
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestMessage : AMessage, IRouteMessage, IProto
|
||||
{
|
||||
public static G2A_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2A_TestRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2A_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static G2A_TestResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2M_RequestAddressableId : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2M_RequestAddressableId Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2M_RequestAddressableId>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2M_RequestAddressableId>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public M2G_ResponseAddressableId ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2M_RequestAddressableId; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class M2G_ResponseAddressableId : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static M2G_ResponseAddressableId Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2G_ResponseAddressableId>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
AddressableId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2G_ResponseAddressableId>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.M2G_ResponseAddressableId; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 通知Chat服务器创建一个RouteId
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2Chat_CreateRouteRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2Chat_CreateRouteRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2Chat_CreateRouteRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
GateRouteId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2Chat_CreateRouteRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Chat2G_CreateRouteResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2Chat_CreateRouteRequest; }
|
||||
[ProtoMember(1)]
|
||||
public long GateRouteId { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Chat2G_CreateRouteResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static Chat2G_CreateRouteResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2G_CreateRouteResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
ChatRouteId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2G_CreateRouteResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.Chat2G_CreateRouteResponse; }
|
||||
[ProtoMember(1)]
|
||||
public long ChatRouteId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Map给另外一个Map发送Unit数据
|
||||
/// </summary>
|
||||
public partial class M2M_SendUnitRequest : AMessage, IRouteRequest
|
||||
{
|
||||
public static M2M_SendUnitRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2M_SendUnitRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Unit = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2M_SendUnitRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[BsonIgnore]
|
||||
public M2M_SendUnitResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.M2M_SendUnitRequest; }
|
||||
public Unit Unit { get; set; }
|
||||
}
|
||||
public partial class M2M_SendUnitResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public static M2M_SendUnitResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2M_SendUnitResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2M_SendUnitResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.M2M_SendUnitResponse; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gate发送Addressable消息给MAP
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2M_SendAddressableMessage : AMessage, IAddressableRouteMessage, IProto
|
||||
{
|
||||
public static G2M_SendAddressableMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2M_SendAddressableMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2M_SendAddressableMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2M_SendAddressableMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2M_CreateSubSceneRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2M_CreateSubSceneRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2M_CreateSubSceneRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2M_CreateSubSceneRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public M2G_CreateSubSceneResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2M_CreateSubSceneRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class M2G_CreateSubSceneResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static M2G_CreateSubSceneResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2G_CreateSubSceneResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
SubSceneRouteId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2G_CreateSubSceneResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.M2G_CreateSubSceneResponse; }
|
||||
[ProtoMember(1)]
|
||||
public long SubSceneRouteId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2SubScene_SentMessage : AMessage, IRouteMessage, IProto
|
||||
{
|
||||
public static G2SubScene_SentMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2SubScene_SentMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2SubScene_SentMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2SubScene_SentMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gate通知SubScene创建一个Addressable消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2SubScene_AddressableIdRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2SubScene_AddressableIdRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2SubScene_AddressableIdRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2SubScene_AddressableIdRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public SubScene2G_AddressableIdResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2SubScene_AddressableIdRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class SubScene2G_AddressableIdResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static SubScene2G_AddressableIdResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<SubScene2G_AddressableIdResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
AddressableId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<SubScene2G_AddressableIdResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.SubScene2G_AddressableIdResponse; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Chat发送一个漫游消息给Map
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Chat2M_TestMessage : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static Chat2M_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2M_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2M_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.Chat2M_TestMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.MapRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
}
|
||||
22
Entity/Generate/NetworkProtocol/InnerOpcode.cs
Normal file
22
Entity/Generate/NetworkProtocol/InnerOpcode.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
public static partial class InnerOpcode
|
||||
{
|
||||
public const uint G2A_TestMessage = 939534097;
|
||||
public const uint G2A_TestRequest = 1073751825;
|
||||
public const uint G2A_TestResponse = 1207969553;
|
||||
public const uint G2M_RequestAddressableId = 1073751826;
|
||||
public const uint M2G_ResponseAddressableId = 1207969554;
|
||||
public const uint G2Chat_CreateRouteRequest = 1073751827;
|
||||
public const uint Chat2G_CreateRouteResponse = 1207969555;
|
||||
public const uint M2M_SendUnitRequest = 1082140436;
|
||||
public const uint M2M_SendUnitResponse = 1216358164;
|
||||
public const uint G2M_SendAddressableMessage = 1744840465;
|
||||
public const uint G2M_CreateSubSceneRequest = 1073751829;
|
||||
public const uint M2G_CreateSubSceneResponse = 1207969557;
|
||||
public const uint G2SubScene_SentMessage = 939534098;
|
||||
public const uint G2SubScene_AddressableIdRequest = 1073751830;
|
||||
public const uint SubScene2G_AddressableIdResponse = 1207969558;
|
||||
public const uint Chat2M_TestMessage = 2952800017;
|
||||
}
|
||||
}
|
||||
787
Entity/Generate/NetworkProtocol/OuterMessage.cs
Normal file
787
Entity/Generate/NetworkProtocol/OuterMessage.cs
Normal file
@@ -0,0 +1,787 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Fantasy;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
// ReSharper disable RedundantOverriddenMember
|
||||
// ReSharper disable PartialTypeWithSinglePart
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
[ProtoContract]
|
||||
public partial class C2G_TestMessage : AMessage, IMessage, IProto
|
||||
{
|
||||
public static C2G_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2G_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2G_TestRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_TestRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_TestRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_TestRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_TestResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_TestResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_TestResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2G_TestRequestPushMessage : AMessage, IMessage, IProto
|
||||
{
|
||||
public static C2G_TestRequestPushMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_TestRequestPushMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_TestRequestPushMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2G_TestRequestPushMessage; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gate服务器推送一个消息给客户端
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2C_PushMessage : AMessage, IMessage, IProto
|
||||
{
|
||||
public static G2C_PushMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_PushMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_PushMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_PushMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2G_CreateAddressableRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_CreateAddressableRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateAddressableRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateAddressableRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateAddressableResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateAddressableRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateAddressableResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_CreateAddressableResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateAddressableResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateAddressableResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateAddressableResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2M_TestMessage : AMessage, IAddressableRouteMessage, IProto
|
||||
{
|
||||
public static C2M_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2M_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2M_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2M_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2M_TestRequest : AMessage, IAddressableRouteRequest, IProto
|
||||
{
|
||||
public static C2M_TestRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2M_TestRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2M_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public M2C_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2M_TestRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class M2C_TestResponse : AMessage, IAddressableRouteResponse, IProto
|
||||
{
|
||||
public static M2C_TestResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2C_TestResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2C_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.M2C_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 通知Gate服务器创建一个Chat的Route连接
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_CreateChatRouteRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_CreateChatRouteRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateChatRouteRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateChatRouteRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateChatRouteResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateChatRouteRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateChatRouteResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_CreateChatRouteResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateChatRouteResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateChatRouteResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateChatRouteResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个Route消息给Chat
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestMessage : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static C2Chat_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个RPCRoute消息给Chat
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestMessageRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
public static C2Chat_TestMessageRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestMessageRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestMessageRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Chat2C_TestMessageResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestMessageRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Chat2C_TestMessageResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
public static Chat2C_TestMessageResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2C_TestMessageResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2C_TestMessageResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Chat2C_TestMessageResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个RPC消息给Map,让Map里的Entity转移到另外一个Map上
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2M_MoveToMapRequest : AMessage, IAddressableRouteRequest, IProto
|
||||
{
|
||||
public static C2M_MoveToMapRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2M_MoveToMapRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2M_MoveToMapRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public M2C_MoveToMapResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2M_MoveToMapRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class M2C_MoveToMapResponse : AMessage, IAddressableRouteResponse, IProto
|
||||
{
|
||||
public static M2C_MoveToMapResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2C_MoveToMapResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2C_MoveToMapResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.M2C_MoveToMapResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个消息给Gate,让Gate发送一个Addressable消息给MAP
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_SendAddressableToMap : AMessage, IMessage, IProto
|
||||
{
|
||||
public static C2G_SendAddressableToMap Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_SendAddressableToMap>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_SendAddressableToMap>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2G_SendAddressableToMap; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个消息给Chat,让Chat服务器主动推送一个RouteMessage消息给客户端
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestRequestPushMessage : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static C2Chat_TestRequestPushMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestRequestPushMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestRequestPushMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestRequestPushMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
}
|
||||
/// <summary>
|
||||
/// Chat服务器主动推送一个消息给客户端
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Chat2C_PushMessage : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Chat2C_PushMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2C_PushMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2C_PushMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Chat2C_PushMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端发送给Gate服务器通知map服务器创建一个SubScene
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_CreateSubSceneRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_CreateSubSceneRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateSubSceneRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateSubSceneRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateSubSceneResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateSubSceneRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateSubSceneResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_CreateSubSceneResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateSubSceneResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateSubSceneResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateSubSceneResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端通知Gate服务器给SubScene发送一个消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_SendToSubSceneMessage : AMessage, IMessage, IProto
|
||||
{
|
||||
public static C2G_SendToSubSceneMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_SendToSubSceneMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_SendToSubSceneMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2G_SendToSubSceneMessage; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端通知Gate服务器创建一个SubScene的Address消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_CreateSubSceneAddressableRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_CreateSubSceneAddressableRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateSubSceneAddressableRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateSubSceneAddressableRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateSubSceneAddressableResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateSubSceneAddressableRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateSubSceneAddressableResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_CreateSubSceneAddressableResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateSubSceneAddressableResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateSubSceneAddressableResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateSubSceneAddressableResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端向SubScene发送一个测试消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2SubScene_TestMessage : AMessage, IAddressableRouteMessage, IProto
|
||||
{
|
||||
public static C2SubScene_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2SubScene_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2SubScene_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2SubScene_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端向SubScene发送一个销毁测试消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2SubScene_TestDisposeMessage : AMessage, IAddressableRouteMessage, IProto
|
||||
{
|
||||
public static C2SubScene_TestDisposeMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2SubScene_TestDisposeMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2SubScene_TestDisposeMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2SubScene_TestDisposeMessage; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端向服务器发送连接消息(Roaming)
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_ConnectRoamingRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_ConnectRoamingRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_ConnectRoamingRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_ConnectRoamingRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_ConnectRoamingResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_ConnectRoamingRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2C_ConnectRoamingResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_ConnectRoamingResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_ConnectRoamingResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_ConnectRoamingResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_ConnectRoamingResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 测试一个Chat漫游普通消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestRoamingMessage : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static C2Chat_TestRoamingMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestRoamingMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestRoamingMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestRoamingMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.ChatRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 测试一个Map漫游普通消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Map_TestRoamingMessage : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static C2Map_TestRoamingMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Map_TestRoamingMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Map_TestRoamingMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Map_TestRoamingMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.MapRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 测试一个Chat漫游RPC消息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestRPCRoamingRequest : AMessage, IRoamingRequest, IProto
|
||||
{
|
||||
public static C2Chat_TestRPCRoamingRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestRPCRoamingRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestRPCRoamingRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Chat2C_TestRPCRoamingResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestRPCRoamingRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.ChatRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Chat2C_TestRPCRoamingResponse : AMessage, IRoamingResponse, IProto
|
||||
{
|
||||
public static Chat2C_TestRPCRoamingResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2C_TestRPCRoamingResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Chat2C_TestRPCRoamingResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Chat2C_TestRPCRoamingResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 客户端发送一个漫游消息给Map通知Map主动推送一个消息给客户端
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Map_PushMessageToClient : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static C2Map_PushMessageToClient Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Map_PushMessageToClient>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Map_PushMessageToClient>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Map_PushMessageToClient; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.MapRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 漫游端发送一个消息给客户端
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Map2C_PushMessageToClient : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static Map2C_PushMessageToClient Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2C_PushMessageToClient>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2C_PushMessageToClient>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Map2C_PushMessageToClient; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.MapRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 测试传送漫游的触发协议
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Map_TestTransferRequest : AMessage, IRoamingRequest, IProto
|
||||
{
|
||||
public static C2Map_TestTransferRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Map_TestTransferRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Map_TestTransferRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Map2C_TestTransferResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Map_TestTransferRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.MapRoamingType;
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Map2C_TestTransferResponse : AMessage, IRoamingResponse, IProto
|
||||
{
|
||||
public static Map2C_TestTransferResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2C_TestTransferResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2C_TestTransferResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Map2C_TestTransferResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 测试一个Chat发送到Map之间漫游协议
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Chat_TestSendMapMessage : AMessage, IRoamingMessage, IProto
|
||||
{
|
||||
public static C2Chat_TestSendMapMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestSendMapMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestSendMapMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestSendMapMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RoamingType.ChatRoamingType;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
}
|
||||
44
Entity/Generate/NetworkProtocol/OuterOpcode.cs
Normal file
44
Entity/Generate/NetworkProtocol/OuterOpcode.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
public static partial class OuterOpcode
|
||||
{
|
||||
public const uint C2G_TestMessage = 134227729;
|
||||
public const uint C2G_TestRequest = 268445457;
|
||||
public const uint G2C_TestResponse = 402663185;
|
||||
public const uint C2G_TestRequestPushMessage = 134227730;
|
||||
public const uint G2C_PushMessage = 134227731;
|
||||
public const uint C2G_CreateAddressableRequest = 268445458;
|
||||
public const uint G2C_CreateAddressableResponse = 402663186;
|
||||
public const uint C2M_TestMessage = 1342187281;
|
||||
public const uint C2M_TestRequest = 1476405009;
|
||||
public const uint M2C_TestResponse = 1610622737;
|
||||
public const uint C2G_CreateChatRouteRequest = 268445459;
|
||||
public const uint G2C_CreateChatRouteResponse = 402663187;
|
||||
public const uint C2Chat_TestMessage = 2147493649;
|
||||
public const uint C2Chat_TestMessageRequest = 2281711377;
|
||||
public const uint Chat2C_TestMessageResponse = 2415929105;
|
||||
public const uint C2M_MoveToMapRequest = 1476405010;
|
||||
public const uint M2C_MoveToMapResponse = 1610622738;
|
||||
public const uint C2G_SendAddressableToMap = 134227732;
|
||||
public const uint C2Chat_TestRequestPushMessage = 2147493650;
|
||||
public const uint Chat2C_PushMessage = 2147493651;
|
||||
public const uint C2G_CreateSubSceneRequest = 268445460;
|
||||
public const uint G2C_CreateSubSceneResponse = 402663188;
|
||||
public const uint C2G_SendToSubSceneMessage = 134227733;
|
||||
public const uint C2G_CreateSubSceneAddressableRequest = 268445461;
|
||||
public const uint G2C_CreateSubSceneAddressableResponse = 402663189;
|
||||
public const uint C2SubScene_TestMessage = 1342187282;
|
||||
public const uint C2SubScene_TestDisposeMessage = 1342187283;
|
||||
public const uint C2G_ConnectRoamingRequest = 268445462;
|
||||
public const uint G2C_ConnectRoamingResponse = 402663190;
|
||||
public const uint C2Chat_TestRoamingMessage = 2550146833;
|
||||
public const uint C2Map_TestRoamingMessage = 2550146834;
|
||||
public const uint C2Chat_TestRPCRoamingRequest = 2684364561;
|
||||
public const uint Chat2C_TestRPCRoamingResponse = 2818582289;
|
||||
public const uint C2Map_PushMessageToClient = 2550146835;
|
||||
public const uint Map2C_PushMessageToClient = 2550146836;
|
||||
public const uint C2Map_TestTransferRequest = 2684364562;
|
||||
public const uint Map2C_TestTransferResponse = 2818582290;
|
||||
public const uint C2Chat_TestSendMapMessage = 2550146837;
|
||||
}
|
||||
}
|
||||
18
Entity/Generate/NetworkProtocol/RoamingType.cs
Normal file
18
Entity/Generate/NetworkProtocol/RoamingType.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
namespace Fantasy
|
||||
{
|
||||
// Roaming协议定义(需要定义10000以上、因为10000以内的框架预留)
|
||||
public static class RoamingType
|
||||
{
|
||||
public const int MapRoamingType = 10001;
|
||||
public const int ChatRoamingType = 10002;
|
||||
public static IEnumerable<int> RoamingTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return 10001;
|
||||
yield return 10002;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Entity/Generate/NetworkProtocol/RouteType.cs
Normal file
9
Entity/Generate/NetworkProtocol/RouteType.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
|
||||
public static class RouteType
|
||||
{
|
||||
public const int GateRoute = 1001; // Gate
|
||||
public const int ChatRoute = 1002; // Chat
|
||||
}
|
||||
}
|
||||
8
Entity/Model/Addressable/Unit.cs
Normal file
8
Entity/Model/Addressable/Unit.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class Unit : Entity
|
||||
{
|
||||
|
||||
}
|
||||
19
Entity/Model/RouteMessage/ChatUnit.cs
Normal file
19
Entity/Model/RouteMessage/ChatUnit.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class ChatUnit : Entity
|
||||
{
|
||||
public long GateRouteId;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GateRouteId = 0;
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
14
Entity/Model/SubScene/GateSubSceneFlagComponent.cs
Normal file
14
Entity/Model/SubScene/GateSubSceneFlagComponent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class GateSubSceneFlagComponent : Entity
|
||||
{
|
||||
public long SubSceneRouteId;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
SubSceneRouteId = 0;
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user