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.
47 lines
1.2 KiB
47 lines
1.2 KiB
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.isReplayMode) |
|
{ |
|
if (!GameSettings.othersSettings.isReplayPause && !GameSettings.othersSettings.isReplayOver) |
|
{ |
|
CursorManager.GetInstance.SetClick(arg); |
|
} |
|
} |
|
RespondFun(); |
|
} |
|
|
|
public abstract void RespondFun(); |
|
|
|
}
|
|
|