/* * /// <summary> * /// 检查是否转场完毕。为确保处理顺序正常,此方法需要延迟处理 * /// </summary> * private void chechTransitOver() * { * TimerManager.GetInstance().RunLater(lateCheckTransitOver, null); * } * * private void lateCheckTransitOver(Hashtable param) * { * if (inTrans) * { * //LogManager.Log("Check Transit Over!! [" + this + "]"); * if (!_inTransSelf && transitChildList.Count == 0) * { * inTrans = false; * * //LogManager.Log("[" + this + "] Transit Over now"); * * dealTransitOver(); * } * else * { * //LogManager.Log("Transit not over, list="+ transitChildList.Count); * } * } * } */ /// <summary> /// 转场完成后的各种处理,包括触发回调等。 /// </summary> private void dealTransitOver() { DealHide(); foc = null; }
/// <summary> /// 调度转场,需设置是否延迟启动 /// </summary> /// <param name='isIn'> /// 转入还是转出 /// </param> /// <param name='_cb'> /// 转场完成的回调 /// </param> public void transit(bool isIn, Action cb) { if (reverse) { isIn = !isIn; } isTransIn = isIn; inTrans = true; _inTransSelf = true; if (foc != null) { foc.Terminate(); } // 设置完成回调 foc = FinishObjectUtil.getInstance().createFinishObjectController(); foc.AddObject(this); foc.cbFinish += dealTransitOver; foc.cbFinish += cb; // 驱动子转场 int count = 0; // 如果有子内容需要转场 if (needTransitChild) { TransitObject[] list = GetComponentsInChildren <TransitObject>(true); //Debug.Log("Find " + list.Length + " child"); for (int i = 0; i < list.Length; i++) { TransitObject tobj = list[i]; if (tobj != null && tobj != this && tobj.transitGroup == this.transitGroup) { if (!tobj.needShowWhenTransitIn && !tobj.gameObject.activeSelf) { continue; } /* * if (tobj.isBusy()) * { * Debug.Log("[" + tobj + "] busy!"); * continue; * } */ tobj.transit(isIn, null); foc.AddObject(tobj); count++; } } //Debug.Log("Transit " + count + " sub object"); } foc.Start(); switch (delayType) { case TransitDelayType.WaitForTime: // 等待时间 if (timerKey > 0) { TimerManager.Instance.RemoveTimer(timerKey); } isWaitingContinue = true; timerKey = TimerManager.Instance.RegisterTimer(DelayByTime, delayTime, 1); //Debug.Log("Regist timer " + timerKey); break; case TransitDelayType.WaitForCall: // 等待调用 isWaitingContinue = true; break; default: // 无延迟 DealShow(); transitContent(isIn); break; } }