zhaoyang 2 gadi atpakaļ
vecāks
revīzija
1efd53b718

+ 0 - 0
FGUIProject/assets/LuckyBox/combox/ComBox_1.xml → FGUIProject/assets/LuckyBox/combox/ComBox.xml


+ 1 - 1
FGUIProject/assets/LuckyBox/package.xml

@@ -36,7 +36,7 @@
     <movieclip id="hibu2m" name="MovieClip3.jta" path="/effect/" atlas="alone_npot"/>
     <component id="njmn2n" name="ComBox_2.xml" path="/combox/" exported="true"/>
     <component id="njmn2o" name="ComBox_3.xml" path="/combox/" exported="true"/>
-    <component id="njmn2p" name="ComBox_1.xml" path="/combox/" exported="true"/>
+    <component id="njmn2p" name="ComBox.xml" path="/combox/" exported="true"/>
     <component id="wono2q" name="LuckyBoxUI.xml" path="/" exported="true"/>
     <image id="v95q2r" name="hd_kkbt_1.png" path="/images/"/>
     <image id="v95q2t" name="cj_glglgl.png" path="/images/"/>

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -8,9 +8,9 @@ namespace GFGGame
     public class LuckyBoxDataManager : SingletonBase<LuckyBoxDataManager>
     {
 
-        public const int BOX_ID_1 = 1;
-        public const int BOX_ID_2 = 2;
-        public const int BOX_ID_3 = 3;
+        // public const int BOX_ID_1 = 1;
+        public const int BOX_ID_2 = 2;//常驻奖池2
+        public const int BOX_ID_3 = 3;//常驻奖池2
 
         public const int ONCE_TIME = 1;
         public const int TEN_TIME = 10;
@@ -19,7 +19,7 @@ namespace GFGGame
         private Dictionary<int, ItemData> _firstRewardsList = new Dictionary<int, ItemData>();//首次获得的奖励
         private Dictionary<int, List<LuckyBoxBonusData>> _dicShowList = new Dictionary<int, List<LuckyBoxBonusData>>();
 
-        public int[] luckyBoxIds = new int[] { 1, 2, 3 };//奖池列表
+        public List<int> luckyBoxIds = new List<int>();//奖池列表
         public long startTime = 1668873600000;
         public long endTime = 1672156799000;
 

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxStarView.cs

@@ -94,7 +94,8 @@ namespace GFGGame
             _ui.m_effEnd.visible = false;
             _rewardList = LuckyBoxDataManager.Instance.RewardList;
             _ui.m_ctrlBuyType.selectedIndex = _rewardList != null && _rewardList.Count > 1 ? 1 : 0;
-            _ui.m_ctrlRewardsType.selectedIndex = LuckyBoxDataManager.Instance.currentBoxId - 1; Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
+            _ui.m_ctrlRewardsType.selectedIndex = LuckyBoxDataManager.Instance.currentBoxId - 1;
+            //Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
             _ui.m_bg.url = ResPathUtil.GetBgImgPath("cj_tp_" + LuckyBoxDataManager.Instance.currentBoxId);
 
             ResetStartView();

+ 61 - 33
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -31,6 +31,7 @@ namespace GFGGame
         private DressUpObjUI _dressUpObjUIChangXi;
 
         private bool isActiveBoxOpen = false;
+        private int _activeBoxId = 0;
         private int _bgIndex = 0;
         private int _curIndex = 0;
 
@@ -100,6 +101,10 @@ namespace GFGGame
         {
             base.OnShown();
 
+            LuckyBoxDataManager.Instance.luckyBoxIds.Clear();
+            LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_2);
+            LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_3);
+
             int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
             if (this.viewData != null)
             {
@@ -113,22 +118,26 @@ namespace GFGGame
                     boxId = (int)this.viewData;
                 }
             }
+
             if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2;
             LuckyBoxDataManager.Instance.currentBoxId = boxId;
 
+            _activeBoxId = 0;
             int result = await LuckyBoxSProxy.ReqGetLuckyBoxRotatingInfo();
-
-            isActiveBoxOpen = result > 0;
-            if (isActiveBoxOpen)
+            if (result > 0)
             {
+                RotatingLuckyBoxCfg rotatingLuckyBox = RotatingLuckyBoxCfgArray.Instance.GetCfg(result);
+                _activeBoxId = rotatingLuckyBox.luckyBoxId;
+                LuckyBoxDataManager.Instance.endTime = TimeUtil.GetTimestamp(rotatingLuckyBox.endTime);
+                LuckyBoxDataManager.Instance.luckyBoxIds.Insert(0, _activeBoxId);
                 Timers.inst.Add(1, 0, CheckTime);
             }
 
             _valueBarController.OnShown();
             _valueBarController.Controller(4);
 
-            _curIndex = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, boxId);
-            _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
+            _curIndex = LuckyBoxDataManager.Instance.luckyBoxIds.IndexOf(boxId);
+            _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Count;
             _ui.m_listBg.ScrollToView(_curIndex);
             _ui.m_listBg.scrollPane.decelerationRate = 0.8f;
 
