Jelajahi Sumber

支持跳过热更新

liuqilin 7 tahun lalu
induk
melakukan
9c13a45ba8

+ 25 - 0
Assets/Plugins/Alipay/IOS/AlipaySDK.framework.meta

@@ -0,0 +1,25 @@
+fileFormatVersion: 2
+guid: 786969225a8dc4e0eb4e00a91e7e1501
+folderAsset: yes
+timeCreated: 1502698138
+licenseType: Pro
+PluginImporter:
+  serializedVersion: 1
+  iconMap: {}
+  executionOrder: {}
+  isPreloaded: 0
+  isOverridable: 0
+  platformData:
+    Any:
+      enabled: 0
+      settings: {}
+    Editor:
+      enabled: 0
+      settings:
+        DefaultValueInitialized: true
+    iOS:
+      enabled: 1
+      settings: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Assets/Resource/Animations/Bird.controller

@@ -54,7 +54,7 @@ AnimatorStateMachine:
   m_ChildStates:
   - serializedVersion: 1
     m_State: {fileID: 1102760688892039484}
-    m_Position: {x: 200, y: 0, z: 0}
+    m_Position: {x: 288, y: 120, z: 0}
   m_ChildStateMachines: []
   m_AnyStateTransitions: []
   m_EntryTransitions: []

+ 23 - 7
Assets/Script/AssetBundleUtility/AssetBundleUtility.cs

@@ -13,6 +13,8 @@ namespace assetBundleUtility
 	
 	public class AssetBundleUtility : MonoBehaviour
 	{
+	    public static Action OnDownloadOrUpdateFinish;
+
 	    #region Config
 		
 	    public static AssetBundleUtility Instance
@@ -163,6 +165,8 @@ namespace assetBundleUtility
         private static void LoadAndDownloadAssetBundles(List<AssetBundleSet> staleAssetBundleSets, List<AssetBundleSet> upToDateAssetBundleSets, Action allSucceedCallback, Action haveFailedCallback)
 	    {
 	        int remainAmount = upToDateAssetBundleSets.Count + staleAssetBundleSets.Count;
+            //Debug.Log(staleAssetBundleSets.Count);
+            //Debug.Log(upToDateAssetBundleSets.Count);
 	        bool failedFlag = false;
 	        foreach (var assetBundleSets in upToDateAssetBundleSets)
 	        {
@@ -170,7 +174,7 @@ namespace assetBundleUtility
 	            (
 	                assetBundleSets,
 	                () => LoadAndDownloadAssetBundleSucceedCallback(ref remainAmount, allSucceedCallback),
-                    () => LoadAndDownloadAssetBundleFailedCallback(ref failedFlag, haveFailedCallback)
+                    () => LoadAndDownloadAssetBundleFailedCallback(ref remainAmount, ref failedFlag, haveFailedCallback)
                 );
 	        }
 	        foreach (var assetBundleSets in staleAssetBundleSets)
@@ -179,21 +183,33 @@ namespace assetBundleUtility
 	            (
 	                assetBundleSets,
 	                () => LoadAndDownloadAssetBundleSucceedCallback(ref remainAmount, allSucceedCallback),
-	                () => LoadAndDownloadAssetBundleFailedCallback(ref failedFlag, haveFailedCallback)
+	                () => LoadAndDownloadAssetBundleFailedCallback(ref remainAmount, ref failedFlag, haveFailedCallback)
 	            );
 	        }
 	    }
 
         private static void LoadAndDownloadAssetBundleSucceedCallback(ref int remainAmount,  Action allSucceedCallback)
         {
-            if (--remainAmount == 0) allSucceedCallback.Invoke();
+            //Debug.LogWarning(0);
+            if (--remainAmount == 0)
+            {
+                OnDownloadOrUpdateFinish.SafeInvoke();
+                allSucceedCallback.Invoke();
+            }
         }
 
-        private static void LoadAndDownloadAssetBundleFailedCallback(ref bool failedFlag, Action haveFailedCallback)
+        private static void LoadAndDownloadAssetBundleFailedCallback(ref int remainAmount, ref bool failedFlag, Action haveFailedCallback)
         {
-            if (failedFlag) return;
-            failedFlag = true;
-            haveFailedCallback.Invoke();
+            //Debug.LogWarning(1);
+            if (!failedFlag)
+            {
+                failedFlag = true;
+                haveFailedCallback.Invoke();
+            }
+            if (--remainAmount == 0)
+            {
+                OnDownloadOrUpdateFinish.SafeInvoke();
+            }
         }
 
 

+ 7 - 7
Assets/Script/Tool/Auxiliary.cs

@@ -221,13 +221,13 @@ public class Auxiliary : Regist
         //    Manager.Diamond = 0;
         //}
 
