Пример #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);
        }
Пример #2
0
        public static AsyncBlock Create(ResourceRequest p_request, OnViewCreated p_callback, Transform p_parent)
        {
            AsyncBlock block = new AsyncBlock();

            block.request  = p_request;
            block.callback = p_callback;
            block.parent   = p_parent;
            return(block);
        }
Пример #3
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);
    }