完成交互逻辑

This commit is contained in:
2025-05-20 00:22:31 +08:00
parent 84d13e8981
commit b0abc1c30a
63 changed files with 42664 additions and 42166 deletions

View File

@@ -11,14 +11,12 @@ namespace NBF
public override string UIPackName => "Fishing";
public override string UIResName => "FishingPanel";
protected override void OnInit()
{
base.OnInit();
}
protected override void OnShow()
{
base.OnShow();
InputManager.OnInteractiveObjectAction += OnInteractiveObjectAction;
InputManager.OnUseAction += OnUseAction;
InputManager.OnUse2Action += OnUse2Action;
}
protected override void OnUpdate()
@@ -27,14 +25,41 @@ namespace NBF
TextFPS.text = SceneSettings.Instance.FPS.ToString(CultureInfo.InvariantCulture);
}
private void OnInteractiveObjectAction(InteractiveObject interactiveObject)
{
if (interactiveObject != null)
{
Interactive.visible = true;
Interactive.SetData(interactiveObject);
}
else
{
Interactive.visible = false;
}
}
private void OnUseAction()
{
if (Interactive.visible)
{
Interactive.Use1();
}
}
private void OnUse2Action()
{
if (Interactive.visible)
{
Interactive.Use2();
}
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnDestroy()
{
base.OnDestroy();
InputManager.OnInteractiveObjectAction -= OnInteractiveObjectAction;
InputManager.OnUseAction -= OnUseAction;
InputManager.OnUse2Action -= OnUse2Action;
}
}
}