From 90805cfa12c065f96d2fe4fc98010d1a5be3f9ce Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 15 五月 2019 17:29:49 +0800
Subject: [PATCH] 3335 任务反馈

---
 System/MainInterfacePanel/TaskFeedbackModel.cs |   66 +++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/System/MainInterfacePanel/TaskFeedbackModel.cs b/System/MainInterfacePanel/TaskFeedbackModel.cs
index a6f69f2..7d63a9b 100644
--- a/System/MainInterfacePanel/TaskFeedbackModel.cs
+++ b/System/MainInterfacePanel/TaskFeedbackModel.cs
@@ -106,9 +106,10 @@
                             int condition = 0;
                             if (IsSatisfyCondition(feedback, out condition))
                             {
-                                if (config.succGuide != 0)
+                                if (config.succGuide != null
+                                    && config.succGuide.Length > 0)
                                 {
-                                    ExecuteGuide(config.succGuide);
+                                    ExecuteGuide(config.succGuide[0]);
                                 }
                             }
                             else
@@ -117,9 +118,10 @@
                                 {
                                     SysNotifyMgr.Instance.ShowTip(config.remind);
                                 }
-                                if (config.failGuide != 0)
+                                if (config.failGuide != null
+                                    && config.failGuide.Length > 0)
                                 {
-                                    ExecuteGuide(config.succGuide);
+                                    ExecuteGuide(config.failGuide[0]);
                                 }
                             }
                         }
@@ -129,21 +131,23 @@
                             int condition = 0;
                             if (IsSatisfyCondition(feedback, out condition))
                             {
-                                if (config.succGuide != 0)
+                                if (config.succGuide != null
+                                    && config.succGuide.Length > 0)
                                 {
-                                    ExecuteGuide(config.succGuide);
+                                    ExecuteGuide(config.succGuide[0]);
                                 }
                             }
                             else
                             {
-                                var sideFeedbackConfig = TaskFeedbackConfig.Get(condition);
-                                if (!string.IsNullOrEmpty(sideFeedbackConfig.remind))
+                                if (!string.IsNullOrEmpty(config.remind))
                                 {
-                                    SysNotifyMgr.Instance.ShowTip(sideFeedbackConfig.remind);
+                                    SysNotifyMgr.Instance.ShowTip(config.remind);
                                 }
-                                if (sideFeedbackConfig != null && sideFeedbackConfig.failGuide != 0)
+                                var index = feedback.IndexOfSideTasks(condition);
+                                if (config.failGuide != null
+                                    && index >= 0 && index < config.failGuide.Length)
                                 {
-                                    ExecuteGuide(sideFeedbackConfig.failGuide);
+                                    ExecuteGuide(config.failGuide[index]);
                                 }
                             }
                         }
@@ -153,23 +157,25 @@
                             int condition = 0;
                             if (IsSatisfyCondition(feedback, out condition))
                             {
-                                if (config.succGuide != 0)
+                                if (config.succGuide != null
+                                    && config.succGuide.Length > 0)
                                 {
-                                    ExecuteGuide(config.succGuide);
+                                    ExecuteGuide(config.succGuide[0]);
                                 }
                             }
                             else
                             {
+                                if (!string.IsNullOrEmpty(config.remind))
+                                {
+                                    SysNotifyMgr.Instance.ShowTip(config.remind);
+                                }
                                 if (!IsSatisfySideTask(feedback.sideTasks, out condition))
                                 {
-                                    var sideFeedbackConfig = TaskFeedbackConfig.Get(condition);
-                                    if (!string.IsNullOrEmpty(sideFeedbackConfig.remind))
+                                    var index = feedback.IndexOfSideTasks(condition);
+                                    if (config.failGuide != null
+                                        && index >= 0 && index < config.failGuide.Length)
                                     {
-                                        SysNotifyMgr.Instance.ShowTip(sideFeedbackConfig.remind);
-                                    }
-                                    if (sideFeedbackConfig != null && sideFeedbackConfig.failGuide != 0)
-                                    {
-                                        ExecuteGuide(sideFeedbackConfig.failGuide);
+                                        ExecuteGuide(config.failGuide[index]);
                                     }
                                 }
                             }
@@ -181,6 +187,10 @@
 
         public void ExecuteGuide(int id)
         {
+            if (id == 0)
+            {
+                return;
+            }
             var config = GuideConfig.Get(id);
             if (config == null)
             {
@@ -271,6 +281,22 @@
         public List<int[]> sideTasks;
         public int[] equipCondition;
         public List<Item> items;
+
+        public int IndexOfSideTasks(int taskId)
+        {
+            var index = 0;
+            for (int i = 0; i < sideTasks.Count; i++)
+            {
+                if (taskId >= sideTasks[i][0]
+                   && taskId <= sideTasks[i][1])
+                {
+                    index += taskId - sideTasks[i][0];
+                    break;
+                }
+                index += (sideTasks[i][1] - sideTasks[i][0] + 1);
+            }
+            return index;
+        }
     }
 
     public enum TaskFeedbackType

--
Gitblit v1.8.0