[+] 接入ET8服务端

[+] 接入ET8服务端
This commit is contained in:
ALEXTANG
2023-07-13 12:23:48 +08:00
parent e0be062006
commit 336d4b2eb9
1316 changed files with 130657 additions and 626 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dfd2cd1dd4c952e4981fd41b1c098de5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Options;
namespace ET
{
[Config]
public partial class AIConfigCategory : ConfigSingleton<AIConfigCategory>, IMerge
{
[BsonElement]
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
private Dictionary<int, AIConfig> dict = new Dictionary<int, AIConfig>();
public void Merge(object o)
{
AIConfigCategory s = o as AIConfigCategory;
foreach (var kv in s.dict)
{
this.dict.Add(kv.Key, kv.Value);
}
}
public AIConfig Get(int id)
{
this.dict.TryGetValue(id, out AIConfig item);
if (item == null)
{
throw new Exception($"配置找不到,配置表名: {nameof (AIConfig)}配置id: {id}");
}
return item;
}
public bool Contain(int id)
{
return this.dict.ContainsKey(id);
}
public Dictionary<int, AIConfig> GetAll()
{
return this.dict;
}
public AIConfig GetOne()
{
if (this.dict == null || this.dict.Count <= 0)
{
return null;
}
return this.dict.Values.GetEnumerator().Current;
}
}
public partial class AIConfig: ProtoObject, IConfig
{
/// <summary>Id</summary>
public int Id { get; set; }
/// <summary>所属ai</summary>
public int AIConfigId { get; set; }
/// <summary>此ai中的顺序</summary>
public int Order { get; set; }
/// <summary>节点名字</summary>
public string Name { get; set; }
/// <summary>节点参数</summary>
public int[] NodeParams { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 63eb883aff2778247b4f5781cc9a649f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Options;
namespace ET
{
[Config]
public partial class UnitConfigCategory : ConfigSingleton<UnitConfigCategory>, IMerge
{
[BsonElement]
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
private Dictionary<int, UnitConfig> dict = new Dictionary<int, UnitConfig>();
public void Merge(object o)
{
UnitConfigCategory s = o as UnitConfigCategory;
foreach (var kv in s.dict)
{
this.dict.Add(kv.Key, kv.Value);
}
}
public UnitConfig Get(int id)
{
this.dict.TryGetValue(id, out UnitConfig item);
if (item == null)
{
throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)}配置id: {id}");
}
return item;
}
public bool Contain(int id)
{
return this.dict.ContainsKey(id);
}
public Dictionary<int, UnitConfig> GetAll()
{
return this.dict;
}
public UnitConfig GetOne()
{
if (this.dict == null || this.dict.Count <= 0)
{
return null;
}
return this.dict.Values.GetEnumerator().Current;
}
}
public partial class UnitConfig: ProtoObject, IConfig
{
/// <summary>Id</summary>
public int Id { get; set; }
/// <summary>Type</summary>
public int Type { get; set; }
/// <summary>名字</summary>
public string Name { get; set; }
/// <summary>位置</summary>
public int Position { get; set; }
/// <summary>身高</summary>
public int Height { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cdf9536c3f3537648aa2f29d89f179eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 39784f35f926de34b866f949b0e4d8ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
using ET;
using MemoryPack;
using System.Collections.Generic;
namespace ET
{
// using
[ResponseType(nameof(NetClient2Main_Login))]
[Message(ClientMessage.Main2NetClient_Login)]
[MemoryPackable]
public partial class Main2NetClient_Login: MessageObject, IActorRequest
{
public static Main2NetClient_Login Create(bool isFromPool = true)
{
return !isFromPool? new Main2NetClient_Login() : ObjectPool.Instance.Fetch(typeof(Main2NetClient_Login)) as Main2NetClient_Login;
}
[MemoryPackOrder(0)]
public int RpcId { get; set; }
[MemoryPackOrder(1)]
public string Account { get; set; }
[MemoryPackOrder(2)]
public string Password { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.RpcId = default;
this.Account = default;
this.Password = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(ClientMessage.NetClient2Main_Login)]
[MemoryPackable]
public partial class NetClient2Main_Login: MessageObject, IActorResponse
{
public static NetClient2Main_Login Create(bool isFromPool = true)
{
return !isFromPool? new NetClient2Main_Login() : ObjectPool.Instance.Fetch(typeof(NetClient2Main_Login)) as NetClient2Main_Login;
}
[MemoryPackOrder(0)]
public int RpcId { get; set; }
[MemoryPackOrder(1)]
public int Error { get; set; }
[MemoryPackOrder(2)]
public string Message { get; set; }
[MemoryPackOrder(3)]
public long PlayerId { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.RpcId = default;
this.Error = default;
this.Message = default;
this.PlayerId = default;
ObjectPool.Instance.Recycle(this);
}
}
public static class ClientMessage
{
public const ushort Main2NetClient_Login = 1001;
public const ushort NetClient2Main_Login = 1002;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1147a7510cf76e6448f555a15d20757f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,342 @@
using ET;
using MemoryPack;
using System.Collections.Generic;
namespace ET
{
[ResponseType(nameof(G2C_Match))]
[Message(LockStepOuter.C2G_Match)]
[MemoryPackable]
public partial class C2G_Match: MessageObject, IRequest
{
public static C2G_Match Create(bool isFromPool = true)
{
return !isFromPool? new C2G_Match() : ObjectPool.Instance.Fetch(typeof(C2G_Match)) as C2G_Match;
}
[MemoryPackOrder(0)]
public int RpcId { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.RpcId = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.G2C_Match)]
[MemoryPackable]
public partial class G2C_Match: MessageObject, IResponse
{
public static G2C_Match Create(bool isFromPool = true)
{
return !isFromPool? new G2C_Match() : ObjectPool.Instance.Fetch(typeof(G2C_Match)) as G2C_Match;
}
[MemoryPackOrder(0)]
public int RpcId { get; set; }
[MemoryPackOrder(1)]
public int Error { get; set; }
[MemoryPackOrder(2)]
public string Message { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.RpcId = default;
this.Error = default;
this.Message = default;
ObjectPool.Instance.Recycle(this);
}
}
// 匹配成功,通知客户端切换场景
[Message(LockStepOuter.Match2G_NotifyMatchSuccess)]
[MemoryPackable]
public partial class Match2G_NotifyMatchSuccess: MessageObject, IActorMessage
{
public static Match2G_NotifyMatchSuccess Create(bool isFromPool = true)
{
return !isFromPool? new Match2G_NotifyMatchSuccess() : ObjectPool.Instance.Fetch(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess;
}
[MemoryPackOrder(0)]
public int RpcId { get; set; }
// 房间的ActorId
[MemoryPackOrder(1)]
public ActorId ActorId { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.RpcId = default;
this.ActorId = default;
ObjectPool.Instance.Recycle(this);
}
}
// 客户端通知房间切换场景完成
[Message(LockStepOuter.C2Room_ChangeSceneFinish)]
[MemoryPackable]
public partial class C2Room_ChangeSceneFinish: MessageObject, IActorRoom
{
public static C2Room_ChangeSceneFinish Create(bool isFromPool = true)
{
return !isFromPool? new C2Room_ChangeSceneFinish() : ObjectPool.Instance.Fetch(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish;
}
[MemoryPackOrder(0)]
public long PlayerId { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.PlayerId = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.LockStepUnitInfo)]
[MemoryPackable]
public partial class LockStepUnitInfo: MessageObject
{
public static LockStepUnitInfo Create(bool isFromPool = true)
{
return !isFromPool? new LockStepUnitInfo() : ObjectPool.Instance.Fetch(typeof(LockStepUnitInfo)) as LockStepUnitInfo;
}
[MemoryPackOrder(0)]
public long PlayerId { get; set; }
[MemoryPackOrder(1)]
public TrueSync.TSVector Position { get; set; }
[MemoryPackOrder(2)]
public TrueSync.TSQuaternion Rotation { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.PlayerId = default;
this.Position = default;
this.Rotation = default;
ObjectPool.Instance.Recycle(this);
}
}
// 房间通知客户端进入战斗
[Message(LockStepOuter.Room2C_Start)]
[MemoryPackable]
public partial class Room2C_Start: MessageObject, IActorMessage
{
public static Room2C_Start Create(bool isFromPool = true)
{
return !isFromPool? new Room2C_Start() : ObjectPool.Instance.Fetch(typeof(Room2C_Start)) as Room2C_Start;
}
[MemoryPackOrder(0)]
public long StartTime { get; set; }
[MemoryPackOrder(1)]
public List<LockStepUnitInfo> UnitInfo { get; set; } = new();
public override void Dispose()
{
if (!this.IsFromPool) return;
this.StartTime = default;
this.UnitInfo.Clear();
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.FrameMessage)]
[MemoryPackable]
public partial class FrameMessage: MessageObject, IActorMessage
{
public static FrameMessage Create(bool isFromPool = true)
{
return !isFromPool? new FrameMessage() : ObjectPool.Instance.Fetch(typeof(FrameMessage)) as FrameMessage;
}
[MemoryPackOrder(0)]
public int Frame { get; set; }
[MemoryPackOrder(1)]
public long PlayerId { get; set; }
[MemoryPackOrder(2)]
public LSInput Input { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.Frame = default;
this.PlayerId = default;
this.Input = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.OneFrameInputs)]
[MemoryPackable]
public partial class OneFrameInputs: MessageObject, IActorMessage
{
public static OneFrameInputs Create(bool isFromPool = true)
{
return !isFromPool? new OneFrameInputs() : ObjectPool.Instance.Fetch(typeof(OneFrameInputs)) as OneFrameInputs;
}
[MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)]
[MemoryPackOrder(1)]
public Dictionary<long, LSInput> Inputs { get; set; } = new();
public override void Dispose()
{
if (!this.IsFromPool) return;
this.Inputs.Clear();
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.Room2C_AdjustUpdateTime)]
[MemoryPackable]
public partial class Room2C_AdjustUpdateTime: MessageObject, IActorMessage
{
public static Room2C_AdjustUpdateTime Create(bool isFromPool = true)
{
return !isFromPool? new Room2C_AdjustUpdateTime() : ObjectPool.Instance.Fetch(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime;
}
[MemoryPackOrder(0)]
public int DiffTime { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.DiffTime = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.C2Room_CheckHash)]
[MemoryPackable]
public partial class C2Room_CheckHash: MessageObject, IActorRoom
{
public static C2Room_CheckHash Create(bool isFromPool = true)
{
return !isFromPool? new C2Room_CheckHash() : ObjectPool.Instance.Fetch(typeof(C2Room_CheckHash)) as C2Room_CheckHash;
}
[MemoryPackOrder(0)]
public long PlayerId { get; set; }
[MemoryPackOrder(1)]
public int Frame { get; set; }
[MemoryPackOrder(2)]
public long Hash { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.PlayerId = default;
this.Frame = default;
this.Hash = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.Room2C_CheckHashFail)]
[MemoryPackable]
public partial class Room2C_CheckHashFail: MessageObject, IActorMessage
{
public static Room2C_CheckHashFail Create(bool isFromPool = true)
{
return !isFromPool? new Room2C_CheckHashFail() : ObjectPool.Instance.Fetch(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail;
}
[MemoryPackOrder(0)]
public int Frame { get; set; }
[MemoryPackOrder(1)]
public byte[] LSWorldBytes { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.Frame = default;
this.LSWorldBytes = default;
ObjectPool.Instance.Recycle(this);
}
}
[Message(LockStepOuter.G2C_Reconnect)]
[MemoryPackable]
public partial class G2C_Reconnect: MessageObject, IActorMessage
{
public static G2C_Reconnect Create(bool isFromPool = true)
{
return !isFromPool? new G2C_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2C_Reconnect)) as G2C_Reconnect;
}
[MemoryPackOrder(0)]
public long StartTime { get; set; }
[MemoryPackOrder(1)]
public List<LockStepUnitInfo> UnitInfos { get; set; } = new();
[MemoryPackOrder(2)]
public int Frame { get; set; }
public override void Dispose()
{
if (!this.IsFromPool) return;
this.StartTime = default;
this.UnitInfos.Clear();
this.Frame = default;
ObjectPool.Instance.Recycle(this);
}
}
public static class LockStepOuter
{
public const ushort C2G_Match = 11002;
public const ushort G2C_Match = 11003;
public const ushort Match2G_NotifyMatchSuccess = 11004;
public const ushort C2Room_ChangeSceneFinish = 11005;
public const ushort LockStepUnitInfo = 11006;
public const ushort Room2C_Start = 11007;
public const ushort FrameMessage = 11008;
public const ushort OneFrameInputs = 11009;
public const ushort Room2C_AdjustUpdateTime = 11010;
public const ushort C2Room_CheckHash = 11011;
public const ushort Room2C_CheckHashFail = 11012;
public const ushort G2C_Reconnect = 11013;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f13c8ac43732d4554b0f3ecbf6fb71d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 64806f5ea712581408fecb08728105c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
{
"name": "Unity.GenerateClient",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"IGNORE"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ee89d158d8fb55845b395c884f8fed45
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: