This commit is contained in:
parent
0b71acdca4
commit
062ad030ee
|
@ -0,0 +1,33 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class ExtendedEvent : UnityEvent<float> { } //定义拓展的事件
|
||||||
|
public class ExtendedSlider : Slider, IBeginDragHandler, IEndDragHandler
|
||||||
|
{
|
||||||
|
public ExtendedEvent DragStart = new ExtendedEvent();
|
||||||
|
|
||||||
|
public ExtendedEvent DragStop = new ExtendedEvent();
|
||||||
|
|
||||||
|
public ExtendedEvent PointerDown = new ExtendedEvent();
|
||||||
|
public void OnBeginDrag(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
DragStart.Invoke(m_Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnEndDrag(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
DragStop.Invoke(m_Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnPointerDown(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
base.OnPointerDown(eventData);
|
||||||
|
PointerDown.Invoke(m_Value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 354647e2aa8b3e84a9705a7d1b14bfc9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue