From 018b0b033fb26de0799e323fc6cd42db04602eff Mon Sep 17 00:00:00 2001
From: Hale Cai <339726288@qq.com>
Date: 星期五, 10 八月 2018 15:45:26 +0800
Subject: [PATCH] fixed #2324 【开发】新手战斗石头人引导优化

---
 Fight/PreFightMission.cs               |  124 +++++++++++++++++++++++++++++------------
 Fight/Stage/MapEditor/NewGuideModel.cs |    1 
 Fight/Actor/AI/HeroAI_KillUntilDie.cs  |    2 
 Fight/Stage/MapEditor/NewGuideWin.cs   |   17 ++++-
 Fight/GameActor/GA_Hero.cs             |    7 -
 5 files changed, 105 insertions(+), 46 deletions(-)

diff --git a/Fight/Actor/AI/HeroAI_KillUntilDie.cs b/Fight/Actor/AI/HeroAI_KillUntilDie.cs
index b66fa7f..00cc4d5 100644
--- a/Fight/Actor/AI/HeroAI_KillUntilDie.cs
+++ b/Fight/Actor/AI/HeroAI_KillUntilDie.cs
@@ -151,7 +151,7 @@
 
         // 纭畾瑕佷娇鐢ㄧ殑鎶�鑳�
         // 鏄惁瀛樺湪棰勮瀹氱殑鎶�鑳�
-        if (m_FirstSkill != -1)
+        if (m_FirstSkill > 0)
         {
             _skill = _hero.SkillMgr.Get(m_FirstSkill);
         }
diff --git a/Fight/GameActor/GA_Hero.cs b/Fight/GameActor/GA_Hero.cs
index 8c94954..a216108 100644
--- a/Fight/GameActor/GA_Hero.cs
+++ b/Fight/GameActor/GA_Hero.cs
@@ -720,12 +720,9 @@
 
         Behaviour.StartKillUntilDieAI();
 
-        if (aiHandler.IsAuto())
+        if (OnUserClickSkill != null)
         {
-            if (OnUserClickSkill != null)
-            {
-                OnUserClickSkill(0);
-            }
+            OnUserClickSkill(0);
         }
     }
 
diff --git a/Fight/PreFightMission.cs b/Fight/PreFightMission.cs
index 5af4f07..699a06c 100644
--- a/Fight/PreFightMission.cs
+++ b/Fight/PreFightMission.cs
@@ -65,6 +65,14 @@
         public byte status;
     }
 
+    private enum E_AfterAttackType
+    {
+        None,
+        RefreshRock,
+    }
+
+    private E_AfterAttackType m_AfterAttackType;
+
     public Dictionary<uint, Mission> s_MissionDict = new Dictionary<uint, Mission>();
     public Dictionary<uint, List<int>> missionNpcDict = new Dictionary<uint, List<int>>();
 
@@ -182,6 +190,9 @@
 
     public void Start()
     {
+        NewGuideModel _model = ModelCenter.Instance.GetModel<NewGuideModel>();
+        _model.arrowScale = 1;
+
         IsHeroCanCastSkill = false;
         Transform _temp = null;
         _temp = WindowCenter.Instance.uiRoot.baseCanvas.Find("MainInterfaceWin/CopyOfThePanel/TopRightTip");
@@ -366,6 +377,7 @@
             return;
         }
 
+        WindowCenter.Instance.Close<NewGuideWin>();
         WindowCenter.Instance.Close<GuideMessageWin>();
 
         needCreate1002 = true;
@@ -423,6 +435,23 @@
         m_MoveToEffect = SFXPlayUtility.Instance.Play(1052, PlayerDatas.Instance.hero.Root);
         FaceTargetXZ _f = m_MoveToEffect.gameObject.AddComponent<FaceTargetXZ>();
         _f.target = m_FuncNpc.Root;
+
+        SnxxzGame.Instance.StartCoroutine(WaitForGoToNpc(_pos));
+
+    }
+
+    private IEnumerator WaitForGoToNpc(Vector3 pos)
+    {
+        GA_Hero _hero = PlayerDatas.Instance.hero;
+        while (true)
+        {
+            if (_hero.IsIdle())
+            {
+                break;
+            }
+            yield return null;
+        }
+        PlayerDatas.Instance.hero.MoveToPosition(pos);
     }
 
     private void HandlerMission(uint missionId)
@@ -616,10 +645,11 @@
         _temp.localScale = Vector3.one;
         NewGuideModel _model = ModelCenter.Instance.GetModel<NewGuideModel>();
         _model.showMask = false;
-        _model.content = "杩斿洖鍚戝笀鍏勫洖澶�";
+        _model.content = "";
         _model.componentPath = "NormalCanvas/TreasureSelectWin/Btn_Back";
         _model.size = new Vector2(92, 81);
         _model.direction = 2;
+        _model.arrowScale = 2;
         _model.pressedClose = false;
         _model.clickClosed = true;
         _model.onClose = null;
