using System;
using System.Collections.Generic;
namespace UnityEngine.ResourceManagement.ResourceLocations
{
///
/// Contains enough information to load an asset (what/where/how/dependencies)
///
public interface IResourceLocation
{
///
/// Internal name used by the provider to load this location
///
/// The identifier.
string InternalId { get; }
///
/// Matches the provider used to provide/load this location
///
/// The provider id.
string ProviderId { get; }
///
/// Gets the dependencies to other IResourceLocations
///
/// The dependencies.
IList Dependencies { get; }
///
/// The hash of this location combined with the specified type.
///
/// The type of the result.
/// The combined hash of the location and the type.
int Hash(Type resultType);
///
/// The precomputed hash code of the dependencies.
///
int DependencyHashCode { get; }
///
/// Gets the dependencies to other IResourceLocations
///
/// The dependencies.
bool HasDependencies { get; }
///
/// Gets any data object associated with this locations
///
/// The object.
object Data { get; }
///
/// Primary address for this location.
///
string PrimaryKey { get; }
///
/// The type of the resource for th location.
///
Type ResourceType { get; }
}
///
/// An IEqualityComparerer to check if two IResourceLocations are the same
///
public class ResourceLocationComparer : IEqualityComparer
{
///
public bool Equals(IResourceLocation x, IResourceLocation y)
{
return GetHashCode(x) == GetHashCode(y);
}
///
public int GetHashCode(IResourceLocation obj)
{
return obj.InternalId.GetHashCode() * 31 + obj.ResourceType.GetHashCode();
}
}
}