Browse Source

剧情关卡速刷

guodong 3 years ago
parent
commit
01cc217185

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 993beeaf18a52163c913584db22c22697a7f2b03
+Subproject commit c6d6248d1540bac39c1c4280fd57c5f7e4c0a36e

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -28,6 +28,9 @@ namespace GFGGame
         public const string GET_MAINTAIN_SUIT_BONUS = "GET_MAINTAIN_SUIT_BONUS";
         public const string GET_MAINTAIN_SUIT_BONUS = "GET_MAINTAIN_SUIT_BONUS";
         public const string MAKE_NEW_SUIT = "MAKE_NEW_SUIT";
         public const string MAKE_NEW_SUIT = "MAKE_NEW_SUIT";
 
 
+        //剧情战斗快速完成,展示奖励
+        public const string STORY_FIGHT_QUICKLY_SUCCESS = "STORY_FIGHT_QUICKLY_SUCCESS";
+
 
 
 
 
     }
     }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -80,7 +80,7 @@ namespace GFGGame
             //SkillDataManager.Instance.InitServerData(result.roleSkillList);
             //SkillDataManager.Instance.InitServerData(result.roleSkillList);
             //SkillDataManager.Instance.SetDicPassivitySkillCfg();
             //SkillDataManager.Instance.SetDicPassivitySkillCfg();
             GetSuitItemController.enable = true;
             GetSuitItemController.enable = true;
-            //RoleDataHandler.StartUpdate();
+            RoleDataHandler.StartUpdate();
 
 
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Data/Cache/StoryBonusDataCache.cs

@@ -44,6 +44,17 @@ namespace GFGGame
             return bonusList;
             return bonusList;
         }
         }
 
 
+        public static List<ItemData> GetBaseBonusList(int levelID)
+        {
+            StoryBonusData bonusData = GetBonusData(levelID);
+            if (bonusData.bonusBase != null)
+            {
+                return bonusData.bonusBase;
+            }
+
+            return null;
+        }
+
         public static List<ItemData> GetChapterBonusList(int chapterID, int index)
         public static List<ItemData> GetChapterBonusList(int chapterID, int index)
         {
         {
             StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterID);
             StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterID);

+ 3 - 23
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -21,10 +21,6 @@ namespace GFGGame
             {
             {
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);
             }
             }
-            set
-            {
-                
-            }
         }
         }
 
 
         public static int gold
         public static int gold
@@ -33,10 +29,6 @@ namespace GFGGame
             {
             {
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
             }
             }
-            set
-            {
-                
-            }
         }
         }
         private static int _exp = 0;
         private static int _exp = 0;
         public static int exp
         public static int exp
@@ -45,24 +37,16 @@ namespace GFGGame
             {
             {
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
             }
             }
-            set
-            {
-                
-            }
         }
         }
-        private static int _lvl = 1;
+
         public static int lvl
         public static int lvl
         {
         {
             get
             get
             {
             {
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
             }
             }
-            set
-            {
-                
-            }
         }
         }
-        private static int _diaP = 0;
+
         public static int diaP
         public static int diaP
         {
         {
             get
             get
@@ -74,17 +58,13 @@ namespace GFGGame
                 
                 
             }
             }
         }
         }
-        private static int _diaR = 0;
+        
         public static int diaR
         public static int diaR
         {
         {
             get
             get
             {
             {
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
                 return GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
             }
             }
-            set
-            {
-                
-            }
         }
         }
         private static string _lastRandomName = null;
         private static string _lastRandomName = null;
 
 

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Data/StoryDataManager.cs

@@ -304,9 +304,9 @@ namespace GFGGame
             //        tempPassLevel = 0;
             //        tempPassLevel = 0;
             //        fistPassLastLvl = true;
             //        fistPassLastLvl = true;
             //    }
             //    }
-            //SetPassData(tempPassChapter, tempPassLevel);
-            //GameProxy.ReqUpdateStoryProgress(_passChapter, _passLevel, _passChapterJY, _passLevelJY);
-            //currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, true, true);
+            //    SetPassData(tempPassChapter, tempPassLevel);
+            //    GameProxy.ReqUpdateStoryProgress(_passChapter, _passLevel, _passChapterJY, _passLevelJY);
+            //    currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, true, true);
             //}
             //}
             //else
             //else
             //{
             //{

+ 50 - 2
GameClient/Assets/Game/HotUpdate/ServerProxy/StorySProxy.cs

