Эх сурвалжийг харах

tooasset替换版本、游戏接入

guodong 1 жил өмнө
parent
commit
bb404d98a8
100 өөрчлөгдсөн 812 нэмэгдсэн , 3726 устгасан
  1. 1 0
      .gitignore
  2. 1 1
      GameClient/Assets/AssetBundleBuilderSetting.asset
  3. 6 1
      GameClient/Assets/AssetBundleCollectorSetting.asset
  4. 28 30
      GameClient/Assets/Editor/ToolsMenu.cs
  5. 0 18
      GameClient/Assets/Editor/Xasset/BuildSetting.cs
  6. 0 8
      GameClient/Assets/Editor/Xasset/Builds.meta
  7. 0 11
      GameClient/Assets/Editor/Xasset/Builds/Asset.cs
  8. 0 3
      GameClient/Assets/Editor/Xasset/Builds/Asset.cs.meta
  9. 0 156
      GameClient/Assets/Editor/Xasset/Builds/BuildScript.cs
  10. 0 519
      GameClient/Assets/Editor/Xasset/Builds/BuildTask.cs
  11. 0 3
      GameClient/Assets/Editor/Xasset/Builds/BuildTask.cs.meta
  12. 0 30
      GameClient/Assets/Editor/Xasset/Builds/PlayerBuildProcessor.cs
  13. 0 15
      GameClient/Assets/Editor/Xasset/Builds/Record.cs
  14. 0 10
      GameClient/Assets/Editor/Xasset/Builds/Records.cs
  15. 0 11
      GameClient/Assets/Editor/Xasset/Builds/Records.cs.meta
  16. 0 169
      GameClient/Assets/Editor/Xasset/Builds/Settings.cs
  17. 0 11
      GameClient/Assets/Editor/Xasset/Builds/Settings.cs.meta
  18. 0 45
      GameClient/Assets/Editor/Xasset/Initializer.cs
  19. 0 11
      GameClient/Assets/Editor/Xasset/Initializer.cs.meta
  20. 0 102
      GameClient/Assets/Editor/Xasset/MenuItems.cs
  21. 0 11
      GameClient/Assets/Editor/Xasset/MenuItems.cs.meta
  22. 0 50
      GameClient/Assets/Editor/Xasset/Simulation/EditorAsset.cs
  23. 0 11
      GameClient/Assets/Editor/Xasset/Simulation/EditorAsset.cs.meta
  24. 0 58
      GameClient/Assets/Editor/Xasset/Simulation/EditorManifestAsset.cs
  25. 0 11
      GameClient/Assets/Editor/Xasset/Simulation/EditorManifestAsset.cs.meta
  26. 0 31
      GameClient/Assets/Editor/Xasset/Simulation/EditorScene.cs
  27. 0 11
      GameClient/Assets/Editor/Xasset/Simulation/EditorScene.cs.meta
  28. 2 1
      GameClient/Assets/Game/HotUpdate/Data/PhotographSceneManager.cs
  29. 4 3
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs
  30. 2 1
      GameClient/Assets/Game/HotUpdate/Game.HotUpdate.asmdef
  31. 1 1
      GameClient/Assets/Game/HotUpdate/GameGlobal.cs
  32. 0 3
      GameClient/Assets/Game/HotUpdate/HotUpdateEntry.cs
  33. 43 34
      GameClient/Assets/Game/HotUpdate/Sqlite/SqliteController.cs
  34. 2 2
      GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs
  35. 2 4
      GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs
  36. 0 1
      GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs
  37. 1 3
      GameClient/Assets/Game/Launcher/FairyGUI/GFGGLoader.cs
  38. 27 18
      GameClient/Assets/Game/Launcher/FairyGUI/GFGUIPackage.cs
  39. 8 0
      GameClient/Assets/Game/Launcher/GameLauncher.cs
  40. 1 1
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper.meta
  41. 10 0
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/BuildinFileManifest.cs
  42. 1 1
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/BuildinFileManifest.cs.meta
  43. 5 0
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsDefine.cs
  44. 1 1
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsDefine.cs.meta
  45. 113 0
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper.cs
  46. 1 1
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper.cs.meta
  47. 161 0
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper2.cs
  48. 1 1
      GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper2.cs.meta
  49. 335 86
      GameClient/Assets/Game/Launcher/Version/VersionController.cs
  50. 35 21
      GameClient/Assets/Game/Launcher/Xasset/GFGAsset.cs
  51. BIN
      GameClient/Assets/ResIn/UI/BornLimit_fui.bytes
  52. BIN
      GameClient/Assets/ResIn/UI/PopWindow_atlas0.png
  53. 0 96
      GameClient/Assets/ResIn/UI/PopWindow_atlas0.png.meta
  54. BIN
      GameClient/Assets/ResIn/UI/PopWindow_fui.bytes
  55. 0 7
      GameClient/Assets/ResIn/UI/PopWindow_fui.bytes.meta
  56. 15 0
      GameClient/Assets/Resources/YooAssetSettings.asset
  57. 3 2
      GameClient/Assets/Resources/YooAssetSettings.asset.meta
  58. 2 1
      GameClient/Assets/ThirdParty/ThirdParty.asmdef
  59. 0 99
      GameClient/Assets/ThirdParty/Xasset/EncryptHelper.cs
  60. 0 11
      GameClient/Assets/ThirdParty/Xasset/EncryptHelper.cs.meta
  61. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime.meta
  62. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config.meta
  63. 0 97
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/Manifest.cs
  64. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/Manifest.cs.meta
  65. 0 33
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/ManifestVersion.cs
  66. 0 3
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/ManifestVersion.cs.meta
  67. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/PlayerSettings.cs
  68. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Config/PlayerSettings.cs.meta
  69. 0 356
      GameClient/Assets/ThirdParty/Xasset/Runtime/Download.cs
  70. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Download.cs.meta
  71. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables.meta
  72. 0 118
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Asset.cs
  73. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Asset.cs.meta
  74. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets.meta
  75. 0 106
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets/BundledAsset.cs
  76. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets/BundledAsset.cs.meta
  77. 0 88
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundle.cs
  78. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundle.cs.meta
  79. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles.meta
  80. 0 51
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/DownloadBundle.cs
  81. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/DownloadBundle.cs.meta
  82. 0 36
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/LocalBundle.cs
  83. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/LocalBundle.cs.meta
  84. 0 92
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Dependencies.cs
  85. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Dependencies.cs.meta
  86. 0 144
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Loadable.cs
  87. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Loadable.cs.meta
  88. 0 246
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/ManifestAsset.cs
  89. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/ManifestAsset.cs.meta
  90. 0 173
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scene.cs
  91. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scene.cs.meta
  92. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes.meta
  93. 0 76
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes/BundledScene.cs
  94. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes/BundledScene.cs.meta
  95. 0 28
      GameClient/Assets/ThirdParty/Xasset/Runtime/Logger.cs
  96. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Logger.cs.meta
  97. 0 8
      GameClient/Assets/ThirdParty/Xasset/Runtime/Operations.meta
  98. 0 52
      GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/ClearHistory.cs
  99. 0 11
      GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/ClearHistory.cs.meta
  100. 0 59
      GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/DownloadVersions.cs

+ 1 - 0
.gitignore

@@ -35,3 +35,4 @@
 /GameClient/Assets/StreamingAssets/build_info
 /GameClient/Assets/StreamingAssets/build_info.meta
 /FGUIProject
+/GameClient/yoo

+ 1 - 1
GameClient/Assets/AssetBundleBuilderSetting.asset

@@ -14,7 +14,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   BuildPipeline: 0
   BuildMode: 0
-  BuildPackage: Logic
+  BuildPackage: GameLogic
   CompressOption: 2
   OutputNameStyle: 1
   CopyBuildinFileOption: 0

+ 6 - 1
GameClient/Assets/AssetBundleCollectorSetting.asset

@@ -19,7 +19,7 @@ MonoBehaviour:
   UniqueBundleName: 1
   ShowEditorAlias: 0
   Packages:
-  - PackageName: Logic
+  - PackageName: GameLogic
     PackageDesc: 
     Groups:
     - GroupName: Game
@@ -83,3 +83,8 @@ MonoBehaviour:
         FilterRuleName: CollectAll
         AssetTags: 
         UserData: 
+    - GroupName: Launcher
+      GroupDesc: 
+      AssetTags: 
+      ActiveRuleName: EnableGroup
+      Collectors: []

+ 28 - 30
GameClient/Assets/Editor/ToolsMenu.cs

@@ -5,8 +5,6 @@ using System.IO;
 using System.Threading;
 using UnityEditor;
 using UnityEditor.Compilation;
-using UnityEngine;
-using VEngine.Editor.Builds;
 
 namespace GFGEditor
 {
@@ -81,7 +79,7 @@ namespace GFGEditor
         {
             EditorUtility.DisplayProgressBar("进度", "正在更新至内网", 1);
             BuildDllHelper.BuildHotUpdateDll();
-            BuildScript.BuildCustomBundles(resArr, "BuildSetting");
+            //BuildScript.BuildCustomBundles(resArr, "BuildSetting");
             EditorUtility.ClearProgressBar();
         }
 
@@ -311,25 +309,25 @@ namespace GFGEditor
             EditorUtility.ClearProgressBar();
         }
 
-        [MenuItem("Tools/Build/Build Bundles Res Init")]
-        public static void BuildBundlesResIn()
-        {
-            BuildScript.BuildCustomBundles(new string[] { "ResIn/Font" }, "BuildSetting");
-        }
-
-        [MenuItem("Tools/Build/Build Bundles All")]
-        public static void BuildBundlesRes()
-        {
-            BuildDllHelper.BuildHotUpdateDll();
-            BuildScript.BuildCustomBundles(resArr, "BuildSetting");
-        }
-
-        //[MenuItem("XAssets/Versions/Copy To StreamingAssets")]
-        [MenuItem("Tools/Build/Copy To StreamingAssets", false, 1)]
-        public static void CopyToStreamingAssets()
-        {
-            BuildScript.CopyToStreamingAssets();
-        }
+        //[MenuItem("Tools/Build/Build Bundles Res Init")]
+        //public static void BuildBundlesResIn()
+        //{
+        //    BuildScript.BuildCustomBundles(new string[] { "ResIn/Font" }, "BuildSetting");
+        //}
+
+        //[MenuItem("Tools/Build/Build Bundles All")]
+        //public static void BuildBundlesRes()
+        //{
+        //    BuildDllHelper.BuildHotUpdateDll();
+        //    BuildScript.BuildCustomBundles(resArr, "BuildSetting");
+        //}
+
+        ////[MenuItem("XAssets/Versions/Copy To StreamingAssets")]
+        //[MenuItem("Tools/Build/Copy To StreamingAssets", false, 1)]
+        //public static void CopyToStreamingAssets()
+        //{
+        //    BuildScript.CopyToStreamingAssets();
+        //}
 
         [MenuItem("Tools/BuildTest/导入临时版本配置", false, 1)]
         public static void SetBundlesExcelTestDir()
@@ -346,14 +344,14 @@ namespace GFGEditor
             }
         }
 
-        [MenuItem("Tools/BuildTest/发布临时版本", false, 3)]
-        public static void BuildBundlesResTemp()
-        {
-            EditorUtility.DisplayProgressBar("进度", "正在发布临时版本", 1);
-            BuildDllHelper.BuildHotUpdateDll();
-            BuildScript.BuildCustomBundles(resArr, "BuildSetting1");
-            EditorUtility.ClearProgressBar();
-        }
+        //[MenuItem("Tools/BuildTest/发布临时版本", false, 3)]
+        //public static void BuildBundlesResTemp()
+        //{
+        //    EditorUtility.DisplayProgressBar("进度", "正在发布临时版本", 1);
+        //    BuildDllHelper.BuildHotUpdateDll();
+        //    BuildScript.BuildCustomBundles(resArr, "BuildSetting1");
+        //    EditorUtility.ClearProgressBar();
+        //}
 
     }
 }

+ 0 - 18
GameClient/Assets/Editor/Xasset/BuildSetting.cs

@@ -1,18 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace GFGEditor
-{
-
-    [CreateAssetMenu(menuName = "Build/BuildSetting", fileName = "BuildSetting", order = 0)]
-    public class BuildSetting : ScriptableObject
-    {
-        public List<string> dirBundleList;
-        public List<string> dirTypeList;
-
-        public static BuildSetting GetBuildSetting(string setName)
-        {
-            return VEngine.Editor.Builds.Settings.LoadAsset<BuildSetting>($"Assets/{setName}.asset");
-        }
-    }
-}

+ 0 - 8
GameClient/Assets/Editor/Xasset/Builds.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 0d3afcac20377574ab296bdd52953300
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 11
GameClient/Assets/Editor/Xasset/Builds/Asset.cs

@@ -1,11 +0,0 @@
-using System;
-
-namespace VEngine.Editor.Builds
-{
-    [Serializable]
-    public class Asset
-    {
-        public string path;
-        public string bundle;
-    }
-}

+ 0 - 3
GameClient/Assets/Editor/Xasset/Builds/Asset.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 2c07a3e59f8444d68af9e2cd40c56ff1
-timeCreated: 1626193398

+ 0 - 156
GameClient/Assets/Editor/Xasset/Builds/BuildScript.cs

@@ -1,156 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using UnityEditor;
-using UnityEngine;
-
-namespace VEngine.Editor.Builds
-{
-    public static class BuildScript
-    {
-        public static Action<BuildTask> postprocessBuildBundles;
-        public static Action<BuildTask> preprocessBuildBundles;
-
-        public static void BuildBundles(BuildTask task)
-        {
-            if (preprocessBuildBundles != null) preprocessBuildBundles(task);
-
-            task.BuildBundles();
-            if (postprocessBuildBundles != null) postprocessBuildBundles(task);
-        }
-
-        public static void BuildBundles()
-        {
-            BuildBundles(new BuildTask());
-        }
-
-        public static void BuildCustomBundles(string[] resRootDirNames, string settingName)
-        {
-            var task = new BuildTask();
-            if (preprocessBuildBundles != null) preprocessBuildBundles(task);
-
-            task.BuildCustomBundles(resRootDirNames, settingName);
-            if (postprocessBuildBundles != null) postprocessBuildBundles(task);
-        }
-
-        private static string GetTimeForNow()
-        {
-            return DateTime.Now.ToString("yyyyMMdd-HHmmss");
-        }
-
-        public static string GetBuildTargetName(BuildTarget target)
-        {
-            var productName = "xc" + "-v" + UnityEditor.PlayerSettings.bundleVersion + ".";
-            var targetName = $"/{productName}-{GetTimeForNow()}";
-            switch (target)
-            {
-                case BuildTarget.Android:
-                    return targetName + ".apk";
-                case BuildTarget.StandaloneWindows:
-                case BuildTarget.StandaloneWindows64:
-                    return targetName + ".exe";
-                case BuildTarget.StandaloneOSX:
-                    return targetName + ".app";
-                default:
-                    return targetName;
-            }
-        }
-
-        public static void BuildPlayer()
-        {
-            var path = Path.Combine(Environment.CurrentDirectory, "Build");
-            if (path.Length == 0) return;
-
-            BuildPlayer(path);
-        }
-
-        public static void BuildPlayer(string path)
-        {
-            var levels = new List<string>();
-            foreach (var scene in EditorBuildSettings.scenes)
-                if (scene.enabled)
-                    levels.Add(scene.path);
-
-            if (levels.Count == 0)
-            {
-                Debug.Log("Nothing to build.");
-                return;
-            }
-
-            var buildTarget = EditorUserBuildSettings.activeBuildTarget;
-            var buildTargetName = GetBuildTargetName(buildTarget);
-            if (buildTargetName == null) return;
-
-            var buildPlayerOptions = new BuildPlayerOptions
-            {
-                scenes = levels.ToArray(),
-                locationPathName = path + buildTargetName,
-                target = buildTarget,
-                options = EditorUserBuildSettings.development
-                    ? BuildOptions.Development
-                    : BuildOptions.None
-            };
-            BuildPipeline.BuildPlayer(buildPlayerOptions);
-        }
-
-        public static void CopyToStreamingAssets()
-        {
-            var settings = Settings.GetDefaultSettings();
-            var destinationDir = Settings.BuildPlayerDataPath;
-            if (Directory.Exists(destinationDir)) Directory.Delete(destinationDir, true);
-
-            Directory.CreateDirectory(destinationDir);
-            var bundles = Settings.GetBundlesInBuild(true);
-            foreach (var bundle in bundles)
-            {
-                var destFile = Path.Combine(Settings.BuildPlayerDataPath, bundle.nameWithAppendHash);
-                var srcFile = Settings.GetBuildPath(bundle.nameWithAppendHash);
-                if (!File.Exists(srcFile))
-                {
-                    Debug.LogWarningFormat("Bundle not found: {0}", bundle.name);
-                    continue;
-                }
-
-                var dir = Path.GetDirectoryName(destFile);
-                if (!Directory.Exists(dir) && !string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir);
-
-                File.Copy(srcFile, destFile, true);
-            }
-
-            var config = Settings.GetPlayerSettings();
-            config.assets = bundles.ConvertAll(o => o.nameWithAppendHash);
-            config.offlineMode = settings.offlineMode;
-            Settings.SaveAsset(config);
-        }
-
-        public static void ClearHistory()
-        {
-            var usedFiles = new List<string>
-            {
-                Settings.GetPlatformName(),
-                Settings.GetPlatformName() + ".manifest"
-            };
-            var manifest = Settings.GetManifest();
-            usedFiles.Add($"{manifest.name}");
-            usedFiles.Add($"{manifest.name}.version");
-            var version = ManifestVersion.Load(Settings.GetBuildPath($"{manifest.name}.version"));
-            usedFiles.Add($"{manifest.name}_v{version.version}_{version.crc}");
-            usedFiles.Add($"{manifest.name}_v{version.version}_{version.crc}.version");
-            foreach (var bundle in manifest.bundles)
-            {
-                usedFiles.Add(bundle.nameWithAppendHash);
-                usedFiles.Add($"{bundle.name}.manifest");
-            }
-
-            var files = Directory.GetFiles(Settings.PlatformBuildPath);
-            foreach (var file in files)
-            {
-                var name = Path.GetFileName(file);
-                if (usedFiles.Contains(name)) continue;
-
-                File.Delete(file);
-                Debug.LogFormat("Delete {0}", file);
-            }
-        }
-    }
-}

+ 0 - 519
GameClient/Assets/Editor/Xasset/Builds/BuildTask.cs

