From d0253a072ba69280985216f513aeb380f3f3822c Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 23 八月 2018 19:18:16 +0800
Subject: [PATCH] 2788【前端】被动技能槽解锁界面表现

---
 System/Skill/SkillModel.cs |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/System/Skill/SkillModel.cs b/System/Skill/SkillModel.cs
index 596509c..755ab6c 100644
--- a/System/Skill/SkillModel.cs
+++ b/System/Skill/SkillModel.cs
@@ -14,11 +14,13 @@
         {
             ParseConfig();
             FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
+            PlayerTaskDatas.Event_TaskInformation += TaskInformationUpdate;
         }
 
         public override void UnInit()
         {
             FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
+            PlayerTaskDatas.Event_TaskInformation -= TaskInformationUpdate;
         }
 
         public void OnBeforePlayerDataInitialize()
@@ -27,6 +29,7 @@
             equipPassSkills.Clear();
             playerLoginOk = false;
             equipPassPage = false;
+            taskHoleCondition = 0;
         }
 
         #region 閰嶇疆
@@ -70,6 +73,7 @@
                     passSkillLimits.Add(limit);
                 }
                 passEquipCnt = int.Parse(funcCfg.Numerical2);
+                taskHoleDict = ConfigParse.GetDic<int, int>(funcCfg.Numerical4);
             }
             funcCfg = Config.Instance.Get<FuncConfigConfig>("PassSkillEquipGetWay");
             if (funcCfg != null)
@@ -212,6 +216,7 @@
         public int presentEquipPage { get; private set; }
         public bool playerLoginOk = false;
         private Dictionary<int, Dictionary<int, int>> equipPassSkills = new Dictionary<int, Dictionary<int, int>>();
+        public Dictionary<int, int> taskHoleDict { get; private set; }
         public event Action UpdatePassEquipSkillEvent;
         public bool equipPassPage { get; set; }
         public bool TryGetEquipPassSkills(int page, int hole, out int _skillId)
@@ -283,6 +288,52 @@
             }
         }
 
+        public event Action taskUnlockUpdate;
+
+        public int taskHoleCondition { get; private set; }
+
+        public const string TASKHOLEKEY = "OpenSkillSlots";
+
+        public int UnlockPassHole
+        {
+            get { return LocalSave.GetInt(StringUtility.Contact(TASKHOLEKEY, "_", PlayerDatas.Instance.baseData.PlayerID)); }
+            set { LocalSave.SetInt(StringUtility.Contact(TASKHOLEKEY, "_", PlayerDatas.Instance.baseData.PlayerID), value); }
+        }
+
+        public bool IsTaskHoleUnlock(int condition)
+        {
+            if (task._DicTaskInformation.ContainsKey(1)
+                && task._DicTaskInformation[1].ContainsKey(TASKHOLEKEY))
+            {
+                var value = 0;
+                int.TryParse(task._DicTaskInformation[1][TASKHOLEKEY], out value);
+                return value >= condition;
+            }
+            return false;
+        }
+
+        private void TaskInformationUpdate(int _id, Dictionary<int, Dictionary<string, string>> _Dic)
+        {
+            if (_Dic != null && _Dic.ContainsKey(1))
+            {
+                var dict = _Dic[1];
+                if (dict.ContainsKey(TASKHOLEKEY))
+                {
+                    var result = 0;
+                    int.TryParse(dict[TASKHOLEKEY], out result);
+                    if (result != taskHoleCondition && playerLoginOk)
+                    {
+                        UnlockPassHole = result;
+                        if (taskUnlockUpdate != null)
+                        {
+                            taskUnlockUpdate();
+                        }
+                    }
+                    taskHoleCondition = result;
+                }
+            }
+        }
+
         RolePromoteModel m_PromoteModel;
         RolePromoteModel promoteModel
         {
@@ -291,6 +342,8 @@
                 return m_PromoteModel ?? (m_PromoteModel = ModelCenter.Instance.GetModel<RolePromoteModel>());
             }
         }
+
+        PlayerTaskDatas task { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } }
 
         public void SendEquipPassSkill(int _page, int _index, int _skillId)
         {
@@ -335,6 +388,13 @@
                 else if (limit.MountLv > 0)
                 {
                     if (promoteModel.GetMountTotallv() < limit.MountLv)
+                    {
+                        return false;
+                    }
+                }
+                else if (limit.OpenSkillSlots > 0)
+                {
+                    if (!IsTaskHoleUnlock(limit.OpenSkillSlots))
                     {
                         return false;
                     }
@@ -584,6 +644,7 @@
         public int level;
         public int vipLv;
         public int MountLv;
+        public int OpenSkillSlots;
     }
 
     [Serializable]

--
Gitblit v1.8.0