@@ -38,8 +38,13 @@ namespace GFGGame
                 {
                 {
                     List<ItemData> bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, true, true);
                     List<ItemData> bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, true, true);
                     BonusController.TryShowBonusList(bonusList);
                     BonusController.TryShowBonusList(bonusList);
+                    FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter) + 1, GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvl));//首次通过要检查是否有功能开启
+                    StoryController.OnFinishStoryLevel(levelCfgId, true);
+                    return;
                 }
                 }
             }
             }
+            //异常返回到关卡列表界面
+            ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
         }
         }
 
 
         //完成剧情战斗关卡
         //完成剧情战斗关卡
@@ -93,8 +98,8 @@ namespace GFGGame
             ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
             ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
         }
         }
 
 
-        //完成剧情战斗关卡失败,更新最高分
-        public static async ETTask FinishStoryFightLevelFail(int levelCfgId, int score)
+        //剧情战斗关卡失败,更新最高分
+        public static async ETTask StoryFightLevelFail(int levelCfgId, int score)
         {
         {
             M2C_FinishStoryFightLevelFail response = null;
             M2C_FinishStoryFightLevelFail response = null;
             response = (M2C_FinishStoryFightLevelFail)await MessageHelper.SendToServer(new C2M_FinishStoryFightLevelFail()
             response = (M2C_FinishStoryFightLevelFail)await MessageHelper.SendToServer(new C2M_FinishStoryFightLevelFail()
@@ -110,5 +115,48 @@ namespace GFGGame
                 }
                 }
             }
             }
         }
         }
+
+        //快速完成关卡战斗
+        public static async ETTask FinishStoryFightQuickly(int levelCfgId, int times)
+        {
+            M2C_FinishStoryFightQuickly response = null;
+            response = (M2C_FinishStoryFightQuickly)await MessageHelper.SendToServer(new C2M_FinishStoryFightQuickly()
+            {
+                LevelCfgId = levelCfgId,
+                times = times
+            });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    List<List<ItemData>> bonusLists = new List<List<ItemData>>();
+                    List<ItemData> allList = new List<ItemData>();
+                    foreach(var proto in response.RandomBonusList)
+                    {
+                        var itemData = ItemUtil.createItemData(proto.ConfigId, proto.Count);
+                        allList.Add(itemData);
+                    }
+                    var index = 0;
+                    for(int i = 0; i < response.BonusLengths.Count; ++i)
+                    {
+                        var len = response.BonusLengths[i];
+
+                        var baseBonusList = StoryBonusDataCache.GetBaseBonusList(response.LevelCfgId);
+                        List<ItemData> bonusList = new List<ItemData>();
+                        if (baseBonusList != null)
+                        {
+                            bonusList.AddRange(baseBonusList);
+                        }
+                        if (len > 0)
+                        {
+                            bonusList.AddRange(allList.GetRange(index, len));
+                        }
+                        bonusLists.Add(bonusList);
+                        index += len;
+                    }
+                    EventAgent.DispatchEvent(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, bonusLists);
+                }
+            }
+        }
     }
     }
 }
 }

+ 19 - 13
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryController.cs

@@ -55,11 +55,28 @@ namespace GFGGame
                 //失败仅判断并更新最高分
                 //失败仅判断并更新最高分
                 if(score > StoryDataManager.GetScoreHighest(StoryDataManager.currentCardId))
                 if(score > StoryDataManager.GetScoreHighest(StoryDataManager.currentCardId))
                 {
                 {
-                    StorySProxy.FinishStoryFightLevelFail(StoryDataManager.currentLevelCfgId, score).Coroutine();
+                    StorySProxy.StoryFightLevelFail(StoryDataManager.currentLevelCfgId, score).Coroutine();
                 }
                 }
             }
             }
         }
         }
 
 
+        public static void OnFinishStoryLevel(int levelCfgId, bool firstPass)
+        {
+            //判断是否是首次打通最后一关
+            int nextLevelID = levelCfgId + 1;
+            StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
+            var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
+
+            if (fistPassLastLvl)
+            {
+                ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW);
+            }
+            else
+            {
+                ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
+            }
+        }
+
         private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
         private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
         {
         {
 
 
@@ -71,18 +88,7 @@ namespace GFGGame
                 //bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
                 //bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
                 StorySProxy.FinishStoryDialogLevel(StoryDataManager.currentLevelCfgId).Coroutine();
                 StorySProxy.FinishStoryDialogLevel(StoryDataManager.currentLevelCfgId).Coroutine();
             }
             }
