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.
46 lines
1.3 KiB
46 lines
1.3 KiB
using AX.InputSystem; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
[RequireComponent(typeof(BaseGameObjInfo))] |
|
[RequireComponent(typeof(CreateStaticObjID))] |
|
public abstract class BaseSlider : MonoBehaviour { |
|
|
|
public virtual void OnEnable() |
|
{ |
|
GetComponent<Slider>().onValueChanged.AddListener(OnValueChanged); |
|
} |
|
|
|
public virtual void OnDisable() |
|
{ |
|
GetComponent<Slider>().onValueChanged.RemoveListener(OnValueChanged); |
|
} |
|
|
|
public virtual void OnDestroy() |
|
{ |
|
GetComponent<Slider>().onValueChanged.RemoveListener(OnValueChanged); |
|
} |
|
|
|
public void OnValueChanged(float value) |
|
{ |
|
var arg = new UISliderArgs(); |
|
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<Slider>().value = ((UISliderArgs)arg).value; |
|
} |
|
|
|
public abstract void RespondFun(float value); |
|
}
|
|
|