提交
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class Gsss
|
||||
{
|
||||
public Action onFinish;
|
||||
private List<TaskProcedure> taskList;
|
||||
private bool isCancel = false;
|
||||
|
||||
public int Count => taskList.Count;
|
||||
|
||||
public Gsss()
|
||||
{
|
||||
taskList = new List<TaskProcedure>();
|
||||
}
|
||||
|
||||
public Gsss(Action onFinish)
|
||||
{
|
||||
taskList = new List<TaskProcedure>();
|
||||
this.onFinish = onFinish;
|
||||
}
|
||||
|
||||
public Gsss Add(Action<TaskProcedure> taskFunc)
|
||||
{
|
||||
TaskProcedure task = new TaskProcedure();
|
||||
task.Gsss = this;
|
||||
task.onTaskFunc = taskFunc;
|
||||
taskList.Add(task);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss Add(bool result, Action<TaskProcedure> trueTaskFunc)
|
||||
{
|
||||
if (!result) return this;
|
||||
return Add(trueTaskFunc);
|
||||
}
|
||||
|
||||
public Gsss Add(bool result, Action<TaskProcedure> trueTaskFunc, Action<TaskProcedure> falseTaskFunc)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
return Add(trueTaskFunc);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Add(falseTaskFunc);
|
||||
}
|
||||
}
|
||||
|
||||
public Gsss Add(float delayTime, Action<TaskProcedure> taskFunc)
|
||||
{
|
||||
TaskProcedure task = new TaskProcedure();
|
||||
task.Gsss = this;
|
||||
task.onTaskFunc = (taskParam) => { TimerHelper.mEasy.AddTimer(delayTime, () => { taskFunc(task); }); };
|
||||
taskList.Add(task);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss AddDelay(float delayTime)
|
||||
{
|
||||
TaskProcedure task = new TaskProcedure();
|
||||
task.Gsss = this;
|
||||
task.onTaskFunc = (taskParam) =>
|
||||
{
|
||||
TimerHelper.mEasy.AddTimer(delayTime, () =>
|
||||
{
|
||||
if (task.onComplete != null)
|
||||
{
|
||||
task.onComplete();
|
||||
}
|
||||
});
|
||||
};
|
||||
taskList.Add(task);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss Run(float delayTime)
|
||||
{
|
||||
TimerHelper.mEasy.AddTimer(delayTime, () => Run());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss Run()
|
||||
{
|
||||
if (isCancel)
|
||||
return null;
|
||||
for (int i = 0; i < taskList.Count - 1; i++)
|
||||
{
|
||||
int index = i;
|
||||
int nextIndex = index + 1;
|
||||
taskList[index].onComplete = () => taskList[nextIndex].onTaskFunc(taskList[nextIndex]);
|
||||
}
|
||||
|
||||
if (taskList.Count > 0)
|
||||
{
|
||||
taskList[taskList.Count - 1].onComplete = onFinish;
|
||||
taskList[0].onTaskFunc(taskList[0]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss Clear()
|
||||
{
|
||||
onFinish = null;
|
||||
foreach (TaskProcedure task in taskList)
|
||||
{
|
||||
task.Dispose();
|
||||
}
|
||||
|
||||
taskList.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Gsss Cancel()
|
||||
{
|
||||
isCancel = true;
|
||||
Clear();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class TaskProcedure
|
||||
{
|
||||
public Gsss Gsss;
|
||||
public Action<TaskProcedure> onTaskFunc;
|
||||
public Action onComplete;
|
||||
|
||||
public void InvokeComplete()
|
||||
{
|
||||
if (onComplete != null)
|
||||
{
|
||||
onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
public void DelayInvokeComplete(float delayTime)
|
||||
{
|
||||
TimerHelper.mEasy.AddTimer(delayTime, InvokeComplete);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Gsss = null;
|
||||
onTaskFunc = null;
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa7436b18ddf94d44b141a67425a0759
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class HRsac
|
||||
{
|
||||
public static string[] UnitSuffixs =
|
||||
{
|
||||
"", "K", "M", "B", "T", "aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj ", "ak", "al", "am", "an",
|
||||
"ao", "ap", "aq", "ar", "as", "at", "au", "av", "aw", "ax", "ay", "az", "ba", "bb", "bc", "bd", "be", "bf",
|
||||
"bg", "bh", "bi", "bj", "bk", "bl", "bm", "bn", "bo", "bp", "bq", "br", "bs", "bt", "bu", "bv", "bw", "bx",
|
||||
"by", "bz", "ca", "cb", "cc", "cd", "ce", "cf", "cg", "ch", "ci", "cj", "ck", "cl", "cm", "cn", "co", "cp",
|
||||
"cq", "cr", "cs", "ct", "cu", "cv", "cw", "cx", "cy", "da", "db", "dc", "dd", "de", "df", "dg", "dh", "di",
|
||||
"dj", "dk", "dl", "dm", "dn", "do", "dp", "dq", "dr", "ds", "dt", "du", "dv", "dw", "dx", "dy"
|
||||
};
|
||||
|
||||
#region 最新需求
|
||||
|
||||
public static int GetDigitNumber(double value)
|
||||
{
|
||||
int count = 0;
|
||||
while (value > 1)
|
||||
{
|
||||
count++;
|
||||
value = value / 10;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#endregion 最新需求
|
||||
|
||||
|
||||
public static string ConvertUnit(int value)
|
||||
{
|
||||
int unit = GetDigitNumber(value);
|
||||
if (unit > 0)
|
||||
{
|
||||
unit--;
|
||||
}
|
||||
|
||||
int unitIdx = 0;
|
||||
if (unit >= 6)
|
||||
{
|
||||
unitIdx = (int)Mathf.Ceil(unit / 3) - 1;
|
||||
}
|
||||
|
||||
unitIdx = Mathf.Min(unitIdx, UnitSuffixs.Length - 1);
|
||||
|
||||
float baseNum = Mathf.Pow(10, unitIdx * 3);
|
||||
string numToShow = Mathf.Ceil(value / baseNum).ToString();
|
||||
string numToShowString = string.Empty;
|
||||
int j = 0;
|
||||
for (int i = numToShow.Length - 1; i >= 0; i--)
|
||||
{
|
||||
j++;
|
||||
numToShowString = numToShow[i] + numToShowString;
|
||||
if (i != 0 && j % 3 == 0)
|
||||
{
|
||||
numToShowString = "," + numToShowString;
|
||||
}
|
||||
}
|
||||
|
||||
return numToShowString + UnitSuffixs[unitIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d812f124e53f2548bc7aba6bf278bc7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
public static class Havva
|
||||
{
|
||||
|
||||
static Havva()
|
||||
{
|
||||
JsonConvert.DefaultSettings = () => { return DefaultUseJsonSettings; };
|
||||
}
|
||||
|
||||
private static JsonSerializerSettings DefaultUseJsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.None,
|
||||
|
||||
|
||||
DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
|
||||
|
||||
DateFormatString = "yyyy/MM/dd hh:mm:ss",
|
||||
};
|
||||
|
||||
public static string ToJson(object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj, DefaultUseJsonSettings);
|
||||
}
|
||||
|
||||
public static T ToObject<T>(string json)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 094e748a04f77844d960e9e2d87e6559
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public static class Jsvva
|
||||
{
|
||||
public static float NormalTimeScale = 1;
|
||||
|
||||
public static void SetTimeScale(float timeScale)
|
||||
{
|
||||
Time.timeScale = timeScale;
|
||||
AppDispatcher.Instance.Dispatch(CsjInfoC.TimeScale_Change, timeScale);
|
||||
}
|
||||
|
||||
public static float GetTimeScale()
|
||||
{
|
||||
return Time.timeScale;
|
||||
}
|
||||
|
||||
public static float GetDeltaTime(bool isUnscale)
|
||||
{
|
||||
if (isUnscale)
|
||||
{
|
||||
return Time.unscaledDeltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
public static Tweener SetUnscaledTime(Tweener tweener)
|
||||
{
|
||||
tweener.SetUpdate(true);
|
||||
return tweener;
|
||||
}
|
||||
|
||||
public static Animator SetUnscaledTime(Animator animator)
|
||||
{
|
||||
animator.updateMode = AnimatorUpdateMode.UnscaledTime;
|
||||
return animator;
|
||||
}
|
||||
|
||||
public static void SetParticleUnscaledTime(GameObject gameObject)
|
||||
{
|
||||
gameObject.AddComponent<Lucsah>();
|
||||
}
|
||||
|
||||
public static IEnumerator PlayAnimation(Animation animation, string clipName, Action onComplete,
|
||||
bool isUnscaleTime)
|
||||
{
|
||||
if (!isUnscaleTime)
|
||||
{
|
||||
var currState = animation[clipName];
|
||||
var isPlaying = true;
|
||||
var progressTime = 0f;
|
||||
var timeAtLastFrame = 0f;
|
||||
var timeAtCurrentFrame = 0f;
|
||||
var deltaTime = 0f;
|
||||
animation.Play(clipName);
|
||||
timeAtLastFrame = Time.realtimeSinceStartup;
|
||||
|
||||
while (isPlaying)
|
||||
{
|
||||
timeAtCurrentFrame = Time.realtimeSinceStartup;
|
||||
deltaTime = timeAtCurrentFrame - timeAtLastFrame;
|
||||
timeAtLastFrame = timeAtCurrentFrame;
|
||||
|
||||
progressTime += deltaTime;
|
||||
currState.normalizedTime = progressTime / currState.length;
|
||||
animation.Sample();
|
||||
if (progressTime >= currState.length)
|
||||
{
|
||||
if (currState.wrapMode != WrapMode.Loop)
|
||||
{
|
||||
isPlaying = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
progressTime = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
yield return null;
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
animation.Play(clipName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b8c681dfcbb0e54f9e1c5100d3e3073
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f071f4f98482cb4ea09fbf4ed3bbfe4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,148 @@
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public static class TimerHelper
|
||||
{
|
||||
private static string name = "TimerHelper";
|
||||
|
||||
#region Time
|
||||
|
||||
private static YFsa _sYFsa;
|
||||
private static Psvsa _psvsa;
|
||||
private static UFdsa _sUFdsa;
|
||||
|
||||
public static YFsa mEasy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sYFsa == null)
|
||||
{
|
||||
_sYFsa = TimerI.Instance.CreateSimpleTimer(name, TimerTimeType.Time);
|
||||
}
|
||||
|
||||
return _sYFsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static Psvsa General
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_psvsa == null)
|
||||
{
|
||||
_psvsa = TimerI.Instance.CreateTimer(name, TimerTimeType.Time);
|
||||
}
|
||||
|
||||
return _psvsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static UFdsa mNormal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sUFdsa == null)
|
||||
{
|
||||
_sUFdsa = TimerI.Instance.CreateHeavyTimer(name, TimerTimeType.Time);
|
||||
}
|
||||
|
||||
return _sUFdsa;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UnscaledTime
|
||||
|
||||
private static YFsa _sUnscaledYFsa;
|
||||
private static Psvsa _unscaledPsvsa;
|
||||
private static UFdsa _sUnscaledUFdsa;
|
||||
|
||||
public static YFsa mUnscaleEasy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sUnscaledYFsa == null)
|
||||
{
|
||||
_sUnscaledYFsa = TimerI.Instance.CreateSimpleTimer(name, TimerTimeType.UnscaledTime);
|
||||
}
|
||||
|
||||
return _sUnscaledYFsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static Psvsa UnscaleGeneral
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_unscaledPsvsa == null)
|
||||
{
|
||||
_unscaledPsvsa = TimerI.Instance.CreateTimer(name, TimerTimeType.UnscaledTime);
|
||||
}
|
||||
|
||||
return _unscaledPsvsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static UFdsa mUnscaleNormal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sUnscaledUFdsa == null)
|
||||
{
|
||||
_sUnscaledUFdsa = TimerI.Instance.CreateHeavyTimer(name, TimerTimeType.UnscaledTime);
|
||||
}
|
||||
|
||||
return _sUnscaledUFdsa;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RealtimeSinceStartup
|
||||
|
||||
private static YFsa _sRealYFsa;
|
||||
private static Psvsa _realPsvsa;
|
||||
private static UFdsa _sRealUFdsa;
|
||||
|
||||
public static YFsa mRealEasy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sRealYFsa == null)
|
||||
{
|
||||
_sRealYFsa = TimerI.Instance.CreateSimpleTimer(name, TimerTimeType.RealtimeSinceStartup);
|
||||
}
|
||||
|
||||
return _sRealYFsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static Psvsa RealGeneral
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_realPsvsa == null)
|
||||
{
|
||||
_realPsvsa = TimerI.Instance.CreateTimer(name, TimerTimeType.RealtimeSinceStartup);
|
||||
}
|
||||
|
||||
return _realPsvsa;
|
||||
}
|
||||
}
|
||||
|
||||
public static UFdsa mRealNormal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sRealUFdsa == null)
|
||||
{
|
||||
_sRealUFdsa = TimerI.Instance.CreateHeavyTimer(name, TimerTimeType.RealtimeSinceStartup);
|
||||
}
|
||||
|
||||
return _sRealUFdsa;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 889a363446c9d38489732b45d60696c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,247 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class Psvsagh
|
||||
{
|
||||
private Psvsa _psvsa;
|
||||
|
||||
public int repeatCount;
|
||||
public float interval;
|
||||
private Action<Psvsagh> onCallBack;
|
||||
public object[] args;
|
||||
public float time;
|
||||
public bool isActive = true;
|
||||
public bool isFrameUpdate = false;
|
||||
|
||||
public Psvsagh(Psvsa psvsa, float interval, Action<Psvsagh> onCallBack, params object[] args)
|
||||
{
|
||||
this._psvsa = psvsa;
|
||||
|
||||
repeatCount = 1;
|
||||
this.interval = interval;
|
||||
this.onCallBack = onCallBack;
|
||||
this.args = args;
|
||||
time = psvsa.GetTriggerTime(interval);
|
||||
}
|
||||
|
||||
public Psvsagh(Psvsa psvsa, int repeatCount, float interval, Action<Psvsagh> onCallBack,
|
||||
params object[] args)
|
||||
{
|
||||
this._psvsa = psvsa;
|
||||
|
||||
this.repeatCount = repeatCount;
|
||||
this.interval = interval;
|
||||
this.onCallBack = onCallBack;
|
||||
this.args = args;
|
||||
time = psvsa.GetTriggerTime(interval);
|
||||
}
|
||||
|
||||
public Psvsagh(Psvsa psvsa, Action<Psvsagh> onCallBack, params object[] args)
|
||||
{
|
||||
this._psvsa = psvsa;
|
||||
|
||||
this.onCallBack = onCallBack;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void SetActive(bool isActive)
|
||||
{
|
||||
if (this.isActive == isActive) return;
|
||||
|
||||
this.isActive = isActive;
|
||||
if (!isFrameUpdate)
|
||||
{
|
||||
if (this.isActive)
|
||||
{
|
||||
time = _psvsa.GetTriggerTime(interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CallFunc()
|
||||
{
|
||||
onCallBack?.Invoke(this);
|
||||
}
|
||||
|
||||
public void Kill(bool needComplete = false)
|
||||
{
|
||||
if (needComplete)
|
||||
{
|
||||
CallFunc();
|
||||
}
|
||||
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_psvsa.RemoveTimer(this);
|
||||
}
|
||||
|
||||
public static implicit operator bool(Psvsagh psvsagh)
|
||||
{
|
||||
return null != psvsagh;
|
||||
}
|
||||
}
|
||||
|
||||
public class Psvsa : MonoBehaviour
|
||||
{
|
||||
public const int INFINITE_LOOP = -1;
|
||||
|
||||
private List<Psvsagh> timerTaskList = new();
|
||||
private List<Psvsagh> timerTaskTriggers = new();
|
||||
|
||||
[SerializeField] private string timerName;
|
||||
private TimerTimeType type = TimerTimeType.Null;
|
||||
|
||||
public void SetTimer(string name, TimerTimeType type)
|
||||
{
|
||||
this.timerName = name + "_" + type;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private float GetTime()
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
TimerTimeType.Time => Time.time,
|
||||
TimerTimeType.UnscaledTime => Time.unscaledTime,
|
||||
TimerTimeType.RealtimeSinceStartup => Time.realtimeSinceStartup,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (timerTaskList.Count > 0)
|
||||
{
|
||||
timerTaskTriggers.Clear();
|
||||
foreach (var timerTask in timerTaskList.Where(timerTask => timerTask.isActive))
|
||||
{
|
||||
if (timerTask.isFrameUpdate)
|
||||
{
|
||||
timerTaskTriggers.Add(timerTask);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timerTask.time <= GetTime())
|
||||
{
|
||||
timerTaskTriggers.Add(timerTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var triggerTimerTask in timerTaskTriggers)
|
||||
{
|
||||
if (triggerTimerTask.repeatCount != INFINITE_LOOP)
|
||||
{
|
||||
triggerTimerTask.repeatCount--;
|
||||
}
|
||||
|
||||
if (triggerTimerTask.repeatCount == 0)
|
||||
{
|
||||
timerTaskList.Remove(triggerTimerTask);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!triggerTimerTask.isFrameUpdate)
|
||||
{
|
||||
triggerTimerTask.time = GetTriggerTime(triggerTimerTask.interval);
|
||||
}
|
||||
}
|
||||
|
||||
triggerTimerTask.CallFunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Psvsagh AddTimer(float interval, Action<Psvsagh> onCallBack, params object[] args)
|
||||
{
|
||||
var timeTask = new Psvsagh(this, interval, onCallBack, args);
|
||||
AddTimer(timeTask);
|
||||
return timeTask;
|
||||
}
|
||||
|
||||
public Psvsagh AddRepeatTimer(int repeatCount, float interval, Action<Psvsagh> onCallBack,
|
||||
params object[] args)
|
||||
{
|
||||
var timeTask = new Psvsagh(this, repeatCount, interval, onCallBack, args);
|
||||
AddTimer(timeTask);
|
||||
return timeTask;
|
||||
}
|
||||
|
||||
public Psvsagh AddLoopTimer(float interval, Action<Psvsagh> onCallBack, params object[] args)
|
||||
{
|
||||
var timeTask = new Psvsagh(this, INFINITE_LOOP, interval, onCallBack, args);
|
||||
AddTimer(timeTask);
|
||||
return timeTask;
|
||||
}
|
||||
|
||||
public Psvsagh AddFrameUpdateTimer(Action<Psvsagh> onCallBack, params object[] args)
|
||||
{
|
||||
var timeTask = new Psvsagh(this, onCallBack, args)
|
||||
{
|
||||
repeatCount = INFINITE_LOOP,
|
||||
isFrameUpdate = true
|
||||
};
|
||||
AddTimer(timeTask);
|
||||
return timeTask;
|
||||
}
|
||||
|
||||
public void AddTimer(Psvsagh psvsagh)
|
||||
{
|
||||
if (null != psvsagh)
|
||||
{
|
||||
if (!psvsagh.isFrameUpdate)
|
||||
{
|
||||
if (psvsagh.interval <= 0)
|
||||
{
|
||||
psvsagh.CallFunc();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
timerTaskList.Add(psvsagh);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveTimer(Psvsagh psvsagh)
|
||||
{
|
||||
if (psvsagh == null) return;
|
||||
if (timerTaskList == null) return;
|
||||
if (timerTaskList.Count == 0) return;
|
||||
|
||||
if (timerTaskList.Contains(psvsagh))
|
||||
{
|
||||
timerTaskList.Remove(psvsagh);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
timerTaskList.Clear();
|
||||
timerTaskTriggers.Clear();
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
public float GetTriggerTime(float interval)
|
||||
{
|
||||
return GetTime() + interval;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearAll();
|
||||
timerTaskList = null;
|
||||
timerTaskTriggers = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1af09b65e6897dd4e8adcb89203638d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class UFdsa : MonoBehaviour
|
||||
{
|
||||
private class TimerTask
|
||||
{
|
||||
private UFdsa _mUFdsa;
|
||||
|
||||
private string name;
|
||||
private TimerMode mode;
|
||||
private float startTime;
|
||||
private float duration;
|
||||
|
||||
private bool isBreak = false;
|
||||
private float breakStart;
|
||||
private float breakDuration = 0;
|
||||
|
||||
private Action timerEvent;
|
||||
private Action<object[]> timerArgsEvent;
|
||||
private object[] args = null;
|
||||
|
||||
public float TimeLeft => Mathf.Max(0f, duration - (_mUFdsa.GetTime() - startTime) + breakDuration);
|
||||
|
||||
public TimerTask(UFdsa uFdsa, string name, TimerMode mode, float startTime, float duration,
|
||||
Action handler)
|
||||
{
|
||||
this._mUFdsa = uFdsa;
|
||||
|
||||
this.name = name;
|
||||
this.mode = mode;
|
||||
this.startTime = startTime;
|
||||
this.duration = duration;
|
||||
timerEvent = handler;
|
||||
}
|
||||
|
||||
public TimerTask(UFdsa uFdsa, string name, TimerMode mode, float startTime, float duration,
|
||||
Action<object[]> handler, params object[] args)
|
||||
{
|
||||
this._mUFdsa = uFdsa;
|
||||
|
||||
this.name = name;
|
||||
this.mode = mode;
|
||||
this.startTime = startTime;
|
||||
this.duration = duration;
|
||||
timerArgsEvent = handler;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
if (isBreak)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TimeLeft > 0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == TimerMode.Normal)
|
||||
{
|
||||
_mUFdsa.RemoveTimer(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
startTime = _mUFdsa.GetTime();
|
||||
breakDuration = 0;
|
||||
}
|
||||
|
||||
timerEvent?.Invoke();
|
||||
timerArgsEvent?.Invoke(args);
|
||||
}
|
||||
|
||||
public void Break()
|
||||
{
|
||||
if (isBreak)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
isBreak = true;
|
||||
breakStart = _mUFdsa.GetTime();
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
if (!isBreak)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
breakDuration += (_mUFdsa.GetTime() - breakStart);
|
||||
isBreak = false;
|
||||
}
|
||||
|
||||
public static implicit operator bool(TimerTask timerTask)
|
||||
{
|
||||
return null != timerTask;
|
||||
}
|
||||
}
|
||||
|
||||
private enum TimerMode
|
||||
{
|
||||
Normal,
|
||||
Repeat,
|
||||
}
|
||||
|
||||
private Dictionary<string, TimerTask> addTimerList = new();
|
||||
private Dictionary<string, TimerTask> timerList = new();
|
||||
private List<string> destroyTimerList = new();
|
||||
|
||||
[SerializeField] private string timerName;
|
||||
private TimerTimeType type = TimerTimeType.Null;
|
||||
|
||||
public void SetTimer(string name, TimerTimeType type)
|
||||
{
|
||||
timerName = name + "_" + type;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private float GetTime()
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
TimerTimeType.Time => Time.time,
|
||||
TimerTimeType.UnscaledTime => Time.unscaledTime,
|
||||
TimerTimeType.RealtimeSinceStartup => Time.realtimeSinceStartup,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (destroyTimerList.Count > 0)
|
||||
{
|
||||
foreach (var i in destroyTimerList)
|
||||
{
|
||||
timerList.Remove(i);
|
||||
}
|
||||
|
||||
destroyTimerList.Clear();
|
||||
}
|
||||
|
||||
if (addTimerList.Count > 0)
|
||||
{
|
||||
foreach (var i in addTimerList.Where(i => i.Value != null))
|
||||
{
|
||||
timerList[i.Key] = i.Value;
|
||||
}
|
||||
|
||||
addTimerList.Clear();
|
||||
}
|
||||
|
||||
if (timerList.Count > 0)
|
||||
{
|
||||
foreach (var timer in timerList.Values)
|
||||
{
|
||||
if (timer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
timer.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddTimer(string key, float duration, Action handler)
|
||||
{
|
||||
return InternalAddTimer(key, TimerMode.Normal, duration, handler);
|
||||
}
|
||||
|
||||
public bool AddTimer(string key, float duration, Action<object[]> handler, params object[] args)
|
||||
{
|
||||
return InternalAddTimer(key, TimerMode.Normal, duration, handler, args);
|
||||
}
|
||||
|
||||
public bool AddRepeatTimer(string key, float duration, Action handler)
|
||||
{
|
||||
return InternalAddTimer(key, TimerMode.Repeat, duration, handler);
|
||||
}
|
||||
|
||||
public bool AddRepeatTimer(string key, float duration, Action<object[]> handler, params object[] args)
|
||||
{
|
||||
return InternalAddTimer(key, TimerMode.Repeat, duration, handler, args);
|
||||
}
|
||||
|
||||
private bool InternalAddTimer(string key, TimerMode mode, float duration, Action handler)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (duration <= 0.0f)
|
||||
{
|
||||
if (mode == TimerMode.Normal)
|
||||
{
|
||||
handler();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[HeavyTimer]Add Repeat Timer Error: Time is Not Greater Than Zero");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var timer = new TimerTask(this, key, mode, GetTime(), duration, handler);
|
||||
addTimerList[key] = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool InternalAddTimer(string key, TimerMode mode, float duration, Action<object[]> handler,
|
||||
params object[] args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (duration <= 0.0f)
|
||||
{
|
||||
if (mode == TimerMode.Normal)
|
||||
{
|
||||
handler(args);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[HeavyTimer]Add Repeat Timer Error: Time is Not Greater Than Zero");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var timer = new TimerTask(this, key, mode, GetTime(), duration, handler, args);
|
||||
addTimerList[key] = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void BreakTimerWithPrefix(string prefix)
|
||||
{
|
||||
if (timerList is { Count: > 0 })
|
||||
{
|
||||
var arr = new string[timerList.Count];
|
||||
timerList.Keys.CopyTo(arr, 0);
|
||||
|
||||
foreach (var t in arr)
|
||||
{
|
||||
if (t.StartsWith(prefix))
|
||||
{
|
||||
BreakTimer(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BreakTimer(string key)
|
||||
{
|
||||
if (!timerList.ContainsKey(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var timer = timerList[key];
|
||||
timer.Break();
|
||||
}
|
||||
|
||||
public void ResumeTimerWithPrefix(string prefix)
|
||||
{
|
||||
if (timerList is { Count: > 0 })
|
||||
{
|
||||
var arr = new string[timerList.Count];
|
||||
timerList.Keys.CopyTo(arr, 0);
|
||||
|
||||
foreach (var t in arr)
|
||||
{
|
||||
if (t.StartsWith(prefix))
|
||||
{
|
||||
ResumeTimer(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeTimer(string key)
|
||||
{
|
||||
if (!timerList.ContainsKey(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var timer = timerList[key];
|
||||
timer.Resume();
|
||||
}
|
||||
|
||||
public void ClearTimerWithPrefix(string prefix)
|
||||
{
|
||||
if (timerList is { Count: > 0 })
|
||||
{
|
||||
foreach (var timerKey in timerList.Keys.Where(timerKey => timerKey.StartsWith(prefix)))
|
||||
{
|
||||
RemoveTimer(timerKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RemoveTimer(string key)
|
||||
{
|
||||
if (!timerList.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!destroyTimerList.Contains(key))
|
||||
{
|
||||
destroyTimerList.Add(key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsRunning(string key)
|
||||
{
|
||||
return timerList.ContainsKey(key);
|
||||
}
|
||||
|
||||
public float GetTimerLeft(string key)
|
||||
{
|
||||
if (!timerList.ContainsKey(key))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
var timer = timerList[key];
|
||||
return timer.TimeLeft;
|
||||
}
|
||||
|
||||
public float GetTimerLeftWithPrefix(string prefix)
|
||||
{
|
||||
if (timerList is { Count: > 0 })
|
||||
{
|
||||
var arr = new string[timerList.Count];
|
||||
timerList.Keys.CopyTo(arr, 0);
|
||||
|
||||
return (from t in arr where t.StartsWith(prefix) select GetTimerLeft(t)).FirstOrDefault();
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
addTimerList.Clear();
|
||||
timerList.Clear();
|
||||
destroyTimerList.Clear();
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearAll();
|
||||
addTimerList = null;
|
||||
timerList = null;
|
||||
destroyTimerList = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fefb9ed2ef0fffd409b6ea3e113cb153
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class YFsa : MonoBehaviour
|
||||
{
|
||||
private Dictionary<Action, float> mIntervalDic = new();
|
||||
private List<Action> triggers = new();
|
||||
|
||||
[SerializeField] private string timerName;
|
||||
private TimerTimeType type = TimerTimeType.Null;
|
||||
|
||||
public void SetTimer(string name, TimerTimeType type)
|
||||
{
|
||||
this.timerName = name + "_" + type;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private float GetTime()
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
TimerTimeType.Time => Time.time,
|
||||
TimerTimeType.UnscaledTime => Time.unscaledTime,
|
||||
TimerTimeType.RealtimeSinceStartup => Time.realtimeSinceStartup,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (mIntervalDic.Count > 0)
|
||||
{
|
||||
triggers.Clear();
|
||||
foreach (var keyValue in mIntervalDic.Where(keyValue => keyValue.Value <= GetTime()))
|
||||
{
|
||||
triggers.Add(keyValue.Key);
|
||||
}
|
||||
|
||||
foreach (var func in triggers)
|
||||
{
|
||||
mIntervalDic.Remove(func);
|
||||
func();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTimer(float interval, Action func)
|
||||
{
|
||||
if (null != func)
|
||||
{
|
||||
if (interval <= 0)
|
||||
{
|
||||
func();
|
||||
return;
|
||||
}
|
||||
|
||||
mIntervalDic[func] = GetTime() + interval;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveTimer(Action func)
|
||||
{
|
||||
if (null != func)
|
||||
{
|
||||
if (mIntervalDic.ContainsKey(func))
|
||||
{
|
||||
mIntervalDic.Remove(func);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
mIntervalDic.Clear();
|
||||
triggers.Clear();
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearAll();
|
||||
mIntervalDic = null;
|
||||
triggers = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cccc8c2ef81a9c04c99cc97fdf07a8a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace BingoBrain.Core
|
||||
{
|
||||
public class TriggerBingo : EventTrigger
|
||||
{
|
||||
public VoidDataDelegate onClickDown;
|
||||
public VoidDataDelegate onClickUp;
|
||||
public VoidDataDelegate onClick;
|
||||
|
||||
public VoidDataDelegate onInitializePotentialDrag;
|
||||
public VoidDataDelegate onBeginDrag;
|
||||
public VoidDataDelegate onDrag;
|
||||
public VoidDataDelegate onEndDrag;
|
||||
public VoidDataDelegate onDrop;
|
||||
|
||||
public VoidDataDelegate onPointerEnter;
|
||||
public VoidDataDelegate onPointerExit;
|
||||
|
||||
public VoidDataDelegate onScroll;
|
||||
|
||||
public VoidBaseDataDelegate onSubmit;
|
||||
public VoidBaseDataDelegate onSelect;
|
||||
public VoidBaseDataDelegate onDeselect;
|
||||
public VoidBaseDataDelegate onUpdateSelect;
|
||||
|
||||
[HideInInspector]
|
||||
public BoxCollider2D boxCollider2D;
|
||||
[HideInInspector]
|
||||
public BoxCollider boxCollider;
|
||||
|
||||
public static TriggerBingo Get(GameObject go)
|
||||
{
|
||||
TriggerBingo listener = go.GetComponent<TriggerBingo>();
|
||||
if (listener == null)
|
||||
listener = go.AddComponent<TriggerBingo>();
|
||||
return listener;
|
||||
}
|
||||
|
||||
public static TriggerBingo Get(Component component)
|
||||
{
|
||||
return Get(component.gameObject);
|
||||
}
|
||||
|
||||
public static TriggerBingo GetForm2D(GameObject go, bool isAutoCreateCollider = true)
|
||||
{
|
||||
if (isAutoCreateCollider)
|
||||
{
|
||||
if (!go.GetComponent<BoxCollider2D>())
|
||||
{
|
||||
go.AddComponent<BoxCollider2D>();
|
||||
}
|
||||
}
|
||||
return Get(go);
|
||||
}
|
||||
|
||||
public static TriggerBingo GetForm2D(Component component, bool isAutoCreateCollider = true)
|
||||
{
|
||||
return GetForm2D(component.gameObject, isAutoCreateCollider);
|
||||
}
|
||||
|
||||
public static TriggerBingo GetForm3D(GameObject go, bool isAutoCreateCollider = true)
|
||||
{
|
||||
if (isAutoCreateCollider)
|
||||
{
|
||||
if (!go.GetComponent<BoxCollider>())
|
||||
{
|
||||
go.AddComponent<BoxCollider>();
|
||||
}
|
||||
}
|
||||
return Get(go);
|
||||
}
|
||||
|
||||
public static TriggerBingo GetForm3D(Component component, bool isAutoCreateCollider = true)
|
||||
{
|
||||
return GetForm3D(component.gameObject, isAutoCreateCollider);
|
||||
}
|
||||
|
||||
public BoxCollider2D GetBoxCollider2D()
|
||||
{
|
||||
if (!boxCollider2D)
|
||||
{
|
||||
boxCollider2D = gameObject.AddComponent<BoxCollider2D>();
|
||||
}
|
||||
return boxCollider2D;
|
||||
}
|
||||
|
||||
public BoxCollider GetBoxCollider()
|
||||
{
|
||||
if (!boxCollider)
|
||||
{
|
||||
boxCollider = gameObject.AddComponent<BoxCollider>();
|
||||
}
|
||||
return boxCollider;
|
||||
}
|
||||
|
||||
public override void OnPointerEnter(PointerEventData data)
|
||||
{
|
||||
if (onPointerEnter != null) onPointerEnter(data);
|
||||
}
|
||||
public override void OnPointerExit(PointerEventData data)
|
||||
{
|
||||
if (onPointerExit != null) onPointerExit(data);
|
||||
}
|
||||
|
||||
public override void OnPointerDown(PointerEventData data)
|
||||
{
|
||||
if (onClickDown != null) onClickDown(data);
|
||||
}
|
||||
public override void OnPointerUp(PointerEventData data)
|
||||
{
|
||||
if (onClickUp != null) onClickUp(data);
|
||||
}
|
||||
public override void OnPointerClick(PointerEventData data)
|
||||
{
|
||||
if (onClick != null) onClick(data);
|
||||
}
|
||||
|
||||
public override void OnInitializePotentialDrag(PointerEventData data)
|
||||
{
|
||||
if (onInitializePotentialDrag != null) onInitializePotentialDrag(data);
|
||||
}
|
||||
public override void OnBeginDrag(PointerEventData data)
|
||||
{
|
||||
if (onBeginDrag != null) onBeginDrag(data);
|
||||
}
|
||||
public override void OnDrag(PointerEventData data)
|
||||
{
|
||||
if (onDrag != null) onDrag(data);
|
||||
}
|
||||
public override void OnEndDrag(PointerEventData data)
|
||||
{
|
||||
if (onEndDrag != null) onEndDrag(data);
|
||||
}
|
||||
public override void OnDrop(PointerEventData data)
|
||||
{
|
||||
if (onDrop != null) onDrop(data);
|
||||
}
|
||||
|
||||
public override void OnScroll(PointerEventData data)
|
||||
{
|
||||
if (onScroll != null) onScroll(data);
|
||||
}
|
||||
|
||||
public override void OnSubmit(BaseEventData data)
|
||||
{
|
||||
if (onSubmit != null) onSubmit(data);
|
||||
}
|
||||
public override void OnSelect(BaseEventData data)
|
||||
{
|
||||
if (onSelect != null) onSelect(data);
|
||||
}
|
||||
public override void OnDeselect(BaseEventData data)
|
||||
{
|
||||
if (onDeselect != null) onDeselect(data);
|
||||
}
|
||||
public override void OnUpdateSelected(BaseEventData data)
|
||||
{
|
||||
if (onUpdateSelect != null) onUpdateSelect(data);
|
||||
}
|
||||
|
||||
public void ClearAllEvent()
|
||||
{
|
||||
onClickDown = null;
|
||||
onClickUp = null;
|
||||
onClick = null;
|
||||
|
||||
onInitializePotentialDrag = null;
|
||||
onBeginDrag = null;
|
||||
onDrag = null;
|
||||
onEndDrag = null;
|
||||
onDrop = null;
|
||||
|
||||
onPointerEnter = null;
|
||||
onPointerExit = null;
|
||||
|
||||
onScroll = null;
|
||||
|
||||
onSubmit = null;
|
||||
onSelect = null;
|
||||
onDeselect = null;
|
||||
onUpdateSelect = null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ClearAllEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c722565edbc4b099b3612f04751fab5
|
||||
timeCreated: 1699945930
|
||||
Reference in New Issue
Block a user