private ICommonResourceComponent GetComponent(AssetRequestSource assetRequestSource) { var entity = GetEntity(assetRequestSource.EntityKey); if (entity != null && entity.HasComponent(assetRequestSource.ComponentId)) { return(entity.GetComponent(assetRequestSource.ComponentId) as ICommonResourceComponent); } return(null); }
private void OnLoadSucc(AssetRequestSource assetRequestSource, UnityObject u) { var obj = u.AsGameObject; var isSourceExist = false; var comp = GetComponent(assetRequestSource); var entity = GetEntity(assetRequestSource.EntityKey); if (comp != null) { var assetStatus = comp.Resources[assetRequestSource.ResIndex]; if (assetStatus.LastRequestTime == assetRequestSource.TimeLine) { isSourceExist = true; var actions = GetActions(assetRequestSource.ResIndex); if (obj == null) { actions.OnLoadFailed(entity, assetStatus); assetStatus.Status = EAssetLoadStatus.Failed; } else { assetStatus.Object = u; if (actions.CanInit(entity, assetStatus)) { actions.Init(entity, assetStatus); assetStatus.Status = EAssetLoadStatus.Loaded; } else { assetStatus.Status = EAssetLoadStatus.UnInit; } } } } if (!isSourceExist) { _loadRequestManager.Recycle(u); } }