From a4708f8dfb78c97ffa69560fac17b2de7bf9ff77 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期四, 14 三月 2019 21:22:55 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Realm/RealmModel.cs                       |   18 ++++++
 Fight/Stage/MapEditor/Game/TransferGroup.cs      |    3 
 System/Realm/RealmWin.cs                         |   13 +++-
 System/Realm/RealmStageBehaviour.cs              |   20 ++++++
 Fight/MapTransferUtility.cs                      |    7 ++
 Fight/Stage/MapEditor/Game/ClientSceneManager.cs |    5 +
 System/Realm/RealmAnimationBehaviour.cs          |   94 +++++++++++++++++++++++++++---
 7 files changed, 142 insertions(+), 18 deletions(-)

diff --git a/Fight/MapTransferUtility.cs b/Fight/MapTransferUtility.cs
index c8c4128..a0058a0 100644
--- a/Fight/MapTransferUtility.cs
+++ b/Fight/MapTransferUtility.cs
@@ -228,8 +228,13 @@
             GActor _npc = GAMgr.Instance.GetCloserNPC(_hero.Pos, npcID);
             if (_npc != null)
             {
-                //Debug.LogFormat(" |-- 鍦ㄨ閲庡唴");
                 _destPostion = _npc.Pos;
+
+                NpcID = npcID;
+                MapTransferDoType = E_MapTransferDoType.Npc;
+
+                _hero.MoveToPosition(_destPostion);
+                yield break;
             }
         }
         else
diff --git a/Fight/Stage/MapEditor/Game/ClientSceneManager.cs b/Fight/Stage/MapEditor/Game/ClientSceneManager.cs
index 0dc9d5e..cac547e 100644
--- a/Fight/Stage/MapEditor/Game/ClientSceneManager.cs
+++ b/Fight/Stage/MapEditor/Game/ClientSceneManager.cs
@@ -344,7 +344,10 @@
                 {
                     var _refreshEvent = new EventRefreshNPCHandler();
                     _refreshEvent.Init(_event as Evt_RefreshMonster);
-                    m_EventHandlerDict.Add(_refreshEvent.GetEventID(), _refreshEvent);
+                    if (!m_EventHandlerDict.ContainsKey(_refreshEvent.GetEventID()))
+                    {
+                        m_EventHandlerDict.Add(_refreshEvent.GetEventID(), _refreshEvent);
+                    }
                 }
             }
 
