private void Func1() { DebugUtils.Info("TestInst", "Func1"); // 第一次 还是会 执行 Func2 // 后一次 才不会 被执行 EnumEventDispatcher.RemoveEventListener(EnumEventType.JoystickRelease, Func2); }
public void Release() { if (IsStillCountingDown) { EnumEventDispatcher.RemoveEventListener(EnumEventType.SecondPast, CountDown); } IsRelease = true; }
/// <summary> /// 倒计时结束 /// </summary> public void EndCountDown() { IsStillCountingDown = false; EnumEventDispatcher.RemoveEventListener(EnumEventType.SecondPast, CountDown); if (mText != null) { mText.text = mEndText; } }
/// <summary> /// 倒计时 /// </summary> public void CountDown() { if (IsStillCountingDown) { mSeconds--; if (mSeconds < 0) { mSeconds = 59; mMinutes--; if (mMinutes < 0) { mMinutes = 59; mHours--; if (mHours < 0) { mDays--; if (mDays < 0) { IsStillCountingDown = false; EnumEventDispatcher.RemoveEventListener(EnumEventType.SecondPast, CountDown); if (mText != null) { mText.text = mEndText; } if (mEndAction != null) { mEndAction(); } return; } else { mHours = 23; } } } } } if (mText != null) { mText.text = FormatTime(); } }
public void RemoveListeners() { EnumEventDispatcher.RemoveEventListener(EnumEventType.JoystickRelease, Func1); EnumEventDispatcher.RemoveEventListener(EnumEventType.JoystickRelease, Func2); EnumEventDispatcher.RemoveEventListener(EnumEventType.JoystickRelease, Func3); }
private void OnDestroy() { EnumEventDispatcher.RemoveEventListener <Vector2>(EnumEventType.JoystickPress, JoystickPress); EnumEventDispatcher.RemoveEventListener <Vector2>(EnumEventType.JoystickRelease, JoystickRelease); }