/// <summary> /// Gets the type of the base class for the given content domain. Used by the editor internal layer to convert static enum to the runtime asset type. /// </summary> /// <param name="domain">The domain.</param> /// <returns>The asset object type.</returns> public static Type GetType(ContentDomain domain) { switch (domain) { case ContentDomain.Texture: return(typeof(Texture)); case ContentDomain.CubeTexture: return(typeof(CubeTexture)); case ContentDomain.Material: return(typeof(MaterialBase)); case ContentDomain.Model: return(typeof(Model)); case ContentDomain.Shader: return(typeof(Shader)); case ContentDomain.Font: return(typeof(FontAsset)); case ContentDomain.IESProfile: return(typeof(IESProfile)); case ContentDomain.Document: return(typeof(JsonAsset)); case ContentDomain.Audio: return(typeof(AudioClip)); case ContentDomain.Animation: return(typeof(Animation)); case ContentDomain.SkeletonMask: return(typeof(SkeletonMask)); } // Anything return(typeof(Asset)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (BaseURI != null) { hashCode = hashCode * 59 + BaseURI.GetHashCode(); } if (ContentDomain != null) { hashCode = hashCode * 59 + ContentDomain.GetHashCode(); } if (SdcSchemaVersion != null) { hashCode = hashCode * 59 + SdcSchemaVersion.GetHashCode(); } if (PkgLineage != null) { hashCode = hashCode * 59 + PkgLineage.GetHashCode(); } if (Version != null) { hashCode = hashCode * 59 + Version.GetHashCode(); } if (Offset != null) { hashCode = hashCode * 59 + Offset.GetHashCode(); } return(hashCode); } }
/// <summary> /// Initializes a new instance of the <see cref="BinaryAssetItem"/> class. /// </summary> /// <param name="path">The asset path.</param> /// <param name="id">The asset identifier.</param> /// <param name="typeName">The asset type name identifier.</param> /// <param name="domain">The asset domain.</param> public BinaryAssetItem(string path, Guid id, string typeName, ContentDomain domain) : base(path, typeName, ref id) { ItemDomain = domain; Type = Utilities.Utils.GetType(typeName); switch (domain) { case ContentDomain.Texture: case ContentDomain.CubeTexture: SearchFilter = ContentItemSearchFilter.Texture; break; case ContentDomain.Material: SearchFilter = ContentItemSearchFilter.Material; break; case ContentDomain.Model: SearchFilter = ContentItemSearchFilter.Model; break; case ContentDomain.Prefab: SearchFilter = ContentItemSearchFilter.Prefab; break; case ContentDomain.Scene: SearchFilter = ContentItemSearchFilter.Scene; break; case ContentDomain.Audio: SearchFilter = ContentItemSearchFilter.Audio; break; case ContentDomain.Animation: SearchFilter = ContentItemSearchFilter.Animation; break; default: if (Type == typeof(ParticleEmitter) || Type == typeof(ParticleSystem)) { SearchFilter = ContentItemSearchFilter.Particles; } else { SearchFilter = ContentItemSearchFilter.Other; } break; } }
/// <summary> /// Returns true if SDCFormPackageMetaData instances are equal /// </summary> /// <param name="other">Instance of SDCFormPackageMetaData to be compared</param> /// <returns>Boolean</returns> public bool Equals(SDCFormPackageMetaData other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BaseURI == other.BaseURI || BaseURI != null && BaseURI.Equals(other.BaseURI) ) && ( ContentDomain == other.ContentDomain || ContentDomain != null && ContentDomain.Equals(other.ContentDomain) ) && ( FormManagerURI == other.FormManagerURI || FormManagerURI != null && FormManagerURI.Equals(other.FormManagerURI) ) && ( SdcSchemaVersion == other.SdcSchemaVersion || SdcSchemaVersion != null && SdcSchemaVersion.Equals(other.SdcSchemaVersion) ) && ( PkgLineage == other.PkgLineage || PkgLineage != null && PkgLineage.Equals(other.PkgLineage) ) && ( Version == other.Version || Version != null && Version.SequenceEqual(other.Version) ) && ( Format == other.Format || Format != null && Format.Equals(other.Format) )); }
/// <summary> /// Initializes a new instance of the <see cref="BinaryAssetItem"/> class. /// </summary> /// <param name="path">The asset path.</param> /// <param name="id">The asset identifier.</param> /// <param name="typeName">The asset type name identifier.</param> /// <param name="domain">The asset domain.</param> public BinaryAssetItem(string path, Guid id, string typeName, ContentDomain domain) : base(path, typeName, ref id) { ItemDomain = domain; switch (domain) { case ContentDomain.Texture: case ContentDomain.CubeTexture: SearchFilter = ContentItemSearchFilter.Texture; break; case ContentDomain.Material: SearchFilter = ContentItemSearchFilter.Material; break; case ContentDomain.Model: SearchFilter = ContentItemSearchFilter.Model; break; case ContentDomain.Prefab: SearchFilter = ContentItemSearchFilter.Prefab; break; case ContentDomain.Scene: SearchFilter = ContentItemSearchFilter.Scene; break; case ContentDomain.Audio: SearchFilter = ContentItemSearchFilter.Audio; break; case ContentDomain.Animation: SearchFilter = ContentItemSearchFilter.Animation; break; default: SearchFilter = ContentItemSearchFilter.Other; break; } }
/// <summary> /// Creates new Asset picker element description. /// </summary> /// <param name="x">The x location (in node area space).</param> /// <param name="y">The y location (in node area space).</param> /// <param name="valueIndex">The index of the node variable linked as the input. Useful to make a physical connection between input box and default value for it.</param> /// <param name="domain">The allowed assets domain to use.</param> /// <returns>The archetype.</returns> public static NodeElementArchetype Asset(float x, float y, int valueIndex, ContentDomain domain) { return(new NodeElementArchetype { Type = NodeElementType.Asset, Position = new Vector2(x, y), Text = null, Single = false, ValueIndex = valueIndex, BoxID = (int)domain, // Pack it to int ConnectionsType = ConnectionType.Invalid }); }
/// <summary> /// Initializes a new instance of the <see cref="BinaryAssetItem"/> class. /// </summary> /// <param name="path">The asset path.</param> /// <param name="id">The asset identifier.</param> /// <param name="typeName">The asset type name identifier.</param> /// <param name="domain">The asset domain.</param> public BinaryAssetItem(string path, Guid id, string typeName, ContentDomain domain) : base(path, typeName, ref id) { ItemDomain = domain; }