From f293a7484f17baf6c6b156f4e5a719a532fbe1fc Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期二, 18 九月 2018 17:01:04 +0800
Subject: [PATCH] 1559 兑换码开发

---
 System/FriendSystem/MailAllModel.cs |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/System/FriendSystem/MailAllModel.cs b/System/FriendSystem/MailAllModel.cs
index 0ac7e2c..d38ac28 100644
--- a/System/FriendSystem/MailAllModel.cs
+++ b/System/FriendSystem/MailAllModel.cs
@@ -62,6 +62,8 @@
         get { return m_dailyModel ?? (m_dailyModel = ModelCenter.Instance.GetModel<DailyQuestModel>()); }
     }
 
+    AwardExchangeModel exchangeModel { get { return ModelCenter.Instance.GetModel<AwardExchangeModel>(); } }
+
     public MailAllModel()
     {
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInit;
@@ -158,12 +160,14 @@
                 if (mailModelDict.ContainsKey(mailModel.PackList[i].GUID))
                 {
                     MailInfo info = mailModelDict[mailModel.PackList[i].GUID];
-                    switch(GetMailType(info))
+                    string mailTitle = GetMailTitle(info);
+                    if(mailTitle.Contains("<gcode>"))
                     {
-                        case "CodeRewardMail":
-                            WindowCenter.Instance.Open<ExchangeGetItemWin>();
-                            break;
-                            
+                        exchangeModel.SetAwardExchangeModel(info.Items);
+                    }
+                    else if(GetMailType(info) == "CodeRewardMail")
+                    {
+                        exchangeModel.SetAwardExchangeModel(info.Items);
                     }
                 }
             }
@@ -428,6 +432,7 @@
             }
 
         }
+        mailTitleStr = mailTitleStr.Replace("<gcode>","");
     }
 
     public string GetMailType(MailInfo info)
@@ -444,6 +449,28 @@
         return string.Empty;
     }
 
+    public string GetMailTitle(MailInfo info)
+    {
+        if (smatch.IsMatch(info.Text))
+        {
+            Match match = smatch.Match(info.Text);
+            MailConfig _mailModel = Config.Instance.Get<MailConfig>(match.Groups[1].Value);
+            if (_mailModel != null)
+            {
+                return _mailModel.Title;
+            }
+        }
+        else
+        {
+            string[] mailContentArray = info.Text.Split(new string[] { "<$_$>" }, StringSplitOptions.RemoveEmptyEntries);
+            if (mailContentArray.Length > 0)
+            {
+                return mailContentArray[1];
+            }
+        }
+        return string.Empty;
+    }
+
     StringBuilder todayDailySB = new StringBuilder();
     public string GetTodayDailyNotify(DateTime getTime)
     {

--
Gitblit v1.8.0