From cb4003b0ed872cd4b7f2500922d5f667450fb833 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 01 十一月 2018 13:41:07 +0800
Subject: [PATCH] 4500【前端】【1.2】人物等级低于世界等级X级,单人挑战仙界密境获得伤害BUFF加成

---
 System/Dungeon/DungeonFairyLandWin.cs |   96 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/System/Dungeon/DungeonFairyLandWin.cs b/System/Dungeon/DungeonFairyLandWin.cs
index 0048ad4..9c310e4 100644
--- a/System/Dungeon/DungeonFairyLandWin.cs
+++ b/System/Dungeon/DungeonFairyLandWin.cs
@@ -17,6 +17,12 @@
         [SerializeField]
         List<Text> targetTextList;
 
+        [SerializeField] RectTransform m_FairyLandUpperBehaviour;
+        [SerializeField] Text m_FairyLandUpperTip;
+        [SerializeField] PositionTween m_PositionTween;
+        [SerializeField] ScaleTween m_ScaleTween;
+        [SerializeField] RectTransform[] m_MoveRects;
+
         DungeonModel m_Model;
         DungeonModel model
         {
@@ -64,14 +70,17 @@
 
         protected override void OnPreOpen()
         {
+            m_FairyLandUpperBehaviour.gameObject.SetActive(false);
+            SetTween(m_PositionTween, m_ScaleTween, 0);
+
             StageChangeEvent();
             MyTeamRefreshEvent();
             DungeonEncourageEvent();
             UpdateBuf();
             model.dungeonFairyLandChangeEvent += StageChangeEvent;
             model.dungeonInspireLvEvent += DungeonEncourageEvent;
-            PlayerBuffDatas.Even_ObjAddBuf += UpdateBuf;
-            PlayerBuffDatas.Even_ObjDelBuff += UpdateBuf;
+            PlayerBuffDatas.Even_ObjAddBuf += AddBuff;
+            PlayerBuffDatas.Even_ObjDelBuff += DeleteBuff;
             teamModel.myTeamRefreshEvent += MyTeamRefreshEvent;
         }
 
@@ -93,6 +102,12 @@
                 _teamOnlineCnt == 0 ? "<color=#ff2828>" : "<color=#00ff00>", Mathf.Max(0, _teamOnlineCnt - 1) * 10, "%</color>");
         }
 
+        protected override void OnActived()
+        {
+            base.OnActived();
+            DisplayBuff();
+        }
+
         protected override void OnAfterOpen()
         {
         }
@@ -101,8 +116,8 @@
         {
             model.dungeonFairyLandChangeEvent -= StageChangeEvent;
             model.dungeonInspireLvEvent -= DungeonEncourageEvent;
-            PlayerBuffDatas.Even_ObjAddBuf -= UpdateBuf;
-            PlayerBuffDatas.Even_ObjDelBuff -= UpdateBuf;
+            PlayerBuffDatas.Even_ObjAddBuf -= AddBuff;
+            PlayerBuffDatas.Even_ObjDelBuff -= DeleteBuff;
             teamModel.myTeamRefreshEvent -= MyTeamRefreshEvent;
         }
 
@@ -124,6 +139,18 @@
             var level = model.GetDungeonInspireLevel();
             targetTextList[3].text = level == 0 ? StringUtility.Contact(Language.Get("FairyLand_Func3"), "锛�", Language.Get("FairyLand_Func4"))
                 : StringUtility.Contact(Language.Get("FairyLand_Func3"), "锛�<color=#00ff00>", level * model.GetDungeonInspireUpper(31080), "%</color>");
+        }
+
+        private void AddBuff()
+        {
+            UpdateBuf();
+            DisplayBuff();
+        }
+
+        private void DeleteBuff()
+        {
+            UpdateBuf();
+            DisplayBuff();
         }
 
         private void UpdateBuf()
@@ -149,6 +176,67 @@
             }
             targetTextList[4].text = StringUtility.Contact(Language.Get("FairyLand_Func1"), "锛�", Language.Get("FairyLand_Func2"));
         }
+
+        private void DisplayBuff()
+        {
+            var gainBuff = Buffmodel._BuffDic.ContainsKey(GeneralDefine.fairyLandBuffId);
+            var config = Config.Instance.Get<SkillConfig>(GeneralDefine.fairyLandBuffId);
+            if (config != null)
+            {
+                m_FairyLandUpperTip.text = UIHelper.ReplaceNewLine(Language.Get("XjmjAddHarm2",
+                    GeneralDefine.fairyLandBuffCondition, config.EffectValue11 / 10000 + 1));
+            }
+            if (!gainBuff)
+            {
+                if (m_FairyLandUpperBehaviour.gameObject.activeSelf)
+                {
+                    m_FairyLandUpperBehaviour.gameObject.SetActive(false);
+                }
+            }
+            else
+            {
+                if (!m_FairyLandUpperBehaviour.gameObject.activeSelf)
+                {
+                    SetTween(m_PositionTween, m_ScaleTween, 0);
+                    m_FairyLandUpperBehaviour.gameObject.SetActive(true);
+                    m_PositionTween.Play(OnPositionTweenComplete);
+                }
+            }
+        }
+
+        private void OnPositionTweenComplete()
+        {
+            SetTween(m_PositionTween, m_ScaleTween, 1);
+            m_PositionTween.Play();
+            m_ScaleTween.Play();
+        }
+
+        private void SetTween(PositionTween _posTween, ScaleTween _scaleTween, int index)
+        {
+            _posTween.from = m_MoveRects[index].localPosition;
+            _posTween.to = m_MoveRects[index + 1].localPosition;
+            _posTween.duration = index == 0 ? 2f : 1f;
+            _posTween.delay = index == 0 ? 0 : 1.0f;
+            _posTween.SetStartState();
+            if (index == 0)
+            {
+                _scaleTween.SetStartState();
+            }
+            else
+            {
+                _scaleTween.delay = 1.0f;
+            }
+        }
+
+#if UNITY_EDITOR
+        [ContextMenu("Test")]
+        void Test()
+        {
+            SetTween(m_PositionTween, m_ScaleTween, 0);
+            m_FairyLandUpperBehaviour.gameObject.SetActive(true);
+            m_PositionTween.Play(OnPositionTweenComplete);
+        }
+#endif
     }
 
 }

--
Gitblit v1.8.0