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.4 KiB
48 lines
1.4 KiB
using AX.InputSystem; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
[RequireComponent(typeof(BaseGameObjInfo))] |
|
[RequireComponent(typeof(CreateStaticObjID))] |
|
public abstract class BaseScrollBar : MonoBehaviour { |
|
|
|
|
|
public virtual void OnEnable() |
|
{ |
|
GetComponent<Scrollbar>().onValueChanged.AddListener(OnValueChanged); |
|
} |
|
|
|
public virtual void OnDisable() |
|
{ |
|
GetComponent<Scrollbar>().onValueChanged.RemoveListener(OnValueChanged); |
|
} |
|
|
|
public virtual void OnDestroy() |
|
{ |
|
GetComponent<Scrollbar>().onValueChanged.RemoveListener(OnValueChanged); |
|
} |
|
|
|
|
|
public void OnValueChanged(float value) |
|
{ |
|
var arg = new UIScrollBarArgs(); |
|
arg.value = value; |
|
arg.currentCursorPos = Input.mousePosition; |
|
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "ValueChanged", arg); |
|
//ValueChanged(arg); |
|
RespondFun(value); |
|
} |
|
|
|
public void ValueChanged(CmdArgs arg) |
|
{ |
|
if (GameSettings.othersSettings.isReplayMode) |
|
{ |
|
if (!GameSettings.othersSettings.isReplayPause && !GameSettings.othersSettings.isReplayOver) |
|
{ |
|
CursorManager.GetInstance.SetClick(arg); |
|
} |
|
} |
|
GetComponent<Scrollbar>().value = ((UIScrollBarArgs)arg).value; |
|
} |
|
|
|
public abstract void RespondFun(float value); |
|
}
|
|
|