94 lines
2.0 KiB
C#
94 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HighlightPlus;
|
|
using UnityEngine.EventSystems;
|
|
|
|
/// <summary>
|
|
/// ³£×¤½»»¥
|
|
/// </summary>
|
|
public class PermanentTriggerBase : MonoBehaviour
|
|
{
|
|
public int triggerID;
|
|
public string triggerName;
|
|
public HighlightEffect _highlight;
|
|
private void Awake()
|
|
{
|
|
OnAwake();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
OnStart();
|
|
}
|
|
private void SwitchSubProcessStepTriggerID(string arg0)
|
|
{
|
|
if (_highlight == null) return;
|
|
if (triggerName == arg0)
|
|
{
|
|
_highlight.SetHighlighted(true);
|
|
}
|
|
else
|
|
{
|
|
_highlight.SetHighlighted(false);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// Awake
|
|
/// </summary>
|
|
protected virtual void OnAwake()
|
|
{
|
|
if (GetComponent<HighlightEffect>())
|
|
_highlight = GetComponent<HighlightEffect>();
|
|
}
|
|
/// <summary>
|
|
/// Start
|
|
/// </summary>
|
|
protected virtual void OnStart()
|
|
{
|
|
GameManager.EventMgr.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
|
}
|
|
private void OnMouseEnter()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject()) return;
|
|
OnMEnter();
|
|
}
|
|
private void OnMouseDown()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject()) return;
|
|
OnMDown();
|
|
}
|
|
|
|
private void OnMouseExit()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject()) return;
|
|
OnMExit();
|
|
}
|
|
|
|
protected virtual void OnMEnter()
|
|
{
|
|
|
|
}
|
|
protected virtual void OnMDown()
|
|
{
|
|
|
|
}
|
|
protected virtual void OnMExit()
|
|
{
|
|
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
|
}
|
|
private void OnDisable()
|
|
{
|
|
GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
|
}
|
|
|
|
|
|
|
|
}
|