@@ -139,8 +148,15 @@ namespace GFGGame
         }
         private string GetListItemResource(int index)
         {
-            int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[index];
-            return string.Format("UI://LuckyBox/ComBox_{0}", boxId);
+            if (index == 0 && _activeBoxId > 0)
+            {
+                return "UI://LuckyBox/ComBox";
+            }
+            else
+            {
+                int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[index];
+                return string.Format("UI://LuckyBox/ComBox_{0}", boxId);
+            }
         }
         private void RenderListBgItem(int index, GObject obj)
         {
@@ -151,8 +167,8 @@ namespace GFGGame
             loaBg.url = ResPathUtil.GetBgImgPath(cfg.resArr[0]);
             GButton btnPreview = (obj as GComponent).GetChild("btnPreview").asButton;
             btnPreview.GetController("c1").selectedIndex = boxId;
-            GButton btnExchange = (obj as GComponent).GetChild("btnExchange").asButton;
-            btnExchange.GetController("c1").selectedIndex = boxId;
+            // GButton btnExchange = (obj as GComponent).GetChild("btnExchange").asButton;
+            // btnExchange.GetController("c1").selectedIndex = boxId;
             GTextField txtOwned = (obj as GComponent).GetChild("txtOwned").asTextField;
             LuckyBoxDataManager.Instance.GetOwnedCount(boxId, out int count, out int totalCount);
             txtOwned.SetVar("v1", "" + count).FlushVars();
@@ -184,11 +200,11 @@ namespace GFGGame
             }
             btnBuyTen.data = boxId;
 
-            if (btnExchange.data == null)
-            {
-                btnExchange.onClick.Add(OnClickBtnExChange);
-            }
-            btnExchange.data = boxId;
+            // if (btnExchange.data == null)
+            // {
+            //     btnExchange.onClick.Add(OnClickBtnExChange);
+            // }
+            // btnExchange.data = boxId;
             if (btnPreview.data == null)
             {
                 btnPreview.onClick.Add(OnClickBtnPreview);
@@ -197,24 +213,36 @@ namespace GFGGame
 
             obj.data = boxId;
 
-            if (boxId == 1)
+            if (boxId == _activeBoxId)
             {
                 long endTime = LuckyBoxDataManager.Instance.endTime;
                 long curTime = TimeHelper.ServerNow();
                 TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
                 (obj as GComponent).GetChild("txtTime").asTextField.text = string.Format("剩余{0}{1}", num, str);
+
                 GGraph holder = (obj as GComponent).GetChild("holder").asGraph;
-                GGraph holder1 = (obj as GComponent).GetChild("holder1").asGraph;
+                holder.visible = false;
+                if (cfg.suitShowArr.Length > 0)
+                {
+                    //羲和
+                    holder.SetXY(cfg.suitShowArr[0][1], cfg.suitShowArr[0][2]);
+                    _dressUpObjUIXiHe.ResetSceneObj(100, false, false, null, false);
+                    _dressUpObjUIXiHe.dressUpObj.PutOnSuitCfg(cfg.suitShowArr[0][0], true, null, false, false);
+                    _dressUpObjUIXiHe.UpdateWrapper(holder);
+                }
 
-                //羲和
-                _dressUpObjUIXiHe.ResetSceneObj(100, false, false, null, false);
-                _dressUpObjUIXiHe.dressUpObj.PutOnSuitCfg(201013, true, null, false, false);
-                _dressUpObjUIXiHe.UpdateWrapper(holder);
 
-                //常曦
-                _dressUpObjUIChangXi.ResetSceneObj(100, false, false, null, false);
-                _dressUpObjUIChangXi.dressUpObj.PutOnSuitCfg(201006, true, null, false, false);
-                _dressUpObjUIChangXi.UpdateWrapper(holder1);
+                GGraph holder1 = (obj as GComponent).GetChild("holder1").asGraph;
+                holder1.visible = false;
+                if (cfg.suitShowArr.Length > 1)
+                {
+                    //羲和
+                    holder.SetXY(cfg.suitShowArr[1][1], cfg.suitShowArr[1][2]);
+                    //常曦
+                    _dressUpObjUIChangXi.ResetSceneObj(100, false, false, null, false);
+                    _dressUpObjUIChangXi.dressUpObj.PutOnSuitCfg(cfg.suitShowArr[1][0], true, null, false, false);
+                    _dressUpObjUIChangXi.UpdateWrapper(holder1);
+                }
             }
         }
 
@@ -262,7 +290,7 @@ namespace GFGGame
 
         private void CheckTime(object param = null)
         {
-            if (LuckyBoxDataManager.Instance.currentBoxId != LuckyBoxDataManager.BOX_ID_1) return;
+            if (LuckyBoxDataManager.Instance.currentBoxId != _activeBoxId) return;
             long endTime = LuckyBoxDataManager.Instance.endTime;
             long curTime = TimeHelper.ServerNow();
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
@@ -291,14 +319,14 @@ namespace GFGGame
 
             }
         }
-        private void OnClickBtnExChange(EventContext context)
-        {
-            GObject obj = context.sender as GObject;
-            int boxId = (int)obj.data;
-            int storeId = boxId == LuckyBoxDataManager.BOX_ID_1 ? ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID : ConstStoreId.LUCKY_BOX_STORE_ID;
-            ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { storeId }, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
-            this.Hide();
-        }
+        // private void OnClickBtnExChange(EventContext context)
+        // {
+        //     GObject obj = context.sender as GObject;
+        //     int boxId = (int)obj.data;
+        //     int storeId = boxId == LuckyBoxDataManager.BOX_ID_1 ? ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID : ConstStoreId.LUCKY_BOX_STORE_ID;
+        //     ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { storeId }, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
+        //     this.Hide();
+        // }
         private void OnClickBtnPreview(EventContext context)
         {
             GObject obj = context.sender as GObject;