Browse Source

修改bug

lzx 2 weeks ago
parent
commit
6591f6478a

+ 18 - 60
Assets/Scripts/GameUI/UI/BoxPanel/BoxPanel.cs

@@ -22,41 +22,20 @@ namespace Fort23.Mono
             if (summonData.tenFreeCount < openBoxConfig.oneConsumeFreePara_1[1] &&
                 PlayerManager.Instance.serverTime >= summonData.nextTenFreeTime)
             {
-                return PlayerManager.Instance.SummonManager.Summon(configId, 10);
+                return await PlayerManager.Instance.SummonManager.Summon(configId, 10);
             }
             else
             {
-                if (openBoxConfig.CostItemID == 1007)
+                //验证道具是否足够
+                if (openBoxConfig.CostItemID != 1007 && !PlayerManager.Instance.BagController.IsEnough(
+                        openBoxConfig.CostItemID,
+                        openBoxConfig.oneConsume))
                 {
-#if UNITY_ANDROID && !UNITY_EDITOR&& Taptap
-                      if (TakuSDKManager.Instance.IsReady())
-                    {
-                        if (!await TakuSDKManager.Instance.ShowAutoAd())
-                        {
-                            return null;
-                        }
-                    }
-                    else
-                    {
-                        return null;
-                    }
-#endif
-                    return PlayerManager.Instance.SummonManager.Summon(configId, 10);
-                }
-                else
-                {
-                    //验证道具是否足够
-                    if (PlayerManager.Instance.BagController.IsEnough(openBoxConfig.CostItemID,
-                            openBoxConfig.tenConsume))
-                    {
-                        return PlayerManager.Instance.SummonManager.Summon(configId, 10);
-                    }
-                    else
-                    {
-                        ItemSourcePanel.OpenPanel(openBoxConfig.CostItemID);
-                        return null;
-                    }
+                    ItemSourcePanel.OpenPanel(openBoxConfig.CostItemID);
+                    return null;
                 }
+
+                return await PlayerManager.Instance.SummonManager.Summon(configId, 10);
             }
         }
 
@@ -68,41 +47,20 @@ namespace Fort23.Mono
             if (summonData.oneFreeCount < openBoxConfig.oneConsumeFreePara[1] &&
                 PlayerManager.Instance.serverTime >= summonData.nextOneFreeTime)
             {
-                return PlayerManager.Instance.SummonManager.Summon(configId, 1);
+                return await PlayerManager.Instance.SummonManager.Summon(configId, 1);
             }
             else
             {
-                if (openBoxConfig.CostItemID == 1007)
+                //验证道具是否足够
+                if (openBoxConfig.CostItemID != 1007 && !PlayerManager.Instance.BagController.IsEnough(
+                        openBoxConfig.CostItemID,
+                        openBoxConfig.oneConsume))
                 {
-#if UNITY_ANDROID && !UNITY_EDITOR && Taptap
-                    if (TakuSDKManager.Instance.IsReady())
-                    {
-                        if (!await TakuSDKManager.Instance.ShowAutoAd())
-                        {
-                            return null;
-                        }
-                    }
-                    else
-                    {
-                        return null;
-                    }
-#endif
-                    return PlayerManager.Instance.SummonManager.Summon(configId, 1);
-                }
-                else
-                {
-                    //验证道具是否足够
-                    if (PlayerManager.Instance.BagController.IsEnough(openBoxConfig.CostItemID,
-                            openBoxConfig.oneConsume))
-                    {
-                        return PlayerManager.Instance.SummonManager.Summon(configId, 1);
-                    }
-                    else
-                    {
-                        ItemSourcePanel.OpenPanel(openBoxConfig.CostItemID);
-                        return null;
-                    }
+                    ItemSourcePanel.OpenPanel(openBoxConfig.CostItemID);
+                    return null;
                 }
+
+                return await PlayerManager.Instance.SummonManager.Summon(configId, 1);
             }
         }
     }

+ 11 - 10
Assets/Scripts/GameUI/UI/BoxPanel/GachaPanel.cs

@@ -57,20 +57,21 @@ namespace Fort23.Mono
 
         public override void AddButtonEvent()
         {
-            tenButton.onClick.AddListener(() =>
+            tenButton.onClick.AddListener(async() =>
             {
 #if UNITY_ANDROID && !UNITY_EDITOR&& Taptap
-                     if (TakuSDKManager.Instance.IsReady())
-                    {
-                        if (!await TakuSDKManager.Instance.ShowAutoAd())
-                        {
-                            return null;
-                        }
-                    }
-                    else
+                      if (TakuSDKManager.Instance.IsReady())
+                {
+                    bool isOK = await TakuSDKManager.Instance.ShowAutoAd();
+                    if (!isOK)
                     {
-                        return null;
+                        return;
                     }
+                }
+                else
+                {
+                    return;
+                }
 #endif
 
                 tenButton.gameObject.SetActive(false);

+ 4 - 0
Assets/Scripts/GameUI/UI/ShopPanel/ShopBoxWidget.cs

@@ -111,6 +111,10 @@ namespace Fort23.Mono
             List<ItemInfo> allIitem = await BoxHelper.TenBox(openBoxConfig.ID);
             if (allIitem != null)
                 ShopGachaPanel.OpenPanel(allIitem, 2, openBoxConfig.ID);
+            else
+            {
+                LogTool.Error("失败1");
+            }
 
             UpdateUi();
         }

+ 12 - 10
Assets/Scripts/GameUI/UI/ShopPanel/ShopGachaPanel.cs

@@ -51,20 +51,22 @@ namespace Fort23.Mono
 
         public override void AddButtonEvent()
         {
-            Btn_ShuangBei.onClick.AddListener(() =>
+            Btn_ShuangBei.onClick.AddListener(async () =>
             {
 #if UNITY_ANDROID && !UNITY_EDITOR&& Taptap
-                      if (TakuSDKManager.Instance.IsReady())
-                    {
-                        if (!await TakuSDKManager.Instance.ShowAutoAd())
-                        {
-                            return null;
-                        }
-                    }
-                    else
+                if (TakuSDKManager.Instance.IsReady())
+                {
+                    bool isOK = await TakuSDKManager.Instance.ShowAutoAd();
+                    if (!isOK)
                     {
-                        return null;
+                        return;
                     }
+                }
+                else
+                {
+                    return;
+                }
+
 #endif
                 float beLv =
                     Utility.UtilTools.GetRandomByWeight(_openBoxConfig.betPara1.ToList(), _openBoxConfig.betPara2);