Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override void Provide(ProvideHandle providerInterface)
        {
            var atlas = providerInterface.GetDependency <SpriteAtlas>(0);

            if (atlas == null)
            {
                providerInterface.Complete <Sprite>(null, false, new System.Exception($"Sprite atlas failed to load for location {providerInterface.Location.PrimaryKey}."));
                return;
            }

            var sprite = atlas.GetSprite(providerInterface.ResourceManager.TransformInternalId(providerInterface.Location));

            providerInterface.Complete(sprite, sprite != null, sprite != null ? null : new System.Exception($"Sprite failed to load for location {providerInterface.Location.PrimaryKey}."));
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void Provide(ProvideHandle providerInterface)
        {
            var atlas = providerInterface.GetDependency <SpriteAtlas>(0);

            if (atlas == null)
            {
                providerInterface.Complete <Sprite>(null, false, new System.Exception($"Sprite atlas failed to load for location {providerInterface.Location.PrimaryKey}."));
                return;
            }

            var key = providerInterface.ResourceManager.TransformInternalId(providerInterface.Location);

            ResourceManagerConfig.ExtractKeyAndSubKey(key, out string mainKey, out string subKey);
            string spriteKey = string.IsNullOrEmpty(subKey) ? mainKey : subKey;
            var    sprite    = atlas.GetSprite(spriteKey);

            providerInterface.Complete(sprite, sprite != null, sprite != null ? null : new System.Exception($"Sprite failed to load for location {providerInterface.Location.PrimaryKey}."));
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public override void Provide(ProvideHandle providerInterface)
        {
            var atlas = providerInterface.GetDependency <SpriteAtlas>(0);

            if (atlas == null)
            {
                providerInterface.Complete <Sprite>(null, false, new System.Exception(string.Format("Sprite atlas failed to load for location {0}.", providerInterface.Location.PrimaryKey)));
                return;
            }

            var sprite = atlas.GetSprite(providerInterface.Location.InternalId);

            if (sprite == null)
            {
                providerInterface.Complete <Sprite>(null, false, new System.Exception(string.Format("Sprite failed to load for location {0}.", providerInterface.Location.PrimaryKey)));
                return;
            }
            providerInterface.Complete(sprite, sprite != null, null);
        }