public void AddParticle(uint resId, Action <Engine.IEffect> oncomplete = null, Engine.EffectCallback endCallback = null) { //ReleaseParticle(); m_uResId = resId; Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { table.ResourceDataBase rd = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(resId); if (rd == null) { Engine.Utility.Log.Error("ID为{0}的资源为空", resId); return; } string path = rd.strPath; if (string.IsNullOrEmpty(path)) { return; } m_oncomplete = oncomplete; bool success = rs.CreateEffect(ref path, ref m_effect, OnCreateEffectEvent, Engine.TaskPriority.TaskPriority_Immediate, cb: endCallback); if (success) { UpdateEffectWidget(); } } }
public void AddParticle(uint resId, UIWidget relativeWidget, RelativeLayerType layerType = RelativeLayerType.Equal, Action <Engine.IEffect> oncomplete = null, Engine.EffectCallback endCallback = null) { SetRelativeUIlayer(relativeWidget, layerType); AddParticle(resId, oncomplete: oncomplete, endCallback: endCallback); }
/// <summary> /// 执行进化动画步骤 /// </summary> /// <param name="step"></param> /// <param name="num"></param> /// <param name="complete"></param> private void DoMuhonEvolveSteps(EquipManager.EvolveAnimStep step, uint muhonBaseId, Action <EquipManager.EvolveAnimStep> complete) { if (!IsInitStatus(TabMode.JinHua)) { return; } Muhon cur = new Muhon(muhonBaseId); if (null == cur || null == cur.Pre) { return; } Muhon pre = cur.Pre; UIParticleWidget tempParticleWidget = null; int pos = 0; uint effectId = emgr.GetEvloveAnimEffectIdByStep(step); Engine.EffectCallback onEvolveEffectComplete = (strEffectName, strEvent, param) => { if (null != complete) { complete.Invoke(step); } }; int num = pre.EvolveNeedMuhonNum; switch (step) { case EquipManager.EvolveAnimStep.MaterialBorderBoom: case EquipManager.EvolveAnimStep.MaterialFlyEffect: case EquipManager.EvolveAnimStep.FlyToTarget: { //星级显示 for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.None + 1; i < EquipDefine.AttrIndex.Max; i++) { if (!m_dicParticleWidgets.TryGetValue(i, out tempParticleWidget) || null == tempParticleWidget) { continue; } //tempParticleWidget.ReleaseParticle(); if (step == EquipManager.EvolveAnimStep.MaterialBorderBoom) { tempParticleWidget.cachedTransform.localPosition = Vector3.zero; } pos = (int)i; if (pos <= num) { if (step == EquipManager.EvolveAnimStep.FlyToTarget) { TweenPosition tp = tempParticleWidget.GetComponent <TweenPosition>(); if (null == tp) { continue; } tp.ResetToBeginning(); tp.onFinished.Clear(); if (pos == num) { EventDelegate.Callback finish = () => { if (null != complete) { complete.Invoke(step); } }; EventDelegate d = new EventDelegate(finish); tp.onFinished.Add(d); } tp.Play(true); } else { if (pos != num) { tempParticleWidget.AddParticle(effectId); } else { if (step == EquipManager.EvolveAnimStep.MaterialFlyEffect) { tempParticleWidget.AddParticle(effectId, (effct) => { if (null != complete) { complete.Invoke(step); } }); } else { tempParticleWidget.AddParticle(effectId, null, endCallback: onEvolveEffectComplete); } } } } } } break; case EquipManager.EvolveAnimStep.TargetBoom: { if (null != m_evolveTargetParticleWidget) { m_evolveTargetParticleWidget.AddParticle(effectId, endCallback: onEvolveEffectComplete); } else if (null != complete) { complete.Invoke(step); } } break; case EquipManager.EvolveAnimStep.StarLight: { if (null != m_evolveStarBoomParticleWidget) { Engine.EffectCallback onStarLightComplete = (strEffectName, strEvent, param) => { if (null != complete) { complete.Invoke(step); } }; Transform startTran = GetStarTransByStarLv(cur.StartLevel); if (null != startTran) { m_evolveStarBoomParticleWidget.cachedTransform.localPosition = startTran.localPosition; } m_evolveStarBoomParticleWidget.AddParticle(effectId, endCallback: onEvolveEffectComplete); } else if (null != complete) { complete.Invoke(step); } } break; } }