public IEnumerable <IPanel> GetPanelsByPanelSearchKeys(PanelSearchKeys panelSearchKeys) { if (panelSearchKeys.PanelType.IsNotNull() && (panelSearchKeys.GameObjName.IsNotNullAndEmpty() || panelSearchKeys.Panel.IsNotNull())) { return(TypeIndex.Get(panelSearchKeys.PanelType) .Where(p => p.Transform.name == panelSearchKeys.GameObjName || p == panelSearchKeys.Panel)); } if (panelSearchKeys.PanelType.IsNotNull()) { return(TypeIndex.Get(panelSearchKeys.PanelType)); } if (panelSearchKeys.Panel.IsNotNull()) { return(GameObjectNameIndex.Get(panelSearchKeys.Panel.Transform.gameObject.name).Where(p => p == panelSearchKeys.Panel)); } if (panelSearchKeys.GameObjName.IsNotNullAndEmpty()) { return(GameObjectNameIndex.Get(panelSearchKeys.GameObjName)); } return(Enumerable.Empty <IPanel>()); }
public AssetData GetAssetDataByResSearchKeys(ResSearchKeys resSearchKeys) { var assetName = resSearchKeys.AssetName.ToLower(); var assetDatas = NameIndex .Get(assetName); if (resSearchKeys.OwnerBundle != null) { assetDatas = assetDatas.Where(a => a.OwnerBundleName == resSearchKeys.OwnerBundle); } if (resSearchKeys.AssetType != null) { var assetTypeCode = resSearchKeys.AssetType.ToCode(); if (assetTypeCode == 0) { } else { var newAssetDatas = assetDatas.Where(a => a.AssetObjectTypeCode == assetTypeCode); // 有可能是从旧的 AssetBundle 中加载出来的资源 if (newAssetDatas.Any()) { assetDatas = newAssetDatas; } } } return(assetDatas.FirstOrDefault()); }
public IRes GetResBySearchKeys(ResSearchKeys resSearchKeys) { var assetName = resSearchKeys.AssetName; var reses = NameIndex .Get(assetName); if (resSearchKeys.AssetType != null) { reses = reses.Where(res => res.AssetType == resSearchKeys.AssetType); } if (resSearchKeys.OwnerBundle != null) { reses = reses.Where(res => res.OwnerBundleName == resSearchKeys.OwnerBundle); } return(reses.FirstOrDefault()); }