Exemplo n.º 1
0
    public void OnLoaded()
    {
        if (null != fCallback)
        {
            fCallback(this);
        }

        fCallback = null;
    }
Exemplo n.º 2
0
    /// <summary>
    /// 取消资源加载监听
    /// </summary>
    /// <param name="_type">资源类型</param>
    /// <param name="_path">资源路径</param>
    /// <param name="call">要取消的回调函数</param>
    public void RemoveAsyncCallback(EAssetType assetType, string _path, DAssetsCallback call)
    {
        string      _name   = GetRelativePath(_path, assetType);
        AssetEntity _entity = null;

        if (m_kAssets.TryGetValue(_name, out _entity))
        {
            _entity.RemoveListener(call);
        }
    }
Exemplo n.º 3
0
 static int RemoveListener(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         AssetEntity     obj  = (AssetEntity)ToLua.CheckObject <AssetEntity>(L, 1);
         DAssetsCallback arg0 = (DAssetsCallback)ToLua.CheckDelegate <DAssetsCallback>(L, 2);
         obj.RemoveListener(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 4
0
 static int RemoveAsyncCallback(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         AssetUtil       obj  = (AssetUtil)ToLua.CheckObject <AssetUtil>(L, 1);
         EAssetType      arg0 = (EAssetType)ToLua.CheckObject(L, 2, typeof(EAssetType));
         string          arg1 = ToLua.CheckString(L, 3);
         DAssetsCallback arg2 = (DAssetsCallback)ToLua.CheckDelegate <DAssetsCallback>(L, 4);
         obj.RemoveAsyncCallback(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 5
0
    public AssetEntity AsyncLoad(EAssetType assetType, string _path, DAssetsCallback call)
    {
        string      _name   = GetRelativePath(_path, assetType);
        AssetEntity _entity = null;

        if (!m_kAssets.TryGetValue(_name, out _entity))
        {
            _entity = new AssetEntity(_path, assetType);
            m_kAssets.Add(_name, _entity);
            m_kWaitQueue.Enqueue(_entity);
        }
        if (!_entity.IsLoaded)
        {
            _entity.AddListener(call);
        }
        else
        {
            call(_entity);
        }
        return(_entity);
    }
Exemplo n.º 6
0
    public DAssetsCallback DAssetsCallback(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            DAssetsCallback fn = delegate(AssetEntity param0) { };
            return(fn);
        }

        if (!flag)
        {
            DAssetsCallback_Event target = new DAssetsCallback_Event(func);
            DAssetsCallback       d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            DAssetsCallback_Event target = new DAssetsCallback_Event(func, self);
            DAssetsCallback       d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }
Exemplo n.º 7
0
 public void RemoveListener(DAssetsCallback _func)
 {
     fCallback -= _func;
 }
Exemplo n.º 8
0
 public void AddListener(DAssetsCallback _func)
 {
     fCallback += _func;
 }
Exemplo n.º 9
0
 void Push_DAssetsCallback(IntPtr L, DAssetsCallback o)
 {
     ToLua.Push(L, o);
 }