@@ -1,519 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using GFGEditor;
-using GFGGame;
-using UnityEditor;
-using UnityEngine;
-
-namespace VEngine.Editor.Builds
-{
-    public class BuildTask
-    {
-        private readonly string[] EXCLUDE_EXTS = new string[] { ".meta", ".bat" };
-        private readonly string[] EXCLUDE_DIRS = new string[] { "Assets/Res/.svn", ImportArtResTool.Md5FilePath };
-        private readonly BuildAssetBundleOptions buildAssetBundleOptions;
-        private readonly List<Asset> bundledAssets = new List<Asset>();
-        private readonly string bundleExtension;
-        public readonly string name;
-        private readonly Dictionary<string, Asset> pathWithAssets = new Dictionary<string, Asset>();
-
-        public BuildTask()
-        {
-            name = nameof(Manifest);
-            buildAssetBundleOptions = BuildAssetBundleOptions.ChunkBasedCompression |
-                                      BuildAssetBundleOptions.AppendHashToAssetBundleName;
-            bundleExtension = ".unity3d";
-        }
-
-        public Record record { get; private set; }
-
-        private static string GetRecordsPath(string buildName)
-        {
-            return Settings.GetBuildPath($"build_records_for_{buildName}.json");
-        }
-
-
-        private static void WriteRecord(Record record)
-        {
-            var records = GetRecords(record.build);
-            records.data.Insert(0, record);
-            File.WriteAllText(GetRecordsPath(record.build), JsonUtility.ToJson(records));
-        }
-
-        private static Records GetRecords(string build)
-        {
-            var records = ScriptableObject.CreateInstance<Records>();
-            var path = GetRecordsPath(build);
-            if (File.Exists(path)) JsonUtility.FromJsonOverwrite(File.ReadAllText(path), records);
-
-            return records;
-        }
-
-        private static void DisplayProgressBar(string title, string content, int index, int max)
-        {
-            EditorUtility.DisplayProgressBar($"{title}({index}/{max}) ", content,
-                index * 1f / max);
-        }
-
-        public void BuildBundles()
-        {
-            var assetBundleNames = AssetDatabase.GetAllAssetBundleNames();
-            for (var i = 0; i < assetBundleNames.Length; i++)
-            {
-                var assetBundleName = assetBundleNames[i];
-                DisplayProgressBar("采集资源", assetBundleName, i, assetBundleNames.Length);
-                var assetNames = AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName);
-                bundledAssets.AddRange(Array.ConvertAll(assetNames, input => new Asset
-                {
-                    path = input,
-                    bundle = assetBundleName
-                }));
-            }
-
-            CheckAssets();
-            EditorUtility.ClearProgressBar();
-            FinishBuild();
-        }
-
-        public void BuildCustomBundles(string[] resRootDirNames, string setName)
-        {
-            List<string> hideFilePathList = new List<string>();
-            List<string> hideDirPahtList = new List<string>();
-            //换装资源打包屏蔽
-            SqliteController.Instance.dirPath = Path.Combine(Environment.CurrentDirectory, ResPathUtil.CONFIG_DIR_PATH);
-            SqliteController.Instance.Init(false, null);
-            var dressUpItemList = ItemCfgArray.Instance.GetCfgsByitemType(ConstItemType.DRESS_UP);
-            foreach (var itemCfg in dressUpItemList)
-            {
-                if (itemCfg.isHide <= 0 || itemCfg.subType == ConstDressUpItemType.BEI_JING)
-                {
-                    continue;
-                }
-                if (!string.IsNullOrEmpty(itemCfg.resLayer1))
-                {
-                    HideItemRes(itemCfg, 1, hideFilePathList, hideDirPahtList);
-                }
-                if (!string.IsNullOrEmpty(itemCfg.resLayer2))
-                {
-                    HideItemRes(itemCfg, 2, hideFilePathList, hideDirPahtList);
-                }
-                if (!string.IsNullOrEmpty(itemCfg.resLayer3))
-                {
-                    HideItemRes(itemCfg, 3, hideFilePathList, hideDirPahtList);
-                }
-            }
-            //套装动作资源打包屏蔽
-            var suitCfgs = SuitCfgArray.Instance.dataArray;
-            foreach(var suitCfg in suitCfgs)
-            {
-                HideSuitActionRes(suitCfg, hideFilePathList, hideDirPahtList);
-            }
-            //词牌资源打包屏蔽
-            //var cardCfgs = ItemCfgArray.Instance.GetCfgsByitemType(ConstItemType.CARD);
-            //foreach (var itemCfg in cardCfgs)
-            //{
-            //    if (itemCfg.isHide <= 0)
-            //    {
-            //        continue;
-            //    }
-            //    HideCardRes(itemCfg, hideFilePathList, hideDirPahtList);
-            //}
-
-            foreach (var resRootDirName in resRootDirNames)
-            {
-                CreateBundles(resRootDirName, setName, hideFilePathList, hideDirPahtList);
-            }
-            CheckAssets();
-            EditorUtility.ClearProgressBar();
-            FinishBuild();
-        }
-
-        private void HideItemRes(ItemCfg itemCfg, int layerId, List<string> hideFilePathList, List<string> hideDirPahtList)
-        {
-            string res = ResPathUtil.GetDressUpItemLayerRes(itemCfg, layerId);
-            //部件图
-            var resPath = ResPathUtil.GetDressUpPath(itemCfg, layerId);
-            hideFilePathList.Add(resPath);
-            //动画
-            resPath = ResPathUtil.GetDressUpAnimationDirPath(res);
-            hideDirPahtList.Add(resPath);
-            //特效
-            resPath = ResPathUtil.GetDressUpEffectDirPath(res);
-            hideDirPahtList.Add(resPath);
-        }
-
-        private void HideSuitActionRes(SuitCfg suitCfg, List<string> hideFilePathList, List<string> hideDirPahtList)
-        {
-            string resPath;
-            if(!string.IsNullOrEmpty(suitCfg.aniRes))
-            {
-                //屏蔽立绘资源,临时代码,下个大版本将删除
-                bool used = false;
-                var luckyboxCfgs = LuckyBoxCfgArray.Instance.dataArray;
-                foreach(var luckyboxCfg in luckyboxCfgs)
-                {
-                    if(luckyboxCfg.isAni <= 0 && luckyboxCfg.suitIdArr != null)
-                    {
-
-                        if (Array.IndexOf(luckyboxCfg.suitIdArr, suitCfg.id) >= 0)
-                        {
-                            used = true;
-                        }
-                    }
-                }
-                if(used)
-                {
-                    Debug.Log($"suit {suitCfg.id} used picture res");
-                }
-                else
-                {
-                    resPath = ResPathUtil.GetDressUpPath(suitCfg.aniRes);
-                    hideFilePathList.Add(resPath);
-                }
-                if (suitCfg.isHide <= 0)
-                {
-                    return;
-                }
-                //动画
-                resPath = ResPathUtil.GetDressUpAnimationDirPath(suitCfg.aniRes);
-                hideDirPahtList.Add(resPath);
-                //特效
-                resPath = ResPathUtil.GetDressUpEffectDirPath(suitCfg.aniRes);
-                hideDirPahtList.Add(resPath);
-            }
-        }
-
-        //private void HideCardRes(ItemCfg itemCfg, List<string> hideFilePathList, List<string> hideDirPahtList)
-        //{
-        //    //大图
-        //    var resPath = ResPathUtil.GetCardPath(itemCfg.res);
-        //    hideFilePathList.Add(resPath); 
-        //    //小图
-        //    resPath = ResPathUtil.GetCardSmallPath(itemCfg.res);
-        //    hideFilePathList.Add(resPath);
-        //    //动画
-        //    resPath = ResPathUtil.GetCardAnimationDirPath(itemCfg.res);
-        //    hideDirPahtList.Add(resPath);
-        //    //特效
-        //    //to do...暂时没有
-        //}
-
-        private void CreateBundles(string resRootDirName, string setName, List<string> hideFilePathList, List<string> hideDirPahtList)
-        {
-            var path = Path.Combine(Application.dataPath, resRootDirName);
-            var buildSetting = GFGEditor.BuildSetting.GetBuildSetting(setName);
-            var dirBundleList = buildSetting.dirBundleList;
-            var excludeDirs = buildSetting.dirBundleList.GetRange(0, buildSetting.dirBundleList.Count);
-            excludeDirs.AddRange(EXCLUDE_DIRS);
-            GFGEditor.FileUtil.ForeachFileInDir(path, excludeDirs, (string file) =>
-            {
-                var ext = Path.GetExtension(file);
-                if (Array.IndexOf(EXCLUDE_EXTS, ext) < 0)
-                {
-                    file = file.Replace('\\', '/');
-                    string curDir = Environment.CurrentDirectory.Replace("\\", "/");
-                    string filePath = file.Replace(curDir + "/", "");
-                    if(hideFilePathList.Contains(filePath))
-                    {
-                        return;
-                    }
-                    EditorUtility.DisplayProgressBar("采集资源", filePath, 1f);
-                    var bundle = filePath.Replace($"Assets/{resRootDirName}/", "");
-
-                    bundle = bundle.Replace('/', '_');
-                    var i = bundle.IndexOf(".");
-                    bundle = bundle.Substring(0, i);
-                    bundle = bundle.ToLower();
-
-                    //以文件名标识分组
-                    for (int j = 0; j < buildSetting.dirTypeList.Count; j++)
-                    {
-                        string str = buildSetting.dirTypeList[j];
-                        if (bundle.IndexOf(str) >= 0)
-                        {
-                            bundle = str.Substring(0, str.Length - 1);
-                            break;
-                        }
-                    }
-                    bundledAssets.Add(new Asset
-                    {
-                        path = filePath,
-                        bundle = bundle
-                    });
-                }
-
-            });
-            //以子文件夹为单位分组
-            foreach (var dir in dirBundleList)
-            {
-                var dirPath = Path.Combine(Environment.CurrentDirectory, dir);
-                if (!GFGEditor.FileUtil.CheckPathInParent(dirPath, path))
-                {
-                    continue;
-                }
-                GFGEditor.FileUtil.ForeachDirInDir(dirPath, (string subDirPath) =>
-                {
-                    var targetDirPath = subDirPath.Replace('\\', '/');
-                    string curDirPath = Environment.CurrentDirectory.Replace("\\", "/");
-                    string subDir = targetDirPath.Replace(curDirPath + "/", "");
-                    if(hideDirPahtList.Contains(subDir))
-                    {
-                        return;
-                    }
-                    var bundle = subDir.Replace($"Assets/{resRootDirName}/", "");
-                    bundle = bundle.Replace('/', '_');
-                    bundle = bundle.ToLower();
-                    GFGEditor.FileUtil.ForeachFileInDir(subDirPath, null, (string file) =>
-                    {
-                        file = file.Replace('\\', '/');
-                        string curDir = Environment.CurrentDirectory.Replace("\\", "/");
-                        string filePath = file.Replace(curDir + "/", "");
-                        EditorUtility.DisplayProgressBar("采集资源", filePath, 1f);
-                        bundledAssets.Add(new Asset
-                        {
-                            path = filePath,
-                            bundle = bundle
-                        });
-
-                    });
-                });
-            }
-        }
-
-        private void CheckAssets()
-        {
-            for (var i = 0; i < bundledAssets.Count; i++)
-            {
-                var asset = bundledAssets[i];
-                //去重
-                if (!pathWithAssets.TryGetValue(asset.path, out var ba))
-                {
-                    pathWithAssets[asset.path] = asset;
-                }
-                else
-                {
-                    bundledAssets.RemoveAt(i);
-                    i--;
-                    Debug.LogWarningFormat("{0} can't pack with {1}, because already pack to {2}", asset.path,
-                        asset.bundle, ba.bundle);
-                }
-            }
-        }
-
-        private void FinishBuild()
-        {
-            var bundles = new List<ManifestBundle>();
-            var dictionary = new Dictionary<string, List<string>>();
-            //分组
-            foreach (var asset in bundledAssets)
-            {
-                if (!dictionary.TryGetValue(asset.bundle, out var assets))
-                {
-                    assets = new List<string>();
-                    dictionary.Add(asset.bundle, assets);
-                    bundles.Add(new ManifestBundle
-                    {
-                        name = asset.bundle,
-                        assets = assets
-                    });
-                }
-
-                assets.Add(asset.path);
-            }
-
-            var unityBuildPath = Settings.PlatformBuildPath;
-            if (!string.IsNullOrEmpty(GFGGame.LauncherConfig.resKey))
-            {
-                unityBuildPath = Settings.UnityBuildPath;
-            }
-            if (bundles.Count <= 0) return;
-            var manifest = BuildPipeline.BuildAssetBundles(unityBuildPath, bundles.ConvertAll(bundle =>
-                    new AssetBundleBuild
-                    {
-                        assetNames = bundle.assets.ToArray(),
-                        assetBundleName = bundle.name
-                    }).ToArray(),
-                buildAssetBundleOptions | BuildAssetBundleOptions.AppendHashToAssetBundleName,
-                EditorUserBuildSettings.activeBuildTarget);
-
-            if (manifest == null)
-            {
-                Debug.LogErrorFormat("Failed to build {0}.", name);
-                return;
-            }
-            //if (!string.IsNullOrEmpty(GFGGame.LauncherConfig.resKey))
-            //{
-            //    string buildPath = Settings.PlatformBuildPath;
-            //    CreateEncryptAssets(unityBuildPath, buildPath, manifest, GFGGame.LauncherConfig.resKey);
-            //}
-            AfterBuildBundles(bundles, manifest);
-        }
-
-
-        /// <summary>
-        /// 创建加密的AssetBundle
-        /// </summary>
-        //public static void CreateEncryptAssets(string bundlePackagePath, string encryptAssetPath, AssetBundleManifest manifest, string secretKey)
-        //{
-        //    if (!Directory.Exists(encryptAssetPath))
-        //    {
-        //        Directory.CreateDirectory(encryptAssetPath);
-        //    }
-        //    string[] assetBundles = manifest.GetAllAssetBundles();
-        //    foreach (string assetBundle in assetBundles)
-        //    {
-        //        string bundlePath = Path.Combine(bundlePackagePath, assetBundle);
-        //        byte[] encryptBytes = EncryptHelper.CreateEncryptData(bundlePath, secretKey);
-        //        using (FileStream fs = new FileStream(Path.Combine(encryptAssetPath, assetBundle), FileMode.OpenOrCreate))
-        //        {
-        //            fs.SetLength(0);
-        //            fs.Write(encryptBytes, 0, encryptBytes.Length);
-        //        }
-        //    }
-        //}
-
-        /// <summary>
-        /// 创建加密的AssetBundle
-        /// </summary>
-        public static void CreateEncryptAsset(string unityBundlesPath, string bundlesPath, string unityBundle, string secretKey)
-        {
-            if (!Directory.Exists(bundlesPath))
-            {
-                Directory.CreateDirectory(bundlesPath);
-            }
-            string unityBundlePath = Path.Combine(unityBundlesPath, unityBundle);
-            byte[] encryptBytes = EncryptHelper.CreateEncryptData(unityBundlePath, secretKey);
-            using (FileStream fs = new FileStream(Path.Combine(bundlesPath, unityBundle), FileMode.OpenOrCreate))
-            {
-                fs.SetLength(0);
-                fs.Write(encryptBytes, 0, encryptBytes.Length);
-            }
-        }
-
-        private string GetOriginBundle(string assetBundle)
-        {
-            var pos = assetBundle.LastIndexOf("_", StringComparison.Ordinal) + 1;
-            var hash = assetBundle.Substring(pos);
-            if (!string.IsNullOrEmpty(bundleExtension)) hash = hash.Replace(bundleExtension, "");
-
-            var originBundle = $"{assetBundle.Replace("_" + hash, "")}";
-            return originBundle;
-        }
-
-        private void AfterBuildBundles(List<ManifestBundle> bundles,
-            AssetBundleManifest manifest)
-        {
-            var nameWithBundles = new Dictionary<string, ManifestBundle>();
-            for (var i = 0; i < bundles.Count; i++)
-            {
-                var bundle = bundles[i];
-                bundle.id = i;
-                nameWithBundles[bundle.name] = bundle;
-            }
-
-            if (manifest != null)
-            {
-                var assetBundles = manifest.GetAllAssetBundles();
-                foreach (var assetBundle in assetBundles)
-                {
-                    var originBundle = GetOriginBundle(assetBundle);
-                    var dependencies = Array.ConvertAll(manifest.GetAllDependencies(assetBundle), GetOriginBundle);
-                    if (nameWithBundles.TryGetValue(originBundle, out var manifestBundle))
-                    {
-                        manifestBundle.nameWithAppendHash = assetBundle;
-                        manifestBundle.dependencies = Array.ConvertAll(dependencies, input => nameWithBundles[input].id);
-                        
-                    }
-                    else
-                    {
-                        Debug.LogErrorFormat("Bundle not exist: {0}", originBundle);
-                    }
-                }
-            }
-
-            CreateManifest(bundles);
-        }
-
-        private void CreateManifest(List<ManifestBundle> bundles)
-        {
-            var manifest = Settings.GetManifest();
-            manifest.version++;
-            manifest.appVersion = UnityEditor.PlayerSettings.bundleVersion;
-            var getBundles = manifest.GetBundles();
-            var newFiles = new List<string>();
-            var newSize = 0L;
-            foreach (var bundle in bundles)
-            {
-                if (!getBundles.TryGetValue(bundle.name, out var value) ||
-                    value.nameWithAppendHash != bundle.nameWithAppendHash)
-                {
-                    newFiles.Add(bundle.nameWithAppendHash);
-                    if (!string.IsNullOrEmpty(GFGGame.LauncherConfig.resKey))
-                    {
-                        string buildPath = Settings.PlatformBuildPath;
-                        CreateEncryptAsset(Settings.UnityBuildPath, buildPath, bundle.nameWithAppendHash, GFGGame.LauncherConfig.resKey);
-                    }
-                }
-                var file = Settings.GetBuildPath(bundle.nameWithAppendHash);
-                if (File.Exists(file))
-                    using (var stream = File.OpenRead(file))
-                    {
-                        bundle.size = stream.Length;
-                        bundle.crc = Utility.ComputeCRC32(stream);
-                    }
-                else
-                    Debug.LogErrorFormat("File not found: {0}", file);
-                newSize += bundle.size;
-            }
-                
-
-            manifest.bundles = bundles;
-            var newFilesSize = Utility.FormatBytes(newSize);
-            newFiles.AddRange(WriteManifest(manifest));
-            // write upload files
-            var filename = Settings.GetBuildPath($"upload_files_for_{manifest.name}_{manifest.version}.txt");
-            File.WriteAllText(filename, string.Join("\n", newFiles.ToArray()));
-            record = new Record
-            {
-                build = name,
-                version = manifest.version,
-                files = newFiles,
-                size = newSize,
-                time = DateTime.Now.ToFileTime()
-            };
-            WriteRecord(record);
-            Debug.LogFormat("Build bundles with {0}({1}) files with version {2} for {3}.", newFiles.Count, newFilesSize,
-                manifest.version, manifest.name);
-        }
-
-
-        private static IEnumerable<string> WriteManifest(Manifest manifest)
-        {
-            var newFiles = new List<string>();
-            var filename = $"{manifest.name}";
-            var version = manifest.version;
-            WriteJson(manifest, filename, newFiles);
-            var path = Settings.GetBuildPath(filename);
-            var crc = Utility.ComputeCRC32(path);
-            var info = new FileInfo(path);
-            WriteJson(manifest, $"{filename}_v{version}_{crc}", newFiles);
-            // for version file
-            var manifestVersion = ScriptableObject.CreateInstance<ManifestVersion>();
-            manifestVersion.crc = crc;
-            manifestVersion.size = info.Length;
-            manifestVersion.version = version;
-            manifestVersion.appVersion = manifest.appVersion;
-            WriteJson(manifestVersion, Manifest.GetVersionFile(filename), newFiles);
-            WriteJson(manifestVersion, $"{filename}_v{version}_{crc}.version", newFiles);
-            return newFiles;
-        }
-
-        private static void WriteJson(ScriptableObject so, string file, List<string> newFiles)
-        {
-            newFiles.Add(file);
-            var json = JsonUtility.ToJson(so);
-            File.WriteAllText(Settings.GetBuildPath(file), json);
-        }
-    }
-}

