|
@@ -4,6 +4,13 @@ using YooAsset;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
+ public enum ResType
|
|
|
+ {
|
|
|
+ Sprite,
|
|
|
+ Animation,
|
|
|
+ Both
|
|
|
+ }
|
|
|
+
|
|
|
public class PreloadManager : SingletonMonoBase<PreloadManager>
|
|
|
{
|
|
|
private List<string> waitList = new List<string>();
|
|
@@ -18,6 +25,68 @@ namespace GFGGame
|
|
|
LogUtil.LogEditor($"PreloadManager TryAdd {location}");
|
|
|
}
|
|
|
|
|
|
+ public void AddSuit(int suitId, ResType resType, int[] excludeType, bool includeOptional)
|
|
|
+ {
|
|
|
+ SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
|
|
|
+ if (suitCfg == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //找到要穿的散件
|
|
|
+ List<int> targetItemList = DressUpUtil.GetSuitItems(suitId, resType != ResType.Sprite, excludeType, includeOptional, false);
|
|
|
+ foreach (var itemId in targetItemList)
|
|
|
+ {
|
|
|
+ PreloadDressUpRes(itemId, resType);
|
|
|
+ }
|
|
|
+ if (resType != ResType.Sprite)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(suitCfg.aniRes))
|
|
|
+ {
|
|
|
+ string assetPath = ResPathUtil.GetDressUpAnimationPath(suitCfg.aniRes);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpEffectPath(suitCfg.aniRes);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void PreloadDressUpRes(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);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerSpriteResPath(dressUpCfg, 2);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerSpriteResPath(dressUpCfg, 3);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ }
|
|
|
+ if (resType != ResType.Sprite)
|
|
|
+ {
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 1);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 2);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerAnimationResPath(dressUpCfg, 3);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 1);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 2);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ assetPath = ResPathUtil.GetDressUpLayerEffectResPath(dressUpCfg, 3);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void PreloadCardAnimationRes(int itemId)
|
|
|
+ {
|
|
|
+ ItemCfg cardCfg = ItemCfgArray.Instance.GetCfg(itemId);
|
|
|
+ string assetPath = ResPathUtil.GetCardAnimationPath(cardCfg.res);
|
|
|
+ PreloadManager.Instance.TryAdd(assetPath);
|
|
|
+ }
|
|
|
+
|
|
|
private void Update()
|
|
|
{
|
|
|
if(downloaderOperation != null)
|