大修改调整
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"unity_port": 25916,
|
||||
"created_date": "2026-02-10T01:48:10.3375388Z",
|
||||
"project_path": "D:/myself/Fishing2/Assets",
|
||||
"project_path": "D:/myself/Games/Fishing2/Assets",
|
||||
"reloading": false,
|
||||
"reason": "ready",
|
||||
"seq": 1,
|
||||
"last_heartbeat": "2026-03-09T09:50:14.4988583Z"
|
||||
"last_heartbeat": "2026-03-09T15:41:07.6469285Z"
|
||||
}
|
||||
@@ -18658,8 +18658,53 @@ MonoBehaviour:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/LineHand1.prefab
|
||||
Address: Plyaer/LineHand1
|
||||
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeLong.asset
|
||||
Address: Plyaer/FishingRopeLong
|
||||
Type: Missing
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
Group:
|
||||
Name: Plyaer
|
||||
Enable: 1
|
||||
BundleMode: 0
|
||||
AddressMode: 2
|
||||
Tags:
|
||||
Collectors:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset
|
||||
Address: Plyaer/FishingRopeLong2
|
||||
Type: Missing
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
Group:
|
||||
Name: Plyaer
|
||||
Enable: 1
|
||||
BundleMode: 0
|
||||
AddressMode: 2
|
||||
Tags:
|
||||
Collectors:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeShort.asset
|
||||
Address: Plyaer/FishingRopeShort
|
||||
Type: Missing
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
Group:
|
||||
Name: Plyaer
|
||||
Enable: 1
|
||||
BundleMode: 0
|
||||
AddressMode: 2
|
||||
Tags:
|
||||
Collectors:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/Float (4).prefab
|
||||
Address: Plyaer/Float (4)
|
||||
Type: GameObject
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
@@ -18688,6 +18733,36 @@ MonoBehaviour:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/RopeSegment_4.asset
|
||||
Address: Plyaer/RopeSegment_4
|
||||
Type: Missing
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
Group:
|
||||
Name: Plyaer
|
||||
Enable: 1
|
||||
BundleMode: 0
|
||||
AddressMode: 2
|
||||
Tags:
|
||||
Collectors:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Line/Spool.mat
|
||||
Address: Plyaer/Spool
|
||||
Type: Material
|
||||
Bundle: main/plyaer.bundle
|
||||
Tags:
|
||||
Group:
|
||||
Name: Plyaer
|
||||
Enable: 1
|
||||
BundleMode: 0
|
||||
AddressMode: 2
|
||||
Tags:
|
||||
Collectors:
|
||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||
FilterEnum: 0
|
||||
Filter: '*'
|
||||
- Path: Assets/ResRaw/Prefabs/Player/Anim/AnimationClip/CameraCrouch.anim
|
||||
Address: Plyaer/CameraCrouch
|
||||
Type: AnimationClip
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
// // 新文件:D:\myself\Fishing2\Assets\Scripts\Fishing\Data\LocalDataManager.cs
|
||||
//
|
||||
// using System.Collections.Generic;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace NBF
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 本地单机模式的数据管理器(模拟服务器转发)
|
||||
// /// </summary>
|
||||
// public class LocalDataManager : PlayerDataManager
|
||||
// {
|
||||
// public override bool IsLocalMode => true;
|
||||
//
|
||||
// private Dictionary<int, FPlayerData> _localPlayers = new();
|
||||
// private uint _sequenceCounter;
|
||||
//
|
||||
// protected void Awake()
|
||||
// {
|
||||
// Instance = this;
|
||||
// }
|
||||
//
|
||||
// public void RegisterPlayer(FPlayerData player)
|
||||
// {
|
||||
// if (!_localPlayers.ContainsKey(player.PlayerID))
|
||||
// {
|
||||
// _localPlayers.Add(player.PlayerID, player);
|
||||
// player.IsLocalPlayer = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void OnPlayerStateChanged(FPlayerData player, PlayerState newState)
|
||||
// {
|
||||
// // 本地模式下,广播给其他本地玩家(分屏)
|
||||
// foreach (var kvp in _localPlayers)
|
||||
// {
|
||||
// if (kvp.Value != player)
|
||||
// {
|
||||
// // 直接应用状态(或者加入简单的延迟模拟)
|
||||
// kvp.Value.State = newState;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void OnHeldItemChanged(FPlayerData player, HeldItemInfo newItem)
|
||||
// {
|
||||
// foreach (var kvp in _localPlayers)
|
||||
// {
|
||||
// if (kvp.Value != player)
|
||||
// {
|
||||
// kvp.Value.CurrentHeldItem = newItem;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void SendStateSnapshot(FPlayerData player)
|
||||
// {
|
||||
// _sequenceCounter++;
|
||||
// var snapshot = player.ToNetworkSnapshot(_sequenceCounter);
|
||||
//
|
||||
// // 本地广播
|
||||
// foreach (var kvp in _localPlayers)
|
||||
// {
|
||||
// if (kvp.Value != player)
|
||||
// {
|
||||
// ReceiveStateSnapshot(kvp.Key, snapshot);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void ReceiveStateSnapshot(int playerID, PlayerStateSnapshot snapshot)
|
||||
// {
|
||||
// if (_localPlayers.TryGetValue(playerID, out var player))
|
||||
// {
|
||||
// player.ApplyFromNetworkSnapshot(snapshot);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 定时同步(例如每秒 10 次)
|
||||
// private float _syncTimer;
|
||||
// private void Update()
|
||||
// {
|
||||
// _syncTimer += Time.deltaTime;
|
||||
// if (_syncTimer >= 0.1f) // 10Hz
|
||||
// {
|
||||
// _syncTimer = 0;
|
||||
// foreach (var player in _localPlayers.Values)
|
||||
// {
|
||||
// SendStateSnapshot(player);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec2bd63eb6c143fdb528da693a8c6969
|
||||
timeCreated: 1773028161
|
||||
@@ -1,60 +0,0 @@
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace NBF
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 网络模式的数据管理器
|
||||
// /// </summary>
|
||||
// public class NetworkDataManager : PlayerDataManager
|
||||
// {
|
||||
// public override bool IsLocalMode => false;
|
||||
//
|
||||
// // TODO: 这里集成你的网络库(Steamworks、Photon、Mirror 等)
|
||||
// // public SteamNetworkClient NetworkClient;
|
||||
//
|
||||
// protected void Awake()
|
||||
// {
|
||||
// Instance = this;
|
||||
// }
|
||||
//
|
||||
// public override void OnPlayerStateChanged(FPlayerData player, PlayerState newState)
|
||||
// {
|
||||
// // 如果是本地玩家,发送到服务器
|
||||
// if (player.IsLocalPlayer)
|
||||
// {
|
||||
// SendStateSnapshot(player);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void OnHeldItemChanged(FPlayerData player, HeldItemInfo newItem)
|
||||
// {
|
||||
// if (player.IsLocalPlayer)
|
||||
// {
|
||||
// // TODO: 发送物品切换消息到服务器
|
||||
// Debug.Log($"发送物品切换:{newItem.ItemType}, ConfigID={newItem.ConfigID}");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void SendStateSnapshot(FPlayerData player)
|
||||
// {
|
||||
// if (!player.IsLocalPlayer) return;
|
||||
//
|
||||
// // TODO: 通过 Steam 或其他网络库发送
|
||||
// // NetworkClient.SendStateSnapshot(player.ToNetworkSnapshot());
|
||||
// }
|
||||
//
|
||||
// public override void ReceiveStateSnapshot(int playerID, PlayerStateSnapshot snapshot)
|
||||
// {
|
||||
// // TODO: 从网络接收其他玩家的状态
|
||||
// // 找到或创建对应的玩家对象
|
||||
// var player = FindOrCreatePlayer(playerID);
|
||||
// player.ApplyFromNetworkSnapshot(snapshot);
|
||||
// }
|
||||
//
|
||||
// private FPlayerData FindOrCreatePlayer(int playerID)
|
||||
// {
|
||||
// // TODO: 实现玩家对象池或动态生成
|
||||
// return FindObjectOfType<FPlayerData>();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1a06ba516ea46f0920729b2af6484c1
|
||||
timeCreated: 1773028213
|
||||
@@ -1,56 +0,0 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace NBF
|
||||
// {
|
||||
// public interface IDataSource
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 数据管理器基类(本地和网络共享接口)
|
||||
// /// </summary>
|
||||
// public class PlayerDataManager : MonoBehaviour
|
||||
// {
|
||||
// public static PlayerDataManager Instance { get; private set; }
|
||||
//
|
||||
// public FPlayerData Self { get; set; }
|
||||
//
|
||||
// private Dictionary<int, FPlayerData> _players = new Dictionary<int, FPlayerData>();
|
||||
//
|
||||
// protected void Awake()
|
||||
// {
|
||||
// Instance = this;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 玩家状态变更时调用
|
||||
// /// </summary>
|
||||
// public void OnPlayerStateChanged(FPlayerData player, PlayerState newState)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 手持物品变更时调用
|
||||
// /// </summary>
|
||||
// public void OnHeldItemChanged(FPlayerData player, HeldItemInfo newItem)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 发送玩家状态快照
|
||||
// /// </summary>
|
||||
// public void SendStateSnapshot(FPlayerData player)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 接收并应用网络快照
|
||||
// /// </summary>
|
||||
// public void ReceiveStateSnapshot(int playerID, PlayerStateSnapshot snapshot)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0478bf9a256a46beb65fd0307c7b5b9b
|
||||
timeCreated: 1773028149
|
||||
@@ -4,6 +4,11 @@ using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class StateParamsConst
|
||||
{
|
||||
public const string ChargedProgress = "ChargedProgress";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态进入参数(用于网络同步和动画/表现播放)
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using UnityEngine;
|
||||
@@ -17,18 +18,13 @@ namespace NBF
|
||||
public bool IsSelf => RoleModel.Instance.Id == Id;
|
||||
|
||||
// ========== 物理状态(高频同步) ==========
|
||||
public Vector3 position;
|
||||
public Quaternion rotation;
|
||||
public Vector3 Position;
|
||||
public Quaternion Rotation;
|
||||
public Vector2 MoveInput;
|
||||
public float Speed;
|
||||
public float RotationSpeed;
|
||||
public bool IsGrounded;
|
||||
public bool Run;
|
||||
|
||||
// ========== 钓鱼相关状态(中频同步) ==========
|
||||
public float currentReelingSpeed;
|
||||
public float lineLength;
|
||||
public float reelSpeed;
|
||||
public float EyeAngle;
|
||||
|
||||
/// <summary>
|
||||
@@ -36,29 +32,21 @@ namespace NBF
|
||||
/// </summary>
|
||||
public long TagValue;
|
||||
|
||||
|
||||
// ========== 状态机 ==========
|
||||
private PlayerState _previousPlayerState = PlayerState.Idle;
|
||||
private PlayerState _playerState;
|
||||
public PlayerState PreviousState => _previousPlayerState;
|
||||
/// <summary>
|
||||
/// 上一个状态
|
||||
/// </summary>
|
||||
public PlayerState PreviousState;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态的进入参数(本地和远程都适用)
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public StateEnterParams CurrentStateParams { get; private set; } = new StateEnterParams();
|
||||
public PlayerState State;
|
||||
|
||||
/// <summary>
|
||||
/// 状态参数
|
||||
/// </summary>
|
||||
public StateEnterParams StateParams;
|
||||
|
||||
public PlayerState State
|
||||
{
|
||||
get => _playerState;
|
||||
set
|
||||
{
|
||||
if (_playerState != value)
|
||||
{
|
||||
_previousPlayerState = _playerState;
|
||||
_playerState = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 玩家的物品
|
||||
@@ -75,9 +63,12 @@ namespace NBF
|
||||
/// </summary>
|
||||
public PlayerItem HandItem => Items[HandItemId];
|
||||
|
||||
#region 初始化
|
||||
|
||||
public void InitPlayer(MapUnitInfo unitInfo)
|
||||
{
|
||||
AddComponent<PlayerViewComponent>();
|
||||
AddComponent<PlayerStateViewComponent>();
|
||||
if (unitInfo.Id == RoleModel.Instance.Id)
|
||||
{
|
||||
//自己
|
||||
@@ -85,13 +76,61 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 物品
|
||||
|
||||
public void UnUseItem()
|
||||
{
|
||||
if (Items.TryGetValue(HandItemId, out var item))
|
||||
{
|
||||
item.Dispose();
|
||||
}
|
||||
|
||||
HandItemId = 0;
|
||||
ItemChangeEvent();
|
||||
}
|
||||
|
||||
public void UseItem(ItemInfo item)
|
||||
public void UseItem(ItemBindInfo item)
|
||||
{
|
||||
var playerItem = Create<PlayerItem>(Scene);
|
||||
playerItem.Init(item);
|
||||
ItemChangeEvent();
|
||||
}
|
||||
|
||||
private void ItemChangeEvent()
|
||||
{
|
||||
Scene.EventComponent.Publish(new PlayerStateChangeEvent
|
||||
{
|
||||
Player = this
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 状态切换
|
||||
|
||||
/// <summary>
|
||||
/// 切换状态
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="stateParams"></param>
|
||||
public void ChangeState(PlayerState state, StateEnterParams stateParams = null)
|
||||
{
|
||||
if (state == State)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PreviousState = State;
|
||||
State = state;
|
||||
StateParams = stateParams;
|
||||
Scene.EventComponent.Publish(new PlayerStateChangeEvent
|
||||
{
|
||||
Player = this
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/Fishing/New/Data/PlayerEvent.cs
Normal file
12
Assets/Scripts/Fishing/New/Data/PlayerEvent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace NBF
|
||||
{
|
||||
public struct PlayerStateChangeEvent
|
||||
{
|
||||
public Player Player;
|
||||
}
|
||||
|
||||
public struct PlayerItemChangeEvent
|
||||
{
|
||||
public Player Player;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing/New/Data/PlayerEvent.cs.meta
Normal file
3
Assets/Scripts/Fishing/New/Data/PlayerEvent.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c10a4d3f5e354dc9a046ddf7219354b2
|
||||
timeCreated: 1773060354
|
||||
@@ -1,4 +1,6 @@
|
||||
using Fantasy.Entitas;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
@@ -8,5 +10,16 @@ namespace NBF
|
||||
/// 配置id
|
||||
/// </summary>
|
||||
public int ConfigID;
|
||||
|
||||
/// <summary>
|
||||
/// 绑定的子物体
|
||||
/// </summary>
|
||||
public List<int> BindItems = new List<int>();
|
||||
|
||||
public void Init(ItemBindInfo bindInfo)
|
||||
{
|
||||
ConfigID = bindInfo.Item;
|
||||
BindItems.AddRange(bindInfo.BindItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing/New/Event.meta
Normal file
3
Assets/Scripts/Fishing/New/Event.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 172aa8a5a1444ccbad1647479739c232
|
||||
timeCreated: 1773060255
|
||||
3
Assets/Scripts/Fishing/New/View/Handle.meta
Normal file
3
Assets/Scripts/Fishing/New/View/Handle.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 958b50133e064daf9764313f24b892da
|
||||
timeCreated: 1773069791
|
||||
@@ -0,0 +1,13 @@
|
||||
using Fantasy.Event;
|
||||
|
||||
namespace NBF.Handle
|
||||
{
|
||||
public class OnPlayerStateChangeEvent : EventSystem<PlayerStateChangeEvent>
|
||||
{
|
||||
protected override void Handler(PlayerStateChangeEvent self)
|
||||
{
|
||||
var view = self.Player.GetOrAddComponent<PlayerItemViewComponent>();
|
||||
view.ShowItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5897acb7a6e40fcb3123362df1669f3
|
||||
timeCreated: 1773069799
|
||||
@@ -1,8 +1,9 @@
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Log = NBC.Log;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
@@ -89,8 +90,15 @@ namespace NBF
|
||||
var item = RoleModel.Instance.GetSlotItem(index - 1);
|
||||
if (item != null)
|
||||
{
|
||||
Player.UseItem(item);
|
||||
// Game.Instance.StartCoroutine(UseItem(item));
|
||||
var itemBindInfo = ItemBindInfo.Create();
|
||||
itemBindInfo.Item = item.ConfigId;
|
||||
var binds = RoleModel.Instance.GetBindItems(item.Id);
|
||||
foreach (var itemInfo in binds)
|
||||
{
|
||||
itemBindInfo.BindItems.Add(itemInfo.ConfigId);
|
||||
}
|
||||
|
||||
Player.UseItem(itemBindInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +129,7 @@ namespace NBF
|
||||
|
||||
#region Move
|
||||
|
||||
private Quaternion lastRotation;
|
||||
private Quaternion _lastRotation;
|
||||
|
||||
private void UpdateMove()
|
||||
{
|
||||
@@ -155,7 +163,7 @@ namespace NBF
|
||||
Quaternion rotation = View.Unity.FirstPerson.transform.rotation;
|
||||
|
||||
// 计算当前帧与上一帧的旋转差异
|
||||
Quaternion rotationDelta = rotation * Quaternion.Inverse(lastRotation);
|
||||
Quaternion rotationDelta = rotation * Quaternion.Inverse(_lastRotation);
|
||||
|
||||
// 将四元数转换为角度轴表示
|
||||
rotationDelta.ToAngleAxis(out float angle, out Vector3 axis);
|
||||
@@ -179,7 +187,7 @@ namespace NBF
|
||||
|
||||
Player.RotationSpeed = turnValue;
|
||||
|
||||
lastRotation = rotation;
|
||||
_lastRotation = rotation;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
67
Assets/Scripts/Fishing/New/View/PlayerItemViewComponent.cs
Normal file
67
Assets/Scripts/Fishing/New/View/PlayerItemViewComponent.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerItemViewComponent : Entity
|
||||
{
|
||||
public void ShowItem()
|
||||
{
|
||||
// Game.Instance.StartCoroutine()
|
||||
}
|
||||
|
||||
#region 使用物品
|
||||
|
||||
// public IEnumerator UseItem(ItemInfo item)
|
||||
// {
|
||||
// if (Data.ChangeItem) yield break;
|
||||
// Data.ChangeItem = true;
|
||||
// var itemType = item?.ConfigId.GetItemType();
|
||||
// if (itemType == ItemType.Rod)
|
||||
// {
|
||||
// //判断旧的是否要收回
|
||||
// yield return UnUseItemConfirm();
|
||||
//
|
||||
// Data.IsLureRod = true;
|
||||
// var rodType = (ItemSubType)item.Config.Type;
|
||||
// if (rodType == ItemSubType.RodTele)
|
||||
// {
|
||||
// Data.IsLureRod = false;
|
||||
// }
|
||||
//
|
||||
// Rod =
|
||||
// item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero,
|
||||
// Quaternion.identity);
|
||||
// yield return Rod.InitRod(this, item);
|
||||
// Tackles.Add(Rod);
|
||||
// OnFishingSetEquiped?.Invoke(Rod);
|
||||
// }
|
||||
//
|
||||
// Data.ChangeItem = false;
|
||||
// }
|
||||
//
|
||||
// public IEnumerator UnUseItem()
|
||||
// {
|
||||
// if (Data.ChangeItem) yield break;
|
||||
// Data.ChangeItem = true;
|
||||
// yield return UnUseItemConfirm();
|
||||
// Data.ChangeItem = false;
|
||||
// }
|
||||
//
|
||||
// private IEnumerator UnUseItemConfirm()
|
||||
// {
|
||||
// if (Rod != null)
|
||||
// {
|
||||
// OnFishingSetUnequip?.Invoke();
|
||||
// yield return Rod.Destroy();
|
||||
// yield return new WaitForSeconds(0.35f);
|
||||
// Destroy(Rod.gameObject);
|
||||
// Tackles.Remove(Rod);
|
||||
// Rod = null;
|
||||
// yield return new WaitForSeconds(0.15f);
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf5f405feb8f431ea52d8f33b3cb2e29
|
||||
timeCreated: 1773069665
|
||||
77
Assets/Scripts/Fishing/New/View/PlayerStateViewComponent.cs
Normal file
77
Assets/Scripts/Fishing/New/View/PlayerStateViewComponent.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Event;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态显示层组件
|
||||
/// </summary>
|
||||
public class PlayerStateViewComponent : Entity
|
||||
{
|
||||
private readonly Dictionary<PlayerState, PlayerStageViewBase> _stageViews =
|
||||
new Dictionary<PlayerState, PlayerStageViewBase>();
|
||||
|
||||
private PlayerStageViewBase _currentStateView;
|
||||
private Player _player;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
_player = GetParent<Player>();
|
||||
_stageViews.Add(PlayerState.Idle, new PlayerStageViewIdle());
|
||||
_stageViews.Add(PlayerState.Prepare, new PlayerStageViewPrepare());
|
||||
_stageViews.Add(PlayerState.Throw, new PlayerStageViewThrow());
|
||||
_stageViews.Add(PlayerState.Fishing, new PlayerStageViewFishing());
|
||||
_stageViews.Add(PlayerState.Fight, new PlayerStageViewFight());
|
||||
foreach (var playerStageView in _stageViews.Values)
|
||||
{
|
||||
playerStageView.Init(_player);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
_currentStateView?.Update();
|
||||
}
|
||||
|
||||
public void OnStageChange()
|
||||
{
|
||||
if (_currentStateView != null)
|
||||
{
|
||||
_currentStateView.Exit();
|
||||
}
|
||||
|
||||
_currentStateView = _stageViews.GetValueOrDefault(_player.State);
|
||||
_currentStateView.Enter(_player.StateParams, _player.PreviousState);
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerStateViewComponentAwakeSystem : AwakeSystem<PlayerStateViewComponent>
|
||||
{
|
||||
protected override void Awake(PlayerStateViewComponent self)
|
||||
{
|
||||
self.Awake();
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerStateViewComponentUpdateSystem : UpdateSystem<PlayerStateViewComponent>
|
||||
{
|
||||
protected override void Update(PlayerStateViewComponent self)
|
||||
{
|
||||
self.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public class OnPlayerStageChange : EventSystem<PlayerStateChangeEvent>
|
||||
{
|
||||
protected override void Handler(PlayerStateChangeEvent self)
|
||||
{
|
||||
var stateView = self.Player.GetComponent<PlayerStateViewComponent>();
|
||||
if (stateView != null)
|
||||
{
|
||||
stateView.OnStageChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f48ea2ea6a0e4b38aa97a3fd07f3a6cc
|
||||
timeCreated: 1773060520
|
||||
@@ -24,6 +24,7 @@ namespace NBF
|
||||
{
|
||||
CameraManager.Instance.SetFppLook(Unity);
|
||||
}
|
||||
|
||||
Unity.transform.localPosition = new Vector3(484, 1, 422);
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ namespace NBF
|
||||
private void CreatePlayerModel()
|
||||
{
|
||||
var modelObject = PrefabsHelper.CreatePlayer(Unity.Root, "Human_Male");
|
||||
modelObject.transform.localPosition = Vector3.zero;
|
||||
modelObject.transform.localPosition = new Vector3(0, 1, 0);
|
||||
Unity.ModelAsset = modelObject.GetComponent<PlayerModelAsset>();
|
||||
Unity.ModelAsset.SetPlayer(Unity.FppLook);
|
||||
}
|
||||
|
||||
3
Assets/Scripts/Fishing/New/View/States.meta
Normal file
3
Assets/Scripts/Fishing/New/View/States.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98b05ca000114232a657f19095fdb49a
|
||||
timeCreated: 1773063071
|
||||
@@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public abstract class PlayerStageViewBase
|
||||
{
|
||||
public Player Player { get; private set; }
|
||||
public PlayerViewComponent PlayerView { get; private set; }
|
||||
protected float EnterTime { get; set; }
|
||||
|
||||
protected PlayerState PreviousState { get; private set; }
|
||||
protected StateEnterParams Params;
|
||||
|
||||
public void Init(Player player)
|
||||
{
|
||||
Player = player;
|
||||
PlayerView = player.GetComponent<PlayerViewComponent>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查状态超时
|
||||
/// </summary>
|
||||
public void CheckStateTimeout(float time)
|
||||
{
|
||||
if (Time.time - EnterTime >= time)
|
||||
{
|
||||
Player.ChangeState(PlayerState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
public void Enter(StateEnterParams par = null, PlayerState prevState = PlayerState.None)
|
||||
{
|
||||
Params = par;
|
||||
PreviousState = prevState;
|
||||
EnterTime = Time.time;
|
||||
OnEnter();
|
||||
}
|
||||
|
||||
protected virtual void OnEnter()
|
||||
{
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
OnExit();
|
||||
}
|
||||
|
||||
protected virtual void OnExit()
|
||||
{
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
protected virtual void OnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cce89f03f80b4fb8a0e36e66e9ffb3a9
|
||||
timeCreated: 1773063081
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStageViewFight : PlayerStageViewBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9445a6593604dc19dea2bb8bb0819bc
|
||||
timeCreated: 1773064542
|
||||
@@ -0,0 +1,99 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStageViewFishing : PlayerStageViewBase
|
||||
{
|
||||
protected override void OnEnter()
|
||||
{
|
||||
Debug.LogError("enter PlayerStateFishing");
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.BaitThrown = true;
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.BaitThrown = false;
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
PlayerState ret = PlayerState.None;
|
||||
var isUpRod = false;
|
||||
var isSubLine = false;
|
||||
|
||||
if (InputManager.IsOp1)
|
||||
{
|
||||
if (!Player.IsLureRod)
|
||||
{
|
||||
//抬杆
|
||||
isUpRod = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//收线
|
||||
isSubLine = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (InputManager.IsOp2)
|
||||
{
|
||||
if (Player.IsLureRod)
|
||||
{
|
||||
//抬杆
|
||||
isUpRod = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Player.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
|
||||
if (isUpRod || PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp > 0)
|
||||
{
|
||||
var upForce = 1;
|
||||
var addNum = upForce * Time.deltaTime;
|
||||
if (!isUpRod)
|
||||
{
|
||||
addNum *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
addNum *= 0.5f;
|
||||
}
|
||||
|
||||
// Debug.Log($"addNum={addNum}");
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp += addNum;
|
||||
// Debug.LogError($"ishingFinal={Player.ModelAsset.PlayerAnimator.FishingUp}");
|
||||
if (PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp >= 1)
|
||||
{
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp = 1;
|
||||
}
|
||||
else if (PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp < 0)
|
||||
{
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
if (PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp >= 0.8f)
|
||||
{
|
||||
ret = CheckTackFish();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
if (ret != PlayerState.None)
|
||||
{
|
||||
Player.ChangeState(ret);
|
||||
}
|
||||
}
|
||||
|
||||
#region 检查上鱼或者返回待机
|
||||
|
||||
private PlayerState CheckTackFish()
|
||||
{
|
||||
return PlayerState.Idle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84665b6bc7c84642b365db024c7759fd
|
||||
timeCreated: 1773064529
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStageViewIdle : PlayerStageViewBase
|
||||
{
|
||||
protected override void OnEnter()
|
||||
{
|
||||
InputManager.OnOp1Action += OnOp1Action;
|
||||
}
|
||||
|
||||
private void OnOp1Action(bool performed)
|
||||
{
|
||||
if (Player.HandItem == null) return;
|
||||
if (performed)
|
||||
{
|
||||
Player.ChangeState(PlayerState.Prepare);
|
||||
// _nextState = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
InputManager.OnOp1Action -= OnOp1Action;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fca81636d7246e7a5f84684a8563ca3
|
||||
timeCreated: 1773063824
|
||||
@@ -0,0 +1,73 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStageViewPrepare : PlayerStageViewBase
|
||||
{
|
||||
public enum Phase
|
||||
{
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// 蓄力
|
||||
/// </summary>
|
||||
Charged,
|
||||
|
||||
/// <summary>
|
||||
/// 确认蓄力结果
|
||||
/// </summary>
|
||||
Confirm,
|
||||
}
|
||||
|
||||
public Phase Stage = Phase.Charged;
|
||||
public float ChargedProgress;
|
||||
|
||||
protected override void OnEnter()
|
||||
{
|
||||
Log.Info("enter PlayerStatePrepare");
|
||||
Stage = Phase.Charged;
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.PrepareThrow = true;
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (Stage == Phase.Charged)
|
||||
{
|
||||
ThrowPowerCharged();
|
||||
}
|
||||
else if (Stage == Phase.Confirm)
|
||||
{
|
||||
//确认蓄力结果,
|
||||
Debug.Log($"确认蓄力结果,ChargedProgress={ChargedProgress}");
|
||||
var par = new StateEnterParams();
|
||||
par.SetFloat(StateParamsConst.ChargedProgress, ChargedProgress);
|
||||
Player.ChangeState(PlayerState.Throw);
|
||||
Stage = Phase.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 蓄力中
|
||||
|
||||
private void ThrowPowerCharged()
|
||||
{
|
||||
if (ChargedProgress < 1)
|
||||
{
|
||||
ChargedProgress += Time.deltaTime;
|
||||
}
|
||||
else if (ChargedProgress > 1)
|
||||
{
|
||||
ChargedProgress = 1;
|
||||
}
|
||||
|
||||
if (!InputManager.IsOp1)
|
||||
{
|
||||
Stage = Phase.Confirm;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77cce716a7f94e0083789eb2953d5f79
|
||||
timeCreated: 1773064499
|
||||
@@ -0,0 +1,75 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStageViewThrow : PlayerStageViewBase
|
||||
{
|
||||
private bool _nextState = false;
|
||||
public float ChargedProgress;
|
||||
|
||||
protected override void OnEnter()
|
||||
{
|
||||
Log.Info("enter PlayerStateThrow");
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.StartThrow = true;
|
||||
|
||||
ChargedProgress = 0;
|
||||
if (Params != null)
|
||||
{
|
||||
ChargedProgress = Params.GetFloat(StateParamsConst.ChargedProgress);
|
||||
}
|
||||
|
||||
Debug.Log($"PlayerThrow ChargedProgress={ChargedProgress}");
|
||||
_nextState = false;
|
||||
// Stage = Phase.Waiting;
|
||||
|
||||
// _owner.Gears.Reel?.Unlock();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
CheckStateTimeout(10);
|
||||
if (_nextState)
|
||||
{
|
||||
// return (uint)PlayerState.Fishing;
|
||||
_nextState = false;
|
||||
Player.ChangeState(PlayerState.Fishing);
|
||||
}
|
||||
}
|
||||
|
||||
// IEnumerator ThrowCoroutine(float distance)
|
||||
// {
|
||||
// float startLength = 0.5f;
|
||||
// Debug.Log($"REST LENGTH : {rope.restLength}");
|
||||
// do
|
||||
// {
|
||||
// float a = Vector3.Distance(rodTipTarget.position, attachedBody.transform.position);
|
||||
// attachedBody.RBody.AddForce(playerForward.Value, ForceMode.VelocityChange);
|
||||
// startLength = Mathf.Max(a, startLength);
|
||||
// UnwindLine(attachedBody.RBody.linearVelocity.magnitude * Time.deltaTime);
|
||||
// yield return null;
|
||||
// }
|
||||
// while ((bool)isBailOpen);
|
||||
// }
|
||||
|
||||
#region 动画回调
|
||||
|
||||
/// <summary>
|
||||
/// 抛竿动画事件
|
||||
/// </summary>
|
||||
public void OnRodThrowStart()
|
||||
{
|
||||
Debug.LogError("OnRodThrowStart");
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.PrepareThrow = false;
|
||||
PlayerView.Unity.ModelAsset.PlayerAnimator.StartThrow = false;
|
||||
}
|
||||
|
||||
public void OnRodThrownEnd()
|
||||
{
|
||||
Debug.LogError("OnRodThrownEnd");
|
||||
_nextState = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 240bbc6c969a4d2e9759ac1df5e6ccf2
|
||||
timeCreated: 1773064512
|
||||
@@ -3,10 +3,11 @@ using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public abstract class FGearBase : PlayerMonoBehaviour
|
||||
public abstract class FGearBase : MonoBehaviour
|
||||
{
|
||||
public FRod Rod { get; protected set; }
|
||||
public ItemInfo ItemInfo;
|
||||
|
||||
public int ConfigId;
|
||||
|
||||
|
||||
public virtual void Init(FRod rod)
|
||||
@@ -15,9 +16,9 @@ namespace NBF
|
||||
OnInit();
|
||||
}
|
||||
|
||||
public void SetItemInfo(ItemInfo itemInfo)
|
||||
public void SetItemConfigId(int id)
|
||||
{
|
||||
ItemInfo = itemInfo;
|
||||
ConfigId = id;
|
||||
}
|
||||
|
||||
|
||||
9
Assets/Scripts/Fishing/New/View/Tackle/FHandItem.cs
Normal file
9
Assets/Scripts/Fishing/New/View/Tackle/FHandItem.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FHandItem : MonoBehaviour
|
||||
{
|
||||
public int ConfigId;
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,6 @@ namespace NBF
|
||||
|
||||
public RodAsset Asset;
|
||||
|
||||
public ItemInfo ItemInfo;
|
||||
|
||||
public FReel Reel;
|
||||
public FHook Hook;
|
||||
public FBobber Bobber;
|
||||
@@ -124,12 +122,12 @@ namespace NBF
|
||||
yield return 1;
|
||||
}
|
||||
|
||||
public IEnumerator InitRod(ItemInfo itemInfo)
|
||||
public IEnumerator InitRod(Player player, ItemBindInfo itemBindInfo)
|
||||
{
|
||||
ItemInfo = itemInfo;
|
||||
ConfigId = itemBindInfo.Item;
|
||||
// Player = player;
|
||||
|
||||
var playerView = Player.GetComponent<PlayerViewComponent>();
|
||||
var playerView = player.GetComponent<PlayerViewComponent>();
|
||||
|
||||
var playerViewUnity = playerView.Unity;
|
||||
|
||||
@@ -138,7 +136,7 @@ namespace NBF
|
||||
transform.localScale = Vector3.one;
|
||||
SceneSettings.Instance.GearNode.position = playerViewUnity.transform.position;
|
||||
yield return 1;
|
||||
var obj = new GameObject($"rod_{itemInfo.Id}_{itemInfo.ConfigId}");
|
||||
var obj = new GameObject($"rod_{ConfigId}");
|
||||
obj.transform.SetParent(SceneSettings.Instance.GearNode);
|
||||
// obj.transform.SetParent(player.transform);
|
||||
// obj.transform.localPosition = Vector3.zero;
|
||||
@@ -149,55 +147,55 @@ namespace NBF
|
||||
|
||||
var parent = GearRoot;
|
||||
|
||||
List<ItemInfo> children = RoleModel.Instance.GetBindItems(itemInfo.Id);
|
||||
// List<ItemInfo> children = RoleModel.Instance.GetBindItems(itemInfo.Id);
|
||||
|
||||
ItemInfo lineItemInfo = null;
|
||||
|
||||
CreateFishingHandler();
|
||||
yield return 1; //等待1帧
|
||||
// children.Sort();
|
||||
foreach (var child in children)
|
||||
foreach (var childConfigId in itemBindInfo.BindItems)
|
||||
{
|
||||
var itemType = child.ConfigId.GetItemType();
|
||||
var itemType = childConfigId.GetItemType();
|
||||
var config = Game.Tables.TbItem.Get(childConfigId);
|
||||
if (itemType == ItemType.Reel)
|
||||
{
|
||||
Reel = child.Config.InstantiateAndComponent<FReel>(Asset.ReelConnector, Vector3.zero,
|
||||
Reel = config.InstantiateAndComponent<FReel>(Asset.ReelConnector, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Reel.SetItemInfo(child);
|
||||
Reel.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Bobber)
|
||||
{
|
||||
Bobber = child.Config.InstantiateAndComponent<FBobber>(parent, Vector3.zero,
|
||||
Bobber = config.InstantiateAndComponent<FBobber>(parent, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Bobber.SetItemInfo(child);
|
||||
Bobber.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Hook)
|
||||
{
|
||||
Hook = child.Config.InstantiateAndComponent<FHook>(parent, Vector3.zero,
|
||||
Hook = config.InstantiateAndComponent<FHook>(parent, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Hook.SetItemInfo(child);
|
||||
Hook.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Bait)
|
||||
{
|
||||
Bait = child.Config.InstantiateAndComponent<FBait>(parent, Vector3.zero,
|
||||
Bait = config.InstantiateAndComponent<FBait>(parent, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Bait.SetItemInfo(child);
|
||||
Bait.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Lure)
|
||||
{
|
||||
Lure = child.Config.InstantiateAndComponent<FLure>(parent, Vector3.zero,
|
||||
Lure = config.InstantiateAndComponent<FLure>(parent, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Lure.SetItemInfo(child);
|
||||
Lure.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Weight)
|
||||
{
|
||||
Weight = child.Config.InstantiateAndComponent<FWeight>(parent, Vector3.zero,
|
||||
Weight = config.InstantiateAndComponent<FWeight>(parent, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
Weight.SetItemInfo(child);
|
||||
Weight.SetItemConfigId(childConfigId);
|
||||
}
|
||||
else if (itemType == ItemType.Line)
|
||||
{
|
||||
lineItemInfo = child;
|
||||
// lineItemInfo = child;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +249,8 @@ namespace NBF
|
||||
if (Line == null)
|
||||
{
|
||||
Debug.LogError("创建钓组=====");
|
||||
var rodType = (ItemSubType)ItemInfo.Config.Type;
|
||||
var itemConfig = Game.Tables.TbItem.Get(ConfigId);
|
||||
var rodType = (ItemSubType)itemConfig.Type;
|
||||
if (rodType == ItemSubType.RodTele)
|
||||
{
|
||||
CreateObiFishingLine(0);
|
||||
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FHandItem : PlayerMonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,233 +0,0 @@
|
||||
// using System.Collections;
|
||||
// using Fantasy;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace NBF
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 虚拟钓组
|
||||
// /// </summary>
|
||||
// public class FVirtualTackle
|
||||
// {
|
||||
// private ItemInfo _itemInfo;
|
||||
// private FPlayer _player;
|
||||
//
|
||||
//
|
||||
// public FRod Rod;
|
||||
//
|
||||
//
|
||||
// public FVirtualTackle(ItemInfo itemInfo, FPlayer player)
|
||||
// {
|
||||
// _itemInfo = itemInfo;
|
||||
// _player = player;
|
||||
// }
|
||||
//
|
||||
// public IEnumerator Create()
|
||||
// {
|
||||
// var parent = _player.transform;
|
||||
// // parent.position = _player.transform.position;
|
||||
//
|
||||
//
|
||||
// Rod = _itemInfo.Config.InstantiateAndComponent<FRod>(parent, Vector3.zero, Quaternion.identity);
|
||||
//
|
||||
//
|
||||
// // var rodObject = _itemInfo.Config.Instantiate(parent, Vector3.zero, Quaternion.identity);
|
||||
// // Rod = rodObject.GetComponent<FRod>();
|
||||
// // if (Rod == null)
|
||||
// // {
|
||||
// // Rod = rodObject.AddComponent<FRod>();
|
||||
// // }
|
||||
// // var rodConfig = RodConfig.Get(itemInfo.ConfigId);
|
||||
// // itemInfo.Config
|
||||
//
|
||||
// // var data = Player.Data.currentGear;
|
||||
// // var rodConfig = data.rod.Config;
|
||||
// // var cloneObj = rodConfig.Instantiate(parent, Vector3.zero, Player.MainArm.RodContainer.rotation);
|
||||
// // if (cloneObj == null)
|
||||
// // {
|
||||
// // yield break;
|
||||
// // }
|
||||
// //
|
||||
// // Rod = cloneObj.GetComponent<FRod>();
|
||||
// // if (Rod == null)
|
||||
// // {
|
||||
// // Rod = cloneObj.AddComponent<FRod>();
|
||||
// // }
|
||||
// //
|
||||
// //
|
||||
// // if (Rod)
|
||||
// // {
|
||||
// // Rod.transform.localPosition = Vector3.zero;
|
||||
// // Rod.transform.rotation = Player.MainArm.RodContainer.rotation;
|
||||
// //
|
||||
// // if (rodConfig.ring > 0)
|
||||
// // {
|
||||
// // var ringConfig = GameRings.Get(rodConfig.ring);
|
||||
// // var ringObject = ringConfig.Instantiate(Rod.transform);
|
||||
// // ringObject.SetActive(false);
|
||||
// // Rod.SetRing(ringObject.GetComponent<RodRingAsset>());
|
||||
// // }
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // yield break;
|
||||
// // }
|
||||
// //
|
||||
// // if (data.line != null)
|
||||
// // {
|
||||
// // var linePrefab = data.line.Config.Instantiate(parent);
|
||||
// // Line = linePrefab.GetComponent<FLine>();
|
||||
// // }
|
||||
// //
|
||||
// // if (data.reel != null)
|
||||
// // {
|
||||
// // var reelPrefab = data.reel.Config.Create(parent);
|
||||
// // Reel = reelPrefab.GetComponent<FReel>();
|
||||
// // }
|
||||
// //
|
||||
// // if (data.bobber != null)
|
||||
// // {
|
||||
// // var bobberPrefab = data.bobber.Config.Create(parent);
|
||||
// // Bobber = bobberPrefab.GetComponent<FFloat>();
|
||||
// // }
|
||||
// //
|
||||
// // if (data.hook != null)
|
||||
// // {
|
||||
// // var hookPrefab = data.hook.Config.Create(parent);
|
||||
// // Hook = hookPrefab.GetComponent<FHook>();
|
||||
// // }
|
||||
// //
|
||||
// // if (data.bait != null)
|
||||
// // {
|
||||
// // var baitPrefab = data.bait.Config.Create(parent);
|
||||
// //
|
||||
// // if (baitPrefab.TryGetComponent<FBait>(out var bait))
|
||||
// // {
|
||||
// // Bait = bait;
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // if (data.lure != null)
|
||||
// // {
|
||||
// // var baitPrefab = data.lure.Config.Create(parent);
|
||||
// // if (baitPrefab.TryGetComponent<FLure>(out var lure))
|
||||
// // {
|
||||
// // Lure = lure;
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// //
|
||||
// // if (data.weight != null)
|
||||
// // {
|
||||
// // var weightPrefab = data.weight.Config.Instantiate(parent);
|
||||
// // Weight = weightPrefab.GetComponent<FWeight>();
|
||||
// // }
|
||||
// //
|
||||
// // Debug.LogError("CreateOrHideGear");
|
||||
// // yield return 1;
|
||||
// // Rod.Initialize(Player, data.rod);
|
||||
// // Rod.CreateFishingHandler();
|
||||
// //
|
||||
// // if (Line)
|
||||
// // {
|
||||
// // Line.Initialize(Player, data.line);
|
||||
// //
|
||||
// //
|
||||
// // if ((bool)Rod.lineHandler.obiRopeSegment_1)
|
||||
// // {
|
||||
// // Rod.lineHandler.obiRopeSegment_1.GetComponent<MeshRenderer>().material =
|
||||
// // Line.lineMat;
|
||||
// // }
|
||||
// //
|
||||
// // if ((bool)Rod.lineHandler.obiRopeSegment_2)
|
||||
// // {
|
||||
// // Rod.lineHandler.obiRopeSegment_2.GetComponent<MeshRenderer>().material =
|
||||
// // Line.lineMat;
|
||||
// // }
|
||||
// //
|
||||
// // if ((bool)Rod.lineHandler.obiRopeSegment_3)
|
||||
// // {
|
||||
// // Rod.lineHandler.obiRopeSegment_3.GetComponent<MeshRenderer>().material =
|
||||
// // Line.lineMat;
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // if (Reel)
|
||||
// // {
|
||||
// // // Reel.maxReelStrength = data.reel.Config.strength;
|
||||
// // // Reel.reelingSpeed = 0.5f; //slotsEquip.reel.currentSpeed;
|
||||
// // Reel.reelingDrag = 0.699f; //slotsEquip.reel.currentDrag;
|
||||
// // Reel.transform.SetParent(Rod.rodAsset.ReelConnector);
|
||||
// // Reel.transform.localPosition = Vector3.zero;
|
||||
// // Reel.transform.localEulerAngles = Vector3.zero;
|
||||
// // // Reel.reelAsset.szpulaObject.GetComponent<MeshRenderer>().material = Line.szpulaMat;
|
||||
// // Reel.Initialize(Player, data.reel);
|
||||
// // }
|
||||
// //
|
||||
// // if (Bobber)
|
||||
// // {
|
||||
// // Bobber.floatDisplacement = data.bobber.Config.displacement;
|
||||
// // // if ((double)slotsEquip.ffloat.lastSetGroundValue > 0.2)
|
||||
// // // {
|
||||
// // // Bobber.newDeepth = slotsEquip.ffloat.lastSetGroundValue;
|
||||
// // // }
|
||||
// //
|
||||
// // Bobber.newDeepth = 0.5f;
|
||||
// //
|
||||
// // Bobber.Initialize(Player, data.bobber);
|
||||
// // Bobber.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
// // Bobber.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
// // Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
// // }
|
||||
// //
|
||||
// //
|
||||
// // if (Hook)
|
||||
// // {
|
||||
// // Hook.Initialize(Player, data.hook);
|
||||
// //
|
||||
// // Hook.transform.position = Rod.lineHandler.LineConnector_2.transform.position;
|
||||
// // Hook.transform.rotation = Rod.lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
|
||||
// // var target = Rod.lineHandler.LineConnector_2.GetComponent<Rigidbody>();
|
||||
// // var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
|
||||
// // // // 关键设置:关闭自动锚点计算,手动设置锚点
|
||||
// // // joint.autoConfigureConnectedAnchor = false;
|
||||
// // // joint.anchor = Vector3.zero; // 以 Hook 自身中心为锚点
|
||||
// // // joint.connectedAnchor = Vector3.zero; // 以目标物体的中心为锚点
|
||||
// // joint.connectedBody = target;
|
||||
// // // // 强制物理引擎立即更新变换(避免1帧延迟)
|
||||
// // // Physics.SyncTransforms();
|
||||
// // // joint.autoConfigureConnectedAnchor = false;
|
||||
// // // joint.anchor = Vector3.zero;
|
||||
// // // joint.connectedAnchor = Vector3.zero;
|
||||
// // Rod.LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
|
||||
// // }
|
||||
// //
|
||||
// // if (Bait)
|
||||
// // {
|
||||
// // Bait.Initialize(Player, data.bait);
|
||||
// // Bait.transform.position = Hook.hookAsset.baitConnector.position;
|
||||
// // Bait.transform.SetParent(Hook.hookAsset.baitConnector);
|
||||
// // }
|
||||
// //
|
||||
// // if (Lure)
|
||||
// // {
|
||||
// // Lure.Initialize(Player, data.bait);
|
||||
// // Lure.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
// // Lure.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
// // Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
// // Rod.LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
|
||||
// // }
|
||||
// //
|
||||
// // if (Weight)
|
||||
// // {
|
||||
// // Weight.weight = data.weight.Config.weight;
|
||||
// // Weight.Initialize(Player, data.weight);
|
||||
// // }
|
||||
// }
|
||||
//
|
||||
// public IEnumerator Destroy()
|
||||
// {
|
||||
// yield return 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4092f341d83540c0b6ba0e2db3669f1b
|
||||
timeCreated: 1766478162
|
||||
@@ -4876,7 +4876,7 @@ namespace Fantasy
|
||||
MessageObjectPool<AwardInfo>.Return(this);
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long ConfigId { get; set; }
|
||||
public int ConfigId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
@@ -4922,9 +4922,9 @@ namespace Fantasy
|
||||
MessageObjectPool<ItemBindInfo>.Return(this);
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long Item { get; set; }
|
||||
public int Item { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public List<long> BindItems { get; set; } = new List<long>();
|
||||
public List<int> BindItems { get; set; } = new List<int>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 物品信息
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ef2143da4eb4506bd2956385af09162
|
||||
timeCreated: 1732110071
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -12,26 +12,22 @@ Material:
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- CREST_FLOW_ON
|
||||
- d_Crest_NoMaskDepth
|
||||
- d_Dithering
|
||||
m_InvalidKeywords:
|
||||
- CREST_CAUSTICS_ON
|
||||
- CREST_FOAM_ON
|
||||
- _ALPHATEST_ON
|
||||
- _BUILTIN_ALPHATEST_ON
|
||||
- _BUILTIN_AlphaClip
|
||||
- _BUILTIN_SURFACE_TYPE_TRANSPARENT
|
||||
- _BUILTIN_TRANSPARENT_RECEIVES_SHADOWS
|
||||
- _DOUBLESIDED_ON
|
||||
- _EMISSION
|
||||
- _ENABLE_FOG_ON_TRANSPARENT
|
||||
- _REFRACTION_PLANE
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
- _TRANSPARENT_WRITES_MOTION_VEC
|
||||
m_LightmapFlags: 4
|
||||
m_LightmapFlags: 2
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
m_DoubleSidedGI: 1
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
@@ -51,7 +47,7 @@ Material:
|
||||
- _Crest_DitheringEnabled: 1
|
||||
- _Crest_Version: 0
|
||||
m_Floats:
|
||||
- CREST_FLOW: 1
|
||||
- CREST_FLOW: 0
|
||||
- _Crest_AmbientTerm: 1
|
||||
- _Crest_Anisotropy: 0.5
|
||||
- _Crest_CausticsDepthOfField: 6
|
||||
|
||||
Reference in New Issue
Block a user