65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
|
|
|
using System.Globalization;
|
|
using UnityEngine;
|
|
using NBC;
|
|
|
|
namespace NBF
|
|
{
|
|
public partial class FishingPanel : UIPanel
|
|
{
|
|
public override string UIPackName => "Fishing";
|
|
public override string UIResName => "FishingPanel";
|
|
|
|
protected override void OnShow()
|
|
{
|
|
base.OnShow();
|
|
InputManager.OnInteractiveObjectAction += OnInteractiveObjectAction;
|
|
InputManager.OnUseAction += OnUseAction;
|
|
InputManager.OnUse2Action += OnUse2Action;
|
|
}
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
if (!SceneSettings.Instance) return;
|
|
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();
|
|
InputManager.OnInteractiveObjectAction -= OnInteractiveObjectAction;
|
|
InputManager.OnUseAction -= OnUseAction;
|
|
InputManager.OnUse2Action -= OnUse2Action;
|
|
}
|
|
}
|
|
} |