Esempio n. 1
0
        public bool CreateAsync <T>(string viewPath, OnViewCreated callback, Transform parent = null)
        {
            UIView viewPrefab;

            if (_assetCache.TryGetValue(viewPath, out viewPrefab))
            {
                UIView newView = _createView(viewPrefab, parent);
                if (callback != null)
                {
                    callback(newView);
                }
            }
            else
            {
                ResourceRequest request = Resources.LoadAsync <UIView>(viewPath);

                if (request == null)
                {
                    return(false);
                }
                AsyncBlock block = AsyncBlock.Create(viewPath, request, callback, parent);
                _asyncList.Add(block);
            }

            return(true);
        }
Esempio n. 2
0
    public bool CreateAsync <T>(string viewPath, OnViewCreated callback, Transform parent = null)
    {
        ResourceRequest request = Resources.LoadAsync <UIView>("GUI/" + viewPath);

        if (request == null)
        {
            return(false);
        }

        AsyncBlock block = AsyncBlock.Create(request, callback, parent);

        _asyncList.Add(block);

        return(true);
    }
Esempio n. 3
0
        public bool CreateAsync <T>(AssetRequest assetRequest, Action <T> callback) where T : UIView
        {
            Assert.IsFalse(String.IsNullOrEmpty(assetRequest.path));

            ResourceRequest request = Resources.LoadAsync <T>(assetRequest.path);

            if (request == null)
            {
                return(false);
            }

            AsyncBlock block = AsyncBlock.Create <T>(assetRequest.path, request, callback, assetRequest.parent);

            _asyncList.Add(block);

            return(true);
        }