@@ -862,36 +892,18 @@
              m_UIEffect = EffectMgr.Instance.PlayUIEffect(1096, 4500, _temp, true);
 
              NewGuideModel _model2 = ModelCenter.Instance.GetModel<NewGuideModel>();
-             _model2.showMask = true;
+             _model2.showMask = false;
              _model2.content = "杩炵画鎸夊浘鏍嘰r\n浣跨敤<color=#00ff00>鏅�氭敾鍑�</color>";
              _model2.componentPath = "BaseCanvas/MainInterfaceWin/SkillButtonTip/Pivot/CastSkillTip/AttackBtn";
              _model2.size = new Vector2(178, 178);
              _model2.direction = 0;
-             _model2.pressedClose = true;
-             _model2.clickClosed = true;
-             _model2.onClose = () =>
-             {
-                 // 鎵撳紑灏忔彁绀虹獥鍙�
-                 GuideMessageModel _model = ModelCenter.Instance.GetModel<GuideMessageModel>();
-                 _model.content = "娓呴櫎鍓嶆柟<color=#00ff00>鎵�鏈夋晫浜�</color>";
-                 _model.duration = -1;
+             _model2.pressedClose = false;
+             _model2.clickClosed = false;
 
-                 WindowCenter.Instance.Open<GuideMessageWin>();
+             m_AfterAttackType = E_AfterAttackType.RefreshRock;
+             GA_Hero.OnUserClickSkill += OnCastSkill;
 
-                 if (m_UIEffect)
-                 {
-                     EffectMgr.Instance.RecyleUIEffect(m_UIEffect.effect, m_UIEffect.gameObject);
-                     m_UIEffect = null;
-                 }
-
-                 Refresh_1001();
-
-                 // 鏄剧ず澶村儚鍖哄煙
-                 _temp = WindowCenter.Instance.uiRoot.baseCanvas.Find("MainInterfaceWin/HeadPortraitTip");
-                 _temp.localScale = Vector3.one;
-
-                 updateAI = true;
-             };
+             _model2.onClose = null;
 
              WindowCenter.Instance.Open<NewGuideWin>();
          });
@@ -1039,6 +1051,18 @@
             m_SimpleTransfer = CreateTransfer();
         }
 
+        NewGuideModel _model2 = ModelCenter.Instance.GetModel<NewGuideModel>();
+        _model2.showMask = false;
+        _model2.content = "浣跨敤鏅�氭敾鍑籠r\n鐮村潖<color=#00ff00>鏍呮爮</color>";
+        _model2.componentPath = "BaseCanvas/MainInterfaceWin/SkillButtonTip/Pivot/CastSkillTip/AttackBtn";
+        _model2.size = new Vector2(178, 178);
+        _model2.direction = 0;
+        _model2.pressedClose = false;
+        _model2.clickClosed = false;
+        _model2.onClose = null;
+        WindowCenter.Instance.Open<NewGuideWin>();
+        SnxxzGame.Instance.StartCoroutine(DelayCloseNewGuideWin(3f));
+
         Transform _temp = WindowCenter.Instance.uiRoot.baseCanvas.Find("MainInterfaceWin/TaskAndTeamTip/TaskListTip");
         _temp.gameObject.SetActive(false);
         _temp = WindowCenter.Instance.uiRoot.baseCanvas.Find("MainInterfaceWin/TaskSwithButton");
