地图修改

This commit is contained in:
2025-12-15 12:30:59 +08:00
parent 7775fa30bb
commit afb4f0d765
22 changed files with 52391 additions and 51666 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1c61b32e7992466f9771eac80763078e
timeCreated: 1765523393

View File

@@ -0,0 +1,7 @@
namespace NBF.Fishing2
{
public struct UseGearEvent
{
public UnitGearComponent Gear;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6172898013ee4551afc0686399136d8f
timeCreated: 1765523056

View File

@@ -17,10 +17,15 @@ namespace NBF.Fishing2
/// 旋转速度
/// </summary>
public float ReelSpeed { get; set; }
/// <summary>
/// 鱼竿设置
/// </summary>
public int RedSetting { get; set; }
/// <summary>
/// 是否拿在手里
/// </summary>
public bool InHand { get; set; }
}
}

View File

@@ -86,6 +86,7 @@ namespace NBF.Fishing2
var unitBasic = GetOrAddComponent<MapUnitBasic>();
unitBasic.UpdateInfo(unitInfo);
// unitInfo.Gears
var numericComponent = GetOrAddComponent<NumericComponent>();
foreach (var kv in unitInfo.Propertys)

View File

@@ -136,23 +136,33 @@ namespace NBF.Fishing2
Quaternion rotation = _Character.transform.rotation;
float num = Quaternion.Angle(rotation, lastRotation);
// float num2 = Vector3.Cross(lastRotation * Vector3.forward, rotation * Vector3.forward).y > 0f
// ? 1f
// : -1f;
bool flag = num > 0f;
if (!flag)
// 计算当前帧与上一帧的旋转差异
Quaternion rotationDelta = rotation * Quaternion.Inverse(lastRotation);
// 将四元数转换为角度轴表示
rotationDelta.ToAngleAxis(out float angle, out Vector3 axis);
// 确保角度在0-360范围内
if (angle > 180f) angle -= 360f;
// 获取Y轴旋转分量归一化处理
float yRotation = 0f;
if (Mathf.Abs(angle) > 0.001f && Mathf.Abs(axis.y) > 0.1f)
{
MapUnit.RotationSpeed = Mathf.Lerp(MapUnit.RotationSpeed, 0f, 5 * Time.deltaTime);
// 计算Y轴方向的旋转角度考虑旋转轴方向
yRotation = angle * Mathf.Sign(axis.y);
}
float maxTurnSpeed = 180f; // 度/秒
// 转换为角速度并归一化到[-1, 1]
float angularSpeed = yRotation / Time.deltaTime;
float turnValue = Mathf.Clamp(angularSpeed / maxTurnSpeed, -1f, 1f);
MapUnit.RotationSpeed = turnValue;
lastRotation = rotation;
// var TargetMultiplier = 15;
// float num3 = MapUnit.RotationSpeed < 1f ? TargetMultiplier * 5f : TargetMultiplier;
// MapUnit.RotationSpeed += (flag ? 1f : 0f) * num2 * Time.deltaTime *
// (Run ? num3 * 0.075f : num3);
}
private void UpdateWater()

View File

