新增逻辑

This commit is contained in:
2025-12-15 12:30:45 +08:00
parent a4c2bb021b
commit 240bee00c3
56 changed files with 649 additions and 526 deletions

View File

@@ -18,4 +18,8 @@
<ProjectReference Include="..\ThirdParty\ThirdParty.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Game\Map\" />
</ItemGroup>
</Project>

View File

@@ -65,13 +65,13 @@
networkProtocol=""
outerPort="0" innerPort="11051" />
<scene id="1007"
processConfigId="1"
worldConfigId="1"
sceneRuntimeMode="MultiThread"
sceneTypeString="Map"
networkProtocol=""
outerPort="0" innerPort="11061" />
<!-- <scene id="1007" -->
<!-- processConfigId="1" -->
<!-- worldConfigId="1" -->
<!-- sceneRuntimeMode="MultiThread" -->
<!-- sceneTypeString="Map" -->
<!-- networkProtocol="" -->
<!-- outerPort="0" innerPort="11061" /> -->
</scenes>
</server>
</fantasy>

View File

@@ -8,7 +8,15 @@ public enum ItemBasicType
None,
Currency = 1,
Item = 2,
Fish = 3,
Rod = 3,
Reel =4,
Bobber = 5,
Line = 6,
Bait = 7,
Lure = 8,
Hook = 9,
Weight = 10,
Feeder = 11,
}
public class Item : Entity
@@ -47,4 +55,9 @@ public class Item : Entity
/// 物品所属的容器
/// </summary>
[BsonIgnore] PlayerItemContainerComponent Container;
/// <summary>
/// 正则使用中
/// </summary>
[BsonIgnore] public bool InUse;
}

View File

@@ -1,8 +1,8 @@
using Fantasy.Entitas;
namespace NB.Map;
namespace NB.Game;
public class MapManageComponent: Entity
public class MapManageComponent : Entity
{
public readonly Dictionary<long, Map> Maps = new();
}

View File

@@ -1,6 +1,6 @@
using Fantasy.Entitas;
namespace NB.Map;
namespace NB.Game;
public class RoomManageComponent : Entity
{
@@ -8,6 +8,4 @@ public class RoomManageComponent : Entity
public readonly PriorityQueue<int, int> FreeIds = new();
public readonly HashSet<int> InUseID = new();
public string TestRoomCode;
}

View File

@@ -1,6 +1,6 @@
using Fantasy.Entitas;
namespace NB.Map;
namespace NB.Game;
public class Map : Entity
{
@@ -12,5 +12,5 @@ public class Map : Entity
/// <summary>
/// 地图玩家
/// </summary>
public Dictionary<long, MapUnit> Units = new Dictionary<long, MapUnit>();
public Dictionary<long, Player> Units = new Dictionary<long, Player>();
}

View File

@@ -1,7 +1,6 @@
using Fantasy.Entitas;
using NB.Map;
namespace NB.Map;
namespace NB.Game;
/// <summary>
/// 地图房间
@@ -26,7 +25,7 @@ public class MapRoom : Entity
/// <summary>
/// 房间玩家
/// </summary>
public Dictionary<long, MapUnit> Units = new Dictionary<long, MapUnit>();
public Dictionary<long, Player> Units = new Dictionary<long, Player>();
/// <summary>
/// 房主

View File

@@ -1,19 +1,13 @@
using Fantasy;
using Fantasy.Entitas;
using Fantasy.Entitas;
using Unity.Mathematics;
namespace NB.Map;
namespace NB.Game;
/// <summary>
/// 地图玩家单元
///
/// </summary>
public class MapUnit : Entity
public class MapUnitComponent : Entity
{
/// <summary>
/// 角色基础信息
/// </summary>
public RoleSimpleInfo Info;
/// <summary>
/// 位置
/// </summary>
@@ -24,20 +18,18 @@ public class MapUnit : Entity
/// </summary>
public float3 Rotation;
/// <summary>
/// 当前所在地图id
/// </summary>
public int MapId;
/// <summary>
/// 当前所在的房间id
/// </summary>
public int RoomId;
public long GateRouteId;
/// <summary>
/// 钓组信息
/// </summary>
public List<MapUnitGear> Gears = new List<MapUnitGear>();
/// <summary>
/// 房间Id
/// </summary>
public int RoomId;
/// <summary>
/// 地图id
/// </summary>
public int MapId;
}

