Browse Source

商城会员中心模型预加载

huangxiaoyue 1 year ago
parent
commit
057b9152b9
1 changed files with 27 additions and 1 deletions
  1. 27 1
      GameClient/Assets/Game/HotUpdate/Views/Store/StoreView.cs

+ 27 - 1
GameClient/Assets/Game/HotUpdate/Views/Store/StoreView.cs

@@ -4,6 +4,7 @@ using FairyGUI;
 using System.Collections.Generic;
 using ET;
 using UnityEngine;
+using System;
 // using System.Diagnostics;
 
 namespace GFGGame
@@ -47,8 +48,9 @@ namespace GFGGame
             _ui.m_comTab.m_c1.onChanged.Add(OnTabChange);
             _ui.m_listSubTab.itemRenderer = RenderListSubTabItem;
             _ui.m_listSubTab.onClickItem.Add(OnListSubTabClick);
-
+            PreloadStoreChargeAddUp();
         }
+
         protected override void AddEventListener()
         {
             base.AddEventListener();
@@ -245,5 +247,29 @@ namespace GFGGame
                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_MONTH_BROCADE_WEAV).asCom, RedDotDataManager.Instance.GetStoreBrocadeWeavRewardRed());
             }
         }
+
+        //会员中心模型预加载
+        private void PreloadStoreChargeAddUp()
+        {
+            int vipIndex = Math.Max(0, RoleDataManager.vipLv - 1);
+            for (int i = vipIndex; i >= 0; i--)
+            {
+                PreloadSuitModel(i);
+            }
+            for (int i = vipIndex + 1; i < VipCfgArray.Instance.dataArray.Length - 1; i++)
+            {
+                PreloadSuitModel(i);
+            }
+        }
+
+        private void PreloadSuitModel(int index)
+        {
+            VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
+            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(vipCfg.suitId);
+            ResType resType = ResType.Sprite;
+            if (suitCfg.aniRes != "")
+                resType = ResType.Animation;
+            PreloadManager.Instance.PreloadSuitRes(vipCfg.suitId, resType, new int[] { ConstDressUpItemType.BEI_JING }, true);
+        }
     }
 }