예제 #1
0
 static int GetID(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         EffectRenderObj obj = (EffectRenderObj)ToLua.CheckObject(L, 1, typeof(EffectRenderObj));
         uint            o   = obj.GetID();
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #2
0
 public void RemoveRenderobj(EffectRenderObj obj, bool Catche = true)
 {
     if (obj == null)
     {
         return;
     }
     //Debug.Log();
     m_EffectRenderObj.Remove(obj.GetID());
     if (m_EffectRenderObjList.Contains(obj))
     {
         m_EffectRenderObjList.Remove(obj);
     }
     if (Catche)
     {
         resetEffect(obj);
         effectPool.FreeObject(obj);
     }
 }
예제 #3
0
    /// <summary>
    /// 创建渲染对象
    /// </summary>
    /// <param name="strObjFileName">渲染对象描述文件</param>
    /// <returns></returns>
    public EffectRenderObj CreateRenderObj(ref string effectName, ref string url, bool bCached = false)
    {
        EffectRenderObj effect = null;

        if (bCached)
        {
            if (!effectPool.downDestoryEffectsList.ContainsKey(effectName))
            {
                // 加入缓存列表,特效不清理
                effectPool.downDestoryEffectsList.Add(effectName, false);
            }
        }
        //从池里拿...
        effect = effectPool.GetObject(effectName) as EffectRenderObj;
        if (effect != null)
        {
            m_EffectRenderObj[effect.GetID()] = effect;
            if (!m_EffectRenderObjList.Contains(effect))
            {
                m_EffectRenderObjList.Add(effect);
            }
            reStartEffect(effect);
        }
        else
        {
            effect = new EffectRenderObj(m_uRenderObjIDSeed);
            effect.Create(ref effectName, ref url, loadComCallBack);
            m_EffectRenderObj[m_uRenderObjIDSeed] = effect;
            if (!m_EffectRenderObjList.Contains(effect))
            {
                m_EffectRenderObjList.Add(effect);
            }
            m_uRenderObjIDSeed++;
        }
        return(effect);
    }