This commit is contained in:
Bob.Song
2025-12-24 18:01:56 +08:00
parent 1ead9e6cc8
commit 875960d3fd
8 changed files with 263 additions and 20 deletions

View File

@@ -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));
}
}
}

View File

@@ -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
}
}