View File

@@ -1,7 +1,7 @@
using Fantasy.Entitas;
using Unity.Mathematics;
namespace NB.Map;
namespace NB.Game;
public enum MapGearState
{
@@ -18,7 +18,7 @@ public class MapUnitGear : Entity
/// <summary>
/// 杆子
/// </summary>
public long Rod;
public long Item;
/// <summary>
/// 杆子配件

View File

@@ -63,4 +63,5 @@ public sealed class Player : Entity
[BsonIgnore] public long SessionRunTimeId;
}

View File

@@ -85,6 +85,7 @@ namespace Fantasy
}
public override void Dispose()
{
ItemId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_UseItemRequest>(this);
#endif
@@ -94,6 +95,8 @@ namespace Fantasy
public uint OpCode() { return OuterOpcode.C2Game_UseItemRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long ItemId { get; set; }
}
/// <summary>
/// 请求使用物品响应
@@ -509,5 +512,57 @@ namespace Fantasy
[ProtoMember(1)]
public List<AwardInfo> Awards = new List<AwardInfo>();
}
/// <summary>
/// /////////// ******** GM *******/////////////
/// </summary>
/// <summary>
/// 请求执行GM
/// </summary>
[ProtoContract]
public partial class C2Game_GMRequest : AMessage, ICustomRouteRequest
{
public static C2Game_GMRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Game_GMRequest>();
}
public override void Dispose()
{
Cmd = default;
Args = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_GMRequest>(this);
#endif
}
[ProtoIgnore]
public Game2C_GMResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GMRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public string Cmd { get; set; }
[ProtoMember(2)]
public string Args { get; set; }
}
/// <summary>
/// 执行GM返回
/// </summary>
[ProtoContract]
public partial class Game2C_GMResponse : AMessage, ICustomRouteResponse
{
public static Game2C_GMResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_GMResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_GMResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GMResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
}

View File

@@ -39,7 +39,7 @@ namespace Fantasy
public Map2C_CreateRoomResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Map_CreateRoomRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public int MapId { get; set; }
}
@@ -193,7 +193,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_ChangeMap; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public int MapId { get; set; }
[ProtoMember(2)]

View File

@@ -99,25 +99,31 @@ namespace Fantasy
}
public override void Dispose()
{
Rod = default;
Rigs.Clear();
Item = default;
Binds.Clear();
Position = default;
Rotation = default;
Propertys.Clear();
InUse = default;
InHand = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<GearInfo>(this);
#endif
}
[ProtoMember(1)]
public long Rod { get; set; }
public ItemInfo Item { get; set; }
[ProtoMember(2)]
public List<long> Rigs = new List<long>();
public List<ItemInfo> Binds = new List<ItemInfo>();
[ProtoMember(3)]
public Vector3Info Position { get; set; }
[ProtoMember(4)]
public Vector3Info Rotation { get; set; }
[ProtoMember(5)]
public List<KeyValueInt64> Propertys = new List<KeyValueInt64>();
[ProtoMember(6)]
public bool InUse { get; set; }
[ProtoMember(7)]
public bool InHand { get; set; }
}
[ProtoContract]
public partial class UnitStateInfo : AMessage

View File

