From bc74cf8e6d4a002174333532e9e955ff90872d16 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期二, 18 十二月 2018 21:25:19 +0800
Subject: [PATCH] Merge branch 'Cross_Server' of http://192.168.0.87:10010/r/snxxz_scripts into Cross_Server

---
 System/CrossServerOneVsOne/CrossServerModel.cs |   79 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/System/CrossServerOneVsOne/CrossServerModel.cs b/System/CrossServerOneVsOne/CrossServerModel.cs
index e511b09..56d4881 100644
--- a/System/CrossServerOneVsOne/CrossServerModel.cs
+++ b/System/CrossServerOneVsOne/CrossServerModel.cs
@@ -18,7 +18,7 @@
 
         public void OnBeforePlayerDataInitialize()
         {
-
+            ResetData();
         }
 
         public void OnAfterPlayerDataInitialize()
@@ -43,8 +43,38 @@
             return upScore == 0;
         }
 
+        public int GetBuyMatchNumPrice()
+        {
+            Equation.Instance.Clear();
+            Equation.Instance.AddKeyValue("buyCnt",alreadyBuyNum);
+            return Equation.Instance.Eval<int>(priceFormula);
+        }
+
+        public List<AwardType> sortDayAwardslist = new List<AwardType>();
+        public void SortDayAwardsList()
+        {
+            sortDayAwardslist.Clear();
+            sortDayAwardslist.AddRange(dayAwardTypelist);
+            sortDayAwardslist.Sort(CompareByCompleteProgress);
+        }
+
+        public int CompareByCompleteProgress(AwardType start,AwardType end)
+        {
+            int x = (int)start.progress;
+            int y = (int)end.progress;
+            if (x.CompareTo(y) != 0) return x.CompareTo(y);
+
+            x = dayAwardTypelist.IndexOf(start);
+            y = dayAwardTypelist.IndexOf(end);
+            if (x.CompareTo(y) != 0) return x.CompareTo(y);
+
+            return 0;
+        }
+
         #region 琛ㄦ暟鎹�
-        public int dayMaxMatchNum { get; private set; } //鍖归厤娆℃暟涓婇檺
+        public int freeMaxMatchNum { get; private set; } //姣忔棩鍏嶈垂鍖归厤娆℃暟
+        public int buyMaxMatchNum { get; private set; } //姣忔棩鍙喘涔版鏁�
+        public string priceFormula { get;private set;} //璐拱鍖归厤娆℃暟闇�瑕佷环鏍煎叕寮�
         public List<AwardType> dayAwardTypelist { get; private set; }
         private void ParseFuncConfig()
         {
@@ -103,23 +133,55 @@
                     }
                 }
             }
+
+            var CrossRealmPKMatchCount = Config.Instance.Get<FuncConfigConfig>("CrossRealmPKMatchCount");
+            freeMaxMatchNum = int.Parse(CrossRealmPKMatchCount.Numerical1);
+            buyMaxMatchNum = int.Parse(CrossRealmPKMatchCount.Numerical2);
+            priceFormula = CrossRealmPKMatchCount.Numerical3;
         }
 
         public class AwardType
         {
-            public int type; //1 鑳滃埄濂栧姳 2 鍖归厤濂栧姳 
+            public int type { get; private set; } //1 鑳滃埄濂栧姳 2 鍖归厤濂栧姳 
             public int num { get; private set;}
+            public int curCompletedNum { get; private set; }
+            public CompleteProgress progress { get; private set;}
+            public bool IsReceived { get; set; }
             public List<AwardItem> awardItems = new List<AwardItem>();
             public AwardType(int _num,int _type)
             {
                 type = _type;
                 num = _num;
+                curCompletedNum = 0;
+                IsReceived = false;
+                progress = CompleteProgress.Completed;
                 awardItems.Clear();
             }
 
             public void SetAwardItems(AwardItem awardItem)
             {
                 awardItems.Add(awardItem);
+            }
+
+            public void SetCompletedNum(int completedNum)
+            {
+                curCompletedNum = completedNum;
+                if(IsReceived)
+                {
+                    curCompletedNum = num;
+                    progress = CompleteProgress.AlreadyReceived;
+                }
+                else
+                {
+                    progress = curCompletedNum < num ? CompleteProgress.UnCompleted : CompleteProgress.Completed;
+                }
+            }
+
+            public enum CompleteProgress
+            {
+                Completed = 0, //宸茶揪鎴�
+                UnCompleted = 1, //鏈揪鎴�
+                AlreadyReceived = 2, //宸查鍙�
             }
         }
 
@@ -143,8 +205,19 @@
         public int curWinRate { get; private set; } //褰撳墠鑳滅巼
         public int sumBattleNum { get; private set; } //瀵规垬鎬诲満鏁�
         public int dayMatchNum { get; private set; } //浠婃棩鍖归厤娆℃暟
+        public int alreadyBuyNum { get; private set;} //浠婃棩璐拱鍖归厤娆℃暟
         #endregion
 
+        private void ResetData()
+        {
+            curRank = 0;
+            curScore = 0;
+            curWinRate = 0;
+            sumBattleNum = 0;
+            dayMatchNum = 0;
+            alreadyBuyNum = 0;
+        }
+
         #region 绾㈢偣
         #endregion
 

--
Gitblit v1.8.0