using System;
namespace ShadowStudio.Model
{
///
/// 资源类型,后续扩展
///
[System.Flags]
public enum ArtType
{
///
/// 模型
///
Model = 1,
///
/// 图片
///
Image = 2,
///
/// 音频
///
Audio = 4,
///
/// 电影
///
Movies = 8,
///
/// 游戏对象,预制体,可直接实例化展示,可能是模型,粒子动效,特殊组件
/// 有可能是文本,线,2D编辑框等等
///
Prefab = 16,
///
/// 2D的模型
///
Model2D = 32,
///
/// 属于世界UI
/// 图片,视频,文本等都属于World
///
WorldDlg = 64
}
///
/// 实例化方式
///
public enum InstaceType
{
///
/// 外部url下载
///
ExtralURLDownload = 0,
///
/// Unity的基本组件,Cube等
///
UnityBase = 1,
///
/// 存放于Resource路径下的资源
///
ResourceLoad = 2,
///
/// 存在本地的资源,例如系统相册
///
LocalPath = 3,
///
/// AssetBundle资源,依赖加载
///
AssetBundle = 4,
///
/// 引用类资源,引用类资源如何加上?
///
References = 5
}
///
/// 资源的结构体
///
public class ArtInfo
{
///
/// 资源id
///
private string artId;
private string artName;
///
/// 下载地址/路径/名称等等
/// 按照资源的获取/实例化类型来定义
/// 如果是外部模型,此为下载链接等
/// 如果是Unity基本组件,此为名称
/// 如果ResourceLoad、LocalPath,AssetBundle此为路径
///
private string url;
///
/// 资源对应的缩略图
///
private string icon;
///
/// 资源类型
///
private ArtType artType;
///
/// 实例化方式
///
private InstaceType instaceType;
///
/// 资源版本
///
private string version;
private float size = 1;
private float distance = 2;
private string containerName = "";
private bool immediateSyn = true;
private string component = "";
private string description = "";
///
/// art ID
///
public string ArtId { get => artId; set => artId = value; }
///
/// art Name
///
public string ArtName { get => artName; set => artName = value; }
///
/// art url
///
public string Url { get => url; set => url = value; }
///
/// art 缩略图
///
public string Icon { get => icon; set => icon = value; }
///
/// 资源类型,后续扩展
/// 模型,图片,音视频,简单预制体等等
///
public ArtType ArtType { get => artType; set => artType = value; }
///
/// 创建方式,实例化方式
///
public InstaceType InstaceType { get => instaceType; set => instaceType = value; }
///
/// 版本
///
public string Version { get => version; set => version = value; }
///
/// 默认大小1
///
public float Size { get => size; set => size = value; }
///
/// 默认距离2
///
public float Distance { get => distance; set => distance = value; }
public string ContainerName { get => containerName; set => containerName = value; }
///
/// 是否即时同步
///
public bool ImmediateSyn { get => immediateSyn; set => immediateSyn = value; }
///
/// 引用的组件
///
public string Component { get => component; set => component = value; }
///
/// 文件描述
///
public string Description { get => description; set => description = value; }
public static ArtType GetArtType(int type)
{
ArtType info = (ArtType)Enum.ToObject(typeof(ArtType), (int)Math.Pow(2, type));
return info;
}
}
}