You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
4 years ago
|
using AX.InputSystem;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
[RequireComponent(typeof(BaseGameObjInfo))]
|
||
|
[RequireComponent(typeof(CreateStaticObjID))]
|
||
|
[RequireComponent(typeof(Button))]
|
||
|
public abstract class BaseButton : MonoBehaviour
|
||
|
{
|
||
|
public virtual void OnEnable()
|
||
|
{
|
||
|
this.GetComponent<Button>().onClick.AddListener(OnClick);
|
||
|
}
|
||
|
|
||
|
public virtual void OnDisable()
|
||
|
{
|
||
|
this.GetComponent<Button>().onClick.RemoveListener(OnClick);
|
||
|
}
|
||
|
|
||
|
public virtual void OnDestroy()
|
||
|
{
|
||
|
this.GetComponent<Button>().onClick.RemoveListener(OnClick);
|
||
|
}
|
||
|
|
||
|
public void OnClick()
|
||
|
{
|
||
|
var arg = new CmdArgs();
|
||
|
arg.currentCursorPos = Input.mousePosition;
|
||
|
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "Click", arg);
|
||
|
//Click(arg);
|
||
|
RespondFun();
|
||
|
}
|
||
|
|
||
|
public void Click(CmdArgs arg)
|
||
|
{
|
||
|
if (GameSettings.othersSettings.playState != PlayState.None)
|
||
|
{
|
||
|
if (GameSettings.othersSettings.playState == PlayState.Playing)
|
||
|
{
|
||
|
CursorManager.GetInstance.SetClick(arg);
|
||
|
}
|
||
|
}
|
||
|
RespondFun();
|
||
|
}
|
||
|
|
||
|
public abstract void RespondFun();
|
||
|
|
||
|
}
|