//Recursive processing private void TweenAllPlay(XTween tween, double delta) { if (tween.children_ != null && tween.children_.Length > 0) { if (tween.IsFinish()) { for (int i = 0; i < tween.children_.Length; ++i) { XTween child = tween.children_[i]; TweenAllPlay(child, delta); if (!IsAllChildFinish(child) && tween.groupType_ == GroupType.Serial) { break; } } } else { tween.AddTime(delta); } } else { if (!tween.IsFinish()) { tween.AddTime(delta); } } //Check Complete if (!tween.isComplete_ && IsAllChildFinish(tween)) { tween.isComplete_ = true; tween.Stop(); EventHandler handler = tween.onCompleted_; if (handler != null) { handler(this, EventArgs.Empty); } } }
//All Tween finish flag private bool IsAllChildFinish(XTween tween) { bool isAllFinish = true; if (tween.children_ != null && tween.children_.Length > 0) { foreach (XTween child in tween.children_) { if (!IsAllChildFinish(child)) { isAllFinish = false; break; } } } else { isAllFinish = tween.IsFinish(); } return(isAllFinish); }
//All Tween finish flag private bool IsAllChildFinish(XTween tween) { bool isAllFinish = true; if (tween.children_ != null && tween.children_.Length > 0) { foreach(XTween child in tween.children_) { if (!IsAllChildFinish(child)) { isAllFinish = false; break; } } } else { isAllFinish = tween.IsFinish(); } return isAllFinish; }