Beispiel #1
0
        public void LoadTexture(string url,
                                LoadCompleteCallback onSuccess,
                                LoadErrorCallback onFail)
        {
            NTexture texture;

            if (mPool.TryGetValue(url, out texture))
            {
                texture.refCount++;
                onSuccess(texture);
                return;
            }

            GameEntry.Resource.LoadAsset(url, typeof(Texture2D), new LoadAssetCallbacks(
                                             (assetName, asset, duration, userData) =>
            {
                texture = new NTexture(asset as Texture2D);
                texture.refCount++;
                onSuccess(texture);
            },

                                             (assetName, status, errorMessage, userData) =>
            {
                onFail(errorMessage);
            }));
        }
        private void LoadIcon(string url,
                              LoadCompleteCallback onSuccess,
                              LoadErrorCallback onFail)
        {
            AssetsLoader loader = new AssetsLoader("icon/" + url, url, new ArrayList {
                onSuccess, onFail
            });

            loader.Load(this.OnLoadComplete, null, this.OnLoadError);
        }
    public void LoadIcon(string url,
                         LoadCompleteCallback onSuccess,
                         LoadErrorCallback onFail)
    {
        LoadItem item = new LoadItem();

        item.url       = url;
        item.onSuccess = onSuccess;
        item.onFail    = onFail;
        _items.Add(item);
    }
 public void LoadIcon(string url,
     LoadCompleteCallback onSuccess,
     LoadErrorCallback onFail)
 {
     LoadItem item = new LoadItem();
     item.url = url;
     item.onSuccess = onSuccess;
     item.onFail = onFail;
     _items.Add(item);
     if(!_started)
         StartCoroutine(Run());
 }
    public void LoadIcon(string url, LoadCompleteCallback onSuccess, LoadErrorCallback onFail)
    {
        LoadItem item = new LoadItem();

        item.url       = url;
        item.onSuccess = onSuccess;
        item.onFail    = onFail;
        _items.Add(item);
        if (!_started)   // _started = false, 进入方法
        {
            StartCoroutine(Run());
        }
    }
Beispiel #6
0
    public void LoadIcon(string _url, LoadCompleteCallback _onSuccess, LoadErrorCallback _onFail)
    {
        LoadItem tempItem = new LoadItem();

        tempItem.url       = _url;
        tempItem.onSuccess = _onSuccess;
        tempItem.onFail    = _onFail;
        items.Add(tempItem);
        if (!started)
        {
            StartCoroutine(Run());
        }
    }
Beispiel #7
0
    public void LoadIcon(string url,
                         LoadCompleteCallback onSuccess,
                         LoadErrorCallback onFail)
    {
        LoadItem item = new LoadItem();

        item.url       = url;
        item.onSuccess = onSuccess;
        item.onFail    = onFail;
        _items.Add(item);
        Debug.Log("url:" + url);
        if (!_started)
        {
            StartCoroutine(Run());
        }
    }
Beispiel #8
0
 static int LoadIcon(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         IconManager          obj  = (IconManager)ToLua.CheckObject <IconManager>(L, 1);
         string               arg0 = ToLua.CheckString(L, 2);
         LoadCompleteCallback arg1 = (LoadCompleteCallback)ToLua.CheckDelegate <LoadCompleteCallback>(L, 3);
         LoadErrorCallback    arg2 = (LoadErrorCallback)ToLua.CheckDelegate <LoadErrorCallback>(L, 4);
         obj.LoadIcon(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #9
0
 public void LoadIcon(string url,
                      LoadCompleteCallback onSuccess,
                      LoadErrorCallback onFail)
 {
     if (texCached.ContainsKey(url))
     {
         NTexture texture = texCached[url];
         texture.refCount++;
         if (onSuccess != null)
         {
             onSuccess(texture);
         }
         return;
     }
     AppFacade.Instance.GetManager <ResManager>(ManagerName.Resource).Load(url, abInfo =>
     {
         NTexture texture = null;
         if (texCached.ContainsKey(url))
         {
             texCached[url].refCount++;
             texture = texCached[url];
         }
         else
         {
             if (abInfo == null)
             {
                 if (onFail != null)
                 {
                     onFail("");
                 }
                 return;
             }
             texture = new NTexture((Texture2D)abInfo.mainObject);
             texture.refCount++;
             texCached[url] = texture;
         }
         if (onSuccess != null)
         {
             onSuccess(texture);
         }
     });
 }
Beispiel #10
0
        public void LoadIcon(string url,
                             LoadCompleteCallback onSuccess,
                             LoadErrorCallback onFail)
        {
            var ret = LoadSync(url);

            if (ret != null && onSuccess != null)
            {
                onSuccess(ret);
            }
            else if (onFail != null)
            {
                onFail(url);
            }

            //LoadItem item = new LoadItem();
            //item.url = url;
            //item.onSuccess = onSuccess;
            //item.onFail = onFail;
            //_items.Add(item);
            //if (!_started)
            //    StartCoroutine(Run());
        }
    public LoadErrorCallback LoadErrorCallback(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            LoadErrorCallback fn = delegate(string param0) { };
            return(fn);
        }

        if (!flag)
        {
            LoadErrorCallback_Event target = new LoadErrorCallback_Event(func);
            LoadErrorCallback       d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            LoadErrorCallback_Event target = new LoadErrorCallback_Event(func, self);
            LoadErrorCallback       d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }
 void Push_LoadErrorCallback(IntPtr L, LoadErrorCallback o)
 {
     ToLua.Push(L, o);
 }