protected static void setCallback(ScaleCallback callback, object userData, ref ScaleCallback curCallback, ref object curUserData, ComponentScale component) { ScaleCallback tempCallback = curCallback; object tempUserData = curUserData; curCallback = null; curUserData = null; // 如果回调函数当前不为空,则是中断了正在进行的变化 if (tempCallback != null) { tempCallback(component, tempUserData, true, false); } curCallback = callback; curUserData = userData; }
protected void doneCallback(ScaleCallback curDoneCallback, object curDoneUserData, ComponentScale component) { // 先保存回调,然后再调用回调之前就清空回调,确保在回调函数执行时已经完全完成 ScaleCallback tempCallback = curDoneCallback; object tempUserData = curDoneUserData; clearCallback(); if (tempCallback != null) { tempCallback(component, tempUserData, false, true); } }