+ 0 - 3
GameClient/Assets/Editor/Xasset/Builds/BuildTask.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: f7f08a787515412b9e1a8dc3d9e58cc2
-timeCreated: 1627223002

+ 0 - 30
GameClient/Assets/Editor/Xasset/Builds/PlayerBuildProcessor.cs

@@ -1,30 +0,0 @@
-using System.IO;
-using UnityEditor.Build;
-using UnityEditor.Build.Reporting;
-using UnityEngine;
-
-namespace VEngine.Editor.Builds
-{
-    public class PlayerBuildProcessor : IPreprocessBuildWithReport, IPostprocessBuildWithReport
-    {
-        public void OnPostprocessBuild(BuildReport report)
-        {
-            //if (VEngine.Utility.buildPath != "Bundles")
-            //{
-            //    var directory = Settings.BuildPlayerDataPath;
-            //    if (!Directory.Exists(directory)) return;
-
-            //    Directory.Delete(directory, true);
-            //}
-            //if (Directory.GetFiles(Application.streamingAssetsPath).Length == 0)
-            //    Directory.Delete(Application.streamingAssetsPath);
-        }
-
-        public int callbackOrder => 0;
-
-        public void OnPreprocessBuild(BuildReport report)
-        {
-            //BuildScript.CopyToStreamingAssets();
-        }
-    }
-}

+ 0 - 15
GameClient/Assets/Editor/Xasset/Builds/Record.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace VEngine.Editor.Builds
-{
-    [Serializable]
-    public class Record
-    {
-        public string build;
-        public int version;
-        public long size;
-        public long time;
-        public List<string> files = new List<string>();
-    }
-}

+ 0 - 10
GameClient/Assets/Editor/Xasset/Builds/Records.cs