@@ -21,8 +21,10 @@ namespace Fantasy
public const uint C2Game_BuyRequest = 2281711384;
public const uint Game2C_BuyResponse = 2415929112;
public const uint Game2C_RewardNotify = 2147493651;
public const uint C2Map_CreateRoomRequest = 2281711385;
public const uint Map2C_CreateRoomResponse = 2415929113;
public const uint C2Game_GMRequest = 2281711385;
public const uint Game2C_GMResponse = 2415929113;
public const uint C2Map_CreateRoomRequest = 2281711386;
public const uint Map2C_CreateRoomResponse = 2415929114;
public const uint C2G_ExitRoomRequest = 268445457;
public const uint G2C_ExitRoomResponse = 402663185;
public const uint C2G_EnterMapRequest = 268445458;
@@ -33,10 +35,12 @@ namespace Fantasy
public const uint C2G_LoginRequest = 268445460;
public const uint G2C_LoginResponse = 402663188;
public const uint G2C_RepeatLogin = 134227729;
public const uint C2Game_GetRoleInfoRequest = 2281711386;
public const uint Game2C_GetRoleInfoResponse = 2415929114;
public const uint C2Game_GetRoleInfoRequest = 2281711387;
public const uint Game2C_GetRoleInfoResponse = 2415929115;
public const uint Map2C_RoleEnterRoomNotify = 2147493653;
public const uint Map2C_RoleExitRoomNotify = 2147493654;
public const uint C2Map_TakeItemRequest = 2281711388;
public const uint Map2C_TakeItemResponse = 2415929116;
public const uint C2Map_RolePropertyChange = 2147493655;
public const uint Map2C_RoleStateNotify = 2147493656;
public const uint Map2C_RoleGearChangeNotify = 2147493657;
@@ -45,37 +49,37 @@ namespace Fantasy
public const uint C2Map_Look = 2147493660;
public const uint Map2C_MoveNotify = 2147493661;
public const uint Map2C_LookeNotify = 2147493662;
public const uint C2S_GetConversationsRequest = 2281711387;
public const uint S2C_GetConversationsResponse = 2415929115;
public const uint C2S_SendMailRequest = 2281711388;
public const uint S2C_SendMailResponse = 2415929116;
public const uint C2S_DeleteMailRequest = 2281711389;
public const uint S2C_DeleteMailResponse = 2415929117;
public const uint C2S_GetConversationsRequest = 2281711389;
public const uint S2C_GetConversationsResponse = 2415929117;
public const uint C2S_SendMailRequest = 2281711390;
public const uint S2C_SendMailResponse = 2415929118;
public const uint C2S_DeleteMailRequest = 2281711391;
public const uint S2C_DeleteMailResponse = 2415929119;
public const uint S2C_HaveMail = 2147493663;
public const uint S2C_MailState = 2147493664;
public const uint C2S_CreateChannelRequest = 2281711390;
public const uint S2C_CreateChannelResponse = 2415929118;
public const uint C2S_JoinChannelRequest = 2281711391;
public const uint S2C_JoinChannelResponse = 2415929119;
public const uint C2S_SendMessageRequest = 2281711392;
public const uint S2C_SendMessageResponse = 2415929120;
public const uint C2S_CreateChannelRequest = 2281711392;
public const uint S2C_CreateChannelResponse = 2415929120;
public const uint C2S_JoinChannelRequest = 2281711393;
public const uint S2C_JoinChannelResponse = 2415929121;
public const uint C2S_SendMessageRequest = 2281711394;
public const uint S2C_SendMessageResponse = 2415929122;
public const uint S2C_Message = 2147493665;
public const uint C2S_CreateClubRequest = 2281711393;
public const uint S2C_CreateClubResponse = 2415929121;
public const uint C2S_GetClubInfoRequest = 2281711394;
public const uint S2C_GetClubInfoResponse = 2415929122;
public const uint C2S_GetMemberListRequest = 2281711395;
public const uint S2C_GetMemberListResponse = 2415929123;
public const uint C2S_GetClubListRequest = 2281711396;
public const uint S2C_GetClubListResponse = 2415929124;
public const uint C2S_JoinClubRequest = 2281711397;
public const uint S2C_JoinClubResponse = 2415929125;
public const uint C2S_LeaveClubRequest = 2281711398;
public const uint S2C_LeaveClubResponse = 2415929126;
public const uint C2S_DissolveClubRequest = 2281711399;
public const uint S2C_DissolveClubResponse = 2415929127;
public const uint C2S_DisposeJoinRequest = 2281711400;
public const uint S2C_DisposeJoinResponse = 2415929128;
public const uint C2S_CreateClubRequest = 2281711395;
public const uint S2C_CreateClubResponse = 2415929123;
public const uint C2S_GetClubInfoRequest = 2281711396;
public const uint S2C_GetClubInfoResponse = 2415929124;
public const uint C2S_GetMemberListRequest = 2281711397;
public const uint S2C_GetMemberListResponse = 2415929125;
public const uint C2S_GetClubListRequest = 2281711398;
public const uint S2C_GetClubListResponse = 2415929126;
public const uint C2S_JoinClubRequest = 2281711399;
public const uint S2C_JoinClubResponse = 2415929127;
public const uint C2S_LeaveClubRequest = 2281711400;
public const uint S2C_LeaveClubResponse = 2415929128;
public const uint C2S_DissolveClubRequest = 2281711401;
public const uint S2C_DissolveClubResponse = 2415929129;
public const uint C2S_DisposeJoinRequest = 2281711402;
public const uint S2C_DisposeJoinResponse = 2415929130;
public const uint S2C_ClubChange = 2147493666;
}
}

