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