player
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FGear : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
223
Assets/Scripts/Fishing/Gear/FTackle.cs
Normal file
223
Assets/Scripts/Fishing/Gear/FTackle.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using System.Collections;
|
||||
using Fantasy;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 钓组
|
||||
/// </summary>
|
||||
public class FTackle : MonoBehaviour
|
||||
{
|
||||
private ItemInfo _itemInfo;
|
||||
|
||||
public static FTackle Create(ItemInfo itemInfo)
|
||||
{
|
||||
var root = SceneSettings.Instance.GearNode;
|
||||
var obj = new GameObject($"Rod_{itemInfo.ConfigId}").AddComponent<FTackle>();
|
||||
obj.transform.SetParent(root.transform);
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localRotation = Quaternion.identity;
|
||||
obj.transform.localScale = Vector3.one;
|
||||
return obj;
|
||||
}
|
||||
|
||||
public IEnumerator Show(ItemInfo itemInfo)
|
||||
{
|
||||
_itemInfo = itemInfo;
|
||||
yield return 1;
|
||||
|
||||
// var parent = GearParent;
|
||||
// parent.position = Player.transform.position;
|
||||
//
|
||||
// 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 Remove()
|
||||
{
|
||||
yield return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using NBC;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -48,6 +49,11 @@ namespace NBF
|
||||
{
|
||||
var index = int.Parse(action.Replace(InputDef.Player.QuickStarts, string.Empty));
|
||||
Log.Info($"快速使用===={index}");
|
||||
var item = RoleModel.Instance.GetSlotItem(index - 1);
|
||||
if (item != null)
|
||||
{
|
||||
Game.Instance.StartCoroutine(UseItem(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ECM2;
|
||||
using ECM2.Examples.FirstPerson;
|
||||
using Fantasy;
|
||||
using NBF.Fishing2;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -23,6 +26,9 @@ namespace NBF
|
||||
|
||||
public FPlayerData Data { get; private set; }
|
||||
|
||||
public readonly List<FTackle> Tackles = new List<FTackle>();
|
||||
public FTackle HandTackle { get; private set; }
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
Character = gameObject.GetComponent<CharacterMovement>();
|
||||
@@ -48,7 +54,6 @@ namespace NBF
|
||||
RemoveInputEvent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 角色模型
|
||||
|
||||
@@ -62,5 +67,29 @@ namespace NBF
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 使用物品
|
||||
|
||||
public IEnumerator UseItem(ItemInfo item)
|
||||
{
|
||||
var itemType = item?.ConfigId.GetItemType();
|
||||
if (itemType == ItemType.Rod)
|
||||
{
|
||||
if (HandTackle)
|
||||
{
|
||||
yield return HandTackle.Remove();
|
||||
Tackles.Remove(HandTackle);
|
||||
HandTackle = null;
|
||||
}
|
||||
|
||||
//判断旧的是否要收回
|
||||
var tackle = FTackle.Create(item);
|
||||
HandTackle = tackle;
|
||||
yield return tackle.Show(item);
|
||||
Tackles.Add(tackle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using FairyGUI;
|
||||
using Fantasy.Async;
|
||||
using NBC;
|
||||
using NBF.Fishing2;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
|
||||
namespace NBF
|
||||
|
||||
@@ -35,9 +35,8 @@ namespace NBF
|
||||
Info = response.RoleInfo;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 背包
|
||||
|
||||
public readonly List<ItemInfo> Items = new List<ItemInfo>();
|
||||
@@ -131,6 +130,7 @@ namespace NBF
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#region 数据操作
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALineRenderer_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003F80_003F9c0662cb_003FLineRenderer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F314938d17f3848e8ac683e11b27f62ee46ae00_003Fe8_003F01e5a04a_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMathf_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003Fdd_003F448b7101_003FMathf_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMonoBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003F57_003Fe1f1d73b_003FMonoBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3789ee403a53437cbb6b5d9ab6311f51573620_003F28_003Fb85198b6_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003F87_003F6890e286_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003F87_003F6890e286_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
Reference in New Issue
Block a user