Esempio n. 1
0
        public override void Load(string src, System.Action <LoadWrapper> OnSuccess, System.Action <LoadWrapper> OnFail)
        {
            if (string.IsNullOrEmpty(src))
            {
                return;
            }

            if (loaderController == null)
            {
                loaderController = entity.meshRootGameObject.GetComponent <NFTShapeLoaderController>();
            }

            if (loaderController == null)
            {
                Debug.LogError("LoadWrapper_NFT >>> loaderController == null!");
                return;
            }

            loaderController.collider.enabled = withCollisions;
            loaderController.backgroundColor  = backgroundColor;

            loaderController.OnLoadingAssetSuccess += CallOnComponentUpdated;

            loaderController.OnLoadingAssetSuccess += () => OnSuccess(this);
            loaderController.OnLoadingAssetFail    += () => OnFail(this);

            loaderController.LoadAsset(src, true);
        }
        public override void Load(string src, System.Action <LoadWrapper> OnSuccess, System.Action <LoadWrapper> OnFail)
        {
            if (string.IsNullOrEmpty(src))
            {
                return;
            }

            if (loaderController == null)
            {
                loaderController = entity.meshRootGameObject.GetComponent <NFTShapeLoaderController>();
            }

            if (loaderController == null)
            {
                Debug.LogError("LoadWrapper_NFT >>> loaderController == null!");
                return;
            }

            loaderController.collider.enabled = withCollisions;
            loaderController.backgroundColor  = backgroundColor;

            loaderController.OnLoadingAssetSuccess += CallOnComponentUpdated;

            assetUrl = src;

            if (CommonScriptableObjects.rendererState.Get())
            {
                LoadAsset();
            }
            else
            {
                CommonScriptableObjects.rendererState.OnChange += OnRendererStateChanged;
            }

            // NOTE: frame meshes are already included in the build, there is no need lock renderer just to wait for the images.
            OnSuccess?.Invoke(this);
        }