diff --git a/Fight/Stage/MapEditor/Game/TransferGroup.cs b/Fight/Stage/MapEditor/Game/TransferGroup.cs
index 81a74d4..2c4a7eb 100644
--- a/Fight/Stage/MapEditor/Game/TransferGroup.cs
+++ b/Fight/Stage/MapEditor/Game/TransferGroup.cs
@@ -142,7 +142,8 @@
                 float _y = 0;
                 if (m_StartPos.y > _p.position.y)
                 {
-                    _y = Constants.hurtAniCurve.animationCurve.Evaluate(m_InCreaseTime) * (m_StartPos.y - _p.position.y) + (1 - m_InCreaseTime) * (m_StartPos.y - _p.position.y);
+                    var _offset = m_StartPos.y - _p.position.y;
+                    _y = Constants.hurtAniCurve.animationCurve.Evaluate(m_InCreaseTime) * _offset + (1 - m_InCreaseTime) * _offset;
                 }
                 else
                 {
diff --git a/System/Realm/RealmAnimationBehaviour.cs b/System/Realm/RealmAnimationBehaviour.cs
index 9d6627a..db3e1b3 100644
--- a/System/Realm/RealmAnimationBehaviour.cs
+++ b/System/Realm/RealmAnimationBehaviour.cs
@@ -9,14 +9,19 @@
         [SerializeField] float m_Radius = 100f;
         [SerializeField] float m_Duration = 1f;
         [SerializeField] TweenCurve m_TweenCurve;
+        [SerializeField] Transform m_RealmStageCenter;
         [SerializeField] Transform m_ContainerLine;
         [SerializeField] RealmStageBehaviour[] m_RealmStages;
+        [SerializeField] Transform m_ContainerEffectLine;
+        [SerializeField] UIEffect[] m_EffectLines;
 
         Coroutine m_RotateCoroutine = null;
 
         float m_DeltaAngle { get { return 360f / 8; } }
 
         public event Action onRotateComplete;
+
+        RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
 
         public void SetDefault()
         {
@@ -25,6 +30,28 @@
             {
                 m_RealmStages[i].transform.localPosition = GetPointPosition(i);
                 m_RealmStages[i].animIndex = i;
+            }
+            m_ContainerEffectLine.localEulerAngles = Vector3.zero;
+            DisplayEffectLines();
+        }
+
+        void DisplayEffectLines()
+        {
+            var realmLevel = PlayerDatas.Instance.baseData.realmLevel;
+            var stage = model.GetRealmStage(realmLevel);
+            List<int> realms = null;
+            if (model.TryGetRealmStages(stage, out realms))
+            {
+                for (int i = 0; i < realms.Count; i++)
+                {
+                    var level = realms[i] + 1;
+                    if (realmLevel >= level)
+                    {
+                       // m_EffectLines[i].Play();
+                       // var animator = m_EffectLines[i].target.GetAnimator();
+                       // animator.Play("idle", 0);
+                    }
+                }
             }
         }
 
@@ -40,13 +67,53 @@
 
         Vector3 GetPointPosition(float angle)
         {
-            var _x = transform.position.x + m_Radius * Mathf.Sin(Mathf.Deg2Rad * angle);
-            var _y = transform.position.y + m_Radius * Mathf.Cos(Mathf.Deg2Rad * angle);
-            var _z = transform.position.z;
+            var _x = m_RealmStageCenter.position.x + m_Radius * Mathf.Sin(Mathf.Deg2Rad * angle);
+            var _y = m_RealmStageCenter.position.y + m_Radius * Mathf.Cos(Mathf.Deg2Rad * angle);
+            var _z = m_RealmStageCenter.position.z;
             return new Vector3(_x, _y, _z);
         }
 
-        public void StartRotate()
+        public void DisplayLevelUp(int index)
+        {
+            StartCoroutine(Co_DisplayLevelUp(index));
+        }
+
+        IEnumerator Co_DisplayLevelUp(int index)
+        {
+            if (index >= m_EffectLines.Length)
+            {
+                yield break;
+            }
+            //m_EffectLines[index].Play();
+            //var animator = m_EffectLines[index].target.GetAnimator();
+            //animator.Play("open", 0, 0);
+            //yield return WaitingForSecondConst.WaitMS1500;
+            //animator.Play("idle", 0);
+            var realmStage = GetRealmStageBeha(index + 1);
+            if (realmStage != null)
+            {
+                realmStage.DisplayEffect(true);
+            }
+            yield return WaitingForSecondConst.WaitMS500;
+            if (index == 3)
+            {
+                StartRotate();
+            }
+        }
+
+        RealmStageBehaviour GetRealmStageBeha(int index)
+        {
+            foreach (var realmStage in m_RealmStages)
+            {
+                if (realmStage.animIndex == index)
+                {
+                    return realmStage;
+                }
+            }
+            return null;
+        }
+
+        void StartRotate()
         {
             if (m_RotateCoroutine != null)
             {
@@ -55,11 +122,13 @@
             m_RotateCoroutine = StartCoroutine(Co_Rotate());
         }
 
-        public void StopRotate()
+        public void Dispose()
         {
+            StopAllCoroutines();
             if (m_RotateCoroutine != null)
             {
                 StopCoroutine(m_RotateCoroutine);
+                m_RotateCoroutine = null;
             }
         }
 
@@ -91,6 +160,7 @@
                             realmStage.gameObject.SetActive(true);
                         }
                     }
+                    m_EffectLines[0].StopImediatly();
                     rotate30 = true;
                 }
 
@@ -100,12 +170,20 @@
                     var position = GetPointPosition(cacheAngle - angle);
                     m_RealmStages[i].transform.localPosition = position;
                 }
