CLoaderConst.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Text;
  4. namespace Engine.CLoader
  5. {
  6. /// <summary>资源类型</summary>
  7. public enum AssetsType
  8. {
  9. /// <summary>配置文件资源</summary>
  10. Config = 0,
  11. /// <summary>正常的游戏资源</summary>
  12. Assets,
  13. /// <summary>场景资源</summary>
  14. Scene,
  15. /// <summary>UI资源</summary>
  16. UI,
  17. }
  18. public class CLoaderConst
  19. {
  20. /// <summary>AssetsBundle资源路径</summary>
  21. #if UNITY_EDITOR
  22. public static readonly string AssetsBundleURL = "file://" + Application.dataPath + "/StreamingAssets/";
  23. #elif UNITY_ANDROID
  24. public static readonly string AssetsBundleURL = "jar:file://" + Application.dataPath + "!/assets/";
  25. #elif UNITY_IPHONE
  26. public static readonly string AssetsBundleURL = Application.dataPath + "/Raw/";
  27. #elif UNITY_STANDALONE_WIN || UNITY_EDITOR
  28. public static readonly string AssetsBundleURL = "file://" + Application.dataPath + "/StreamingAssets/";
  29. #else
  30. public static readonly string AssetsBundleURL = "file://" + Application.dataPath + "/StreamingAssets/";
  31. #endif
  32. /// <summary>下载对象的最大个数</summary>
  33. public static int CLoaderMaxCount = 5;
  34. /// <summary>资源文件后缀名</summary>
  35. public const string AB_POSTFIX = ".assetbundle";
  36. /// <summary>数据资源后缀名</summary>
  37. public const string DATA_POSTFIX = ".bytes";
  38. /// <summary>预制件资源后缀名</summary>
  39. public const string PREFAB_POSTFIX = ".prefab";
  40. /// <summary>音效后缀</summary>
  41. public const string MP3_POSTFIX = ".mp3";
  42. /// <summary>添加一个后缀</summary>
  43. public static string AddPostfix(string source, string postfix)
  44. {
  45. if (string.IsNullOrEmpty (source)) {
  46. return string.Empty;
  47. }
  48. if (source.IndexOf (postfix) == -1) {
  49. StringBuilder strBuilder = new StringBuilder ();
  50. strBuilder.Append (source);
  51. strBuilder.Append (postfix);
  52. return strBuilder.ToString ();
  53. } else {
  54. return source;
  55. }
  56. }
  57. }
  58. }