Compare commits

..

No commits in common. "698cdcba61e7c9f7c2d34ab1c869de1038b74ee8" and "d55db19f0e4e94f3c9fbb3ba9e2cd3d6e01f6bcb" have entirely different histories.

5 changed files with 59 additions and 51 deletions

View File

@ -69,6 +69,7 @@ namespace YooAsset.Editor
_scannerListView = root.Q<ListView>("ScannerListView"); _scannerListView = root.Q<ListView>("ScannerListView");
_scannerListView.makeItem = MakeScannerListViewItem; _scannerListView.makeItem = MakeScannerListViewItem;
_scannerListView.bindItem = BindScannerListViewItem; _scannerListView.bindItem = BindScannerListViewItem;
#if UNITY_2022_3_OR_NEWER #if UNITY_2022_3_OR_NEWER
_scannerListView.selectionChanged += ScannerListView_onSelectionChange; _scannerListView.selectionChanged += ScannerListView_onSelectionChange;
#elif UNITY_2020_1_OR_NEWER #elif UNITY_2020_1_OR_NEWER
@ -276,23 +277,12 @@ namespace YooAsset.Editor
{ {
_scannerListView.Clear(); _scannerListView.Clear();
_scannerListView.ClearSelection(); _scannerListView.ClearSelection();
_scannerListView.itemsSource = FilterScanners();
_scannerListView.Rebuild();
var filterItems = FilterScanners(); if (_lastModifyScannerIndex >= 0 && _lastModifyScannerIndex < _scannerListView.itemsSource.Count)
if (AssetArtScannerSettingData.Setting.Scanners.Count == filterItems.Count)
{ {
#if UNITY_2020_3_OR_NEWER _scannerListView.selectedIndex = _lastModifyScannerIndex;
_scannerListView.reorderable = true;
#endif
_scannerListView.itemsSource = AssetArtScannerSettingData.Setting.Scanners;
_scannerListView.Rebuild();
}
else
{
#if UNITY_2020_3_OR_NEWER
_scannerListView.reorderable = false;
#endif
_scannerListView.itemsSource = filterItems;
_scannerListView.Rebuild();
} }
} }
private List<AssetArtScanner> FilterScanners() private List<AssetArtScanner> FilterScanners()
@ -354,7 +344,31 @@ namespace YooAsset.Editor
// 显示检视面板 // 显示检视面板
var scanSchema = selectScanner.LoadSchema(); var scanSchema = selectScanner.LoadSchema();
RefreshInspector(scanSchema); if (scanSchema != null)
{
var inspector = scanSchema.CreateInspector();
if (inspector == null)
{
UIElementsTools.SetElementVisible(_inspectorContainer, false);
}
else
{
if (inspector.Containner is VisualElement container)
{
UIElementsTools.SetElementVisible(_inspectorContainer, true);
_inspectorContainer.Clear();
_inspectorContainer.Add(container);
_inspectorContainer.style.width = inspector.Width;
_inspectorContainer.style.minWidth = inspector.MinWidth;
_inspectorContainer.style.maxWidth = inspector.MaxWidth;
}
else
{
Debug.LogWarning($"{nameof(ScannerSchema)} inspector container is invalid !");
UIElementsTools.SetElementVisible(_inspectorContainer, false);
}
}
}
// 设置Schema对象 // 设置Schema对象
if (scanSchema == null) if (scanSchema == null)
@ -507,38 +521,6 @@ namespace YooAsset.Editor
AssetArtScannerSettingData.RemoveCollector(selectSacnner, selectCollector); AssetArtScannerSettingData.RemoveCollector(selectSacnner, selectCollector);
FillCollectorViewData(); FillCollectorViewData();
} }
// 属性面板相关
private void RefreshInspector(ScannerSchema scanSchema)
{
if (scanSchema == null)
{
UIElementsTools.SetElementVisible(_inspectorContainer, false);
return;
}
var inspector = scanSchema.CreateInspector();
if (inspector == null)
{
UIElementsTools.SetElementVisible(_inspectorContainer, false);
return;
}
if (inspector.Containner is VisualElement container)
{
UIElementsTools.SetElementVisible(_inspectorContainer, true);
_inspectorContainer.Clear();
_inspectorContainer.Add(container);
_inspectorContainer.style.width = inspector.Width;
_inspectorContainer.style.minWidth = inspector.MinWidth;
_inspectorContainer.style.maxWidth = inspector.MaxWidth;
}
else
{
Debug.LogWarning($"{nameof(ScannerSchema)} inspector container is invalid !");
UIElementsTools.SetElementVisible(_inspectorContainer, false);
}
}
} }
} }
#endif #endif

View File

@ -9,7 +9,7 @@
<ui:VisualElement name="ScannerListContainer" style="width: 250px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;"> <ui:VisualElement name="ScannerListContainer" style="width: 250px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:Label text="Scanner List" display-tooltip-when-elided="true" name="ScannerListTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 3px; border-right-width: 3px; border-top-width: 3px; border-bottom-width: 3px; font-size: 12px;" /> <ui:Label text="Scanner List" display-tooltip-when-elided="true" name="ScannerListTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 3px; border-right-width: 3px; border-top-width: 3px; border-bottom-width: 3px; font-size: 12px;" />
<uie:ToolbarSearchField focusable="true" name="ScannerSearchField" style="width: 230px;" /> <uie:ToolbarSearchField focusable="true" name="ScannerSearchField" style="width: 230px;" />
<ui:ListView focusable="true" name="ScannerListView" item-height="20" virtualization-method="DynamicHeight" reorder-mode="Animated" reorderable="true" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="ScannerListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="ScannerAddContainer" style="justify-content: center; flex-direction: row; flex-shrink: 0;"> <ui:VisualElement name="ScannerAddContainer" style="justify-content: center; flex-direction: row; flex-shrink: 0;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" /> <ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" /> <ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />

View File

@ -28,7 +28,7 @@
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;"> <ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;"> <ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" /> <ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;"> <ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" /> <ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" /> <ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
@ -38,7 +38,7 @@
<ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" /> <ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" /> <ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" />
<ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" /> <ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" />
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;"> <ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" /> <ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" /> <ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />

View File

@ -268,6 +268,19 @@ internal class TiktokFileSystem : IFileSystem
} }
return filePath; return filePath;
} }
/// <summary>
/// 加载加密资源文件
/// </summary>
public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
{
WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
fileInfo.BundleName = bundle.BundleName;
fileInfo.FileLoadCRC = bundle.UnityCRC;
fileInfo.FileData = fileData;
var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
return decryptResult.Result;
}
#endregion #endregion
} }
#endif #endif

View File

@ -286,6 +286,19 @@ internal class WechatFileSystem : IFileSystem
} }
return filePath; return filePath;
} }
/// <summary>
/// 加载加密资源文件
/// </summary>
public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
{
WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
fileInfo.BundleName = bundle.BundleName;
fileInfo.FileLoadCRC = bundle.UnityCRC;
fileInfo.FileData = fileData;
var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
return decryptResult.Result;
}
#endregion #endregion
} }
#endif #endif