+
+                m_ContainerEffectLine.localEulerAngles = new Vector3(0, 0, angle);
             }
             m_ContainerLine.gameObject.SetActive(false);
             foreach (var realmStage in m_RealmStages)
             {
                 realmStage.animIndex = (realmStage.animIndex + 5) % 9;
             }
+
+            foreach (var effectLine in m_EffectLines)
+            {
+                effectLine.StopImediatly();
+            }
+            m_ContainerEffectLine.localEulerAngles = Vector3.zero;
 
             if (onRotateComplete != null)
             {
@@ -117,12 +195,6 @@
         void TestReset()
         {
             SetDefault();
-        }
-
-        [ContextMenu("Rotate")]
-        void TestRotate()
-        {
-            StartRotate();
         }
     }
 }
diff --git a/System/Realm/RealmModel.cs b/System/Realm/RealmModel.cs
index acf4659..6f77bb8 100644
--- a/System/Realm/RealmModel.cs
+++ b/System/Realm/RealmModel.cs
@@ -171,6 +171,24 @@
             return m_RealmStages.Count - 1;
         }
 
+        public int GetRealmStageEffect(int realmLevel)
+        {
+            var config = RealmConfig.Get(realmLevel);
+            if (config != null)
+            {
+                switch (config.Quality)
+                {
+                    case 1: return 7028;
+                    case 2: return 7029;
+                    case 3: return 7030;
+                    case 4: return 7031;
+                    case 5: return 7032;
+                    case 6: return 7033;
+                }
+            }
+            return 7028;
+        }
+
         public void SendLevelUpRealm()
         {
             CA523_tagCMRealmLVUp pak = new CA523_tagCMRealmLVUp();
diff --git a/System/Realm/RealmStageBehaviour.cs b/System/Realm/RealmStageBehaviour.cs
index 7111668..487bbdc 100644
--- a/System/Realm/RealmStageBehaviour.cs
+++ b/System/Realm/RealmStageBehaviour.cs
@@ -35,6 +35,7 @@
 
             DisplayBase();
             DisplaySelect();
+            DisplayEffect(false);
         }
 
         void DisplayBase()
@@ -53,6 +54,25 @@
             }
         }
 
+        public void DisplayEffect(bool levelUp)
+        {
+            m_Effect.StopImediatly();
+            if (PlayerDatas.Instance.baseData.realmLevel >= realmLevel)
+            {
+                m_Effect.effect = model.GetRealmStageEffect(realmLevel);
+                m_Effect.Play();
+                Animator animator = null;
+                if (m_Effect.target != null)
+                {
+                    animator = m_Effect.target.GetAnimator();
+                }
+                if (animator != null)
+                {
+                    animator.Play(levelUp ? "open" : "idle", 0);
+                }
+            }
+        }
+
         public void Dispose()
         {
             model.selectRealmRefresh -= SelectRealmRefresh;
diff --git a/System/Realm/RealmWin.cs b/System/Realm/RealmWin.cs
index 9798b69..dce5575 100644
--- a/System/Realm/RealmWin.cs
+++ b/System/Realm/RealmWin.cs
@@ -158,7 +158,7 @@
         void HideRealmUp()
         {
             m_ContainerRealmUp.gameObject.SetActive(false);
-            m_RealmAnimation.StopRotate();
+            m_RealmAnimation.Dispose();
             m_RealmBriefTween.Stop();
             m_RealmBriefTween.SetEndState();
             m_RealmLevelUpTween.Stop();
@@ -276,10 +276,15 @@
                     }
                     else
                     {
-                        if (stage != currentStage)
+                        List<int> realms = null;
+                        if (model.TryGetRealmStages(currentStage, out realms))
                         {
-                            m_RealmAnimation.StartRotate();
-                            m_ContainerUnlockEquip.gameObject.SetActive(false);
+                            var index = realms.IndexOf(cacheRealmLevel);
+                            m_RealmAnimation.DisplayLevelUp(realms.IndexOf(cacheRealmLevel));
+                            if (index == 3)
+                            {
+                                m_ContainerUnlockEquip.gameObject.SetActive(false);
+                            }
                         }
                     }
                     cacheRealmLevel = realmLevel;

--
Gitblit v1.8.0