@@ -1050,17 +1074,6 @@
 
         m_SimpleTransfer.Init(-1, _pos, false, null, () =>
          {
-             NewGuideModel _model2 = ModelCenter.Instance.GetModel<NewGuideModel>();
-             _model2.showMask = false;
-             _model2.content = "浣跨敤鏅�氭敾鍑籠r\n鐮村潖<color=#00ff00>鏍呮爮</color>";
-             _model2.componentPath = "BaseCanvas/MainInterfaceWin/SkillButtonTip/Pivot/CastSkillTip/AttackBtn";
-             _model2.size = new Vector2(178, 178);
-             _model2.direction = 0;
-             _model2.pressedClose = false;
-             _model2.clickClosed = true;
-             _model2.onClose = null;
-             WindowCenter.Instance.Open<NewGuideWin>();
-
              HeroBehaviour.onCastSkill += OnCastSkill;
 
              _pos = new Vector3(124.65f, 51.494f, 33.01f);
@@ -1109,9 +1122,48 @@
         GameObjectPoolManager.Instance.UnLoadNPC(1000);
     }
 
+    private IEnumerator DelayCloseNewGuideWin(float time)
+    {
+        float _time = Time.realtimeSinceStartup;
+        while (Time.realtimeSinceStartup - _time < time)
+        {
+            yield return null;
+        }
+        WindowCenter.Instance.Close<NewGuideWin>();
+    }
+
     private void OnCastSkill(int skillID)
     {
         GA_Hero.OnUserClickSkill -= OnCastSkill;
+
+        if (m_AfterAttackType == E_AfterAttackType.RefreshRock)
+        {
+            // 鎵撳紑灏忔彁绀虹獥鍙�
+            GuideMessageModel _model = ModelCenter.Instance.GetModel<GuideMessageModel>();
+            _model.content = "娓呴櫎鍓嶆柟<color=#00ff00>鎵�鏈夋晫浜�</color>";
+            _model.duration = -1;
+
+            WindowCenter.Instance.Open<GuideMessageWin>();
+
+            if (m_UIEffect)
+            {
+                EffectMgr.Instance.RecyleUIEffect(m_UIEffect.effect, m_UIEffect.gameObject);
+                m_UIEffect = null;
+            }
+
+            Refresh_1001();
+
+            // 鏄剧ず澶村儚鍖哄煙
+            Transform _temp = WindowCenter.Instance.uiRoot.baseCanvas.Find("MainInterfaceWin/HeadPortraitTip");
+            _temp.localScale = Vector3.one;
+
+            updateAI = true;
+
+            m_AfterAttackType = E_AfterAttackType.None;
+
+            return;
+        }
+
         if (WindowCenter.Instance.CheckOpen<NewGuideWin>())
         {
             WindowCenter.Instance.Close<NewGuideWin>();
diff --git a/Fight/Stage/MapEditor/NewGuideModel.cs b/Fight/Stage/MapEditor/NewGuideModel.cs
index ab8cf76..61de2d4 100644
--- a/Fight/Stage/MapEditor/NewGuideModel.cs
+++ b/Fight/Stage/MapEditor/NewGuideModel.cs
@@ -21,6 +21,7 @@
     /// 璇存槑鏂囧瓧鍙婄澶寸殑鏂瑰悜, 0123 涓婁笅宸﹀彸
     /// </summary>
     public byte direction;
+    public float arrowScale = 1f;
 
     public override void Init()
     {
diff --git a/Fight/Stage/MapEditor/NewGuideWin.cs b/Fight/Stage/MapEditor/NewGuideWin.cs
index dcabc11..43e1bbc 100644
--- a/Fight/Stage/MapEditor/NewGuideWin.cs
+++ b/Fight/Stage/MapEditor/NewGuideWin.cs
@@ -49,8 +49,17 @@
 
             holdImage.cell = _model.size;
             rtSelectFrame.sizeDelta = _model.size + new Vector2(15, 15);
+            if (string.IsNullOrEmpty(_model.content))
+            {
+                rtContent.gameObject.SetActive(false);
+            }
+            else
+            {
+                rtContent.gameObject.SetActive(true);
+            }
             txtContent.text = _model.content;
             m_PressClose = _model.pressedClose;
+            rtArrow.localScale = Vector3.one * _model.arrowScale;
             container.gameObject.SetActive(_model.showMask);
 
             if (_model.onClose != null)
@@ -115,25 +124,25 @@
                 {
                     _arrowPosition = rtSelectFrame.anchoredPosition + new Vector2(0, rtSelectFrame.sizeDelta.y * .5f + 20f);
                     _contentPosition = _arrowPosition + new Vector2(0, rtArrow.sizeDelta.y * .5f + rtContent.sizeDelta.y * .5f + 5);
-                    _rotation = Vector3.zero;
+                    _rotation = new Vector3(0, 0, 90);
                 }
                 else if (m_Direction == 1)// 涓�
                 {
                     _arrowPosition = rtSelectFrame.anchoredPosition + new Vector2(0, -rtSelectFrame.sizeDelta.y * .5f - 20f);
                     _contentPosition = _arrowPosition + new Vector2(0, -rtArrow.sizeDelta.y * .5f - rtContent.sizeDelta.y * .5f - 5);
-                    _rotation = new Vector3(0, 0, 180);
+                    _rotation = new Vector3(0, 0, 270);
                 }
                 else if (m_Direction == 2)// 宸�
                 {
                     _arrowPosition = rtSelectFrame.anchoredPosition + new Vector2(-rtSelectFrame.sizeDelta.x * .5f - 20f, 0);
                     _contentPosition = _arrowPosition + new Vector2(-rtArrow.sizeDelta.x * .5f - rtContent.sizeDelta.x * .5f - 5, 0);
-                    _rotation = new Vector3(0, 0, 90);
+                    _rotation = new Vector3(0, 0, 180);
                 }
                 else if (m_Direction == 3)// 鍙�
                 {
                     _arrowPosition = rtSelectFrame.anchoredPosition + new Vector2(rtSelectFrame.sizeDelta.x * .5f + 20f, 0);
                     _contentPosition = _arrowPosition + new Vector2(rtArrow.sizeDelta.x * .5f + rtContent.sizeDelta.x * .5f + 5, 0);
-                    _rotation = new Vector3(0, 0, 270);
+                    _rotation = Vector3.zero;
                 }
 
                 rtArrow.anchoredPosition = _arrowPosition;

--
Gitblit v1.8.0