zhaoyang 2 years ago
parent
commit
283265dfa2

+ 22 - 22
GameClient/Assets/Game/HotUpdate/Views/Common/Controller/LuckyBoxController.cs

@@ -48,39 +48,39 @@ namespace GFGGame
             if (_luckyBoxCfg.resArr.Length > 1 || _luckyBoxCfg.suitShowArr.Length > 1)
             {
                 Timers.inst.Remove(UpdateTime);
-                Timers.inst.Add(1, 0, UpdateTime);
+                Timers.inst.Add(_turnTime, 0, UpdateTime);
             }
         }
 
         private void UpdateTime(object param)
         {
-            _curTime = _curTime - 1 == 0 ? _turnTime : _curTime - 1;
+            // _curTime = _curTime - 1 == 0 ? _turnTime : _curTime - 1;
 
-            if (_curTime == _turnTime)
+            // if (_curTime == _turnTime)
+            // {
+            _bgIndex = _bgIndex + 1 == _luckyBoxCfg.resArr.Length ? 0 : _bgIndex + 1;
+            _modelIndex = _modelIndex + 1 == _luckyBoxCfg.suitShowArr.Length ? 0 : _modelIndex + 1;
+            if (_luckyBoxCfg.resArr.Length > 1)
             {
-                _bgIndex = _bgIndex + 1 == _luckyBoxCfg.resArr.Length ? 0 : _bgIndex + 1;
-                _modelIndex = _modelIndex + 1 == _luckyBoxCfg.suitShowArr.Length ? 0 : _modelIndex + 1;
-                if (_luckyBoxCfg.resArr.Length > 1)
-                {
-                    _comModel.m_loaBg.url = ResPathUtil.GetBgImgPath(_luckyBoxCfg.resArr[_bgIndex]);
+                _comModel.m_loaBg.url = ResPathUtil.GetBgImgPath(_luckyBoxCfg.resArr[_bgIndex]);
 
-                }
-                if (_luckyBoxCfg.suitShowArr.Length > 0)
+            }
+            if (_luckyBoxCfg.suitShowArr.Length > 0)
+            {
+                int scale = 100;
+                int direction = 1;
+                if (_luckyBoxCfg.scaleArr.Length > 0)
                 {
-                    int scale = 100;
-                    int direction = 1;
-                    if (_luckyBoxCfg.scaleArr.Length > 0)
-                    {
-                        scale = Math.Abs(_luckyBoxCfg.scaleArr[_modelIndex]);
-                        direction = _luckyBoxCfg.scaleArr[_modelIndex] >= 0 ? 1 : -1;
-                    }
-                    _dressUpObjUI.ResetSceneObj(scale, false, false, null, false);
-                    _dressUpObjUI.dressUpObj.PutOnSuitCfg(_luckyBoxCfg.suitShowArr[_modelIndex][0], true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
-                    _dressUpObjUI.UpdateWrapper(_comModel.m_holder);
-                    _dressUpObjUI.sceneObject.transform.localPosition = new Vector3(_luckyBoxCfg.suitShowArr[_modelIndex][1], _luckyBoxCfg.suitShowArr[_modelIndex][2], 0);
-                    _dressUpObjUI.sceneObject.transform.localScale = new Vector3(direction * scale, scale, scale);
+                    scale = Math.Abs(_luckyBoxCfg.scaleArr[_modelIndex]);
+                    direction = _luckyBoxCfg.scaleArr[_modelIndex] >= 0 ? 1 : -1;
                 }
+                _dressUpObjUI.ResetSceneObj(scale, false, false, null, false);
+                _dressUpObjUI.dressUpObj.PutOnSuitCfg(_luckyBoxCfg.suitShowArr[_modelIndex][0], true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
+                _dressUpObjUI.UpdateWrapper(_comModel.m_holder);
+                _dressUpObjUI.sceneObject.transform.localPosition = new Vector3(_luckyBoxCfg.suitShowArr[_modelIndex][1], _luckyBoxCfg.suitShowArr[_modelIndex][2], 0);
+                _dressUpObjUI.sceneObject.transform.localScale = new Vector3(direction * scale, scale, scale);
             }
+            // }
         }
 
         public void OnHide()

+ 5 - 14
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -123,15 +123,7 @@ namespace GFGGame
             int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
             if (this.viewData != null)
             {
-                // object[] datas = (this.viewData as object[]);
-                // if (datas != null && datas.Length > 1)
-                // {
-                //     boxId = (int)datas[1];
-                // }
-                // else
-                // {
                 boxId = (int)this.viewData;
-                // }
             }
 
             if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2;
@@ -149,7 +141,7 @@ namespace GFGGame
 
             OnListBgScroll();
             updateBoxEffect();
-            // Timers.inst.Add(8, 0, UpdateBg);
+
             Timers.inst.AddUpdate(CheckGuide);
         }
         private string GetListItemResource(int index)
@@ -175,12 +167,11 @@ namespace GFGGame
             if (!_lcukyBoxCtrl.ContainsKey(boxId))
             {
                 _lcukyBoxCtrl.Add(boxId, new LuckyBoxController(comBox.m_comModel.target));
-                // if (_ui.m_listBg.ChildIndexToItemIndex(0) == index)
-                // {
-                //     _lcukyBoxCtrl[index].OnShown(boxId);
-                // }
+                if (_ui.m_listBg.ChildIndexToItemIndex(0) == index)
+                {
+                    _lcukyBoxCtrl[boxId].OnShown(boxId);
+                }
             }
-            if (_lcukyBoxCtrl.ContainsKey(boxId)) _lcukyBoxCtrl[boxId].OnShown(boxId);
             comBox.m_btnPreview.m_c1.selectedIndex = boxId;
             LuckyBoxDataManager.Instance.GetOwnedCount(boxId, out int count, out int totalCount);
             comBox.m_txtOwned.SetVar("v1", "" + count).FlushVars();