private string GetAddress(AssetBundleCollectorGroup group, string assetPath) { if (CollectorType != ECollectorType.MainAssetCollector) { return(string.Empty); } IAddressRule addressRuleInstance = AssetBundleCollectorSettingData.GetAddressRuleInstance(AddressRuleName); string adressValue = addressRuleInstance.GetAssetAddress(new AddressRuleData(assetPath, CollectPath, group.GroupName)); return(adressValue); }
private void RefreshFoldout(Foldout foldout, AssetBundleCollectorGroup group, AssetBundleCollector collector) { // 清空旧元素 foldout.Clear(); if (collector.IsValid() == false) { Debug.LogWarning($"The collector is invalid : {collector.CollectPath} in group : {group.GroupName}"); return; } if (collector.CollectorType == ECollectorType.MainAssetCollector || collector.CollectorType == ECollectorType.StaticAssetCollector) { List <CollectAssetInfo> collectAssetInfos = null; try { collectAssetInfos = collector.GetAllCollectAssets(group); } catch (System.Exception e) { Debug.LogError(e.ToString()); } if (collectAssetInfos != null) { foreach (var collectAssetInfo in collectAssetInfos) { VisualElement elementRow = new VisualElement(); elementRow.style.flexDirection = FlexDirection.Row; foldout.Add(elementRow); string showInfo = collectAssetInfo.AssetPath; if (_enableAddressableToogle.value) { IAddressRule instance = AssetBundleCollectorSettingData.GetAddressRuleInstance(collector.AddressRuleName); AddressRuleData ruleData = new AddressRuleData(collectAssetInfo.AssetPath, collector.CollectPath, group.GroupName); string addressValue = instance.GetAssetAddress(ruleData); showInfo = $"[{addressValue}] {showInfo}"; } var label = new Label(); label.text = showInfo; label.style.width = 300; label.style.marginLeft = 0; label.style.flexGrow = 1; elementRow.Add(label); } } } }