@@ -1,10 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace VEngine.Editor.Builds
-{
-    public class Records : ScriptableObject
-    {
-        public List<Record> data = new List<Record>();
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Builds/Records.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 04d4b10611b54474c9d5d0777bfb3989
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 169
GameClient/Assets/Editor/Xasset/Builds/Settings.cs

@@ -1,169 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using UnityEditor;
-using UnityEngine;
-
-namespace VEngine.Editor.Builds
-{
-    public enum ScriptPlayMode
-    {
-        Simulation,
-        Preload,
-        Incremental
-    }
-
-    [CreateAssetMenu(menuName = "Versions/Settings", fileName = "Settings", order = 0)]
-    public sealed class Settings : ScriptableObject
-    {
-        public List<string> excludeFiles =
-            new List<string>
-            {
-                ".spriteatlas",
-                ".giparams",
-                "LightingData.asset"
-            };
-
-        public bool offlineMode;
-        public ScriptPlayMode scriptPlayMode = ScriptPlayMode.Simulation;
-
-        public static string PlatformBuildPath
-        {
-            get
-            {
-                var dir = Utility.buildPath + $"/{GetPlatformName()}";
-                if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
-
-                return dir;
-            }
-        }
-
-        public static string UnityBuildPath
-        {
-            get
-            {
-                var dir = Utility.BuildlesUnityFolder + $"/{GetPlatformName()}";
-                if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
-
-                return dir;
-            }
-        }
-
-        public static string BuildPlayerDataPath =>
-            string.Format("{0}/{1}", Application.streamingAssetsPath, Utility.buildPath);
-
-        public static PlayerSettings GetPlayerSettings()
-        {
-            return LoadAsset<PlayerSettings>("Assets/Resources/PlayerSettings.asset");
-        }
-
-        public static Settings GetDefaultSettings()
-        {
-            var guilds = AssetDatabase.FindAssets("t:Settings");
-            foreach (var guild in guilds)
-            {
-                var assetPath = AssetDatabase.GUIDToAssetPath(guild);
-                if (string.IsNullOrEmpty(assetPath)) continue;
-
-                var settings = LoadAsset<Settings>(assetPath);
-                if (settings == null) continue;
-
-                return settings;
-            }
-
-            return LoadAsset<Settings>("Assets/Settings.asset");
-        }
-
-        public static Manifest GetManifest()
-        {
-            var manifest = CreateInstance<Manifest>();
-            manifest.name = nameof(Manifest);
-            var path = GetBuildPath(manifest.name);
-            if (!File.Exists(path)) return manifest;
-
-            manifest.Load(path);
-            return manifest;
-        }
-
-        public static List<ManifestBundle> GetBundlesInBuild(bool includeManifest)
-        {
-            var bundles = new List<ManifestBundle>();
-            var manifest = GetManifest();
-            bundles.AddRange(manifest.bundles);
-            if (includeManifest)
-            {
-                var manifestName = $"{manifest.name}";
-                var manifestVersionName = Manifest.GetVersionFile(manifestName);
-                bundles.Add(new ManifestBundle
-                {
-                    name = manifestVersionName,
-                    nameWithAppendHash = manifestVersionName
-                });
-                bundles.Add(new ManifestBundle
-                {
-                    name = manifestName,
-                    nameWithAppendHash = manifestName
-                });
-            }
-
-            return bundles;
-        }
-
-        public static string GetBuildPath(string file)
-        {
-            return $"{PlatformBuildPath}/{file}";
-        }
-
-        public static string GetPlatformName()
-        {
-            switch (EditorUserBuildSettings.activeBuildTarget)
-            {
-                case BuildTarget.Android:
-                    return "Android";
-                case BuildTarget.StandaloneOSX:
-                    return "OSX";
-                case BuildTarget.StandaloneWindows:
-                case BuildTarget.StandaloneWindows64:
-                    return "Windows";
-                case BuildTarget.iOS:
-                    return "iOS";
-                case BuildTarget.WebGL:
-                    return "WebGL";
-                default:
-                    return Utility.unsupportedPlatform;
-            }
-        }
-
-        public static void PingWithSelected(Object target)
-        {
-            Selection.activeObject = target;
-            EditorGUIUtility.PingObject(target);
-        }
-
-        public static T LoadAsset<T>(string path) where T : ScriptableObject
-        {
-            var asset = AssetDatabase.LoadAssetAtPath<T>(path);
-            if (asset != null) return asset;
-
-            var dir = Path.GetDirectoryName(path);
-            if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) Directory.CreateDirectory(dir);
-
-            asset = CreateInstance<T>();
-            AssetDatabase.CreateAsset(asset, path);
-            return asset;
-        }
-
-        public static void SaveAsset(Object asset)
-        {
-            EditorUtility.SetDirty(asset);
-            AssetDatabase.SaveAssets();
-            AssetDatabase.Refresh();
-        }
-
-        public static IEnumerable<string> GetDependencies(string path)
-        {
-            var set = new HashSet<string>(AssetDatabase.GetDependencies(path, true));
-            set.Remove(path);
-            return set;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Builds/Settings.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 38652c3fc7d9e5e49b0e1830899b6543
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 45
GameClient/Assets/Editor/Xasset/Initializer.cs

@@ -1,45 +0,0 @@
-using System;
-using System.IO;
-using UnityEngine;
-using VEngine.Editor.Builds;
-using VEngine.Editor.Simulation;
-using GFGGame;
-
-namespace VEngine.Editor
-{
-    public static class Initializer
-    {
-        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
-        private static void Init()
-        {
-            Versions.DownloadDataPath = Path.Combine(Application.persistentDataPath, Utility.buildPath);
-            Versions.PlatformName = Settings.GetPlatformName();
-            var config = Settings.GetPlayerSettings();
-            var settings = Settings.GetDefaultSettings();
-            Versions.SimulationMode = settings.scriptPlayMode == ScriptPlayMode.Simulation;
-            switch (settings.scriptPlayMode)
-            {
-                case ScriptPlayMode.Simulation:
-                    Versions.FuncCreateAsset = EditorAsset.Create;
-                    Versions.FuncCreateScene = EditorScene.Create;
-                    Versions.FuncCreateManifest = EditorManifestAsset.Create;
-                    SqliteController.Instance.dirPath = Path.Combine(Environment.CurrentDirectory, ResPathUtil.CONFIG_DIR_PATH);
-                    config.offlineMode = true;
-                    break;
-                case ScriptPlayMode.Preload:
-                    Versions.PlayerDataPath = Path.Combine(Environment.CurrentDirectory, Settings.PlatformBuildPath);
-                    config.offlineMode = true;
-                    break;
-                case ScriptPlayMode.Incremental:
-                    if (!Directory.Exists(Path.Combine(Application.streamingAssetsPath,
-                        Utility.buildPath)))
-                        config.assets.Clear();
-                    SqliteController.Instance.dirPath = null;
-                    config.offlineMode = false;
-                    break;
-                default:
-                    throw new ArgumentOutOfRangeException();
-            }
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Initializer.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f2a3f5eee393f0a418fb8cc097feea68
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 102
GameClient/Assets/Editor/Xasset/MenuItems.cs

@@ -1,102 +0,0 @@
-using System.IO;
-using GFGEditor;
-using UnityEditor;
-using UnityEngine;
-using VEngine.Editor.Builds;
-
-namespace VEngine.Editor
-{
-    public static class MenuItems
-    {
-        [MenuItem("XAssets/Compute CRC")]
-        public static void ComputeCRC()
-        {
-            var target = Selection.activeObject;
-            var path = AssetDatabase.GetAssetPath(target);
-            var crc32 = Utility.ComputeCRC32(File.OpenRead(path));
-            Debug.LogFormat("ComputeCRC for {0} with {1}", path, crc32);
-        }
-
-        [MenuItem("XAssets/Versions/Build Bundles")]
-        public static void BuildBundles()
-        {
-            BuildScript.BuildBundles();
-        }
-
-        [MenuItem("XAssets/Versions/Build Player")]
-        public static void BuildPlayer()
-        {
-            BuildScript.BuildPlayer();
-        }
-
-        [MenuItem("XAssets/Versions/Clear Bundles")]
-        public static void ClearBuild()
-        {
-            if (EditorUtility.DisplayDialog("提示", "清理构建数据将无法正常增量打包,确认清理?", "确定"))
-            {
-                var buildPath = Settings.PlatformBuildPath;
-                Directory.Delete(buildPath, true);
-
-                var directory = Settings.BuildPlayerDataPath;
-                if (!Directory.Exists(directory)) return;
-                Directory.Delete(directory, true);
-
-                directory = Settings.UnityBuildPath;
-                if (!Directory.Exists(directory)) return;
-                Directory.Delete(directory, true);
-
-                ClearDownload();
-            }
-        }
-
-        [MenuItem("XAssets/Versions/Clear History")]
-        public static void ClearHistory()
-        {
-            BuildScript.ClearHistory();
-        }
-
-        [MenuItem("XAssets/Versions/Clear Download")]
-        public static void ClearDownload()
-        {
-            Directory.Delete(Application.persistentDataPath, true);
-        }
-
-        [MenuItem("XAssets/Versions/Clear Temporary")]
-        public static void ClearTemporary()
-        {
-            Directory.Delete(Application.temporaryCachePath, true);
-        }
-
-        [MenuItem("XAssets/Versions/View Settings")]
-        public static void ViewSettings()
-        {
-            Settings.PingWithSelected(Settings.GetDefaultSettings());
-        }
-
-        [MenuItem("XAssets/Versions/View Build")]
-        public static void ViewBuild()
-        {
-            EditorUtility.OpenWithDefaultApp(Settings.PlatformBuildPath);
-        }
-
-        [MenuItem("XAssets/Versions/View Download")]
-        public static void ViewDownload()
-        {
-            EditorUtility.OpenWithDefaultApp(Application.persistentDataPath);
-        }
-
-        [MenuItem("XAssets/Versions/View Temporary")]
-        public static void ViewTemporary()
-        {
-            EditorUtility.OpenWithDefaultApp(Application.temporaryCachePath);
-        }
-
-#if !UNITY_2018_1_OR_NEWER
-        [MenuItem("XAssets/Copy Path")]
-        public static void CopyAssetPath()
-        {
-            EditorGUIUtility.systemCopyBuffer = AssetDatabase.GetAssetPath(Selection.activeObject);
-        }
-#endif
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/MenuItems.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b91f7e3a42a64114eb945eb0efe865b2
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 50
GameClient/Assets/Editor/Xasset/Simulation/EditorAsset.cs

@@ -1,50 +0,0 @@
-using System;
-using System.IO;
-using UnityEditor;
-using UnityEngine;
-
-namespace VEngine.Editor.Simulation
-{
-    public class EditorAsset : Asset
-    {
-        protected override void OnLoad()
-        {
-        }
-
-        protected override void OnUnload()
-        {
-            if (asset == null) return;
-
-            if (!(asset is GameObject))
-            {
-                Resources.UnloadAsset(asset);
-                Resources.UnloadUnusedAssets();
-            }
-
-            asset = null;
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status != LoadableStatus.Loading) return;
-
-            OnLoaded(AssetDatabase.LoadAssetAtPath(pathOrURL, type));
-        }
-
-        public override void LoadImmediate()
-        {
-            OnLoaded(AssetDatabase.LoadAssetAtPath(pathOrURL, type));
-        }
-
-        internal static EditorAsset Create(string path, Type type)
-        {
-            if (!File.Exists(path)) throw new FileNotFoundException(path);
-
-            return new EditorAsset
-            {
-                pathOrURL = path,
-                type = type
-            };
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Simulation/EditorAsset.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7e1596434c825b641a293ead3a9a4c61
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 58
GameClient/Assets/Editor/Xasset/Simulation/EditorManifestAsset.cs

@@ -1,58 +0,0 @@
-using UnityEditor;
-
-namespace VEngine.Editor.Simulation
-{
-    public class EditorManifestAsset : ManifestAsset
-    {
-        private int assetIndex;
-        private int groupIndex;
-
-        private string[] groups;
-
-        protected override void OnLoad()
-        {
-            base.OnLoad();
-            groupIndex = 0;
-            assetIndex = 0;
-            pathOrURL = name;
-            groups = AssetDatabase.GetAllAssetBundleNames();
-            status = LoadableStatus.Loading;
-        }
-
-        public override void Override()
-        {
-            Versions.Override(asset);
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.Loading)
-            {
-                while (groupIndex < groups.Length)
-                {
-                    var group = groups[groupIndex];
-                    var assets = AssetDatabase.GetAssetPathsFromAssetBundle(group);
-                    while (assetIndex < assets.Length)
-                    {
-                        asset.AddAsset(assets[assetIndex]);
-                        assetIndex++;
-                    }
-
-                    assetIndex = 0;
-                    groupIndex++;
-                }
-
-                Finish();
-            }
-        }
-
-        public static EditorManifestAsset Create(string name, bool builtin)
-        {
-            var asset = new EditorManifestAsset
-            {
-                name = name
-            };
-            return asset;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Simulation/EditorManifestAsset.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 32cae96a539c5a445a36e7b22d49f263
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 31
GameClient/Assets/Editor/Xasset/Simulation/EditorScene.cs

@@ -1,31 +0,0 @@
-using System.IO;
-using UnityEditor.SceneManagement;
-using UnityEngine.SceneManagement;
-
-namespace VEngine.Editor.Simulation
-{
-    public class EditorScene : Scene
-    {
-        internal static Scene Create(string assetPath, bool additive = false)
-        {
-            if (!File.Exists(assetPath)) throw new FileNotFoundException(assetPath);
-
-            var scene = new EditorScene
-            {
-                pathOrURL = assetPath,
-                loadSceneMode = additive ? LoadSceneMode.Additive : LoadSceneMode.Single
-            };
-            return scene;
-        }
-
-        protected override void OnLoad()
-        {
-            PrepareToLoad();
-            var parameters = new LoadSceneParameters
-            {
-                loadSceneMode = loadSceneMode
-            };
-            operation = EditorSceneManager.LoadSceneAsyncInPlayMode(pathOrURL, parameters);
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Editor/Xasset/Simulation/EditorScene.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1cb200699735dee4cb231ff38da0c84e
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Data/PhotographSceneManager.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using UnityEngine;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -70,7 +71,7 @@ namespace GFGGame
             string res = value == "n" ? itemCfg.res : string.Format("{0}_{1}", itemCfg.res, value);
 
             string resPath = ResPathUtil.GetDressUpAnimationPath(res);
-            if (VEngine.Versions.Contains(resPath))
+            if (YooAssets.CheckDressUpResExist(resPath))
             {
                 DressUpUtil.AddItem(itemId, sceneObj, false, true, parentGameObj, resLayer);
                 parentGameObj.transform.localPosition = Vector3.zero;

+ 4 - 3
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -3,6 +3,7 @@ using Live2D.Cubism.Rendering;
 using System.IO;
 using FairyGUI;
 using UnityEngine.Rendering;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -300,7 +301,7 @@ namespace GFGGame
 
         private static GameObject AddSpriteObj(string resPath, string ext, string objName, GameObject parentObj, int sortingOrder, bool needSetMask)
         {
-            if (!VEngine.Versions.Contains(resPath))
+            if (!YooAssets.CheckDressUpResExist(resPath))
             {
                 return null;
             }
@@ -457,7 +458,7 @@ namespace GFGGame
 
         public static GameObject CreateAnimationObj(string resPath)
         {
-            if (!VEngine.Versions.Contains(resPath))
+            if (!YooAssets.CheckDressUpResExist(resPath))
             {
                 return null;
             }
@@ -470,7 +471,7 @@ namespace GFGGame
         public static void LoadSpritePos(string resPath, out float tx, out float ty)
         {
             resPath = resPath.Replace(".png", ".bytes");
-            if (VEngine.Versions.Contains(resPath))
+            if (YooAssets.CheckDressUpResExist(resPath))
             {
                 var asset = GFGAsset.Load<TextAsset>(resPath);
                 if (asset != null)

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Game.HotUpdate.asmdef

@@ -3,7 +3,8 @@
     "rootNamespace": "",
     "references": [
         "GUID:065d51621aad9d6498c45bc251a1d8e4",
-        "GUID:7a41fac89c3ce014e99efb3723e6a98e"
+        "GUID:7a41fac89c3ce014e99efb3723e6a98e",
+        "GUID:e34a5702dd353724aa315fb8011f08c3"
     ],
     "includePlatforms": [],
     "excludePlatforms": [],

+ 1 - 1
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -45,7 +45,7 @@ namespace GFGGame
         {
             get
             {
-                return Application.version + "." + VEngine.Versions.ManifestsVersion;
+                return Application.version + "." + VersionController.Instance.PackageVersion;
             }
         }
 

+ 0 - 3
GameClient/Assets/Game/HotUpdate/HotUpdateEntry.cs

@@ -1,6 +1,5 @@
 using Assets.Game.Launcher.HotUpdateProxy;
 using ET;
-using FairyGUI;
 using System;
 using System.Threading;
 using UnityEngine;
@@ -15,8 +14,6 @@ namespace GFGGame.HotUpdate
             Reporter reporter = GameObject.Find("Reporter").GetComponent<Reporter>();
             reporter.numOfCircleToShow = 10;
             reporter.isOpen = LauncherConfig.onDebug > 0;
-            //版本日志
-            VEngine.Logger.Loggable = false;
             //ET
             System.AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
             {

+ 43 - 34
GameClient/Assets/Game/HotUpdate/Sqlite/SqliteController.cs

@@ -1,5 +1,6 @@
 using UnityEngine;
 using System.IO;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -19,51 +20,59 @@ namespace GFGGame
             if (string.IsNullOrEmpty(dirPath))
                 dirPath = $"{Application.persistentDataPath}";
 
-            dbPath = $"{dirPath}/{LauncherConfig.SQL_FILE_NAME}";
+            //dbPath = $"{dirPath}/{LauncherConfig.SQL_FILE_NAME}";
+
+            dbPath = GetSqlFilePath(resPath);
             var connectionPath = "data source=" + dbPath;
 #if !UNITY_EDITOR && UNITY_ANDROID
             connectionPath =  "uri=file:" + dbPath;
 #endif
             //Debug.Log($"connectionPath {connectionPath}");
-            if(resPath != null)
-            {
-                CheckSqlFile(dbPath, resPath);
-            }
+            //if(resPath != null)
+            //{
+                //CheckSqlFile(dbPath, resPath);
+            //}
             SQLiteHelper.Instance.Init(logable, connectionPath);
         }
 
+        private string GetSqlFilePath(string resPath)
+        {
+            RawFileOperationHandle handle = YooAssets.LoadRawFileSync(resPath);
+            return handle.GetRawFilePath();
+        }
+
         /// <summary>
         /// 检查数据库文件是否存在并且是最新版
         /// </summary>
-        private void CheckSqlFile(string dbPath, string resPath)
-        {
-#if UNITY_EDITOR
-            if(!VEngine.Versions.OfflineMode)
-            {
-#endif
-                bool needWrite = true;
-                var crcKey = "crc" + resPath;
-                string crc = "";
-                VEngine.ManifestBundle version;
-                if (File.Exists(dbPath))
-                {
-                    version = VEngine.Versions.GetBundle(resPath);
-                    crc = PlayerPrefs.GetString(crcKey, "");
-                    needWrite = crc != version.crc.ToString();
-                }
-                if(needWrite)
-                {
-                    var asset = GFGAsset.Load<TextAsset>(resPath);
-                    byte[] bytes = asset.bytes;
-                    File.WriteAllBytes(dbPath, bytes);
-                    GFGAsset.Release(resPath);
-                    version = VEngine.Versions.GetBundle(resPath);
-                    PlayerPrefs.SetString(crcKey, version.crc.ToString());
-                }
+//        private void CheckSqlFile(string dbPath, string resPath)
+//        {
+//#if UNITY_EDITOR
+//            if(GameLauncher.Instance.PlayMode != YooAsset.EPlayMode.OfflinePlayMode)
+//            {
+//#endif
+//                bool needWrite = true;
+//                var crcKey = "crc" + resPath;
+//                string crc = "";
+//                VEngine.ManifestBundle version;
+//                if (File.Exists(dbPath))
+//                {
+//                    version = VEngine.Versions.GetBundle(resPath);
+//                    crc = PlayerPrefs.GetString(crcKey, "");
+//                    needWrite = crc != version.crc.ToString();
+//                }
+//                if(needWrite)
+//                {
+//                    var asset = GFGAsset.Load<TextAsset>(resPath);
+//                    byte[] bytes = asset.bytes;
+//                    File.WriteAllBytes(dbPath, bytes);
+//                    GFGAsset.Release(resPath);
+//                    version = VEngine.Versions.GetBundle(resPath);
+//                    PlayerPrefs.SetString(crcKey, version.crc.ToString());
+//                }
 
-#if UNITY_EDITOR
-            }
-#endif
-        }
+//#if UNITY_EDITOR
+//            }
+//#endif
+//        }
     }
 }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Utils/ResPathUtil.cs

@@ -1,4 +1,4 @@
-using static UnityEditor.Experimental.GraphView.GraphView;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -145,7 +145,7 @@ namespace GFGGame
                 return false;
             }
             string resPath = ResPathUtil.GetDressUpAnimationPath(res, extName);
-            return VEngine.Versions.Contains(resPath);
+            return YooAssets.CheckDressUpResExist(resPath);
         }
 
         public static string GetDressUpEffectDirPath(string res)

+ 2 - 4
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -4,11 +4,9 @@ using UI.CommonGame;
 using UI_ComConsume = UI.Card.UI_ComConsume;
 using System.Collections.Generic;
 using UnityEngine;
-using System.Timers;
-using System.Collections;
 using System.Linq;
-using VEngine;
 using ET;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -347,7 +345,7 @@ namespace GFGGame
             }
             string resName = _cardData.resources[_cardData.resIndex];
             string resPath = ResPathUtil.GetCardAnimationPath(_cardData.resources[_cardData.resIndex]);
-            if (_cardData.itemCfg.animationCardStar > 0 && _cardData.star >= _cardData.itemCfg.animationCardStar && Versions.Contains(resPath))
+            if (_cardData.itemCfg.animationCardStar > 0 && _cardData.star >= _cardData.itemCfg.animationCardStar && YooAssets.CheckDressUpResExist(resPath))
             {
                 _effectUI1 = new EffectUI();
                 _effectUI1.Reset(_ui.m_comCard.m_comCardHolder.m_holder, resName, resName, 100, EffectUIType.Card);

+ 0 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs

@@ -1,7 +1,6 @@
 using UI.Login;
 using UnityEngine;
 using FairyGUI;
-using VEngine;
 
 namespace GFGGame
 {

+ 1 - 3
GameClient/Assets/Game/Launcher/FairyGUI/GFGGLoader.cs

@@ -1,7 +1,5 @@
-using System.Collections.Generic;
-using UnityEngine;
+using UnityEngine;
 using FairyGUI;
-using VEngine;
 
 namespace GFGGame
 {

+ 27 - 18
GameClient/Assets/Game/Launcher/FairyGUI/GFGUIPackage.cs

@@ -1,15 +1,14 @@
 using FairyGUI;
 using System.Collections.Generic;
-using System.IO;
 using UnityEngine;
-using VEngine;
+using YooAsset;
 
 namespace GFGGame
 {
     public class GFGUIPackage
     {
         private static Dictionary<string, UIPackage> _packages = new Dictionary<string, UIPackage>();
-        private static Dictionary<string, List<Asset>> _assetDic = new Dictionary<string, List<Asset>>();
+        private static Dictionary<string, List<AssetOperationHandle>> _assetDic = new Dictionary<string, List<AssetOperationHandle>>();
         private static Dictionary<string, int> _assetCount = new Dictionary<string, int>();
 
         public static UIPackage AddPackage(string descFilePath)
@@ -20,19 +19,28 @@ namespace GFGGame
                 _assetCount[descFilePath] = count + 1;
                 return _packages[descFilePath];
             }
-            var asset = Asset.Load($"{descFilePath}_fui.bytes", typeof(TextAsset));
-            AddAsset(descFilePath, asset);
-            var uiPackage = UIPackage.AddPackage((asset.asset as TextAsset).bytes, descFilePath, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
+            //var asset = Asset.Load($"{descFilePath}_fui.bytes", typeof(TextAsset));
+            var handle = YooAssets.LoadAssetSync<TextAsset>($"{descFilePath}_fui.bytes");
+            TextAsset textAsset = handle.AssetObject as TextAsset;
+            AddAsset(descFilePath, handle);
+            var uiPackage = UIPackage.AddPackage(textAsset.bytes, descFilePath, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
             {
-                destroyMethod = DestroyMethod.Unload;
+                //destroyMethod = DestroyMethod.Unload;
                 string path = name + extension;
-                if (Versions.Contains(path))
-                {
-                    var asset = Asset.Load(path, type);
-                    AddAsset(descFilePath, asset);
-                    return asset.asset;
-                }
-                return null;
+                //if (Versions.Contains(path))
+                //{
+                //    var asset = Asset.Load(path, type);
+                //    AddAsset(descFilePath, asset);
+                //    return asset.asset;
+                //}
+                //return null;
+
+
+                destroyMethod = DestroyMethod.None; //注意:这里一定要设置为None
+                string location = path;
+                var handle = YooAssets.LoadAssetSync(location, type);
+                AddAsset(descFilePath, handle);
+                return handle.AssetObject;
             });
             _assetCount.Add(descFilePath, count + 1);
             _packages.Add(descFilePath, uiPackage);
@@ -53,24 +61,25 @@ namespace GFGGame
                 _packages.Remove(descFilePath);
                 UIPackage.RemovePackage(package.name);
 
-                List<Asset> list = null;
+                List<AssetOperationHandle> list = null;
                 if (_assetDic.TryGetValue(descFilePath, out list))
                 {
                     foreach (var asset in list)
                     {
                         asset.Release();
                     }
+                    list.Clear();
                 }
 
             }
         }
 
-        private static void AddAsset(string key, Asset asset)
+        private static void AddAsset(string key, AssetOperationHandle asset)
         {
-            List<Asset> list = null;
+            List<AssetOperationHandle> list = null;
             if (!_assetDic.TryGetValue(key, out list))
             {
-                list = new List<Asset>();
+                list = new List<AssetOperationHandle>();
                 _assetDic.Add(key, list);
             }
             list.Add(asset);

+ 8 - 0
GameClient/Assets/Game/Launcher/GameLauncher.cs

@@ -4,11 +4,19 @@ using GFGGame.Launcher;
 using FairyGUI;
 using System;
 using System.Collections.Generic;
+using YooAsset;
 
 public class GameLauncher : MonoBehaviour
 {
+    public static GameLauncher Instance;
+    /// <summary>
+    /// ×ÊԴϵͳÔËÐÐģʽ
+    /// </summary>
+    public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
+
     private void Awake()
     {
+        Instance = this;
         DontDestroyOnLoad(gameObject);
     }
 

+ 1 - 1
GameClient/Assets/Editor/Xasset.meta → GameClient/Assets/Game/Launcher/StreamingAssetsHelper.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 04ba5ccdd17db43438182510509803b9
+guid: 85b46ba8457f5c942a7657efd9239c6c
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 10 - 0
GameClient/Assets/Game/Launcher/StreamingAssetsHelper/BuildinFileManifest.cs

@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 内置资源清单
+/// </summary>
+public class BuildinFileManifest : ScriptableObject
+{
+	public List<string> BuildinFiles = new List<string>();
+}

+ 1 - 1
GameClient/Assets/Editor/Xasset/Builds/PlayerBuildProcessor.cs.meta → GameClient/Assets/Game/Launcher/StreamingAssetsHelper/BuildinFileManifest.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: b4eb0e860e84a314c94b9f2ff7b28017
+guid: 71b02dfa7aa9d4545b3417a18477fbee
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 5 - 0
GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsDefine.cs

@@ -0,0 +1,5 @@
+
+public class StreamingAssetsDefine
+{
+	public const string RootFolderName = "yoo";
+}

+ 1 - 1
GameClient/Assets/Editor/Xasset/Builds/BuildScript.cs.meta → GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsDefine.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 42b3288209c952c41b384fc2ca87e8be
+guid: 7e44d691f47abe34e9deb9cb309074f4
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 113 - 0
GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper.cs

@@ -0,0 +1,113 @@
+using System.IO;
+using System.Collections.Generic;
+using UnityEngine;
+using YooAsset;
+
+/// <summary>
+/// 资源文件查询服务类
+/// </summary>
+public class GameQueryServices : IQueryServices
+{
+	public bool QueryStreamingAssets(string packageName, string fileName)
+	{
+		// 注意:fileName包含文件格式
+		return StreamingAssetsHelper.FileExists(packageName, fileName);
+	}
+}
+
+#if UNITY_EDITOR
+/// <summary>
+/// StreamingAssets目录下资源查询帮助类
+/// </summary>
+public sealed class StreamingAssetsHelper
+{
+	public static void Init() { }
+	public static bool FileExists(string packageName, string fileName)
+	{
+		string filePath = Path.Combine(Application.streamingAssetsPath, StreamingAssetsDefine.RootFolderName, packageName, fileName);
+		return File.Exists(filePath);
+	}
+}
+#else
+/// <summary>
+/// StreamingAssets目录下资源查询帮助类
+/// </summary>
+public sealed class StreamingAssetsHelper
+{
+	private static bool _isInit = false;
+	private static readonly HashSet<string> _cacheData = new HashSet<string>();
+
+	/// <summary>
+	/// 初始化
+	/// </summary>
+	public static void Init()
+	{
+		if (_isInit == false)
+		{
+			_isInit = true;
+			var manifest = Resources.Load<BuildinFileManifest>("BuildinFileManifest");
+			if (manifest != null)
+			{
+				foreach (string fileName in manifest.BuildinFiles)
+				{
+					_cacheData.Add(fileName);
+				}
+			}
+		}
+	}
+
+	/// <summary>
+	/// 内置文件查询方法
+	/// </summary>
+	public static bool FileExists(string packageName, string fileName)
+	{
+		if (_isInit == false)
+			Init();
+		return _cacheData.Contains(fileName);
+	}
+}
+#endif
+
+
+#if UNITY_EDITOR
+internal class PreprocessBuild : UnityEditor.Build.IPreprocessBuildWithReport
+{
+	public int callbackOrder { get { return 0; } }
+
+	/// <summary>
+	/// 在构建应用程序前处理
+	/// </summary>
+	public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
+	{
+		string saveFilePath = "Assets/Resources/BuildinFileManifest.asset";
+		if (File.Exists(saveFilePath))
+			File.Delete(saveFilePath);
+
+		string folderPath = $"{Application.dataPath}/StreamingAssets/{StreamingAssetsDefine.RootFolderName}";
+		DirectoryInfo root = new DirectoryInfo(folderPath);
+		if (root.Exists == false)
+		{
+			Debug.Log($"没有发现YooAsset内置目录 : {folderPath}");
+			return;
+		}
+
+		var manifest = ScriptableObject.CreateInstance<BuildinFileManifest>();
+		FileInfo[] files = root.GetFiles("*", SearchOption.AllDirectories);
+		foreach (var fileInfo in files)
+		{
+			if (fileInfo.Extension == ".meta")
+				continue;
+			if (fileInfo.Name.StartsWith("PackageManifest_"))
+				continue;
+			manifest.BuildinFiles.Add(fileInfo.Name);
+		}
+
+		if (Directory.Exists("Assets/Resources") == false)
+			Directory.CreateDirectory("Assets/Resources");
+		UnityEditor.AssetDatabase.CreateAsset(manifest, saveFilePath);
+		UnityEditor.AssetDatabase.SaveAssets();
+		UnityEditor.AssetDatabase.Refresh();
+		Debug.Log($"一共{manifest.BuildinFiles.Count}个内置文件,内置资源清单保存成功 : {saveFilePath}");
+	}
+}
+#endif

+ 1 - 1
GameClient/Assets/Editor/Xasset/BuildSetting.cs.meta → GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: e5e55fcd4ab13e0499f04a829427db8b
+guid: ca0617f5ec2b4504b923e3205dc77f54
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 161 - 0
GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper2.cs

@@ -0,0 +1,161 @@
+//-------------------------------------
+// 作者:Stark
+//-------------------------------------
+using System.Collections.Generic;
+using UnityEngine;
+using YooAsset;
+
+/*
+/// <summary>
+/// 资源文件查询服务类
+/// </summary>
+public class GameQueryServices2 : IQueryServices
+{
+	public DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName)
+	{
+		throw new System.NotImplementedException();
+	}
+
+	public bool QueryDeliveryFiles(string packageName, string fileName)
+	{
+		return false;
+	}
+
+	public bool QueryStreamingAssets(string packageName, string fileName)
+	{
+		return StreamingAssetsHelper2.FileExists($"{StreamingAssetsDefine.RootFolderName}/{packageName}/{fileName}");
+	}
+}
+
+/// <summary>
+/// StreamingAssets目录下资源查询帮助类
+/// </summary>
+public sealed class StreamingAssetsHelper2
+{
+	private static readonly Dictionary<string, bool> _cacheData = new Dictionary<string, bool>(1000);
+
+#if UNITY_ANDROID && !UNITY_EDITOR
+	private static AndroidJavaClass _unityPlayerClass;
+	public static AndroidJavaClass UnityPlayerClass
+	{
+		get
+		{
+			if (_unityPlayerClass == null)
+				_unityPlayerClass = new UnityEngine.AndroidJavaClass("com.unity3d.player.UnityPlayer");
+			return _unityPlayerClass;
+		}
+	}
+
+	private static AndroidJavaObject _currentActivity;
+	public static AndroidJavaObject CurrentActivity
+	{
+		get
+		{
+			if (_currentActivity == null)
+				_currentActivity = UnityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
+			return _currentActivity;
+		}
+	}
+
+	/// <summary>
+	/// 利用安卓原生接口查询内置文件是否存在
+	/// </summary>
+	public static bool FileExists(string filePath)
+	{
+		if (_cacheData.TryGetValue(filePath, out bool result) == false)
+		{
+			result = CurrentActivity.Call<bool>("CheckAssetExist", filePath);
+			_cacheData.Add(filePath, result);
+		}
+		return result;
+	}
+#else
+	public static bool FileExists(string filePath)
+	{
+		if (_cacheData.TryGetValue(filePath, out bool result) == false)
+		{
+			result = System.IO.File.Exists(System.IO.Path.Combine(Application.streamingAssetsPath, filePath));
+			_cacheData.Add(filePath, result);
+		}
+		return result;
+	}
+#endif
+}
+
+
+#if UNITY_ANDROID && UNITY_EDITOR
+/// <summary>
+/// 为Github对开发者的友好,采用自动补充UnityPlayerActivity.java文件的通用姿势满足各个开发者
+/// </summary>
+internal class AndroidPost : UnityEditor.Android.IPostGenerateGradleAndroidProject
+{
+	public int callbackOrder => 99;
+	public void OnPostGenerateGradleAndroidProject(string path)
+	{
+		path = path.Replace("\\", "/");
+		string untityActivityFilePath = $"{path}/src/main/java/com/unity3d/player/UnityPlayerActivity.java";
+		var readContent = System.IO.File.ReadAllLines(untityActivityFilePath);
+		string postContent =
+			"    //auto-gen-function \n" +
+			"    public boolean CheckAssetExist(String filePath) \n" +
+			"    { \n" +
+			"        android.content.res.AssetManager assetManager = getAssets(); \n" +
+			"        try \n" +
+			"        { \n" +
+			"            java.io.InputStream inputStream = assetManager.open(filePath); \n" +
+			"            if (null != inputStream) \n" +
+			"            { \n" +
+			"                 inputStream.close(); \n" +
+			"                 return true; \n" +
+			"            } \n" +
+			"        } \n" +
+			"        catch(java.io.IOException e) \n" +
+			"        { \n" +
+			"        } \n" +
+			"        return false; \n" +
+			"    } \n" +
+			"}";
+
+		if (CheckFunctionExist(readContent) == false)
+			readContent[readContent.Length - 1] = postContent;
+		System.IO.File.WriteAllLines(untityActivityFilePath, readContent);
+	}
+	private bool CheckFunctionExist(string[] contents)
+	{
+		for (int i = 0; i < contents.Length; i++)
+		{
+			if (contents[i].Contains("CheckAssetExist"))
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+}
+#endif
+*/
+
+
+
+/*
+// 以下代码为安卓原生代码,不需要解除注释
+//auto-gen-function
+public boolean CheckAssetExist(String filePath)
+{
+	android.content.res.AssetManager assetManager = getAssets();
+	try
+	{
+		java.io.InputStream inputStream = assetManager.open(filePath);
+		if(null != inputStream)
+		{
+			inputStream.close();
+			return true;
+		}
+	}
+	catch(java.io.IOException e)
+	{
+		//e.printStackTrace();
+	}
+	return false;
+}
+*/

+ 1 - 1
GameClient/Assets/Editor/Xasset/Builds/Record.cs.meta → GameClient/Assets/Game/Launcher/StreamingAssetsHelper/StreamingAssetsHelper2.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 11d0306befe1ea643887fd8722108bc1
+guid: 358145d67e230b34883002b08b23cba3
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 335 - 86
GameClient/Assets/Game/Launcher/Version/VersionController.cs

@@ -1,142 +1,391 @@
 using GFGGame.Launcher;
-using VEngine;
+//using VEngine;
 using System.Collections;
+using System.Collections.Generic;
 using UnityEngine;
+using YooAsset;
+//using dnlib.PE;
+//using VEngine;
+//using UnityEngine.Events;
 
 namespace GFGGame
 {
     public class VersionController : SingletonMonoBase<VersionController>
     {
-        private UpdateVersions updateVersions;
+        //private UpdateVersions updateVersions;
+        public const string PackageName_GameLogic = "GameLogic";
+        public const string PackageName_GameArt = "ArtRes";
+
+        private string[] packageNameArr = new string[] {PackageName_GameLogic, PackageName_GameArt };
+        private Dictionary<string, bool> packageStateDic = new Dictionary<string, bool>();
+
+        /// <summary>
+        /// 包裹的版本信息
+        /// </summary>
+        public string PackageVersion { set; get; }
+
+        /// <summary>
+        /// 下载器
+        /// </summary>
+        public ResourceDownloaderOperation Downloader { set; get; }
+
 
-        
 
         public void Init()
         {
+            // 初始化资源系统
+            YooAssets.Initialize();
             StartCoroutine(InitVersion());
         }
 
         public IEnumerator InitVersion()
         {
-            VEngine.Logger.Loggable = false;
-            EncryptHelper.resKey = LauncherConfig.resKey;
-            Versions.DownloadURL = LauncherConfig.CDN_ROOT;
-            var operation = Versions.InitializeAsync(LauncherConfig.CDN_ROOT);
-            yield return operation;
-            //VEngine.Logger.I("Initialize: {0}", operation.status);
-            //VEngine.Logger.I("API Version: {0}", Versions.APIVersion);
-            //VEngine.Logger.I("AppVersion: {0}", Versions.Manifest.appVersion);
-            //VEngine.Logger.I("Manifests Version: {0}", Versions.ManifestsVersion);
-            //VEngine.Logger.I("PlayerDataPath: {0}", Versions.PlayerDataPath);
-            //VEngine.Logger.I("DownloadDataPath: {0}", Versions.DownloadDataPath);
-            //VEngine.Logger.I("DownloadURL: {0}", Versions.DownloadURL);
-            StartCheckManifestVersion();
-        }
+            //VEngine.Logger.Loggable = false;
+            //EncryptHelper.resKey = LauncherConfig.resKey;
+            //Versions.DownloadURL = LauncherConfig.CDN_ROOT;
+            //var operation = Versions.InitializeAsync(LauncherConfig.CDN_ROOT);
+            //yield return operation;
 
-        private void StartCheckManifestVersion()
-        {
-            StartCoroutine(CheckManifestVersion());
+            yield return InitGameLogicPackage();
+
+            yield return InitGameArtPackage();
+
+            yield return GetStaticVersion(PackageName_GameLogic);
+            yield return UpdateManifest(PackageName_GameLogic);
+
+            yield return GetStaticVersion(PackageName_GameArt);
+            yield return UpdateManifest(PackageName_GameArt);
+
+            OnPackageDownloadCompleted(null);
         }
 
-        private IEnumerator CheckManifestVersion()
+        private IEnumerator InitGameLogicPackage()
         {
-            if (!Versions.OfflineMode)
+            // 创建默认的资源包
+            string packageName = PackageName_GameLogic;
+            var package = YooAssets.TryGetPackage(packageName);
+            if (package == null)
             {
-                LogServerHelperHttp.SendNodeLog((int)LogNode.StartCheckVersion);
-                // TODO:生产环境这里的清单名字应该使用带 hash 的版本
-                updateVersions = Versions.UpdateAsync(nameof(Manifest) + LauncherConfig.manifest_v);
-                while(!updateVersions.isDone)
-                {
-                    if(updateVersions.asset != null && updateVersions.asset.assetVersion != null)
-                    {
-                        
-                        var max = updateVersions.asset.assetVersion.size;
-                        LauncherView.Instance.SetDesc($"正在校验资源版本...", $"{Utility.FormatBytes(max)}");
-                        LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
-                    }
-                    yield return updateVersions;
-                };
-                if (updateVersions.status == OperationStatus.Failed)
-                {
-                    Alert.Show("更新版本信息失败,请检测网络链接后重试。")
-                        .SetLeftButton(true, "重试", (data) => { StartCheckManifestVersion(); });
-                }
-                else
-                {
-                    yield return GetDownloadSize();
-                }
+                package = YooAssets.CreatePackage(packageName);
+                YooAssets.SetDefaultPackage(package);
             }
-            else
+
+            var playMode = GameLauncher.Instance.PlayMode;
+            InitializationOperation initializationOperation = null;
+            if (playMode == EPlayMode.EditorSimulateMode)
+            {
+                // 编辑器下的模拟模式
+                var createParameters = new EditorSimulateModeParameters();
+                createParameters.SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild(packageName);
+                initializationOperation = package.InitializeAsync(createParameters);
+            }
+            else if (playMode == EPlayMode.HostPlayMode)
             {
-                OnComplete();
+                // 联机运行模式
+                string defaultHostServer = GetHostServerURL(PackageName_GameLogic);
+                string fallbackHostServer = defaultHostServer;
+                var createParameters = new HostPlayModeParameters();
+                //createParameters.DecryptionServices = new GameDecryptionServices();
+                createParameters.QueryServices = new GameQueryServices();
+                createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
+                initializationOperation = package.InitializeAsync(createParameters);
+            }
+
+            yield return initializationOperation;
+            if (initializationOperation.Status != EOperationStatus.Succeed)
+            {
+                Debug.LogWarning($"{initializationOperation.Error}");
             }
         }
 
-        private IEnumerator GetDownloadSize()
+        private IEnumerator InitGameArtPackage()
         {
-            var getDownloadSize = Versions.GetDownloadSizeAsync(updateVersions);
-            var totalCount = getDownloadSize.bundles.Count;
-            while(!getDownloadSize.isDone)
+            InitializationOperation initializationOperation = null;
+            var package = YooAssets.CreatePackage(PackageName_GameArt);
+            string defaultHostServer = GetHostServerURL(PackageName_GameArt);
+            string fallbackHostServer = defaultHostServer;
+            var createParameters = new HostPlayModeParameters();
+            //createParameters.DecryptionServices = new GameDecryptionServices();
+            createParameters.QueryServices = new GameQueryServices();
+            createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
+            initializationOperation = package.InitializeAsync(createParameters);
+            yield return initializationOperation;
+            if (initializationOperation.Status != EOperationStatus.Succeed)
             {
-                var remainCount = getDownloadSize.bundles.Count;
-                LauncherView.Instance.SetDesc($"正在计算更新内容大小...", $"{ totalCount - remainCount }/{totalCount}");
-                yield return getDownloadSize;
+                Debug.LogWarning($"{initializationOperation.Error}");
             }
-            if (getDownloadSize.totalSize > 0 || updateVersions.changed)
+        }
+
+        private IEnumerator GetStaticVersion(string packageName)
+        {
+            var package = YooAssets.GetPackage(packageName);
+            var operation = package.UpdatePackageVersionAsync();
+            yield return operation;
+
+            if (operation.Status == EOperationStatus.Succeed)
             {
-                string message = $"游戏有新的版本,需要更新{Utility.FormatBytes(getDownloadSize.totalSize)}大小的内容";
-                yield return Alert.Show(message)
-                    .SetLeftButton(true, "更新", (data) => {
-                        StartDownload(getDownloadSize);
-                    });
-                yield break;
+                VersionController.Instance.PackageVersion = operation.PackageVersion;
+                Debug.Log($"远端最新版本为: {operation.PackageVersion}");
             }
             else
             {
-                OnComplete();
+                Debug.LogWarning(operation.Error);
             }
         }
 
-        private void StartDownload(GetDownloadSize getDownloadSize)
+        private IEnumerator UpdateManifest(string packageName)
         {
-            LogServerHelperHttp.SendNodeLog((int)LogNode.StartDownload);
-            StartCoroutine(Downloading(getDownloadSize));
+            bool savePackageVersion = true;
+            var package = YooAssets.GetPackage(packageName);
+            var operation = package.UpdatePackageManifestAsync(VersionController.Instance.PackageVersion, savePackageVersion);
+            yield return operation;
+
+            if (operation.Status != EOperationStatus.Succeed)
+            {
+                Debug.LogWarning(operation.Error);
+                Alert.Show("更新版本信息失败,请检测网络链接后重试。")
+                        .SetLeftButton(true, "重试", (data) => { StartCoroutine(UpdateManifest(packageName)); });
+                }
         }
 
-        private IEnumerator Downloading(GetDownloadSize getDownloadSize)
+        void CreateDownloader(string packageName)
         {
-            LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
-            var downloadAsync = Versions.DownloadAsync(getDownloadSize.result.ToArray());
-            downloadAsync.updated += downloadAsync =>
-            {
-                var current = downloadAsync.downloadedBytes; 
-                 var max = downloadAsync.totalSize;
-                var speed = Download.TotalBandwidth;
-                LauncherView.Instance.SetDesc($"正在下载资源,速度 {Utility.FormatBytes(speed)}/s", $"{Utility.FormatBytes(current)}/{Utility.FormatBytes(max)}", true); 
-                LauncherView.Instance.SetProgress((int)(downloadAsync.progress * 100));
-            };
-            yield return downloadAsync;
-            if (downloadAsync.status == OperationStatus.Failed)
+            int downloadingMaxNum = 10;
+            int failedTryAgain = 3;
+            ResourcePackage package = YooAssets.GetPackage(packageName);
+            var downloaderOperation = package.CreateResourceDownloader(downloadingMaxNum, failedTryAgain);
+            VersionController.Instance.Downloader = downloaderOperation;
+
+            if (downloaderOperation.TotalDownloadCount == 0)
             {
-                Alert.Show("下载失败!请检查网络状态后重试。")
-                    .SetLeftButton(true, "重试", (data) => { 
-                        StartDownload(getDownloadSize); 
-                    });
+                OnPackageDownloadCompleted(packageName);
             }
             else
             {
-                OnComplete();
+                //A total of 10 files were found that need to be downloaded
+                Debug.Log($"Found total {downloaderOperation.TotalDownloadCount} files that need download !");
+
+                // 发现新更新文件后,挂起流程系统
+                // 注意:开发者需要在下载前检测磁盘空间不足
+                int totalDownloadCount = downloaderOperation.TotalDownloadCount;
+                long totalDownloadBytes = downloaderOperation.TotalDownloadBytes;
+                float sizeMB = totalDownloadBytes / 1048576f;
+                sizeMB = Mathf.Clamp(sizeMB, 0.1f, float.MaxValue);
+                string totalSizeMB = sizeMB.ToString("f1");
+                string message = $"游戏有新的版本,{packageName}需要更新{totalSizeMB}MB大小的内容";
+                Alert.Show(message)
+                    .SetLeftButton(true, "更新", (data) =>
+                    {
+                        StartCoroutine(BeginDownload(downloaderOperation, packageName));
+                    });
             }
         }
 
-        private void OnComplete()
+        private IEnumerator BeginDownload(ResourceDownloaderOperation downloaderOperation, string packageName)
         {
-            if(updateVersions != null)
+            // 注册下载回调
+            downloaderOperation.OnDownloadErrorCallback = 
+                (fileName, error) =>
+                {
+                    Debug.LogError($"加载{fileName}失败 {error}");
+                };
+            downloaderOperation.OnDownloadProgressCallback =
+                (totalDownloadCount, currentDownloadCount, totalDownloadSizeBytes, currentDownloadSizeBytes) =>
+                {
+                    string currentSizeMB = (currentDownloadSizeBytes / 1048576f).ToString("f1");
+                    string totalSizeMB = (totalDownloadSizeBytes / 1048576f).ToString("f1");
+                    var progress = currentDownloadSizeBytes / totalDownloadSizeBytes;
+                    LauncherView.Instance.SetDesc($"正在下载资源,{currentDownloadCount}/{totalDownloadCount}", $"{currentSizeMB}MB/{totalSizeMB}MB", true);
+                    LauncherView.Instance.SetProgress((int)(progress * 100));
+                };
+            downloaderOperation.BeginDownload();
+            yield return downloaderOperation;
+
+            // 检测下载结果
+            if (downloaderOperation.Status != EOperationStatus.Succeed)
             {
-                updateVersions.Override();
+                Alert.Show("下载失败!请检查网络状态后重试。")
+                    .SetLeftButton(true, "重试", (data) =>
+                    {
+                        StartCoroutine(BeginDownload(downloaderOperation, packageName));
+                    });
+                yield break;
+            }
+            OnPackageDownloadCompleted(packageName);
+        }
+
+        private void OnPackageDownloadCompleted(string packageNameCompleted)
+        {
+            if(packageNameCompleted != null)
+            {
+                packageStateDic[packageNameCompleted] = true;
+            }
+            //if(updateVersions != null)
+            //{
+            //    updateVersions.Override();
+            //}
+            foreach (var packageName in packageNameArr)
+            {
+                packageStateDic.TryGetValue(packageName, out bool done);
+                if(!done)
+                {
+                    CreateDownloader(packageName);
+                    return;
+                }
             }
             LauncherController.OnVersionCompleted();
         }
 
+        /// <summary>
+        /// 获取资源服务器地址
+        /// </summary>
+        private string GetHostServerURL(string packageName)
+        {
+            string hostServerIP = "http://127.0.0.1";
+
+#if UNITY_EDITOR
+            if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.Android)
+                return $"{hostServerIP}/CDN/Android/{packageName}";
+            else if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.iOS)
+                return $"{hostServerIP}/CDN/IPhone/{packageName}";
+            else if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)
+                return $"{hostServerIP}/CDN/WebGL/{packageName}";
+            else
+                return $"{hostServerIP}/CDN/PC/{packageName}";
+#else
+		if (Application.platform == RuntimePlatform.Android)
+			return $"{hostServerIP}/CDN/Android/{packageName}";
+		else if (Application.platform == RuntimePlatform.IPhonePlayer)
+			return $"{hostServerIP}/CDN/IPhone/{packageName}";
+		else if (Application.platform == RuntimePlatform.WebGLPlayer)
+			return $"{hostServerIP}/CDN/WebGL/{packageName}";
+		else
+			return $"{hostServerIP}/CDN/PC/{packageName}";
+#endif
+        }
+        /// <summary>
+        /// 远端资源地址查询服务类
+        /// </summary>
+        private class RemoteServices : IRemoteServices
+        {
+            private readonly string _defaultHostServer;
+            private readonly string _fallbackHostServer;
+
+            public RemoteServices(string defaultHostServer, string fallbackHostServer)
+            {
+                _defaultHostServer = defaultHostServer;
+                _fallbackHostServer = fallbackHostServer;
+            }
+            string IRemoteServices.GetRemoteMainURL(string fileName)
+            {
+                return $"{_defaultHostServer}/{fileName}";
+            }
+            string IRemoteServices.GetRemoteFallbackURL(string fileName)
+            {
+                return $"{_fallbackHostServer}/{fileName}";
+            }
+        }
+        //private void StartCheckManifestVersion()
+        //{
+        //    StartCoroutine(CheckManifestVersion());
+        //}
+
+        //private IEnumerator CheckManifestVersion()
+        //{
+        //    if (GameLauncher.Instance.PlayMode == EPlayMode.HostPlayMode)
+        //    {
+        //        LogServerHelperHttp.SendNodeLog((int)LogNode.StartCheckVersion);
+        //        // TODO:生产环境这里的清单名字应该使用带 hash 的版本
+        //        updateVersions = Versions.UpdateAsync(nameof(Manifest) + LauncherConfig.manifest_v);
+        //        while (!updateVersions.isDone)
+        //        {
+        //            if (updateVersions.asset != null && updateVersions.asset.assetVersion != null)
+        //            {
+
+        //                var max = updateVersions.asset.assetVersion.size;
+        //                LauncherView.Instance.SetDesc($"正在校验资源版本...", $"{Utility.FormatBytes(max)}");
+        //                LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
+        //            }
+        //            yield return updateVersions;
+        //        };
+        //        if (updateVersions.status == OperationStatus.Failed)
+        //        {
+        //            Alert.Show("更新版本信息失败,请检测网络链接后重试。")
+        //                .SetLeftButton(true, "重试", (data) => { StartCheckManifestVersion(); });
+        //        }
+        //        else
+        //        {
+        //            yield return GetDownloadSize();
+        //        }
+
+
+        //    }
+        //    else
+        //    {
+        //        OnComplete();
+        //    }
+
+
+
+        //}
+
+
+        //private IEnumerator GetDownloadSize()
+        //{
+        //    var getDownloadSize = Versions.GetDownloadSizeAsync(updateVersions);
+        //    var totalCount = getDownloadSize.bundles.Count;
+        //    while(!getDownloadSize.isDone)
+        //    {
+        //        var remainCount = getDownloadSize.bundles.Count;
+        //        LauncherView.Instance.SetDesc($"正在计算更新内容大小...", $"{ totalCount - remainCount }/{totalCount}");
+        //        yield return getDownloadSize;
+        //    }
+        //    if (getDownloadSize.totalSize > 0 || updateVersions.changed)
+        //    {
+        //        string message = $"游戏有新的版本,需要更新{Utility.FormatBytes(getDownloadSize.totalSize)}大小的内容";
+        //        yield return Alert.Show(message)
+        //            .SetLeftButton(true, "更新", (data) => {
+        //                StartDownload(getDownloadSize);
+        //            });
+        //        yield break;
+        //    }
+        //    else
+        //    {
+        //        OnComplete();
+        //    }
+        //}
+
+        //private void StartDownload(GetDownloadSize getDownloadSize)
+        //{
+        //    LogServerHelperHttp.SendNodeLog((int)LogNode.StartDownload);
+        //    StartCoroutine(Downloading(getDownloadSize));
+        //}
+
+        //private IEnumerator Downloading(GetDownloadSize getDownloadSize)
+        //{
+        //    LauncherView.Instance.SetProgress((int)(updateVersions.asset.progress * 100));
+        //    var downloadAsync = Versions.DownloadAsync(getDownloadSize.result.ToArray());
+        //    downloadAsync.updated += downloadAsync =>
+        //    {
+        //        var current = downloadAsync.downloadedBytes; 
+        //         var max = downloadAsync.totalSize;
+        //        var speed = Download.TotalBandwidth;
+        //        LauncherView.Instance.SetDesc($"正在下载资源,速度 {Utility.FormatBytes(speed)}/s", $"{Utility.FormatBytes(current)}/{Utility.FormatBytes(max)}", true); 
+        //        LauncherView.Instance.SetProgress((int)(downloadAsync.progress * 100));
+        //    };
+        //    yield return downloadAsync;
+        //    if (downloadAsync.status == OperationStatus.Failed)
+        //    {
+        //        Alert.Show("下载失败!请检查网络状态后重试。")
+        //            .SetLeftButton(true, "重试", (data) => { 
+        //                StartDownload(getDownloadSize); 
+        //            });
+        //    }
+        //    else
+        //    {
+        //        OnComplete();
+        //    }
+        //}
+
     }
 }

+ 35 - 21
GameClient/Assets/Game/Launcher/Xasset/GFGAsset.cs

@@ -1,7 +1,5 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using VEngine;
+using UnityEngine;
+using YooAsset;
 
 namespace GFGGame
 {
@@ -9,14 +7,38 @@ namespace GFGGame
     {
         public static T Load<T>(string path) where T : Object
         {
-            VEngine.Logger.I($"GFGAsset.Load {path} {Random.Range(0, int.MaxValue)}");
+            //VEngine.Logger.I($"GFGAsset.Load {path} {Random.Range(0, int.MaxValue)}");
             T t = null;
             if (path.Contains("Asset"))
             {
-                Asset asset = VEngine.Asset.Load(path, typeof(T));
-                if (asset != null)
+                //Asset asset = VEngine.Asset.Load(path, typeof(T));
+                //if (asset != null)
+                //{
+                //    t = asset.asset as T;
+                //}
+                ResourcePackage package;
+                if (path.Contains("Assets/Res/"))
                 {
-                    t = asset.asset as T;
+                    package = YooAssets.GetPackage(VersionController.PackageName_GameArt);
+                }
+                else
+                {
+                    package = YooAssets.GetPackage(VersionController.PackageName_GameLogic);
+                }
+                AssetOperationHandle handle = package.LoadAssetSync<T>(path);
+                if(handle != null)
+                {
+                    var t1 = typeof(T);
+                    var t2 = typeof(GameObject);
+                    if (t1 == t2)
+                    {
+                        var t3 = handle.InstantiateSync();
+                        t = t3 as T;
+                    }
+                    else
+                    {
+                        t = handle.AssetObject as T;
+                    }
                 }
             }
             else
@@ -31,19 +53,11 @@ namespace GFGGame
             //VEngine.Logger.I($"GFGAsset.Release {path} {Random.Range(0, int.MaxValue)}");
             if (path.Contains("Asset"))
             {
-                // int count = 0;
-                // if (Asset.CacheCount.TryGetValue(path, out count))
-                // {
-                //     count--;
-                //     Asset.CacheCount[path] = count;
-                // }
-                // if (count > 0) return;
-
-                Asset asset;
-                if (Asset.Cache.TryGetValue(path, out asset))
-                {
-                    asset.Release();
-                }
+                //Asset asset;
+                //if (Asset.Cache.TryGetValue(path, out asset))
+                //{
+                //    asset.Release();
+                //}
             }
             else
             {

BIN
GameClient/Assets/ResIn/UI/BornLimit_fui.bytes


BIN
GameClient/Assets/ResIn/UI/PopWindow_atlas0.png


+ 0 - 96
GameClient/Assets/ResIn/UI/PopWindow_atlas0.png.meta

@@ -1,96 +0,0 @@
-fileFormatVersion: 2
-guid: 048b2e5c448fa2d4db0311545934f819
-TextureImporter:
-  internalIDToNameTable: []
-  externalObjects: {}
-  serializedVersion: 11
-  mipmaps:
-    mipMapMode: 0
-    enableMipMap: 0
-    sRGBTexture: 1
-    linearTexture: 0
-    fadeOut: 0
-    borderMipMap: 0
-    mipMapsPreserveCoverage: 0
-    alphaTestReferenceValue: 0.5
-    mipMapFadeDistanceStart: 1
-    mipMapFadeDistanceEnd: 3
-  bumpmap:
-    convertToNormalMap: 0
-    externalNormalMap: 0
-    heightScale: 0.25
-    normalMapFilter: 0
-  isReadable: 0
-  streamingMipmaps: 0
-  streamingMipmapsPriority: 0
-  vTOnly: 0
-  grayScaleToAlpha: 0
-  generateCubemap: 6
-  cubemapConvolution: 0
-  seamlessCubemap: 0
-  textureFormat: 1
-  maxTextureSize: 2048
-  textureSettings:
-    serializedVersion: 2
-    filterMode: 1
-    aniso: 1
-    mipBias: 0
-    wrapU: 1
-    wrapV: 1
-    wrapW: 1
-  nPOTScale: 0
-  lightmap: 0
-  compressionQuality: 50
-  spriteMode: 1
-  spriteExtrude: 1
-  spriteMeshType: 1
-  alignment: 0
-  spritePivot: {x: 0.5, y: 0.5}
-  spritePixelsToUnits: 100
-  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
-  spriteGenerateFallbackPhysicsShape: 1
-  alphaUsage: 1
-  alphaIsTransparency: 1
-  spriteTessellationDetail: -1
-  textureType: 8
-  textureShape: 1
-  singleChannelComponent: 0
-  flipbookRows: 1
-  flipbookColumns: 1
-  maxTextureSizeSet: 0
-  compressionQualitySet: 0
-  textureFormatSet: 0
-  ignorePngGamma: 0
-  applyGammaDecoding: 0
-  platformSettings:
-  - serializedVersion: 3
-    buildTarget: DefaultTexturePlatform
-    maxTextureSize: 2048
-    resizeAlgorithm: 0
-    textureFormat: -1
-    textureCompression: 1
-    compressionQuality: 50
-    crunchedCompression: 0
-    allowsAlphaSplitting: 0
-    overridden: 0
-    androidETC2FallbackOverride: 0
-    forceMaximumCompressionQuality_BC6H_BC7: 0
-  spriteSheet:
-    serializedVersion: 2
-    sprites: []
-    outline: []
-    physicsShape: []
-    bones: []
-    spriteID: 5e97eb03825dee720800000000000000
-    internalID: 0
-    vertices: []
-    indices: 
-    edges: []
-    weights: []
-    secondaryTextures: []
-  spritePackingTag: 
-  pSDRemoveMatte: 0
-  pSDShowRemoveMatteOption: 0
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
GameClient/Assets/ResIn/UI/PopWindow_fui.bytes


+ 0 - 7
GameClient/Assets/ResIn/UI/PopWindow_fui.bytes.meta

@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: b056dd65f718b994cb1aa3769ab0e2e6
-TextScriptImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 15 - 0
GameClient/Assets/Resources/YooAssetSettings.asset

@@ -0,0 +1,15 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 5bd1afdce9715f84eb4cbc901922afc2, type: 3}
+  m_Name: YooAssetSettings
+  m_EditorClassIdentifier: 
+  ManifestFileName: PackageManifest

+ 3 - 2
GameClient/Assets/ResIn/UI/BornLimit_fui.bytes.meta → GameClient/Assets/Resources/YooAssetSettings.asset.meta

@@ -1,7 +1,8 @@
 fileFormatVersion: 2
-guid: 849e0835f03590f4ea13cb812292a3d2
-TextScriptImporter:
+guid: e8bacee744b99b84999085de5839fffd
+NativeFormatImporter:
   externalObjects: {}
+  mainObjectFileID: 11400000
   userData: 
   assetBundleName: 
   assetBundleVariant: 

+ 2 - 1
GameClient/Assets/ThirdParty/ThirdParty.asmdef

@@ -2,7 +2,8 @@
     "name": "ThirdParty",
     "rootNamespace": "",
     "references": [
-        "GUID:7a1fa966b0ea23f40a6a4dc4dab1e297"
+        "GUID:7a1fa966b0ea23f40a6a4dc4dab1e297",
+        "GUID:e34a5702dd353724aa315fb8011f08c3"
     ],
     "includePlatforms": [],
     "excludePlatforms": [],

+ 0 - 99
GameClient/Assets/ThirdParty/Xasset/EncryptHelper.cs

@@ -1,99 +0,0 @@
-using System.Collections;
-using System.IO;
-using ET;
-using UnityEngine;
-using UnityEngine.Networking;
-
-namespace VEngine
-{
-
-    public class EncryptHelper
-    {
-        public static string resKey;
-
-        private static char[] _resKeyChars;
-        public static char[] resKeyChars
-        {
-            get
-            {
-                if(_resKeyChars == null && !string.IsNullOrEmpty(resKey))
-                {
-                    _resKeyChars = resKey.ToCharArray();
-                }
-                return _resKeyChars;
-            }
-        }
-        /// <summary>
-        /// 创建加密过的数据
-        /// </summary>
-        public static byte[] CreateEncryptData(string filePath, string secretKey)
-        {
-            byte[] encryptData;
-            char[] key = secretKey.ToCharArray();
-            using (FileStream fs = new FileStream(filePath, FileMode.Open))
-            {
-                encryptData = new byte[fs.Length];
-                fs.Read(encryptData, 0, encryptData.Length);
-                for (int i = 0; i < key.Length; i++)
-                {
-                    encryptData[i] = (byte)(encryptData[i] ^ key[i % key.Length]);
-                }
-            }
-            return encryptData;
-        }
-
-        /// <summary>
-        /// 获取解密的数据(无密钥的情况下直接获取数据)
-        /// </summary>
-        internal static byte[] GetDecryptData(string filePath, char[] secretKey = null)
-        {
-            //Logger.I($"GetDecryptData filePath : {filePath} secretKey : {secretKey}");
-            byte[] encryptData;
-            if (filePath.IndexOf("storage/emulated") > 0)
-            {
-                encryptData = File.ReadAllBytes(filePath);
-                if (secretKey != null)
-                {
-                    for (int i = 0; i < secretKey.Length; i++)
-                    {
-                        encryptData[i] = (byte)(encryptData[i] ^ secretKey[i % secretKey.Length]);
-                    }
-                }
-            }
-            else
-            {
-                using (UnityWebRequest webRequest = UnityWebRequest.Get(filePath))
-                {
-                    webRequest.SendWebRequest();
-                    while (!webRequest.isDone) { }
-#if UNITY_2020_1_OR_NEWER
-                    //Logger.I($"GetDecryptData filePath : 1 webRequest.isDone : {webRequest.isDone} webRequest.result : {webRequest.result}");
-                    if (webRequest.result == UnityWebRequest.Result.Success)
-#else
-                    Logger.I($"GetDecryptData filePath : 2");
-                if (string.IsNullOrEmpty(webRequest.error))
-#endif
-                    {
-                        //Logger.I($"GetDecryptData filePath : 3");
-                        encryptData = webRequest.downloadHandler.data;
-                        if (secretKey != null)
-                        {
-                            for (int i = 0; i < secretKey.Length; i++)
-                            {
-                                encryptData[i] = (byte)(encryptData[i] ^ secretKey[i % secretKey.Length]);
-                            }
-                        }
-                    }
-                    else
-                    {
-                        //Logger.I($"GetDecryptData filePath : 4");
-                        encryptData = null;
-                    }
-                }
-            }
-            return encryptData;
-        }
-
-    }
-
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/EncryptHelper.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d7fe4256865f27a448c2c27c42717ba9
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: a0856074e57c7ff4292135804296695f
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Config.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 6765c9ca4d8949208824554e94671000
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 97
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/Manifest.cs

@@ -1,97 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using UnityEngine;
-
-namespace VEngine
-{
-    [Serializable]
-    public class ManifestBundle
-    {
-        public static ManifestBundle Empty = new ManifestBundle();
-        public int id;
-        public string name;
-        public List<string> assets;
-        public long size;
-        public uint crc;
-        public string nameWithAppendHash;
-        public int[] dependencies;
-    }
-
-    public class Manifest : ScriptableObject
-    {
-        public static readonly ManifestBundle[] EmptyBundles = new ManifestBundle[0];
-        public int version;
-        public string appVersion;
-        public List<ManifestBundle> bundles = new List<ManifestBundle>();
-        private Dictionary<string, ManifestBundle> nameWithBundles = new Dictionary<string, ManifestBundle>();
-        public Action<string> onReadAsset;
-
-        public Dictionary<string, ManifestBundle> GetBundles()
-        {
-            var dictionary = new Dictionary<string, ManifestBundle>();
-            foreach (var bundle in bundles) dictionary[bundle.name] = bundle;
-
-            return dictionary;
-        }
-
-        public bool Contains(string assetPath)
-        {
-            return nameWithBundles.ContainsKey(assetPath);
-        }
-
-        public ManifestBundle GetBundle(string assetPath)
-        {
-            ManifestBundle manifestBundle;
-            return nameWithBundles.TryGetValue(assetPath, out manifestBundle) ? manifestBundle : null;
-        }
-
-        public ManifestBundle[] GetDependencies(ManifestBundle bundle)
-        {
-            if (bundle == null) return EmptyBundles;
-
-            return Array.ConvertAll(bundle.dependencies, input => bundles[input]);
-        }
-
-        public void Override(Manifest manifest)
-        {
-            version = manifest.version;
-            bundles = manifest.bundles;
-            nameWithBundles = manifest.nameWithBundles;
-        }
-
-        public static string GetVersionFile(string file)
-        {
-            return $"{file}.version";
-        }
-
-        public void Load(string path)
-        {
-            var json = File.ReadAllText(path);
-            JsonUtility.FromJsonOverwrite(json, this);
-            nameWithBundles.Clear();
-            if (onReadAsset != null)
-                foreach (var bundle in bundles)
-                {
-                    nameWithBundles[bundle.nameWithAppendHash] = bundle;
-                    foreach (var asset in bundle.assets)
-                    {
-                        nameWithBundles[asset] = bundle;
-                        onReadAsset.Invoke(asset);
-                    }
-                }
-            else
-                foreach (var bundle in bundles)
-                {
-                    nameWithBundles[bundle.nameWithAppendHash] = bundle;
-                    foreach (var asset in bundle.assets) nameWithBundles[asset] = bundle;
-                }
-        }
-
-        public void AddAsset(string assetPath)
-        {
-            nameWithBundles[assetPath] = ManifestBundle.Empty;
-            if (onReadAsset != null) onReadAsset(assetPath);
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/Manifest.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8a3a21b6e3028ab4f84a5d55fd75dc8f
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 33
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/ManifestVersion.cs

@@ -1,33 +0,0 @@
-using System;
-using System.IO;
-using UnityEngine;
-
-namespace VEngine
-{
-    public class ManifestVersion : ScriptableObject
-    {
-        public uint crc;
-        public long size;
-        public int version;
-        public string appVersion;
-
-        public static ManifestVersion Load(string filename)
-        {
-            if (!File.Exists(filename)) return CreateInstance<ManifestVersion>();
-
-            var json = File.ReadAllText(filename);
-            var manifestVersion = CreateInstance<ManifestVersion>();
-            try
-            {
-                JsonUtility.FromJsonOverwrite(json, manifestVersion);
-            }
-            catch (Exception e)
-            {
-                Debug.LogException(e);
-                File.Delete(filename);
-            }
-
-            return manifestVersion;
-        }
-    }
-}

+ 0 - 3
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/ManifestVersion.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: da75c547704042d190ea45bf3e0bc886
-timeCreated: 1625913095

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/PlayerSettings.cs

@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace VEngine
-{
-    public class PlayerSettings : ScriptableObject
-    {
-        public List<string> assets = new List<string>();
-        public bool offlineMode;
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Config/PlayerSettings.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 4ce368b5578d7564d8abc7ec7d9b2113
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 356
GameClient/Assets/ThirdParty/Xasset/Runtime/Download.cs

@@ -1,356 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using UnityEngine;
-
-namespace VEngine
-{
-    public enum DownloadStatus
-    {
-        Wait,
-        Progressing,
-        Success,
-        Failed
-    }
-
-    public class DownloadInfo
-    {
-        public uint crc;
-        public string savePath;
-        public long size;
-        public string url;
-    }
-
-    public class Download : CustomYieldInstruction
-    {
-        public static uint MaxDownloads = 10;
-        public static uint ReadBufferSize = 1042 * 4;
-        public static readonly List<Download> Prepared = new List<Download>();
-        public static readonly List<Download> Progressing = new List<Download>();
-        public static readonly Dictionary<string, Download> Cache = new Dictionary<string, Download>();
-        private static float lastSampleTime;
-        private static long lastTotalDownloadedBytes;
-        private readonly byte[] _readBuffer = new byte[ReadBufferSize];
-        private Thread _thread;
-        private FileStream writer;
-
-
-        private Download()
-        {
-            status = DownloadStatus.Wait;
-            downloadedBytes = 0;
-        }
-
-        public DownloadInfo info { get; private set; }
-        public DownloadStatus status { get; private set; }
-        public string error { get; private set; }
-        public Action<Download> completed { get; set; }
-        public Action<Download> updated { get; set; }
-
-        public bool isDone => status == DownloadStatus.Failed || status == DownloadStatus.Success;
-        public float progress => downloadedBytes * 1f / info.size;
-        public long downloadedBytes { get; private set; }
-        public override bool keepWaiting => !isDone;
-        public static bool Working => Progressing.Count > 0;
-
-        public static long TotalDownloadedBytes
-        {
-            get
-            {
-                var value = 0L;
-                foreach (var item in Cache) value += item.Value.downloadedBytes;
-
-                return value;
-            }
-        }
-
-        public static long TotalSize
-        {
-            get
-            {
-                var value = 0L;
-                foreach (var item in Cache) value += item.Value.info.size;
-
-                return value;
-            }
-        }
-
-        public static long TotalBandwidth { get; private set; }
-
-        public static void ClearAllDownloads()
-        {
-            foreach (var download in Progressing) download.Cancel();
-
-            Prepared.Clear();
-            Progressing.Clear();
-            Cache.Clear();
-        }
-
-        public static Download DownloadAsync(string url, string savePath, Action<Download> completed = null,
-            long size = 0, uint crc = 0)
-        {
-            return DownloadAsync(new DownloadInfo
-            {
-                url = url,
-                savePath = savePath,
-                crc = crc,
-                size = size
-            }, completed);
-        }
-
-        public static Download DownloadAsync(DownloadInfo info, Action<Download> completed = null)
-        {
-            Download download;
-            if (!Cache.TryGetValue(info.url, out download))
-            {
-                download = new Download
-                {
-                    info = info
-                };
-                Prepared.Add(download);
-                Cache.Add(info.url, download);
-            }
-            else
-            {
-                Logger.W("Download url {0} already exist.", info.url);
-            }
-
-            if (completed != null) download.completed += completed;
-
-            return download;
-        }
-
-        public static void UpdateAll()
-        {
-            if (Prepared.Count > 0)
-                for (var index = 0; index < Mathf.Min(Prepared.Count, MaxDownloads - Progressing.Count); index++)
-                {
-                    var download = Prepared[index];
-                    Prepared.RemoveAt(index);
-                    index--;
-                    Progressing.Add(download);
-                    download.Start();
-                }
-
-            if (Progressing.Count > 0)
-            {
-                for (var index = 0; index < Progressing.Count; index++)
-                {
-                    var download = Progressing[index];
-                    if (download.updated != null) download.updated(download);
-
-                    if (download.isDone)
-                    {
-                        if (download.status == DownloadStatus.Failed)
-                            Logger.E("Unable to download {0} with error {1}", download.info.url, download.error);
-                        else
-                            Logger.I("Success to download {0}", download.info.url);
-
-                        Progressing.RemoveAt(index);
-                        index--;
-                        download.Complete();
-                    }
-                }
-
-                if (Time.realtimeSinceStartup - lastSampleTime >= 1)
-                {
-                    TotalBandwidth = TotalDownloadedBytes - lastTotalDownloadedBytes;
-                    lastTotalDownloadedBytes = TotalDownloadedBytes;
-                    lastSampleTime = Time.realtimeSinceStartup;
-                }
-            }
-            else
-            {
-                if (Cache.Count <= 0) return;
-
-                Cache.Clear();
-                lastTotalDownloadedBytes = 0;
-                lastSampleTime = Time.realtimeSinceStartup;
-            }
-        }
-
-        public void Retry()
-        {
-            status = DownloadStatus.Wait;
-            Start();
-        }
-
-        public void UnPause()
-        {
-            Retry();
-        }
-
-        public void Pause()
-        {
-            status = DownloadStatus.Wait;
-        }
-
-        public void Cancel()
-        {
-            error = "User Cancel.";
-            status = DownloadStatus.Failed;
-        }
-
-        private void Complete()
-        {
-            if (completed != null)
-            {
-                completed.Invoke(this);
-                completed = null;
-            }
-        }
-
-        private void Run()
-        {
-            try
-            {
-                Downloading();
-                CloseWrite();
-                if (status == DownloadStatus.Failed) return;
-
-                if (downloadedBytes != info.size)
-                {
-                    error = $"Download lenght {downloadedBytes} mismatch to {info.size}";
-                    status = DownloadStatus.Failed;
-                    return;
-                }
-
-                if (info.crc != 0)
-                {
-                    var crc = Utility.ComputeCRC32(info.savePath);
-                    if (info.crc != crc)
-                    {
-                        File.Delete(info.savePath);
-                        error = $"Download crc {crc} mismatch to {info.crc}";
-                        status = DownloadStatus.Failed;
-                        return;
-                    }
-                }
-
-                status = DownloadStatus.Success;
-            }
-            catch (Exception e)
-            {
-                CloseWrite();
-                error = e.Message;
-                status = DownloadStatus.Failed;
-            }
-        }
-
-        private void CloseWrite()
-        {
-            if (writer != null)
-            {
-                writer.Flush();
-                writer.Close();
-            }
-        }
-
-        private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain,
-            SslPolicyErrors spe)
-        {
-            return true;
-        }
-
-        private void Downloading()
-        {
-            var request = CreateWebRequest();
-            using (var response = request.GetResponse())
-            {
-                if (response.ContentLength > 0)
-                {
-                    if (info.size == 0) info.size = response.ContentLength + downloadedBytes;
-
-                    using (var reader = response.GetResponseStream())
-                    {
-                        if (downloadedBytes < info.size)
-                            while (status == DownloadStatus.Progressing)
-                                if (ReadToEnd(reader))
-                                    break;
-                    }
-                }
-                else
-                {
-                    status = DownloadStatus.Success;
-                }
-            }
-        }
-
-        private WebRequest CreateWebRequest()
-        {
-            WebRequest request;
-            if (info.url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
-            {
-                ServicePointManager.ServerCertificateValidationCallback = CheckValidationResult;
-                request = GetHttpWebRequest();
-            }
-            else
-            {
-                request = GetHttpWebRequest();
-            }
-
-            return request;
-        }
-
-        private WebRequest GetHttpWebRequest()
-        {
-            var httpWebRequest = (HttpWebRequest) WebRequest.Create(info.url);
-            httpWebRequest.ProtocolVersion = HttpVersion.Version10;
-            if (downloadedBytes > 0) httpWebRequest.AddRange(downloadedBytes);
-
-            return httpWebRequest;
-        }
-
-        private bool ReadToEnd(Stream reader)
-        {
-            var len = reader.Read(_readBuffer, 0, _readBuffer.Length);
-            if (len > 0)
-            {
-                writer.Write(_readBuffer, 0, len);
-                downloadedBytes += len;
-                return false;
-            }
-
-            return true;
-        }
-
-        private void Start()
-        {
-            if (status != DownloadStatus.Wait) return;
-
-            Logger.I("Start download {0}", info.url);
-            status = DownloadStatus.Progressing;
-            var file = new FileInfo(info.savePath);
-            if (file.Exists && file.Length > 0)
-            {
-                if (info.size > 0 && file.Length == info.size)
-                {
-                    status = DownloadStatus.Success;
-                    return;
-                }
-
-                writer = File.OpenWrite(info.savePath);
-                downloadedBytes = writer.Length - 1;
-                if (downloadedBytes > 0) writer.Seek(-1, SeekOrigin.End);
-            }
-            else
-            {
-                var dir = Path.GetDirectoryName(info.savePath);
-                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) Directory.CreateDirectory(dir);
-
-                writer = File.Create(info.savePath);
-                downloadedBytes = 0;
-            }
-
-            _thread = new Thread(Run)
-            {
-                IsBackground = true
-            };
-            _thread.Start();
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Download.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f68ca9f89f2ec33458ec9bb7fc54db7c
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: aab092dbc17c9a04099d2780e3d4ac7f
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 118
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Asset.cs

@@ -1,118 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Object = UnityEngine.Object;
-
-namespace VEngine
-{
-    public class Asset : Loadable, IEnumerator
-    {
-        public static readonly Dictionary<string, Asset> Cache = new Dictionary<string, Asset>();
-        public static readonly Dictionary<string, int> CacheCount = new Dictionary<string, int>();
-
-        public static readonly List<Asset> Unused = new List<Asset>();
-
-        public Action<Asset> completed;
-
-        public Object asset { get; protected set; }
-
-        protected Type type { get; set; }
-
-        public bool MoveNext()
-        {
-            return !isDone;
-        }
-
-        public void Reset()
-        {
-        }
-
-        protected void OnLoaded(Object target)
-        {
-            asset = target;
-            Finish(asset == null ? "asset == null" : null);
-        }
-
-        public object Current => null;
-
-        public T Get<T>() where T : Object
-        {
-            return asset as T;
-        }
-
-        protected override void OnComplete()
-        {
-            if (completed == null) return;
-
-            var saved = completed;
-            if (completed != null) completed(this);
-
-            completed -= saved;
-        }
-
-        protected override void OnUnused()
-        {
-            completed = null;
-            Unused.Add(this);
-        }
-
-        public static Asset LoadAsync(string path, Type type, Action<Asset> completed = null)
-        {
-            return LoadInternal(path, type, false, completed);
-        }
-
-        public static Asset Load(string path, Type type)
-        {
-            return LoadInternal(path, type, true);
-        }
-
-        internal static Asset LoadInternal(string path, Type type, bool mustCompleteOnNextFrame,
-            Action<Asset> completed = null)
-        {
-            if (!Versions.Contains(path))
-            {
-                Logger.W("请添加资源 {0}", path);
-                return null;
-            }
-
-            if (!Cache.TryGetValue(path, out var item))
-            {
-                item = Versions.CreateAsset(path, type);
-                Cache.Add(path, item);
-
-            }
-            // if (CacheCount.ContainsKey(path))
-            // {
-            //     CacheCount[path] = CacheCount[path] + 1;
-            // }
-            // else
-            // {
-            //     CacheCount.Add(path, 1);
-            // }
-
-            if (completed != null) item.completed += completed;
-
-            item.mustCompleteOnNextFrame = mustCompleteOnNextFrame;
-            item.Load();
-            if (mustCompleteOnNextFrame) item.LoadImmediate();
-
-            return item;
-        }
-
-        public static void UpdateAssets()
-        {
-            for (var index = 0; index < Unused.Count; index++)
-            {
-                var item = Unused[index];
-                if (!item.isDone) continue;
-
-                Unused.RemoveAt(index);
-                index--;
-                if (!item.reference.unused) continue;
-
-                item.Unload();
-                Cache.Remove(item.pathOrURL);
-            }
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Asset.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 0dfc9a99017ebcd43b4071b93e13127f
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: da2f34ec8fba7174bb36706397755de3
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 106
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets/BundledAsset.cs

@@ -1,106 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace VEngine
-{
-    public class BundledAsset : Asset
-    {
-        private Dependencies dependencies;
-        private AssetBundleRequest request;
-
-        internal static BundledAsset Create(string path, Type type)
-        {
-            return new BundledAsset
-            {
-                pathOrURL = path,
-                type = type
-            };
-        }
-
-        protected override void OnLoad()
-        {
-            dependencies = new Dependencies
-            {
-                pathOrURL = pathOrURL
-            };
-            dependencies.Load();
-            status = LoadableStatus.DependentLoading;
-        }
-
-        protected override void OnUnload()
-        {
-            if (dependencies != null)
-            {
-                dependencies.Unload();
-                dependencies = null;
-            }
-
-            request = null;
-            asset = null;
-        }
-
-        public override void LoadImmediate()
-        {
-            if (isDone) return;
-
-            if (dependencies == null)
-            {
-                Finish("dependencies == null");
-                return;
-            }
-
-            if (!dependencies.isDone) dependencies.LoadImmediate();
-
-            if (dependencies.assetBundle == null)
-            {
-                Finish("dependencies.assetBundle == null");
-                return;
-            }
-
-            OnLoaded(dependencies.assetBundle.LoadAsset(pathOrURL, type));
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.Loading)
-                UpdateLoading();
-            else if (status == LoadableStatus.DependentLoading) UpdateDependencies();
-        }
-
-        private void UpdateLoading()
-        {
-            if (request == null)
-            {
-                Finish("request == null");
-                return;
-            }
-
-            progress = 0.5f + request.progress * 0.5f;
-            if (!request.isDone) return;
-
-            OnLoaded(request.asset);
-        }
-
-        private void UpdateDependencies()
-        {
-            if (dependencies == null)
-            {
-                Finish("dependencies == null");
-                return;
-            }
-
-            progress = 0.5f * dependencies.progress;
-            if (!dependencies.isDone) return;
-
-            var assetBundle = dependencies.assetBundle;
-            if (assetBundle == null)
-            {
-                Finish("assetBundle == null");
-                return;
-            }
-
-            request = assetBundle.LoadAssetAsync(pathOrURL, type);
-            status = LoadableStatus.Loading;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Assets/BundledAsset.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 89c87512164686c47be2102e61e462c7
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 88
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundle.cs

@@ -1,88 +0,0 @@
-using System;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace VEngine
-{
-    public class Bundle : Loadable
-    {
-        public static Func<ManifestBundle, Bundle> customBundleCreator;
-
-        public static readonly Dictionary<string, Bundle> Cache = new Dictionary<string, Bundle>();
-
-        public static readonly List<Bundle> Unused = new List<Bundle>();
-
-        public ManifestBundle info;
-
-        public AssetBundle assetBundle { get; protected set; }
-
-        protected void OnLoaded(AssetBundle bundle)
-        {
-            assetBundle = bundle;
-            Finish(assetBundle == null ? "assetBundle == null" : null);
-        }
-
-        protected override void OnUnused()
-        {
-            Unused.Add(this);
-        }
-
-        internal static Bundle LoadInternal(ManifestBundle bundle, bool mustCompleteOnNextFrame)
-        {
-            if (bundle == null) throw new NullReferenceException();
-
-            if (!Cache.TryGetValue(bundle.nameWithAppendHash, out var item))
-            {
-                var url = Versions.GetBundlePathOrURL(bundle);
-                if (Application.platform == RuntimePlatform.WebGLPlayer)
-                {
-                    throw new NotImplementedException("开源版不提供 WebGL 支持");
-                }
-                else
-                {
-                    if (customBundleCreator != null) item = customBundleCreator(bundle);
-                    if (item == null)
-                    {
-                        if (url.StartsWith("http://") || url.StartsWith("https://") || url.StartsWith("ftp://"))
-                            item = new DownloadBundle {pathOrURL = url, info = bundle};
-                        else
-                            item = new LocalBundle {pathOrURL = url, info = bundle};
-                    }
-                }
-
-                Cache.Add(bundle.nameWithAppendHash, item);
-            }
-
-            item.mustCompleteOnNextFrame = mustCompleteOnNextFrame;
-            item.Load();
-            if (mustCompleteOnNextFrame) item.LoadImmediate();
-
-            return item;
-        }
-
-        internal static void UpdateBundles()
-        {
-            for (var index = 0; index < Unused.Count; index++)
-            {
-                var item = Unused[index];
-                if (!item.isDone) continue;
-
-                Unused.RemoveAt(index);
-                index--;
-                if (!item.reference.unused) continue;
-
-                item.Unload();
-                Cache.Remove(item.info.nameWithAppendHash);
-                if (Updater.Instance.busy) return;
-            }
-        }
-
-        protected override void OnUnload()
-        {
-            if (assetBundle == null) return;
-
-            assetBundle.Unload(true);
-            assetBundle = null;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundle.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 29c4e49e96faacd4f9925530e4014692
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: feaac4544c3ec7f4b90f15a48947f148
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 51
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/DownloadBundle.cs

@@ -1,51 +0,0 @@
-using UnityEngine;
-
-namespace VEngine
-{
-    internal class DownloadBundle : Bundle
-    {
-        private Download download;
-        private AssetBundleCreateRequest request;
-
-        protected override void OnLoad()
-        {
-            download = Download.DownloadAsync(pathOrURL, Versions.GetDownloadDataPath(info.nameWithAppendHash), null,
-                info.size, info.crc);
-            download.completed += OnDownloaded;
-        }
-
-        private void OnDownloaded(Download obj)
-        {
-            if (download.status == DownloadStatus.Failed)
-            {
-                Finish(download.error);
-                return;
-            }
-
-            if (assetBundle != null) return;
-
-            var encrpytData = EncryptHelper.GetDecryptData(obj.info.savePath, EncryptHelper.resKeyChars);
-            request = AssetBundle.LoadFromMemoryAsync(encrpytData);
-            Versions.SetBundlePathOrURl(info.nameWithAppendHash, obj.info.savePath);
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status != LoadableStatus.Loading) return;
-
-            if (!download.isDone)
-            {
-                progress = download.downloadedBytes * 1f / download.info.size * 0.5f;
-                return;
-            }
-
-            if (request == null) return;
-
-            progress = 0.5f + request.progress;
-            if (!request.isDone) return;
-
-            OnLoaded(request.assetBundle);
-            request = null;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/DownloadBundle.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e8c87731c791f3742881f41a934c6c4d
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 36
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/LocalBundle.cs

@@ -1,36 +0,0 @@
-using UnityEngine;
-
-namespace VEngine
-{
-    internal class LocalBundle : Bundle
-    {
-        private AssetBundleCreateRequest request;
-
-        protected override void OnLoad()
-        {
-            if(EncryptHelper.resKeyChars == null)
-            {
-                request = AssetBundle.LoadFromFileAsync(pathOrURL);
-            }
-            else
-            {
-                var encrpytData = EncryptHelper.GetDecryptData(pathOrURL, EncryptHelper.resKeyChars);
-                request = AssetBundle.LoadFromMemoryAsync(encrpytData);
-            }
-        }
-
-        public override void LoadImmediate()
-        {
-            if (isDone) return;
-            OnLoaded(request.assetBundle);
-            request = null;
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status != LoadableStatus.Loading) return;
-            progress = request.progress;
-            if (request.isDone) OnLoaded(request.assetBundle);
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Bundles/LocalBundle.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 6c514e6ec3da245419cb131a367b6d8b
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 92
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Dependencies.cs

@@ -1,92 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace VEngine
-{
-    public class Dependencies : Loadable
-    {
-        protected readonly List<Bundle> bundles = new List<Bundle>();
-        protected Bundle mainBundle;
-
-        public AssetBundle assetBundle => mainBundle?.assetBundle;
-
-        protected override void OnLoad()
-        {
-            if (!Versions.GetDependencies(pathOrURL, out var info, out var infos))
-            {
-                Finish("Dependencies not found");
-                return;
-            }
-
-            if (info == null)
-            {
-                Finish("info == null");
-                return;
-            }
-
-            mainBundle = Bundle.LoadInternal(info, mustCompleteOnNextFrame);
-            bundles.Add(mainBundle);
-            if (infos != null && infos.Length > 0)
-                foreach (var item in infos)
-                    bundles.Add(Bundle.LoadInternal(item, mustCompleteOnNextFrame));
-        }
-
-        public override void LoadImmediate()
-        {
-            if (isDone) return;
-
-            foreach (var request in bundles) request.LoadImmediate();
-        }
-
-        protected override void OnUnload()
-        {
-            if (bundles.Count > 0)
-            {
-                foreach (var item in bundles)
-                    if (string.IsNullOrEmpty(item.error))
-                        item.Release();
-
-                bundles.Clear();
-            }
-
-            mainBundle = null;
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.Loading)
-            {
-                var totalProgress = 0f;
-                var allDone = true;
-                foreach (var child in bundles)
-                {
-                    totalProgress += child.progress;
-                    if (!string.IsNullOrEmpty(child.error))
-                    {
-                        status = LoadableStatus.FailedToLoad;
-                        error = child.error;
-                        progress = 1;
-                        return;
-                    }
-
-                    if (child.isDone) continue;
-
-                    allDone = false;
-                    break;
-                }
-
-                progress = totalProgress / bundles.Count * 0.5f;
-                if (allDone)
-                {
-                    if (assetBundle == null)
-                    {
-                        Finish("assetBundle == null");
-                        return;
-                    }
-
-                    Finish();
-                }
-            }
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Dependencies.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7da2fa086832e544db365d22d326767d
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 144
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Loadable.cs

@@ -1,144 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace VEngine
-{
-    public enum LoadableStatus
-    {
-        Wait,
-        Loading,
-        DependentLoading,
-        SuccessToLoad,
-        FailedToLoad,
-        Unloaded,
-        CheckVersion,
-        Downloading
-    }
-
-    public class Loadable
-    {
-        protected internal static readonly List<Loadable> Loading = new List<Loadable>();
-        protected readonly Reference reference = new Reference();
-        public LoadableStatus status { get; protected set; } = LoadableStatus.Wait;
-        public string pathOrURL { get; set; }
-        protected bool mustCompleteOnNextFrame { get; set; }
-        public string error { get; internal set; }
-
-        public bool isDone => status == LoadableStatus.SuccessToLoad || status == LoadableStatus.Unloaded ||
-                              status == LoadableStatus.FailedToLoad;
-
-        public float progress { get; protected set; }
-
-
-        protected void Finish(string errorCode = null)
-        {
-            error = errorCode;
-            status = string.IsNullOrEmpty(errorCode) ? LoadableStatus.SuccessToLoad : LoadableStatus.FailedToLoad;
-            progress = 1;
-        }
-
-
-        public static void UpdateAll()
-        {
-            for (var index = 0; index < Loading.Count; index++)
-            {
-                var item = Loading[index];
-                if (Updater.Instance.busy) return;
-
-                item.Update();
-                if (!item.isDone) continue;
-
-                Loading.RemoveAt(index);
-                index--;
-                item.Complete();
-            }
-
-            Asset.UpdateAssets();
-            Scene.UpdateScenes();
-            Bundle.UpdateBundles();
-            ManifestAsset.UpdateManifestAssets();
-        }
-
-        internal static void Add(Loadable loadable)
-        {
-            Loading.Add(loadable);
-        }
-
-        internal void Update()
-        {
-            OnUpdate();
-        }
-
-        internal void Complete()
-        {
-            if (status == LoadableStatus.FailedToLoad)
-            {
-                Logger.E("Unable to load {0} {1} with error: {2}", GetType().Name, pathOrURL, error);
-                Release();
-            }
-
-            OnComplete();
-        }
-
-        protected virtual void OnUpdate()
-        {
-        }
-
-        protected virtual void OnLoad()
-        {
-        }
-
-        protected virtual void OnUnload()
-        {
-        }
-
-        protected virtual void OnComplete()
-        {
-        }
-
-        public virtual void LoadImmediate()
-        {
-            throw new InvalidOperationException();
-        }
-
-        protected internal void Load()
-        {
-            reference.Retain();
-            Add(this);
-            if (status != LoadableStatus.Wait) return;
-
-            Logger.I("Load {0} {1}.{2}", GetType().Name, Path.GetFileName(pathOrURL), UnityEngine.Random.Range(0, int.MaxValue));
-            status = LoadableStatus.Loading;
-            progress = 0;
-            OnLoad();
-        }
-
-        protected internal void Unload()
-        {
-            if (status == LoadableStatus.Unloaded) return;
-
-            Logger.I("Unload {0} {1}.{2} {3}", GetType().Name, Path.GetFileName(pathOrURL), error, UnityEngine.Random.Range(0, int.MaxValue));
-            OnUnload();
-            status = LoadableStatus.Unloaded;
-        }
-
-        public void Release()
-        {
-            if (reference.count <= 0)
-            {
-                Logger.W("Release {0} {1}.", GetType().Name, Path.GetFileName(pathOrURL));
-                return;
-            }
-
-            reference.Release();
-            if (!reference.unused) return;
-
-            OnUnused();
-        }
-
-        protected virtual void OnUnused()
-        {
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Loadable.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 689cd550b4f410840853f24ee04f3f03
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 246
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/ManifestAsset.cs

@@ -1,246 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using UnityEngine;
-using UnityEngine.Networking;
-
-namespace VEngine
-{
-    public class ManifestAsset : Loadable
-    {
-        private static readonly List<ManifestAsset> Unused = new List<ManifestAsset>();
-        private bool builtin;
-        private UnityWebRequest request;
-        public Manifest asset { get; protected set; }
-        public ManifestVersion assetVersion { get; protected set; }
-        protected string name { get; set; }
-
-        public bool changed
-        {
-            get
-            {
-                if (assetVersion == null) return false;
-
-                var find = Versions.Manifest;
-                if (find != null) return find.version < assetVersion.version;
-
-                return true;
-            }
-        }
-
-        protected override void OnLoad()
-        {
-            asset = ScriptableObject.CreateInstance<Manifest>();
-            asset.name = name;
-            pathOrURL = builtin ? Versions.GetPlayerDataURL(name) : Versions.GetDownloadURL(name);
-            var file = Manifest.GetVersionFile(name);
-            var url = builtin ? Versions.GetPlayerDataURL(file) : Versions.GetDownloadURL(file);
-            DownloadAsync(url, GetTemporaryPath(file));
-            status = LoadableStatus.CheckVersion;
-        }
-
-        protected override void OnUnused()
-        {
-            Unused.Add(this);
-        }
-
-        public virtual void Override()
-        {
-            if (assetVersion == null) return;
-
-            if (builtin)
-            {
-                var path = Versions.GetDownloadDataPath(Manifest.GetVersionFile(asset.name));
-                var file = ManifestVersion.Load(path);
-                if (file.version > assetVersion.version)
-                {
-                    path = Versions.GetDownloadDataPath(asset.name);
-                    if (File.Exists(path))
-                        using (var stream = File.OpenRead(path))
-                        {
-                            if (Utility.ComputeCRC32(stream) == file.crc)
-                            {
-                                asset.Load(path);
-                                Versions.Override(asset);
-                                return;
-                            }
-                        }
-                }
-
-                asset.Load(GetTemporaryPath(name));
-                Versions.Override(asset);
-            }
-            else
-            {
-                if (!changed) return;
-
-                var split = name.Split(new[]
-                {
-                    '_'
-                }, StringSplitOptions.RemoveEmptyEntries);
-                if (split.Length > 1)
-                {
-                    var newName = split[0];
-                    asset.name = newName;
-                }
-
-                var from = GetTemporaryPath(name);
-                var dest = Versions.GetDownloadDataPath(name).Replace(name, asset.name);
-                if (File.Exists(from))
-                {
-                    Logger.I("Copy {0} to {1}.", from, dest);
-                    File.Copy(from, dest, true);
-                }
-
-                var versionName = Manifest.GetVersionFile(name);
-                from = GetTemporaryPath(versionName);
-                if (File.Exists(from))
-                {
-                    var path = Versions.GetDownloadDataPath(versionName).Replace(name, asset.name);
-                    Logger.I("Copy {0} to {1}.", from, path);
-                    File.Copy(from, path, true);
-                }
-            }
-
-            Versions.Override(asset);
-        }
-
-        public static ManifestAsset LoadAsync(string name, bool builtin = false)
-        {
-            var manifestAsset = Versions.CreateManifest(name, builtin);
-            manifestAsset.Load();
-            return manifestAsset;
-        }
-
-        internal static ManifestAsset Create(string name, bool builtin)
-        {
-            return new ManifestAsset
-            {
-                name = name,
-                builtin = builtin
-            };
-        }
-
-        public static void UpdateManifestAssets()
-        {
-            for (var index = 0; index < Unused.Count; index++)
-            {
-                var item = Unused[index];
-                if (Updater.Instance.busy) break;
-
-                if (!item.isDone) continue;
-
-                Unused.RemoveAt(index);
-                index--;
-                item.Unload();
-            }
-        }
-
-        private void DownloadAsync(string url, string savePath)
-        {
-            if (File.Exists(savePath)) File.Delete(savePath);
-
-            Logger.I("Load {0}", url);
-            request = UnityWebRequest.Get(url);
-            request.downloadHandler = new DownloadHandlerFile(savePath);
-            request.SendWebRequest();
-        }
-
-        private string GetTemporaryPath(string filename)
-        {
-            return Versions.GetTemporaryPath(string.Format(builtin ? "Builtin/{0}" : "{0}", filename));
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.CheckVersion)
-            {
-                UpdateVersion();
-            }
-            else if (status == LoadableStatus.Downloading)
-            {
-                UpdateDownloading();
-            }
-            else if (status == LoadableStatus.Loading)
-            {
-                if (changed && !builtin)
-                {
-                    var assetPath = GetTemporaryPath(name);
-                    asset.Load(assetPath);
-                }
-
-                Finish();
-            }
-        }
-
-        private void UpdateDownloading()
-        {
-            if (request == null)
-            {
-                Finish("request == nul with " + status);
-                return;
-            }
-
-            progress = 0.2f + request.downloadProgress;
-            if (!request.isDone) return;
-
-            if (!string.IsNullOrEmpty(request.error))
-            {
-                Finish(request.error);
-                return;
-            }
-
-            request.Dispose();
-            request = null;
-
-            status = LoadableStatus.Loading;
-        }
-
-        private void UpdateVersion()
-        {
-            if (request == null)
-            {
-                Finish("request == null with " + status);
-                return;
-            }
-
-            progress = 0.2f * request.downloadProgress;
-            if (!request.isDone) return;
-
-            if (!string.IsNullOrEmpty(request.error))
-            {
-                Finish(request.error);
-                return;
-            }
-
-            request.Dispose();
-            request = null;
-
-            var savePath = GetTemporaryPath(Manifest.GetVersionFile(name));
-            if (!File.Exists(savePath))
-            {
-                Finish("version not exist.");
-                return;
-            }
-
-            assetVersion = ManifestVersion.Load(savePath);
-            Logger.I("Read {0} with version {1} crc {2}", name, assetVersion.version, assetVersion.crc);
-            var path = GetTemporaryPath(name);
-            if (File.Exists(path))
-                using (var stream = File.OpenRead(path))
-                {
-                    if (Utility.ComputeCRC32(stream) == assetVersion.crc)
-                    {
-                        Logger.I("Skip to download {0}, because nothing to update.", name);
-                        status = LoadableStatus.Loading;
-                        return;
-                    }
-                }
-
-            if (File.Exists(path)) File.Delete(path);
-
-            DownloadAsync(pathOrURL, path);
-            status = LoadableStatus.Downloading;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/ManifestAsset.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 069ead56ebe2eb94b9fd25970a7583b0
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 173
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scene.cs

@@ -1,173 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using UnityEngine;
-using UnityEngine.SceneManagement;
-
-namespace VEngine
-{
-    public class Scene : Loadable, IEnumerator
-    {
-        internal static readonly List<Scene> Unused = new List<Scene>();
-
-        public static Action<Scene> onSceneUnloaded;
-        public static Action<Scene> onSceneLoaded;
-        internal readonly List<Scene> additives = new List<Scene>();
-        public Action<Scene> completed;
-        protected string sceneName;
-        public Action<Scene> updated;
-
-        public AsyncOperation operation { get; protected set; }
-        public static Scene main { get; private set; }
-        public static Scene current { get; private set; }
-        protected Scene parent { get; set; }
-        protected internal LoadSceneMode loadSceneMode { get; set; }
-
-        public bool MoveNext()
-        {
-            return !isDone;
-        }
-
-        public void Reset()
-        {
-        }
-
-        public object Current => null;
-
-        public static Scene LoadAsync(string assetPath, Action<Scene> completed = null, bool additive = false)
-        {
-            if (string.IsNullOrEmpty(assetPath)) throw new ArgumentNullException(nameof(assetPath));
-
-            var scene = Versions.CreateScene(assetPath, additive);
-            if (completed != null) scene.completed += completed;
-            current = scene;
-            scene.Load();
-            return scene;
-        }
-
-        public static Scene LoadAdditiveAsync(string assetPath, Action<Scene> completed = null)
-        {
-            return LoadAsync(assetPath, completed, true);
-        }
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.Loading)
-            {
-                UpdateLoading();
-                if (updated != null) updated(this);
-            }
-        }
-
-        protected void UpdateLoading()
-        {
-            if (operation == null)
-            {
-                Finish("operation == null");
-                return;
-            }
-
-            progress = 0.5f + operation.progress * 0.5f;
-
-            if (operation.allowSceneActivation)
-            {
-                if (!operation.isDone) return;
-            }
-            else
-            {
-                // https://docs.unity3d.com/ScriptReference/AsyncOperation-allowSceneActivation.html
-                if (operation.progress < 0.9f) return;
-            }
-
-            Finish();
-        }
-
-        protected override void OnLoad()
-        {
-            PrepareToLoad();
-            operation = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
-        }
-
-        protected void PrepareToLoad()
-        {
-            sceneName = Path.GetFileNameWithoutExtension(pathOrURL);
-            if (loadSceneMode == LoadSceneMode.Single)
-            {
-                if (main != null)
-                {
-                    main.Release();
-                    main = null;
-                }
-
-                main = this;
-            }
-            else
-            {
-                if (main != null)
-                {
-                    main.additives.Add(this);
-                    parent = main;
-                }
-            }
-        }
-
-        protected override void OnUnused()
-        {
-            completed = null;
-            Unused.Add(this);
-        }
-
-        protected override void OnUnload()
-        {
-            if (loadSceneMode == LoadSceneMode.Additive)
-            {
-                if (main != null) main.additives.Remove(this);
-                if (parent != null && string.IsNullOrEmpty(error))
-                    SceneManager.UnloadSceneAsync(sceneName);
-                parent = null;
-            }
-            else
-            {
-                foreach (var item in additives)
-                {
-                    item.Release();
-                    item.parent = null;
-                }
-
-                additives.Clear();
-            }
-
-            if (onSceneUnloaded != null) onSceneUnloaded.Invoke(this);
-        }
-
-        protected override void OnComplete()
-        {
-            if (onSceneLoaded != null) onSceneLoaded.Invoke(this);
-
-            if (completed == null) return;
-
-            var saved = completed;
-            if (completed != null) completed(this);
-
-            completed -= saved;
-        }
-
-        public static void UpdateScenes()
-        {
-            if (current == null || !current.isDone) return;
-
-            for (var index = 0; index < Unused.Count; index++)
-            {
-                var item = Unused[index];
-                if (Updater.Instance.busy) break;
-
-                if (!item.isDone) continue;
-
-                Unused.RemoveAt(index);
-                index--;
-                item.Unload();
-            }
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scene.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d2d052f2159aa88458ff34151f411b94
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 8937a129f7cae51469616f24df28d972
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 76
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes/BundledScene.cs

@@ -1,76 +0,0 @@
-using UnityEngine.SceneManagement;
-
-namespace VEngine
-{
-    public class BundledScene : Scene
-    {
-        protected Dependencies dependencies;
-
-        protected override void OnUpdate()
-        {
-            if (status == LoadableStatus.DependentLoading)
-                UpdateDependencies();
-            else if (status == LoadableStatus.Loading) UpdateLoading();
-        }
-
-        private void UpdateDependencies()
-        {
-            if (dependencies == null)
-            {
-                Finish("dependencies == null");
-                return;
-            }
-
-            progress = dependencies.progress * 0.5f;
-            if (!dependencies.isDone) return;
-
-            var assetBundle = dependencies.assetBundle;
-            if (assetBundle == null)
-            {
-                Finish("assetBundle == null");
-                return;
-            }
-
-            operation = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
-            status = LoadableStatus.Loading;
-        }
-
-        protected override void OnUnload()
-        {
-            base.OnUnload();
-            if (dependencies != null)
-            {
-                dependencies.Unload();
-                dependencies = null;
-            }
-        }
-
-
-        protected override void OnLoad()
-        {
-            PrepareToLoad();
-            dependencies = new Dependencies
-            {
-                pathOrURL = pathOrURL
-            };
-            dependencies.Load();
-            status = LoadableStatus.DependentLoading;
-        }
-
-        internal static Scene Create(string assetPath, bool additive = false)
-        {
-            if (!Versions.Contains(assetPath))
-                return new Scene
-                {
-                    pathOrURL = assetPath,
-                    loadSceneMode = additive ? LoadSceneMode.Additive : LoadSceneMode.Single
-                };
-
-            return new BundledScene
-            {
-                pathOrURL = assetPath,
-                loadSceneMode = additive ? LoadSceneMode.Additive : LoadSceneMode.Single
-            };
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Loadables/Scenes/BundledScene.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 652d616e7e316094e889d37abc7e5245
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 28
GameClient/Assets/ThirdParty/Xasset/Runtime/Logger.cs

@@ -1,28 +0,0 @@
-using System.Diagnostics;
-using Debug = UnityEngine.Debug;
-
-namespace VEngine
-{
-    public static class Logger
-    {
-        public static bool Loggable = true;
-
-        public static void E(string format, params object[] args)
-        {
-            Debug.LogErrorFormat(format, args);
-        }
-
-        public static void W(string format, params object[] args)
-        {
-            Debug.LogWarningFormat(format, args);
-        }
-
-        [Conditional("DEBUG")]
-        public static void I(string format, params object[] args)
-        {
-            if (!Loggable) return;
-
-            Debug.LogFormat(format, args);
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Logger.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 6e644e02d1e64794bab246cae59f949b
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/ThirdParty/Xasset/Runtime/Operations.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 662eb7d1126eed0489dfd82b3c734ecf
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 52
GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/ClearHistory.cs

@@ -1,52 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-
-namespace VEngine
-{
-    public sealed class ClearHistory : Operation
-    {
-        public readonly List<string> files = new List<string>();
-        private int count;
-
-        public override void Start()
-        {
-            base.Start();
-            files.AddRange(Directory.GetFiles(Versions.DownloadDataPath));
-            var usedFiles = new List<string>();
-            var manifest = Versions.Manifest;
-            usedFiles.Add(Manifest.GetVersionFile(manifest.name));
-            usedFiles.Add(manifest.name);
-            foreach (var bundle in manifest.bundles)
-            {
-                if (string.IsNullOrEmpty(bundle.nameWithAppendHash)) continue;
-
-                usedFiles.Add(bundle.nameWithAppendHash);
-            }
-
-            files.RemoveAll(file =>
-            {
-                var name = Path.GetFileName(file);
-                return usedFiles.Contains(name);
-            });
-            count = files.Count;
-        }
-
-        protected override void Update()
-        {
-            if (status == OperationStatus.Processing)
-            {
-                while (files.Count > 0)
-                {
-                    progress = (count - files.Count) * 1f / count;
-                    var file = files[0];
-                    if (File.Exists(file)) File.Delete(file);
-
-                    files.RemoveAt(0);
-                    if (Updater.Instance.busy) break;
-                }
-
-                Finish();
-            }
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/ClearHistory.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7015cfc374765b34c9464ab11eef0ec5
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 59
GameClient/Assets/ThirdParty/Xasset/Runtime/Operations/DownloadVersions.cs

@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace VEngine
-{
-    public sealed class DownloadVersions : Operation
-    {
-        public readonly List<DownloadInfo> items = new List<DownloadInfo>();
-        private Download download;
-        private long lastDownloadedBytes;
-        public Action<DownloadVersions> updated;
-
-        public long totalSize { get; set; }
-        public long downloadedBytes { get; private set; }
-
-        public override void Start()
-        {
-            base.Start();
-            downloadedBytes = 0;
-            lastDownloadedBytes = 0;
-            foreach (var info in items) totalSize += info.size;
-
-            if (items.Count > 0)
-                download = Download.DownloadAsync(items[0]);
-            else
-                Finish();
-        }
-
-        protected override void Update()
-        {
-            if (status == OperationStatus.Processing)
-            {
-                if (download.isDone)
-                {
-                    if (download.status == DownloadStatus.Success)
-                    {
-                        lastDownloadedBytes += download.downloadedBytes;
-                        items.RemoveAt(0);
-                        if (items.Count > 0)
-                            download = Download.DownloadAsync(items[0]);
-                        else
-                            Finish();
-                    }
-                    else
-                    {
-                        Finish(download.error);
-                    }
-                }
-                else
-                {
-                    downloadedBytes = lastDownloadedBytes + download.downloadedBytes;
-                    progress = downloadedBytes * 1f / totalSize;
-                }
-
-                if (updated != null) updated(this);
-            }
-        }
-    }
-}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно