public void onFinish(params object[] obj) { if (returnAuto || obj == null) { CLEffectPool.returnObj(name, this); NGUITools.SetActive(gameObject, false); if (returnAuto) { transform.parent = null; } } Utl.doCallback(finishCallback, this, finishCallbackPara); }
/// <summary> /// Plaies the delay.延迟播放特效 /// </summary> /// <returns>The delay.</returns> /// <param name="name">Name.</param> /// <param name="pos">Position.</param> /// <param name="parent">Parent.</param> /// <param name="willFinishTimePercent">Will finish time.</param> /// <param name="willFinishCallback">Will finish callback.</param> /// <param name="willFinishCallbackPara">Will finish callback para.</param> /// <param name="finishCallback">Finish callback.</param> /// <param name="finishCallbackPara">Finish callback para.</param> /// <param name="delaySec">Delay sec.</param> /// <param name="returnAuto">If set to <c>true</c> return auto.</param> public static CLEffect playDelay(string name, Vector3 pos, Transform parent, float willFinishTimePercent, object willFinishCallback, object willFinishCallbackPara, object finishCallback, object finishCallbackPara, float delaySec, bool returnAuto = true) { if (string.IsNullOrEmpty(name)) { return(null); } if (!CLEffectPool.havePrefab(name)) { ArrayList list = new ArrayList(); list.Add(name); list.Add(pos); list.Add(parent); list.Add(willFinishTimePercent); list.Add(willFinishCallback); list.Add(willFinishCallbackPara); list.Add(finishCallback); list.Add(finishCallbackPara); list.Add(delaySec); list.Add(returnAuto); // CLEffectPool.setPrefab (name, (Callback)onFinishSetPrefab2, list, null); CLEffectPool.borrowObjAsyn (name, (Callback)onFinishSetPrefab2, list); return(null); } CLEffect effect = CLEffectPool.borrowObj(name); if (effect == null) { return(null); } NGUITools.SetActive(effect.gameObject, false); CLMainBase.self.StartCoroutine(effect.playDelay(pos, parent, willFinishTimePercent, willFinishCallback, willFinishCallbackPara, finishCallback, finishCallbackPara, delaySec, returnAuto)); return(effect); }
public static CLEffect play(string name, Vector3 pos, Transform parent, float willFinishTimePercent, object willFinishCallback, object willFinishCallbackPara, object finishCallback, object finishCallbackPara, bool returnAuto) { try { if (string.IsNullOrEmpty(name)) { return(null); } if (!CLEffectPool.havePrefab(name)) { ArrayList list = new ArrayList(); list.Add(name); list.Add(pos); list.Add(parent); list.Add(willFinishTimePercent); list.Add(willFinishCallback); list.Add(willFinishCallbackPara); list.Add(finishCallback); list.Add(finishCallbackPara); list.Add(returnAuto); CLEffectPool.borrowObjAsyn(name, (Callback)onFinishSetPrefab, list); return(null); } CLEffect effect = CLEffectPool.borrowObj(name); if (effect == null) { return(null); } // effect.effectName = name; effect.show(pos, parent, willFinishTimePercent, willFinishCallback, willFinishCallbackPara, finishCallback, finishCallbackPara, returnAuto); return(effect); } catch (System.Exception e) { Debug.LogError(e); return(null); } }