-        if (Input.GetKeyDown(KeyCode.D))
-        {
-            PlayerPrefManager.SaveBool(PlayerPrefManager.INTERACT_CONFIG, false);
-            //DebugManager.ResetElf();
-            //Manager.Coin = 100000;
-            //Manager.Diamond = 1000;
-        }
+        //if (Input.GetKeyDown(KeyCode.D))
+        //{
+        //    PlayerPrefManager.SaveBool(PlayerPrefManager.INTERACT_CONFIG, false);
+        //    DebugManager.ResetElf();
+        //    Manager.Coin = 100000;
+        //    Manager.Diamond = 1000;
+        //}
 
         //if (Input.GetKeyDown(KeyCode.Z))
         //{

+ 40 - 12
Assets/Script/Tool/Bundle.cs

@@ -419,6 +419,16 @@ public class Bundle : MonoBehaviour
         //return "file://" + Application.streamingAssetsPath + "/Bundle/Windows/";
     }
 
+    public static string GetPersistingPath()
+    {
+        if (Application.platform == RuntimePlatform.IPhonePlayer)
+            return "file://" + Application.persistentDataPath;
+        else if (Application.isMobilePlatform)
+            return Application.streamingAssetsPath;
+        else
+            return "file://" + Application.persistentDataPath;
+    }
+
     public static string GetStreamingUrlPath()
     {
         if (Application.platform == RuntimePlatform.IPhonePlayer)
@@ -714,7 +724,7 @@ public class Bundle : MonoBehaviour
                 CopyCount++;
                 Initializer.Instance.StartCoroutine
                 (
-                    LoadAssetBundle
+                    LoadAssetBundleFromStream
                     (
                         streamingFolder,
                         assetBundleName,
@@ -734,7 +744,7 @@ public class Bundle : MonoBehaviour
         CopyCount--;
     }
 
-    public static IEnumerator LoadAssetBundle(string folder, string name, Action<WWW> callback)
+    public static IEnumerator LoadAssetBundleFromStream(string folder, string name, Action<WWW> callback)
     {
         WWW www = new WWW(GetStreamingUrlPath() + Path.DirectorySeparatorChar + "Bundle" + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + "HotUpdate" + Path.DirectorySeparatorChar + name);
         yield return www;
@@ -782,15 +792,16 @@ public class Bundle : MonoBehaviour
             }
             else
             {
-                Debug.Log(localMD5);
-                Debug.Log(HttpManager.Md5);
+                //Debug.Log(localMD5);
+                //Debug.Log(HttpManager.Md5);
                 needUpdate = localMD5 != HttpManager.Md5;
                 Debug.LogWarning($"NeedUpdate : {needUpdate}");
             }
-            if (Application.isEditor)
-            {
-                needUpdate = false;
-            }
+            //if (Application.isEditor)
+            //{
+            //    needUpdate = false;
+            //}
+            AssetBundleUtility.OnDownloadOrUpdateFinish += FinishDownloadAndLoad;
             if (needUpdate)
             {
                 Initializer.DebugText.text = "U4";
@@ -828,7 +839,7 @@ public class Bundle : MonoBehaviour
         }
     }
 
-    public static void DownloadAllAssetBundleSucceed()
+    private static void FinishDownloadAndLoad()
     {
         try
         {
@@ -917,6 +928,11 @@ public class Bundle : MonoBehaviour
         }
     }
 
+    public static void DownloadAllAssetBundleSucceed()
+    {
+        Debug.Log("succeed");
+    }
+
     public static void DownloadAllAssetBundleFailed()
     {
         Debug.Log("failed");
@@ -958,9 +974,21 @@ public class Bundle : MonoBehaviour
 
     public static void DownloadAssetBundleFailed(AssetBundleSet assetBundleSet, string error)
     {
-        string str = Language.GetStr(LanguageLabel.UI__AJ_UpdateFailed, Application.systemLanguage) + "    "  + error;
-        UpdatePanel.SetContent(str);
-        //Debug.Log(error);
+        Debug.Log(error);
+        string path = assetBundleSet.PersistentPath;
+        path = path.Replace("/", Path.DirectorySeparatorChar.ToString());
+        path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
+        path = path.Replace("\\\\", Path.DirectorySeparatorChar.ToString());
+        path = "file://" + path;
+        WWW www = new WWW(path);
+        AssetBundleSet bundleSet = new AssetBundleSet();
+        bundleSet.Name = assetBundleSet.Name;
+        bundleSet.AssetBundle = www.assetBundle;
+        DownloadAssetBundleSucceed(bundleSet, false);
+
+        //string str = Language.GetStr(LanguageLabel.UI__AJ_UpdateFailed, Application.systemLanguage) + "    "  + error;
+        //UpdatePanel.SetContent(str);
+
         //Initializer.DebugText.text = assetBundleSet.Name;
         //Initializer.DebugText.text += error;
         //Initializer.EnableDebugLab();