@@ -1,5 +1,6 @@
using Fantasy.Entitas;
using Fantasy.Entitas.Interface;
using NBC;
using UnityEngine;
namespace NBF.Fishing2
@@ -34,11 +35,16 @@ namespace NBF.Fishing2
public static readonly int PreciseIdle = Animator.StringToHash("Precise Idle");
public static readonly string Torso = "Torso";
#endregion
public Animator Animator { get; private set; }
public MapUnit MapUnit;
private bool _isTorsoLayerEnabled;
#region System
public class CharacterAnimatorComponentDestroySystem : DestroySystem<CharacterAnimatorComponent>
@@ -58,9 +64,17 @@ namespace NBF.Fishing2
}
}
public class CharacterAnimatorComponentUpdateSystem : UpdateSystem<CharacterAnimatorComponent>
// public class CharacterAnimatorComponentUpdateSystem : UpdateSystem<CharacterAnimatorComponent>
// {
// protected override void Update(CharacterAnimatorComponent self)
// {
// // self.UpdateAnimator();
// }
// }
public class CharacterAnimatorComponentLateUpdateSystem : LateUpdateSystem<CharacterAnimatorComponent>
{
protected override void Update(CharacterAnimatorComponent self)
protected override void LateUpdate(CharacterAnimatorComponent self)
{
self.UpdateAnimator();
}
@@ -74,8 +88,26 @@ namespace NBF.Fishing2
Animator.SetBool(OnGround, MapUnit.IsGrounded);
float value3 = Mathf.Lerp(Animator.GetFloat(Forward), MapUnit.Speed / 5f, Time.deltaTime * 20f);
Animator.SetFloat(Forward, value3);
float value4 = Mathf.Lerp(Animator.GetFloat(Turn), MapUnit.RotationSpeed, Time.deltaTime * 15f);
Animator.SetFloat(Turn, Mathf.Clamp(value4, -1f, 1f));
// 平滑处理
// float smoothedTurn = Mathf.SmoothDamp(Animator.GetFloat(Turn),
// MapUnit.RotationSpeed,
// ref turnSmoothVelocity,
// smoothingTime
// );
float smoothedTurn = Mathf.Lerp(Animator.GetFloat(Turn), MapUnit.RotationSpeed, Time.deltaTime * 10f);
Animator.SetFloat(Turn, smoothedTurn);
float layerWeight = Animator.GetLayerWeight(Animator.GetLayerIndex(Torso));
SetLayerWeight(Torso,
Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f));
}
public void SetLayerWeight(string layer, float weight)
{
Animator.SetLayerWeight(Animator.GetLayerIndex(layer), weight);
}
}
}

View File

@@ -76,6 +76,7 @@ namespace Fantasy
}
public override void Dispose()
{
ItemId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_UseItemRequest>(this);
#endif
@@ -85,6 +86,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>
/// 请求使用物品响应
@@ -500,5 +503,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

@@ -30,7 +30,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; }
}
@@ -184,7 +184,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

@@ -90,25 +90,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

@@ -29,9 +29,10 @@ namespace Fantasy
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Game2C_UseItemResponse> C2Game_UseItemRequest(this Session session)
public static async FTask<Game2C_UseItemResponse> C2Game_UseItemRequest(this Session session, long itemId)
{
using var request = Fantasy.C2Game_UseItemRequest.Create(session.Scene);
request.ItemId = itemId;
return (Game2C_UseItemResponse)await session.Call(request);
}
@@ -168,6 +169,21 @@ namespace Fantasy
session.Send(message);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Game2C_GMResponse> C2Game_GMRequest(this Session session, C2Game_GMRequest request)
{
return (Game2C_GMResponse)await session.Call(request);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Game2C_GMResponse> C2Game_GMRequest(this Session session, string cmd, string args)
{
using var request = Fantasy.C2Game_GMRequest.Create(session.Scene);
request.Cmd = cmd;
request.Args = args;
return (Game2C_GMResponse)await session.Call(request);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Map2C_CreateRoomResponse> C2Map_CreateRoomRequest(this Session session, C2Map_CreateRoomRequest request)
{
@@ -311,6 +327,21 @@ namespace Fantasy
session.Send(message);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Map2C_TakeItemResponse> C2Map_TakeItemRequest(this Session session, C2Map_TakeItemRequest request)
{
return (Map2C_TakeItemResponse)await session.Call(request);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static async FTask<Map2C_TakeItemResponse> C2Map_TakeItemRequest(this Session session, int id, bool task)
{
using var request = Fantasy.C2Map_TakeItemRequest.Create(session.Scene);
request.Id = id;
request.Task = task;
return (Map2C_TakeItemResponse)await session.Call(request);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void C2Map_RolePropertyChange(this Session session, C2Map_RolePropertyChange message)
{

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

@@ -28,7 +28,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; }
}
@@ -51,10 +51,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
{
@@ -71,7 +126,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>();
}
@@ -95,7 +150,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)]
@@ -121,7 +176,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)]
@@ -144,7 +199,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)]
@@ -171,7 +226,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)]
@@ -202,7 +257,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)]
@@ -233,7 +288,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)]
@@ -270,7 +325,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; // 地图
}
}