Browse Source

田野调查

zhaoyang 3 years ago
parent
commit
66d579321c

+ 10 - 3
GameClient/Assets/Game/HotUpdate/ServerProxy/FieldSProxy.cs

@@ -7,7 +7,7 @@ namespace GFGGame
 {
     public static class FieldSProxy
     {
-        public static async ETTask<bool> ReqFieldInstanceInfos(List<int> itemIds, List<int> itemNums)
+        public static async ETTask<bool> ReqFieldInstanceInfos()
         {
             M2C_GetFieldInstanceInfos response = null;
             response = (M2C_GetFieldInstanceInfos)await MessageHelper.SendToServer(new C2M_GetFieldInstanceInfos());
@@ -50,7 +50,14 @@ namespace GFGGame
                     fieldInfos.bonusWeekly = response.BonusWeekly;
                     for (int i = 0; i < response.kTaskIds.Count; i++)
                     {
-                        fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
+                        if (!fieldInfos.taskDic.ContainsKey(response.kTaskIds[i]))
+                        {
+                            fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
+                        }
+                        else
+                        {
+                            fieldInfos.taskDic[response.kTaskIds[i]] = response.vTaskStatus[i];
+                        }
                     }
                     return true;
                 }
@@ -60,7 +67,7 @@ namespace GFGGame
         public static async ETTask<bool> ReqFieldTaskBonus(int taskId)
         {
             M2C_GetFieldTaskBonus response = null;
-            response = (M2C_GetFieldTaskBonus)await MessageHelper.SendToServer(new GetFieldTaskBonus() { TaskId = taskId });
+            response = (M2C_GetFieldTaskBonus)await MessageHelper.SendToServer(new C2M_GetFieldTaskBonus() { TaskId = taskId });
             if (response != null)
             {
                 if (response.Error == ErrorCode.ERR_Success)

+ 3 - 1
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -120,8 +120,10 @@ namespace GFGGame
             _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
             if (_levelCfg.type == ConstInstanceZonesType.Field)
             {
-                _fightCfg.scoreType = FieldDataManager.Instance.Theme;
+                _fightCfg.scoreType = FieldDataManager.Instance.fieldInfos.theme;
             }
+
+
             if (!string.IsNullOrEmpty(_fightCfg.music))
             {
                 MusicManager.Instance.Play(ResPathUtil.GetMusicPath(_fightCfg.music, "mp3"));

+ 10 - 7
GameClient/Assets/Game/HotUpdate/Views/Field/FieldView.cs

@@ -11,6 +11,8 @@ namespace GFGGame
 
         private FieldCfg _curCfg;
         private int _curLevelId;
+
+        private FieldDataManager _dataManager;
         public override void Dispose()
         {
             base.Dispose();
@@ -34,9 +36,10 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            FieldDataManager.Instance.c_difficulty = _ui.m_c1.selectedIndex;
-            _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex);
-            _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex);
+            _dataManager = FieldDataManager.Instance;
+            _dataManager.c_difficulty = _ui.m_c1.selectedIndex;
+            _curCfg = _dataManager.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex);
+            _curLevelId = _dataManager.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex);
             FieldCfg[] cfgs = FieldCfgArray.Instance.dataArray;
             for (int i = 0; i < cfgs.Length; i++)
             {
@@ -61,14 +64,14 @@ namespace GFGGame
 
         private void OnDifficultyChange()
         {
-            FieldDataManager.Instance.c_difficulty = _ui.m_c1.selectedIndex;
-            _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex);
-            _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex);
+            _dataManager.c_difficulty = _ui.m_c1.selectedIndex;
+            _curCfg = _dataManager.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex);
+            _curLevelId = _dataManager.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex);
             UpdateView();
         }
         private void UpdateView()
         {
-            _ui.m_txtScore.text = ConstDressUpScoreType.scoreTypeList()[FieldDataManager.Instance.Theme].ToString();
+            _ui.m_txtScore.text = ConstDressUpScoreType.scoreTypeList()[_dataManager.fieldInfos.theme].ToString();
             _ui.m_txtMaxLv.text = string.Format("最高记录:{0}/{1}", 0, _curCfg.num);
             _ui.m_txtConsume.text = string.Format("x{0}", _curCfg.needPower);
         }