From ad739bd4dea8b8f103832229613d30fd7b47a37e Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 16 十月 2018 16:15:29 +0800
Subject: [PATCH] 4208 【前端】Boss之家和古神禁地从封魔坛界面前往异兽之地逻辑

---
 System/DogzDungeon/DogzDungeonWin.cs |  108 +++++++++++++++++++++++++++++++----
 Fight/MapTransferUtility.cs          |   23 +++----
 2 files changed, 104 insertions(+), 27 deletions(-)

diff --git a/Fight/MapTransferUtility.cs b/Fight/MapTransferUtility.cs
index c5f2b0b..6272363 100644
--- a/Fight/MapTransferUtility.cs
+++ b/Fight/MapTransferUtility.cs
@@ -18,14 +18,11 @@
         Fight,
     }
     private E_MapTransferDoType m_MapTransferType;
-    public E_MapTransferDoType MapTransferDoType
-    {
-        get
-        {
+    public E_MapTransferDoType MapTransferDoType {
+        get {
             return m_MapTransferType;
         }
-        set
-        {
+        set {
             m_MapTransferType = value;
 #if UNITY_EDITOR
             // Debug.LogFormat("璁剧疆鏂瑰紡: {0}", m_MapTransferType);
@@ -124,8 +121,7 @@
     #endregion
 
     #region npc
-    public int NpcID
-    {
+    public int NpcID {
         get; set;
     }
     #endregion
@@ -267,13 +263,14 @@
         MapModel _model = ModelCenter.Instance.GetModel<MapModel>();
         GActor _npc = null;
         // 鍔犲叆鍒ゆ柇鏄惁涓栫晫BOSS鍒ゆ柇
-        WorldBossConfig _worldBoss = Config.Instance.Get<WorldBossConfig>(npcID);
+        var _worldBoss = Config.Instance.Get<WorldBossConfig>(npcID);
+        var dogzBoss = Config.Instance.Get<DogzDungeonConfig>(npcID);
 
         if (_findLocation)
         {
             var _mapConfig = Config.Instance.Get<MapConfig>(_npcLocation.mapId);
             // 涓珛鍦板浘
-            if (_mapConfig.Camp == 5 && _worldBoss != null)
+            if (_mapConfig.Camp == 5 && (_worldBoss != null || dogzBoss != null))
             {
                 if (_npcLocation.mapId == PlayerDatas.Instance.baseData.MapID)
                 {
@@ -292,7 +289,7 @@
         }
 
         FairyGrabBossConfig _fairyBoss = Config.Instance.Get<FairyGrabBossConfig>(npcID);
-        bool _isBoss = _worldBoss != null || _fairyBoss != null;
+        bool _isBoss = _worldBoss != null || _fairyBoss != null || dogzBoss != null;
         if (_isBoss && _findLocation)
         {
             //Debug.LogFormat("鐩爣鏄痓oss");
@@ -359,7 +356,7 @@
                     var mapId = _npcLocation.mapId;
                     var position = new Vector3(_mapConfig.BornPoints[0].x, 0, _mapConfig.BornPoints[0].y);
                     Send_WorldTransfer(mapId, position, MapTransferType.WorldTransport, (byte)_lineID, npcID);
-                    
+
                     forceMove = true;
 
                     if (BossFakeLineUtility.Instance.IsShuntBoss(npcID))
@@ -471,7 +468,7 @@
             // 鍓湰涓笉鍙互浼犻��
             if (_curMapConfig.MapFBType != 0)
             {
-                SysNotifyMgr.Instance.ShowTip("Map_Delivery");
+                SysNotifyMgr.Instance.ShowTip("InDungeon_CantGo");
                 return;
             }
 
diff --git a/System/DogzDungeon/DogzDungeonWin.cs b/System/DogzDungeon/DogzDungeonWin.cs
index 9d34be0..2365d2b 100644
--- a/System/DogzDungeon/DogzDungeonWin.cs
+++ b/System/DogzDungeon/DogzDungeonWin.cs
@@ -34,6 +34,7 @@
         DogzDungeonModel model { get { return ModelCenter.Instance.GetModel<DogzDungeonModel>(); } }
         FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
         DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
+        BossHomeModel bossHomeModel { get { return ModelCenter.Instance.GetModel<BossHomeModel>(); } }
 
         #region Built-in
         protected override void BindController()
@@ -107,28 +108,107 @@
 
         private void GotoKillBoss()
         {
-            if (PlayerDatas.Instance.baseData.MapID == DogzDungeonModel.DATA_MAPID)
+            var error = 0;
+            if (TestGotoKillBoss(out error))
             {
-                WindowJumpMgr.Instance.ClearJumpData();
-                WindowCenter.Instance.Close<LootPreciousFrameWin>();
-                WindowCenter.Instance.Open<MainInterfaceWin>();
+                if (PlayerDatas.Instance.baseData.MapID == DogzDungeonModel.DATA_MAPID)
+                {
+                    WindowJumpMgr.Instance.ClearJumpData();
+                    WindowCenter.Instance.Close<LootPreciousFrameWin>();
+                    WindowCenter.Instance.Open<MainInterfaceWin>();
+                }
+
+                var config = Config.Instance.Get<DogzDungeonConfig>(model.selectedBoss);
+                switch (config.MonsterType)
+                {
+                    case 1:
+                    case 2:
+                    case 3:
+                        if (PlayerDatas.Instance.baseData.MapID != DogzDungeonModel.DATA_MAPID)
+                        {
+                            var map = Config.Instance.Get<MapConfig>(DogzDungeonModel.DATA_MAPID);
+                            var position = new Vector3(map.BornPoints[0].x, 0, map.BornPoints[0].y);
+                            MapTransferUtility.Send_WorldTransfer(DogzDungeonModel.DATA_MAPID, position, MapTransferType.WorldTransport, 0, 0);
+                        }
+                        break;
+                    case 4:
+                        MapTransferUtility.Instance.MoveToNPC(model.selectedBoss);
+                        break;
+                }
+            }
+            else
+            {
+                ProcessGotoKillBossError(error);
+            }
+        }
+
+        private bool TestGotoKillBoss(out int error)
+        {
+            var mapId = PlayerDatas.Instance.baseData.MapID;
+            var dataMapId = dungeonModel.GetDataMapIdByMapId(mapId);
+
+            if (dataMapId == BossHomeModel.BOSSHOME_MAPID || dataMapId == ElderGodAreaModel.ELDERGODAREA_MAPID)
+            {
+                error = 1;
+                return false;
             }
 
-            var config = Config.Instance.Get<DogzDungeonConfig>(model.selectedBoss);
-            switch (config.MonsterType)
+            var mapConfig = Config.Instance.Get<MapConfig>(mapId);
+            if (mapConfig.MapFBType != (int)MapType.OpenCountry)
+            {
+                error = 2;
+                return false;
+            }
+
+            error = 0;
+            return true;
+        }
+
+        private void ProcessGotoKillBossError(int _error)
+        {
+            switch (_error)
             {
                 case 1:
-                case 2:
-                case 3:
-                    if (PlayerDatas.Instance.baseData.MapID != DogzDungeonModel.DATA_MAPID)
+                    var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
+                    var config = Config.Instance.Get<DungeonOpenTimeConfig>(dataMapId);
+                    var tip = string.Empty;
+
+                    if (dataMapId == BossHomeModel.BOSSHOME_MAPID)
                     {
-                        var map = Config.Instance.Get<MapConfig>(DogzDungeonModel.DATA_MAPID);
-                        var position = new Vector3(map.BornPoints[0].x, 0, map.BornPoints[0].y);
-                        MapTransferUtility.Send_WorldTransfer(DogzDungeonModel.DATA_MAPID, position, MapTransferType.WorldTransport, 0, 0);
+                        var vipLevel = PlayerDatas.Instance.baseData.VIPLv;
+                        var vipNeed = bossHomeModel.GetFloorVipRequirement(PlayerDatas.Instance.baseData.dungeonLineId + 1);
+                        if (vipLevel < vipNeed)
+                        {
+                            var moneyNeed = bossHomeModel.GetVipLackCost(PlayerDatas.Instance.baseData.dungeonLineId + 1);
+                            var dungeonId = dungeonModel.GetDungeonId(BossHomeModel.BOSSHOME_MAPID, PlayerDatas.Instance.baseData.dungeonLineId);
+                            var dungeonConfig = Config.Instance.Get<DungeonConfig>(dungeonId);
+                            tip = Language.Get("QuitRemindBossHome", dungeonConfig.FBName, vipNeed, moneyNeed);
+                        }
+                        else
+                        {
+                            tip = Language.Get(config.ExitDescription);
+                        }
                     }
+                    else
+                    {
+                        tip = Language.Get(config.ExitDescription);
+                    }
+
+                    ConfirmCancel.ShowPopConfirm(
+                        Language.Get("Mail101"),
+                        tip,
+                        (bool _ok) =>
+                        {
+                            if (_ok)
+                            {
+                                WindowCenter.Instance.Close<FindPreciousFrameWin>();
+                                MapTransferUtility.Instance.MoveToNPC(model.selectedBoss);
+                            }
+                        }
+                        );
                     break;
-                case 4:
-                    MapTransferUtility.Instance.MoveToNPC(model.selectedBoss);
+                case 2:
+                    SysNotifyMgr.Instance.ShowTip("InDungeon_CantGo");
                     break;
             }
         }

--
Gitblit v1.8.0