-            if (_fistPassLastLvl)
-            {
-                ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
-            }
-            else
-            {
-                ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
-            }
-            if (_curLvfirstPass)
-            {
-                FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter) + 1, GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvl));//首次通过要检查是否有功能开启
-            }
+            
             //if (bonusList != null && bonusList.Count > 0)
             //if (bonusList != null && bonusList.Count > 0)
             //{
             //{
             //    ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
             //    ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);

+ 16 - 8
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightQuicklyView.cs

@@ -53,6 +53,7 @@ namespace GFGGame
             _power = levelCfg.power;
             _power = levelCfg.power;
             StartFight(count);
             StartFight(count);
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
+            EventAgent.AddEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
         }
         }
 
 
         protected override void OnHide()
         protected override void OnHide()
@@ -60,6 +61,7 @@ namespace GFGGame
             base.OnHide();
             base.OnHide();
             Timers.inst.Remove(ShowBonusItem);
             Timers.inst.Remove(ShowBonusItem);
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
+            EventAgent.RemoveEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
         }
         }
 
 
         private void StartFight(int count)
         private void StartFight(int count)
@@ -75,14 +77,20 @@ namespace GFGGame
             _ui.m_btnFightTimes.visible = false;
             _ui.m_btnFightTimes.visible = false;
             _ui.m_txtPowerDesc.visible = false;
             _ui.m_txtPowerDesc.visible = false;
             _ui.m_list.RemoveChildren();
             _ui.m_list.RemoveChildren();
-            _totalBonusList = new List<List<ItemData>>();
-            for (int i = 1; i <= count; i++)
-            {
-                bool fistPassLastLvl = false;
-                bool curLvfirstPass = false;
-                List<ItemData> bonusList = StoryDataManager.PassCurrentLevel(out fistPassLastLvl, out curLvfirstPass);
-                _totalBonusList.Add(bonusList);
-            }
+            //_totalBonusList = new List<List<ItemData>>();
+            //for (int i = 1; i <= count; i++)
+            //{
+            //    bool fistPassLastLvl = false;
+            //    bool curLvfirstPass = false;
+            //    List<ItemData> bonusList = StoryDataManager.PassCurrentLevel(out fistPassLastLvl, out curLvfirstPass);
+            //    _totalBonusList.Add(bonusList);
+            //}
+            StorySProxy.FinishStoryFightQuickly(_levelID, count).Coroutine();
+        }
+
+        private void StartShowBonus(EventContext eventContext)
+        {
+            _totalBonusList = (List<List<ItemData>>)eventContext.data;
             _index = 0;
             _index = 0;
             ShowBonusItem();
             ShowBonusItem();
             Timers.inst.Add(0.3f, 0, ShowBonusItem);
             Timers.inst.Add(0.3f, 0, ShowBonusItem);

+ 7 - 24
GameClient/Assets/Game/HotUpdate/Views/MainStory/StroyFightResultView.cs

@@ -21,11 +21,8 @@ namespace GFGGame
         private UI_StoryFightResultUI _ui;
         private UI_StoryFightResultUI _ui;
         private GameObject _sceneObject;
         private GameObject _sceneObject;
         private GameObject _scenePrefab;
         private GameObject _scenePrefab;
-        private List<ItemData> _currentBonusList;
-
-        private bool result = false;
-        private bool _fistPassLastLvl = false;
 
 
+        private StoryFightResultData _resultData;
 
 
         public override void Dispose()
         public override void Dispose()
         {
         {
@@ -69,11 +66,6 @@ namespace GFGGame
             {
             {
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
             }
             }
-            _currentBonusList = resultData.BonusList;
-            //判断是否是首次打通最后一关
-            int nextLevelID = StoryDataManager.currentLevelCfgId + 1;
-            StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
-            _fistPassLastLvl = (nextLevelCfg == null) && resultData.FirstPass;
 
 
             SceneController.UpdateRole(EquipDataCache.cacher.equipDatas, _sceneObject);
             SceneController.UpdateRole(EquipDataCache.cacher.equipDatas, _sceneObject);
             _ui.m_selfScore.m_txtScore.text = "" + resultData.Score;
             _ui.m_selfScore.m_txtScore.text = "" + resultData.Score;
@@ -82,12 +74,11 @@ namespace GFGGame
             _ui.m_expBar.m_pbExp.max = roleLevelCfg.exp;
             _ui.m_expBar.m_pbExp.max = roleLevelCfg.exp;
             _ui.m_expBar.m_pbExp.value = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
             _ui.m_expBar.m_pbExp.value = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
 
 
-            result = resultData.Result;
             StoryUtil.UpdateStar(resultData.Star, _ui.m_selfScore.m_flower.target);
             StoryUtil.UpdateStar(resultData.Star, _ui.m_selfScore.m_flower.target);
             _ui.m_selfScore.m_bg.url = "ui://Main/zd_jsjm_jszi_" + resultData.Star;
             _ui.m_selfScore.m_bg.url = "ui://Main/zd_jsjm_jszi_" + resultData.Star;
             TextFormat tf = _ui.m_selfScore.m_txtScore.textFormat;
             TextFormat tf = _ui.m_selfScore.m_txtScore.textFormat;
             UpdateToCheckGuide(null);
             UpdateToCheckGuide(null);
-            if (!result)
+            if (!_resultData.Result)
             {
             {
                 tf.font = "ui://Main/Font3";
                 tf.font = "ui://Main/Font3";
                 _ui.m_expBar.m_txtLvlAdded.text = "0";
                 _ui.m_expBar.m_txtLvlAdded.text = "0";
@@ -118,22 +109,14 @@ namespace GFGGame
                 GameObject.Destroy(_sceneObject);
                 GameObject.Destroy(_sceneObject);
                 _sceneObject = null;
                 _sceneObject = null;
             }
             }
-            _currentBonusList = null;
         }
         }
 
 
         private void OnClickBtnClose()
         private void OnClickBtnClose()
         {
         {
             this.Hide();
             this.Hide();
-            if (_fistPassLastLvl)
-            {
-                ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW);
-            }
-            else
-            {
-                ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
-            }
+            StoryController.OnFinishStoryLevel(StoryDataManager.currentLevelCfgId, _resultData.FirstPass);
             //尝试显示奖励
             //尝试显示奖励
-            BonusController.TryShowBonusList(_currentBonusList);
+            BonusController.TryShowBonusList(_resultData.BonusList);
             StoryDataManager.currentCardId = -1;
             StoryDataManager.currentCardId = -1;
         }
         }
 
 
