Browse Source

抽卡滑动切换奖池不放报错

zhaoyang 2 years ago
parent
commit
047d1557b2
1 changed files with 11 additions and 4 deletions
  1. 11 4
      GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

+ 11 - 4
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -208,7 +208,9 @@ namespace GFGGame
             string[] resArr = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.currentBoxId).resArr;
             string[] resArr = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.currentBoxId).resArr;
             _bgIndex++;
             _bgIndex++;
             if (_bgIndex >= resArr.Length) _bgIndex = 0;
             if (_bgIndex >= resArr.Length) _bgIndex = 0;
-            GComponent item = _ui.m_listBg.GetChildAt(0).asCom;
+            GObject gObject = _ui.m_listBg.GetChildAt(0);
+            if (gObject == null) return;
+            GComponent item = gObject.asCom;
             if (item.gameObjectName != "ComBox_2") return;
             if (item.gameObjectName != "ComBox_2") return;
             GLoader loaBg = item.GetChild("loaBg").asLoader;
             GLoader loaBg = item.GetChild("loaBg").asLoader;
             loaBg.url = ResPathUtil.GetBgImgPath(resArr[_bgIndex]);
             loaBg.url = ResPathUtil.GetBgImgPath(resArr[_bgIndex]);
@@ -256,7 +258,11 @@ namespace GFGGame
             long endTime = LuckyBoxDataManager.Instance.endTime;
             long endTime = LuckyBoxDataManager.Instance.endTime;
             long curTime = TimeHelper.ServerNow();
             long curTime = TimeHelper.ServerNow();
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
-            _ui.m_listBg.GetChildAt(0).asCom.GetChild("txtTime").asTextField.text = string.Format("剩余{0}{1}", num, str);
+            GObject item = _ui.m_listBg.GetChildAt(0);
+            if (item == null) return;
+            GObject textField = item.asCom.GetChild("txtTime");
+            if (textField == null) return;
+            textField.asTextField.text = string.Format("剩余{0}{1}", num, str);
             // _ui.m_listBg.GetChildAt(0).asCom.GetChild("txtTimeStr").asTextField.text = string.Format("{0}", str);
             // _ui.m_listBg.GetChildAt(0).asCom.GetChild("txtTimeStr").asTextField.text = string.Format("{0}", str);
         }
         }
         private void updateBoxEffect()
         private void updateBoxEffect()
@@ -394,8 +400,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;
-
-            GButton btnBuyTen = _ui.m_listBg.GetChildAt(0).asCom.GetChild("btnBuyTen").asButton;
+            GObject gObject = _ui.m_listBg.GetChildAt(0);
+            if (gObject == null) return;
+            GButton btnBuyTen = gObject.asCom.GetChild("btnBuyTen").asButton;
 
 
             GuideController.TryGuide(null, ConstGuideId.LUCKY_BOX, 1, "“摘星”里可以通过星辰的力量获得服饰。", -1, true, _ui.target.height - 600);
             GuideController.TryGuide(null, ConstGuideId.LUCKY_BOX, 1, "“摘星”里可以通过星辰的力量获得服饰。", -1, true, _ui.target.height - 600);
             GuideController.TryGuide(btnBuyTen, ConstGuideId.LUCKY_BOX, 2, "点击摘取十次。");
             GuideController.TryGuide(btnBuyTen, ConstGuideId.LUCKY_BOX, 2, "点击摘取十次。");