protected static void doneCallback(ref KeyFrameCallback curDoneCallback, ComponentKeyFrameBase component) { // 先保存回调,然后再调用回调之前就清空回调,确保在回调函数执行时已经完全完成 KeyFrameCallback tempCallback = curDoneCallback; component.clearCallback(); tempCallback?.Invoke(component, false); }
protected static void setCallback(KeyFrameCallback callback, ref KeyFrameCallback curCallback, ComponentKeyFrameBase component) { KeyFrameCallback tempCallback = curCallback; curCallback = null; // 如果回调函数当前不为空,则是中断了正在进行的变化 tempCallback?.Invoke(component, true); curCallback = callback; }
protected void afterApplyTrembling(bool done) { mTremblingCallBack?.Invoke(this, false); if (done) { setActive(false); // 强制停止组件 stop(true); doneCallback(ref mTrembleDoneCallBack, this); } }