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_LoginRequest : AMessage, IRequest, IProto { public static C2G_LoginRequest Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { UserName = default; PassWord = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoIgnore] public G2C_LoginResponse ResponseType { get; set; } public uint OpCode() { return OuterOpcode.C2G_LoginRequest; } [ProtoMember(1)] public string UserName { get; set; } [ProtoMember(2)] public string PassWord { get; set; } } /// /// 服务器返回登陆状态给客户端 /// [ProtoContract] public partial class G2C_LoginResponse : AMessage, IResponse, IProto { public static G2C_LoginResponse Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ErrorCode = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_LoginResponse; } [ProtoMember(1)] public uint ErrorCode { get; set; } } /// /// 客户端请求服务器使用物品 /// [ProtoContract] public partial class C2G_UseItemRequest : AMessage, IRequest, IProto { public static C2G_UseItemRequest Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ItemId = default; Count = default; ContainerType = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoIgnore] public G2C_UseItemResponse ResponseType { get; set; } public uint OpCode() { return OuterOpcode.C2G_UseItemRequest; } [ProtoMember(1)] public long ItemId { get; set; } [ProtoMember(2)] public int Count { get; set; } [ProtoMember(3)] public int ContainerType { get; set; } } [ProtoContract] public partial class G2C_UseItemResponse : AMessage, IResponse, IProto { public static G2C_UseItemResponse Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ErrorCode = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_UseItemResponse; } [ProtoMember(1)] public uint ErrorCode { get; set; } } /// /// 装备基础信息类 /// [ProtoContract] public partial class EquipInfo : AMessage, IProto { public static EquipInfo Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { Durable = default; DurableMax = default; MainKeys.Clear(); EquipAttrKeys.Clear(); EquipAttrValues.Clear(); EquipAttrSValues.Clear(); #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoMember(1)] public int Durable { get; set; } [ProtoMember(2)] public int DurableMax { get; set; } [ProtoMember(3)] public List MainKeys = new List(); [ProtoMember(4)] public List EquipAttrKeys = new List(); [ProtoMember(5)] public List EquipAttrValues = new List(); [ProtoMember(6)] public List EquipAttrSValues = new List(); /// /// 比如强化等级,副属性,词缀等。都可以在这里添加 /// } /// /// 物品基础信息类 /// [ProtoContract] public partial class ItemInfo : AMessage, IProto { public static ItemInfo Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ItemId = default; Container = default; ConfigId = default; CellId = default; Count = default; IsBind = default; EquipInfo = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoMember(1)] public long ItemId { get; set; } [ProtoMember(2)] public int Container { get; set; } [ProtoMember(3)] public int ConfigId { get; set; } [ProtoMember(4)] public long CellId { get; set; } [ProtoMember(5)] public int Count { get; set; } [ProtoMember(6)] public bool IsBind { get; set; } [ProtoMember(7)] public EquipInfo EquipInfo { get; set; } /// /// 后面可能会有装备词条 也会在这里定义的,现在没有所以就是先不管了 /// } /// /// 容器信息类 /// [ProtoContract] public partial class ContainerInfo : AMessage, IProto { public static ContainerInfo Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { CurrentCellCount = default; ConfigId = default; Items.Clear(); #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoMember(1)] public int CurrentCellCount { get; set; } [ProtoMember(2)] public int ConfigId { get; set; } [ProtoMember(3)] public List Items = new List(); } /// /// 物品变更协议(服务器推送给客户端) /// [ProtoContract] public partial class G2C_UpdateItems : AMessage, IMessage, IProto { public static G2C_UpdateItems Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ItemReason = default; Items.Clear(); #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_UpdateItems; } [ProtoMember(1)] public int ItemReason { get; set; } [ProtoMember(2)] public List Items = new List(); } /// /// 通知服务器客户端初始化完成 /// [ProtoContract] public partial class C2G_GameInitCompleteRequest : AMessage, IRequest, IProto { public static C2G_GameInitCompleteRequest Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { PushContainer = default; PushUnitInfo = default; Aoi = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } [ProtoIgnore] public G2C_GameInitCompleteResponse ResponseType { get; set; } public uint OpCode() { return OuterOpcode.C2G_GameInitCompleteRequest; } [ProtoMember(1)] public bool PushContainer { get; set; } [ProtoMember(2)] public bool PushUnitInfo { get; set; } [ProtoMember(3)] public bool Aoi { get; set; } } [ProtoContract] public partial class G2C_GameInitCompleteResponse : AMessage, IResponse, IProto { public static G2C_GameInitCompleteResponse Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ErrorCode = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_GameInitCompleteResponse; } [ProtoMember(1)] public uint ErrorCode { get; set; } } /// /// 推送所有容器数据给客户端 /// [ProtoContract] public partial class G2C_PushAllContainerInfo : AMessage, IMessage, IProto { public static G2C_PushAllContainerInfo Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { Containers.Clear(); #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_PushAllContainerInfo; } [ProtoMember(1)] public List Containers = new List(); } /// /// 推送单个的容器数据给客户端 /// [ProtoContract] public partial class G2C_PushContainerInfo : AMessage, IMessage, IProto { public static G2C_PushContainerInfo Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { Container = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.G2C_PushContainerInfo; } [ProtoMember(1)] public ContainerInfo Container { get; set; } } /// /// 通知服务器创建一个物品到背包容器中。 /// [ProtoContract] public partial class C2G_StartCreateItem : AMessage, IMessage, IProto { public static C2G_StartCreateItem Create(Scene scene) { return scene.MessagePoolComponent.Rent(); } public override void Dispose() { #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif } public uint OpCode() { return OuterOpcode.C2G_StartCreateItem; } } }