AssetConfig_GlobalSetting.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4. /// <summary>
  5. /// AssetsBundle路径和配置标记
  6. /// </summary>
  7. public class AssetConfig_GlobalSetting
  8. {
  9. /// <summary>
  10. /// 是否为测试端测试模式
  11. /// 测试模式=versiontest.txt
  12. /// 正式版本=version.txt
  13. /// </summary>
  14. public static bool IsClientTest = true;
  15. public static string AssetBundleSenceEntry = "VersionManager";
  16. /// <summary>
  17. /// 模型
  18. /// </summary>
  19. public static string CharacterPath = "Character";
  20. /// <summary>
  21. /// 图片(icon)
  22. /// </summary>
  23. public static string TexturePath = "Texture";
  24. /// <summary>
  25. /// 特效
  26. /// </summary>
  27. public static string EffectPath = "Effect";
  28. /// <summary>
  29. /// 全局(脚本)
  30. /// </summary>
  31. public static string WorldPath = "World";
  32. /// <summary>
  33. /// UI(prefeb)
  34. /// </summary>
  35. public static string UIPath = "UI";
  36. /// <summary>
  37. /// Scene(prefeb)
  38. /// </summary>
  39. public static string ScenePath = "Scene";
  40. /// <summary>
  41. /// version.txt 格式内容是:
  42. /// Cube.assetbundle,1.0.6
  43. /// Main.unity3d,1.0.6
  44. /// 前面为资源名,后面为该资源的版本号
  45. /// </summary>
  46. public static readonly string strVersionFileName = "VersionMD5.txt";
  47. /// <summary>
  48. /// 获得资源路径
  49. /// 使用【WWW】读取
  50. /// </summary>
  51. public static string strLocalReadUrl
  52. {
  53. get
  54. {
  55. string persistentDataPath = Application.persistentDataPath + "/";
  56. if (Application.isEditor)
  57. {
  58. return "file://" + Application.streamingAssetsPath + "/Res/";
  59. }
  60. return "jar:file://" + Application.dataPath + "!/assets/Res/";
  61. }
  62. }
  63. /// <summary>
  64. /// 获得资源路径
  65. /// 使用【WWW】读取
  66. /// </summary>
  67. public static string strLocalReadPath
  68. {
  69. get
  70. {
  71. if (Application.isEditor)
  72. {
  73. return Application.streamingAssetsPath + "/Res/";
  74. }
  75. return Application.dataPath + "!/assets/Res/";
  76. }
  77. }
  78. /// <summary>
  79. /// 客户端可读写目标路径
  80. /// </summary>
  81. public static string strLocalSaveUrl
  82. {
  83. get { return "file://" + Application.persistentDataPath + "/Res/"; }
  84. }
  85. /// <summary>
  86. /// 客户端可读写目标路径
  87. /// </summary>
  88. public static string strLocalSavePath
  89. {
  90. //////////这里改过,测试用。
  91. get
  92. {
  93. //if (Application.isEditor)
  94. //{
  95. // return Application.dataPath + "/StreamingAssets/Res/";
  96. //}
  97. return Application.persistentDataPath + "/Res/";
  98. }
  99. }
  100. /// <summary>
  101. /// 服务器地址
  102. /// </summary>
  103. public static string strServerUrl
  104. {
  105. // get { return "http://192.168.10.56:8089/bundle/"; }
  106. // get { return "http://115.159.121.129/SweepAllTower/CDN/"; } ///外网ip
  107. get
  108. {
  109. if (GlobalConfig.netType == eNetType.Online || GlobalConfig.netType == eNetType.TestOnline)
  110. {
  111. return "http://115.159.121.129/SweepAllTower/CDN/"; // 外网
  112. }
  113. else
  114. {
  115. return "http://192.168.10.16/SweepAllTower/CDN/yanling/";///内网
  116. }
  117. }
  118. }
  119. public static string ConvertToAssetBundleName(string name)
  120. {
  121. return name + ".unity3d";
  122. }
  123. public static string ConverToStreamPath(string assetBundleName)
  124. {
  125. if (Application.isEditor)
  126. {
  127. return Application.dataPath + "/StreamingAssets/Res/" + assetBundleName; ;
  128. }
  129. return Application.persistentDataPath + "/Res/" + assetBundleName;
  130. }
  131. }