Przeglądaj źródła

添加代码注释

guodong 1 rok temu
rodzic
commit
91022d7cb2

+ 21 - 20
GameClient/Assets/Game/HotUpdate/Assets/PreloadManager.cs → GameClient/Assets/Game/HotUpdate/Assets/PreDownloadManager.cs

@@ -11,7 +11,8 @@ namespace GFGGame
         Both
     }
 
-    public class PreloadManager : SingletonMonoBase<PreloadManager>
+    //负责提供获得卡牌和衣服部件时开启后台预下载的接口
+    public class PreDownloadManager : SingletonMonoBase<PreDownloadManager>
     {
         private List<string> waitList = new List<string>();
         private ResourceDownloaderOperation downloaderOperation;
@@ -32,7 +33,7 @@ namespace GFGGame
         /// <param name="resType">可以选择预加载静态图或者动画或者全部</param>
         /// <param name="excludeType">排除一些类型,由ConstDressUpItemType定义</param>
         /// <param name="includeOptional">是否包含可选部件</param>
-        public void PreloadSuitRes(int suitId, ResType resType, int[] excludeType, bool includeOptional)
+        public void PreDownloadSuitRes(int suitId, ResType resType, int[] excludeType, bool includeOptional)
         {
             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
             if (suitCfg == null)
@@ -43,61 +44,61 @@ namespace GFGGame
             List<int> targetItemList = DressUpUtil.GetSuitItems(suitId, resType != ResType.Sprite, excludeType, includeOptional, false);
             foreach (var itemId in targetItemList)
             {
-                PreloadDressUpRes(itemId, resType);
+                PreDownloadDressUpRes(itemId, resType);
             }
             if (resType != ResType.Sprite)
             {
                 if (!string.IsNullOrEmpty(suitCfg.aniRes))
                 {
                     string assetPath = ResPathUtil.GetDressUpAnimationPath(suitCfg.aniRes);
-                    PreloadManager.Instance.TryAdd(assetPath);
+                    PreDownloadManager.Instance.TryAdd(assetPath);
                     assetPath = ResPathUtil.GetDressUpEffectPath(suitCfg.aniRes, true);
-                    PreloadManager.Instance.TryAdd(assetPath);
+                    PreDownloadManager.Instance.TryAdd(assetPath);
                 }
             }
         }
 
-        public void PreloadDressUpRes(int itemId, ResType resType = ResType.Sprite)
+        public void PreDownloadDressUpRes(int itemId, ResType resType = ResType.Sprite)
         {
             ItemCfg dressUpCfg = ItemCfgArray.Instance.GetCfg(itemId);
             string assetPath;
             if (resType != ResType.Animation)
             {
                 assetPath = ResPathUtil.GetDressUpLayerSpriteResPath(dressUpCfg, 1);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerSpriteResPath(dressUpCfg, 2);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerSpriteResPath(dressUpCfg, 3);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 1, false);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 2, false);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 3, false);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
             }
             if (resType != ResType.Sprite)
             {
                 assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 1);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 2);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 3);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 1, true);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 2, true);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
                 assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 3, true);
-                PreloadManager.Instance.TryAdd(assetPath);
+                PreDownloadManager.Instance.TryAdd(assetPath);
             }
         }
 
-        public void PreloadCardAnimationRes(int itemId)
+        public void PreDownloadCardAnimationRes(int itemId)
         {
             ItemCfg cardCfg = ItemCfgArray.Instance.GetCfg(itemId);
             string assetPath = ResPathUtil.GetCardAnimationPath(cardCfg.res);
-            PreloadManager.Instance.TryAdd(assetPath);
+            PreDownloadManager.Instance.TryAdd(assetPath);
         }
 
         private void Update()

+ 0 - 0
GameClient/Assets/Game/HotUpdate/Assets/PreloadManager.cs.meta → GameClient/Assets/Game/HotUpdate/Assets/PreDownloadManager.cs.meta


+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/CardDataManager.cs

@@ -66,7 +66,7 @@ namespace GFGGame
             _cardDicByType[cardData.mainScore][cardData.id] = cardData;
             if(GameGlobal.AfterDataInited && !fromeList)
             {
-                PreloadManager.Instance.PreloadCardAnimationRes(cardData.id);
+                PreDownloadManager.Instance.PreDownloadCardAnimationRes(cardData.id);
             }
         }
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/DressUpMenuItemDataManager.cs

@@ -82,7 +82,7 @@ namespace GFGGame
                 {
                     AddNewDressItem(value);
                     DressUpMenuSuitDataManager.CheckItemInSuit(value);
-                    PreloadManager.Instance.PreloadDressUpRes(value, ResType.Both);
+                    PreDownloadManager.Instance.PreDownloadDressUpRes(value, ResType.Both);
                 }
                 else
                 {

+ 4 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -336,6 +336,9 @@ namespace GFGGame
             }
             if (objName == BODY_ANIMATION_NAME)
             {
+                //这里有个需求是一些特殊动作需要自定义位置和角度,
+                //实现方法就是美术在动作预制体上设置这个位置,
+                //然后程序记录下这个位置,把他设置到role节点上,并把动作节点的位置重置成默认值。
                 DressUpOffsetInfo dressUpOffsetInfo = gameObj.GetComponent<DressUpOffsetInfo>();
                 if(dressUpOffsetInfo == null)
                 {
@@ -385,6 +388,7 @@ namespace GFGGame
             DressUpOffsetInfo dressUpOffsetInfo = gameObj.GetComponent<DressUpOffsetInfo>();
             if (dressUpOffsetInfo == null)
             {
+                //这里因为特效资源初始是有位移偏移的,记录下来每次设置为初始位置和角度,以防unity自身的坐标转换导致位置偏移
                 dressUpOffsetInfo = gameObj.AddComponent<DressUpOffsetInfo>();
                 dressUpOffsetInfo.OffsetPosition = gameObj.transform.localPosition;
                 dressUpOffsetInfo.Rotation = gameObj.transform.localRotation;

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/NewLimitChargeView.cs

@@ -65,7 +65,7 @@ namespace GFGGame
             _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(_activityId);
             //RefreshList();
             //由于这个需要外部参数所以在onshown里面预加载
-            PreloadManager.Instance.PreloadSuitRes(_rechargeCfgs[0].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
+            PreDownloadManager.Instance.PreDownloadSuitRes(_rechargeCfgs[0].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[0].suitId).name;
             _ui.m_packageName.text = name;
 
@@ -93,7 +93,7 @@ namespace GFGGame
             {
                 if (_rechargeCfgs[i].suitId != _rechargeCfgs[i - 1].suitId)
                 {
-                    PreloadManager.Instance.PreloadSuitRes(_rechargeCfgs[i].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
+                    PreDownloadManager.Instance.PreDownloadSuitRes(_rechargeCfgs[i].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
                 }
             }
             ItemRenderer(_curSelectIndex);

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

@@ -312,7 +312,7 @@ namespace GFGGame
             ResType resType = ResType.Sprite;
             if (suitCfg.aniRes != "")
                 resType = ResType.Animation;
-            PreloadManager.Instance.PreloadSuitRes(vipCfg.suitId, resType, new int[] { ConstDressUpItemType.BEI_JING }, true);
+            PreDownloadManager.Instance.PreDownloadSuitRes(vipCfg.suitId, resType, new int[] { ConstDressUpItemType.BEI_JING }, true);
         }
     }
 }