View File

@@ -37,7 +37,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleEnterRoomNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public MapUnitInfo Info { get; set; }
}
@@ -60,10 +60,65 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleExitRoomNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
}
/// <summary>
/// 请求拿起物品
/// </summary>
[ProtoContract]
public partial class C2Map_TakeItemRequest : AMessage, ICustomRouteRequest
{
public static C2Map_TakeItemRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Map_TakeItemRequest>();
}
public override void Dispose()
{
Id = default;
Task = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Map_TakeItemRequest>(this);
#endif
}
[ProtoIgnore]
public Map2C_TakeItemResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Map_TakeItemRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public int Id { get; set; }
[ProtoMember(2)]
public bool Task { get; set; }
}
/// <summary>
/// 请求拿起物品响应
/// </summary>
[ProtoContract]
public partial class Map2C_TakeItemResponse : AMessage, ICustomRouteResponse
{
public static Map2C_TakeItemResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Map2C_TakeItemResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Id = default;
Task = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2C_TakeItemResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Map2C_TakeItemResponse; }
[ProtoMember(1)]
public int Id { get; set; }
[ProtoMember(2)]
public bool Task { get; set; }
[ProtoMember(3)]
public uint ErrorCode { get; set; }
}
[ProtoContract]
public partial class C2Map_RolePropertyChange : AMessage, ICustomRouteMessage
{
@@ -80,7 +135,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_RolePropertyChange; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public List<KeyValueInt64> Propertys = new List<KeyValueInt64>();
}
@@ -104,7 +159,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleStateNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -130,7 +185,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleGearChangeNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -153,7 +208,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RolePropertyChangeNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -180,7 +235,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_Move; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public Vector3Info Position { get; set; }
[ProtoMember(2)]
@@ -211,7 +266,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_Look; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public Vector3Info Rotation { get; set; }
[ProtoMember(2)]
@@ -242,7 +297,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_MoveNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -279,7 +334,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_LookeNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]

View File

@@ -6,6 +6,5 @@ namespace Fantasy
public const int GateRoute = 1001; // Gate
public const int SocialRoute = 1002; // Social
public const int GameRoute = 1003; // Game
public const int MapRoute = 1004; // 地图
}
}

View File

@@ -1,8 +0,0 @@
using Fantasy.Entitas;
namespace NB.Map;
public class MapUnitManageComponent : Entity
{
public readonly Dictionary<long, MapUnit> Units = new();
}