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