コード例 #1
0
    public bool RemoveLightingImmediate(int nID, int nFeedbackID = 0)
    {
        //遍历光效列表,对光效进行更新或关闭操作
        for (int i = 0; i < mEffectList.Count;)
        {
            LightingEffectBehavior effect = mEffectList[i];
            bool bRemove = effect.getID() == nID;
            bRemove = bRemove && (nFeedbackID == 0 || effect.EffectParam.nFeedbackID == nFeedbackID);
            bRemove = bRemove || !effect.Valid;

            if (bRemove)
            {
                effect.Close();
                mEffectList.RemoveAt(i);
                LightingEffectFactory.Instance.CacheEffectBehavior(ref effect);
            }
            else
            {
                i++;
            }
        }
        return(true);
    }
コード例 #2
0
    public void LateUpdate() //光效更新改在了LateUpdate阶段,在人物动作计算之后,以便获得绑点准确的transoform信息
#endif
    {
        if (mEffectList == null)
        {
            return;
        }
        //dealWithStateEffect();

        //遍历光效列表,对光效进行更新或关闭操作
        for (int i = 0; i < mEffectList.Count;)
        {
            LightingEffectBehavior effect = mEffectList[i];
            int effectid = effect.getID();


            bool bRemove = false;
            if (!effect.Valid)
            {
                bRemove = true;
            }
            else
            {
                if (effect.needClose == true) //光效需要关闭并移除
                {
                    effect.Close();
                    if (effect.needClose)
                    {
                        //如果有类似原路返回的效果,则不能立刻删除光效,在Close()函数中会把needClose改回false,此时就不移除光效
                        bRemove = true;
                    }
                }
                else if (effect.LateUpdate() == false) //否则,对光效进行更新,更新失败的关闭并移除
                {
                    effect.needClose = true;
                    effect.Close();
                    if (effect.needClose)
                    {
                        //如果有类似原路返回的效果,则不能立刻删除光效,在Close()函数中会把needClose改回false,此时就不移除光效
                        bRemove = true;
                    }
                }


                effect.ApplyPlayDataToResHandler();
            }

            if (bRemove)
            {
                mEffectList.RemoveAt(i);
                DoCompleteCallBack(effectid);

                LightingEffectFactory.Instance.CacheEffectBehavior(ref effect);
            }
            else
            {
                DoStartCallBack(effectid);
                i++;
            }
        }
    }