@@ -152,9 +135,9 @@ namespace GFGGame
         protected override void UpdateToCheckGuide(object param)
         protected override void UpdateToCheckGuide(object param)
         {
         {
             if (!ViewManager.CheckIsTopView(this.viewCom)) return;
             if (!ViewManager.CheckIsTopView(this.viewCom)) return;
-            if (!result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_FAILED, 1, "不要气馁呀,可以通过再次挑战已通关的关卡、摘星、绣坊等途径获取更多的物资来提升自己的战斗力哦!", false, 0, true, false, (int)(this.viewCom.height - 150));
-            if (result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_SINGLE_WIN, 1, "这条连衣裙可真好看!点击空白区域继续", false, 0, true, false, (int)(this.viewCom.height - 150));
-            if (result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_TARGET_WIN, 1, "你太厉害了,初次对战就获得了这么好的战绩,继续加油吧", false, 0, true, false, (int)(this.viewCom.height - 350));
+            if (!_resultData.Result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_FAILED, 1, "不要气馁呀,可以通过再次挑战已通关的关卡、摘星、绣坊等途径获取更多的物资来提升自己的战斗力哦!", false, 0, true, false, (int)(this.viewCom.height - 150));
+            if (_resultData.Result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_SINGLE_WIN, 1, "这条连衣裙可真好看!点击空白区域继续", false, 0, true, false, (int)(this.viewCom.height - 150));
+            if (_resultData.Result) GuideController.TryGuide(null, ConstGuideId.FIRST_FIGHT_TARGET_WIN, 1, "你太厉害了,初次对战就获得了这么好的战绩,继续加油吧", false, 0, true, false, (int)(this.viewCom.height - 350));
         }
         }
 
 
         protected override void TryCompleteGuide()
         protected override void TryCompleteGuide()

+ 2 - 0
GameClient/Assets/Game/Launcher/GameLauncher.cs

@@ -24,6 +24,8 @@ public class GameLauncher : MonoBehaviour
         Log.ILog = new UnityLogger();
         Log.ILog = new UnityLogger();
 
 
         Options.Instance = new Options();
         Options.Instance = new Options();
+
+        TimeInfo.Instance.TimeZone = 8;
     }
     }
 
 
     // Start is called before the first frame update
     // Start is called before the first frame update