78 lines
2.1 KiB
C#
78 lines
2.1 KiB
C#
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
|
|
|
using System.Globalization;
|
|
using UnityEngine;
|
|
using NBC;
|
|
|
|
namespace NBF
|
|
{
|
|
public partial class FishingPanel : UIPanel
|
|
{
|
|
protected override void OnInit()
|
|
{
|
|
IsShowCursor = false;
|
|
IsDontBack = true;
|
|
}
|
|
|
|
protected override void OnShow()
|
|
{
|
|
InputManager.OnUICanceled += OnUICanceled;
|
|
InputManager.OnInteractiveObjectAction += OnInteractiveObjectAction;
|
|
InputManager.OnPlayerCanceled += OnPlayerCanceled;
|
|
// 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 OnUICanceled(string action)
|
|
{
|
|
if (action == InputDef.UI.Back)
|
|
{
|
|
if (!IsTop) return;
|
|
// HomePanel.Show();
|
|
}
|
|
}
|
|
|
|
private void OnPlayerCanceled(string action)
|
|
{
|
|
if (Interactive.visible)
|
|
{
|
|
if (action == "Use1")
|
|
{
|
|
Interactive.Use1();
|
|
}
|
|
else if (action == "Use2")
|
|
{
|
|
Interactive.Use2();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
{
|
|
base.OnHide();
|
|
InputManager.OnUICanceled -= OnUICanceled;
|
|
InputManager.OnInteractiveObjectAction -= OnInteractiveObjectAction;
|
|
InputManager.OnUICanceled -= OnPlayerCanceled;
|
|
}
|
|
}
|
|
} |