ArtInfo.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. 
  2. using System;
  3. namespace ShadowStudio.Model
  4. {
  5. /// <summary>
  6. /// 资源类型,后续扩展
  7. /// </summary>
  8. [System.Flags]
  9. public enum ArtType
  10. {
  11. /// <summary>
  12. /// 模型
  13. /// </summary>
  14. Model = 1,
  15. /// <summary>
  16. /// 图片
  17. /// </summary>
  18. Image = 2,
  19. /// <summary>
  20. /// 音频
  21. /// </summary>
  22. Audio = 4,
  23. /// <summary>
  24. /// 电影
  25. /// </summary>
  26. Movies = 8,
  27. /// <summary>
  28. /// 游戏对象,预制体,可直接实例化展示,可能是模型,粒子动效,特殊组件
  29. /// 有可能是文本,线,2D编辑框等等
  30. /// </summary>
  31. Prefab = 16,
  32. /// <summary>
  33. /// 2D的模型
  34. /// </summary>
  35. Model2D = 32,
  36. /// <summary>
  37. /// 属于世界UI
  38. /// 图片,视频,文本等都属于World
  39. /// </summary>
  40. WorldDlg = 64
  41. }
  42. /// <summary>
  43. /// 实例化方式
  44. /// </summary>
  45. public enum InstaceType
  46. {
  47. /// <summary>
  48. /// 外部url下载
  49. /// </summary>
  50. ExtralURLDownload = 0,
  51. /// <summary>
  52. /// Unity的基本组件,Cube等
  53. /// </summary>
  54. UnityBase = 1,
  55. /// <summary>
  56. /// 存放于Resource路径下的资源
  57. /// </summary>
  58. ResourceLoad = 2,
  59. /// <summary>
  60. /// 存在本地的资源,例如系统相册
  61. /// </summary>
  62. LocalPath = 3,
  63. /// <summary>
  64. /// AssetBundle资源,依赖加载
  65. /// </summary>
  66. AssetBundle = 4,
  67. /// <summary>
  68. /// 引用类资源,引用类资源如何加上?
  69. /// </summary>
  70. References = 5
  71. }
  72. /// <summary>
  73. /// 资源的结构体
  74. /// </summary>
  75. public class ArtInfo
  76. {
  77. /// <summary>
  78. /// 资源id
  79. /// </summary>
  80. private string artId;
  81. private string artName;
  82. /// <summary>
  83. /// 下载地址/路径/名称等等
  84. /// 按照资源的获取/实例化类型来定义
  85. /// 如果是外部模型,此为下载链接等
  86. /// 如果是Unity基本组件,此为名称
  87. /// 如果ResourceLoad、LocalPath,AssetBundle此为路径
  88. /// </summary>
  89. private string url;
  90. /// <summary>
  91. /// 资源对应的缩略图
  92. /// </summary>
  93. private string icon;
  94. /// <summary>
  95. /// 资源类型
  96. /// </summary>
  97. private ArtType artType;
  98. /// <summary>
  99. /// 实例化方式
  100. /// </summary>
  101. private InstaceType instaceType;
  102. /// <summary>
  103. /// 资源版本
  104. /// </summary>
  105. private string version;
  106. private float size = 1;
  107. private float distance = 2;
  108. private string containerName = "";
  109. private bool immediateSyn = true;
  110. private string component = "";
  111. private string description = "";
  112. /// <summary>
  113. /// art ID
  114. /// </summary>
  115. public string ArtId { get => artId; set => artId = value; }
  116. /// <summary>
  117. /// art Name
  118. /// </summary>
  119. public string ArtName { get => artName; set => artName = value; }
  120. /// <summary>
  121. /// art url
  122. /// </summary>
  123. public string Url { get => url; set => url = value; }
  124. /// <summary>
  125. /// art 缩略图
  126. /// </summary>
  127. public string Icon { get => icon; set => icon = value; }
  128. /// <summary>
  129. /// 资源类型,后续扩展
  130. /// 模型,图片,音视频,简单预制体等等
  131. /// </summary>
  132. public ArtType ArtType { get => artType; set => artType = value; }
  133. /// <summary>
  134. /// 创建方式,实例化方式
  135. /// </summary>
  136. public InstaceType InstaceType { get => instaceType; set => instaceType = value; }
  137. /// <summary>
  138. /// 版本
  139. /// </summary>
  140. public string Version { get => version; set => version = value; }
  141. /// <summary>
  142. /// 默认大小1
  143. /// </summary>
  144. public float Size { get => size; set => size = value; }
  145. /// <summary>
  146. /// 默认距离2
  147. /// </summary>
  148. public float Distance { get => distance; set => distance = value; }
  149. public string ContainerName { get => containerName; set => containerName = value; }
  150. /// <summary>
  151. /// 是否即时同步
  152. /// </summary>
  153. public bool ImmediateSyn { get => immediateSyn; set => immediateSyn = value; }
  154. /// <summary>
  155. /// 引用的组件
  156. /// </summary>
  157. public string Component { get => component; set => component = value; }
  158. /// <summary>
  159. /// 文件描述
  160. /// </summary>
  161. public string Description { get => description; set => description = value; }
  162. public static ArtType GetArtType(int type)
  163. {
  164. ArtType info = (ArtType)Enum.ToObject(typeof(ArtType), (int)Math.Pow(2, type));
  165. return info;
  166. }
  167. }
  168. }