From 10f6ea39b62827a2e4b535ab9935cf65b1b4dadb Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期一, 08 四月 2019 14:33:09 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/AssetVersion/InGameDownLoad.cs |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/System/AssetVersion/InGameDownLoad.cs b/System/AssetVersion/InGameDownLoad.cs
index f32fe00..5832b0d 100644
--- a/System/AssetVersion/InGameDownLoad.cs
+++ b/System/AssetVersion/InGameDownLoad.cs
@@ -5,10 +5,8 @@
 using Snxxz.UI;
 using System.Text.RegularExpressions;
 
-
 [XLua.LuaCallCSharp]
 public class InGameDownLoad : SingletonMonobehaviour<InGameDownLoad>
-
 {
     public const int BYTE_PER_KILOBYTE = 1024;
     public const int BYTE_PER_MILLIONBYTE = 1048576;
@@ -81,6 +79,8 @@
             }
         }
     }
+
+    int maxWorkingTask = 2;
 
     TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
 
@@ -323,7 +323,7 @@
 
         while (okCount < totalCount)
         {
-            while (workingQueue.Count < 2 && downLoadTasksQueues.Count > 0)
+            while (workingQueue.Count < maxWorkingTask && downLoadTasksQueues.Count > 0)
             {
                 var assetVersion = downLoadTasksQueues.Dequeue();
                 var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", assetVersion.relativePath);
@@ -631,6 +631,41 @@
         }
     }
 
+    private int GetMaxTask()
+    {
+        switch (Application.platform)
+        {
+            case RuntimePlatform.Android:
+                if (DeviceUtility.cpu >= 4 && DeviceUtility.memory > 3.2f * 1024)
+                {
+                    return 2;
+                }
+                else
+                {
+                    return 1;
+                }
+            case RuntimePlatform.IPhonePlayer:
+                if (DeviceUtility.cpu > 1 && DeviceUtility.memory > 1.5f * 1024)
+                {
+                    return 2;
+                }
+                else
+                {
+                    return 1;
+                }
+            case RuntimePlatform.WindowsEditor:
+                return 2;
+            default:
+                return 1;
+        }
+
+    }
+
+    private void Awake()
+    {
+        maxWorkingTask = GetMaxTask();
+    }
+
     public struct Reward
     {
         public int id;

--
Gitblit v1.8.0