Bladeren bron

自动战斗存储

zhaoyang 3 jaren geleden
bovenliggende
commit
d8ad6d54fd

+ 3 - 2
GameClient/Assets/Game/HotUpdate/Constant/ConstStorageId.cs

@@ -4,8 +4,9 @@ namespace GFGGame
     {
         public const int STORAGE_GUIDE = 10000;//引导起始Id,引导存储id:10000+引导编号id
 
-        public const int STORAGE_SKIP_GUIDE = 20000;//跳过引导,1跳过,2不跳过
-
+        public const int STORAGE_SKIP_GUIDE = 20000;//跳过引导,0不跳过,1跳过
+        public const int STORAGE_AUTO_PLAY = 20001;//自动战斗,0不自动战斗,1自动战斗
+        public const int STORAGE_AUTO_PLAY_SPEED = 20002;//战斗速度
 
     }
 }

+ 21 - 15
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -91,26 +91,29 @@ namespace GFGGame
             await StorageSProxy.ReqGetClientValues();
 
             int skipGuide = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_SKIP_GUIDE);
-            if (skipGuide > 0)
+
+            if (skipGuide < 0)
             {
-                if (skipGuide == 1) GameGlobal.skipGuide = true;
-                EnterGame();
+                Alert.Show("是否跳过引导?如果您是第一次体验,建议不要跳过引导!")
+                           .SetLeftButton(true, "不用", (obj) =>
+                           {
+                               EnterGame();
+                               StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 0).Coroutine();
+                           })
+                           .SetRightButton(true, "跳过", (obj) =>
+                           {
+                               GameGlobal.skipGuide = true;
+                               EnterGame();
+                               StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 1).Coroutine();
+                           });
             }
             else
             {
-                Alert.Show("是否跳过引导?如果您是第一次体验,建议不要跳过引导!")
-                        .SetLeftButton(true, "不用", (obj) =>
-                        {
-                            EnterGame();
-                            StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 2).Coroutine();
-                        })
-                        .SetRightButton(true, "跳过", (obj) =>
-                        {
-                            GameGlobal.skipGuide = true;
-                            EnterGame();
-                            StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 1).Coroutine();
-                        });
+                if (skipGuide == 1) GameGlobal.skipGuide = true;
+                EnterGame();
+
             }
+
         }
 
         public static void QuitToLoginView(bool logout)
@@ -185,6 +188,9 @@ namespace GFGGame
             SuitFosterProxy.SendGetSuitInfos().Coroutine();
             MainStorySProxy.GetStoryInfos().Coroutine();
 
+            EquipDataCache.cacher.autoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY) <= 0 ? false : true;
+            EquipDataCache.cacher.fightSpeed = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED) <= 1 ? 1 : StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED);
+
         }
 
         public static void PrepareUpdateTreasure()

+ 6 - 3
GameClient/Assets/Game/HotUpdate/Data/StorageDataManager.cs

@@ -22,9 +22,12 @@ namespace GFGGame
         }
         public int GetStorageValue(int key)
         {
-            int value = 0;
-            _storangeInfoById.TryGetValue(key, out value);
-            return value;
+            if (!_storangeInfoById.ContainsKey(key))
+            {
+                return -1;
+            }
+
+            return _storangeInfoById[key];
         }
     }
 }

+ 4 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjDataCache.cs

@@ -101,6 +101,8 @@ namespace GFGGame
             set
             {
                 _autoPlay = value;
+                if (!_autoPlay) fightSpeed = 1;
+                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_AUTO_PLAY, _autoPlay == true ? 1 : 0).Coroutine();
             }
         }
         public int maxFightSpeed = 8;
@@ -115,6 +117,8 @@ namespace GFGGame
             {
 
                 _fightSpeed = value;
+                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED, _fightSpeed).Coroutine();
+
             }
         }
         public void Dispose()

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

@@ -109,6 +109,7 @@ namespace GFGGame
             _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
             _ui.m_btnAutoPlay.selected = EquipDataCache.cacher.autoPlay;
             // _ui.m_btnAutoPlay.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
+
             _levelID = (int)viewData;
             _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
             _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);