/// <summary> /// 指引点击主UI右下角的展开按钮 /// </summary> /// <param name="currentGuideButton">当前被指引的按钮</param> /// <param name="clickMainKongZhiBtnCallback">展开按钮点击后的回调事件</param> /// <param name="isFunctionOpen">是否是功能开启</param> protected void GuideMainKongzhiButton(Button currentGuideButton, vp_Timer.Callback clickMainKongZhiBtnCallback, bool isFunctionOpen = true) { _isFunctionOpen = isFunctionOpen; CurrentGuideButton = currentGuideButton; _clickMainKongZhiBtnCallback = clickMainKongZhiBtnCallback; var mainViewKongZhiToggle = MainBottomRightView.Instance.ckb_kongzhi; GuideView.Instance.OpenRightGuide(mainViewKongZhiToggle.transform, "点击展开按钮"); MainBottomRightView.Instance.BeforeClickKongzhiButton = BeforeClickMainViewCkbKongZhiButton; }
private static void Schedule(float time, vp_Timer.Callback func, vp_Timer.ArgCallback argFunc, object args, vp_Timer.Handle timerHandle, int iterations, float interval) { if (func == null && argFunc == null) { Debug.LogError("Error: (vp_Timer) Aborted event because function is null."); return; } if (vp_Timer.m_MainObject == null) { vp_Timer.m_MainObject = new GameObject("Timers"); vp_Timer.m_MainObject.AddComponent <vp_Timer>(); UnityEngine.Object.DontDestroyOnLoad(vp_Timer.m_MainObject); } time = Mathf.Max(0f, time); iterations = Mathf.Max(0, iterations); interval = ((interval != -1f) ? Mathf.Max(0f, interval) : time); vp_Timer.m_NewEvent = null; if (vp_Timer.m_Pool.Count > 0) { vp_Timer.m_NewEvent = vp_Timer.m_Pool[0]; vp_Timer.m_Pool.Remove(vp_Timer.m_NewEvent); } else { vp_Timer.m_NewEvent = new vp_Timer.Event(); } vp_Timer.m_EventCount++; vp_Timer.m_NewEvent.Id = vp_Timer.m_EventCount; if (func != null) { vp_Timer.m_NewEvent.Function = func; } else if (argFunc != null) { vp_Timer.m_NewEvent.ArgFunction = argFunc; vp_Timer.m_NewEvent.Arguments = args; } vp_Timer.m_NewEvent.StartTime = Time.time; vp_Timer.m_NewEvent.DueTime = Time.time + time; vp_Timer.m_NewEvent.Iterations = iterations; vp_Timer.m_NewEvent.Interval = interval; vp_Timer.m_NewEvent.LifeTime = 0f; vp_Timer.m_NewEvent.Paused = false; vp_Timer.m_Active.Add(vp_Timer.m_NewEvent); if (timerHandle != null) { if (timerHandle.Active) { timerHandle.Cancel(); } timerHandle.Id = vp_Timer.m_NewEvent.Id; } }
private void Recycle() { this.Id = 0; this.DueTime = 0f; this.StartTime = 0f; this.Function = null; this.ArgFunction = null; this.Arguments = null; if (vp_Timer.m_Active.Remove(this)) { vp_Timer.m_Pool.Add(this); } }
public static void In(float delay, vp_Timer.Callback callback, int iterations, float interval, vp_Timer.Handle timerHandle = null) { vp_Timer.Schedule(delay, callback, null, null, timerHandle, iterations, interval); }
public static void In(float delay, vp_Timer.Callback callback, vp_Timer.Handle timerHandle = null) { vp_Timer.Schedule(delay, callback, null, null, timerHandle, 1, -1f); }