完成交互逻辑
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user