ArtInfo.cs 5.0 KB

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