mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-28 11:38:47 +00:00
feat: add bundle type dropdown for editor simulate pipeline
This commit is contained in:
@@ -33,7 +33,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建资源包类型下拉框
|
/// 构建资源包类型下拉框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected DropdownField _buildBundleTypeField;
|
protected PopupField<string> _buildBundleTypeField;
|
||||||
|
|
||||||
|
|
||||||
public override void CreateView(VisualElement parent)
|
public override void CreateView(VisualElement parent)
|
||||||
@@ -56,8 +56,8 @@ namespace YooAsset.Editor
|
|||||||
SetBuildVersionField(_buildVersionField);
|
SetBuildVersionField(_buildVersionField);
|
||||||
|
|
||||||
// 构建资源包类型
|
// 构建资源包类型
|
||||||
_buildBundleTypeField = Root.Q<DropdownField>("BuildBundleType");
|
var buildBundleTypeContainer = Root.Q<VisualElement>("BuildBundleType");
|
||||||
SetBuildBundleTypeField(_buildBundleTypeField);
|
_buildBundleTypeField = CreateBuildBundleTypeField(buildBundleTypeContainer);
|
||||||
|
|
||||||
// 构建按钮
|
// 构建按钮
|
||||||
var buildButton = Root.Q<Button>("Build");
|
var buildButton = Root.Q<Button>("Build");
|
||||||
@@ -104,7 +104,7 @@ namespace YooAsset.Editor
|
|||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetBuildBundleTypeField(DropdownField dropdownField)
|
private PopupField<string> CreateBuildBundleTypeField(VisualElement container)
|
||||||
{
|
{
|
||||||
var bundleTypes = Enum.GetValues(typeof(EBundleType))
|
var bundleTypes = Enum.GetValues(typeof(EBundleType))
|
||||||
.Cast<EBundleType>()
|
.Cast<EBundleType>()
|
||||||
@@ -112,10 +112,17 @@ namespace YooAsset.Editor
|
|||||||
.Select(type => type.ToString())
|
.Select(type => type.ToString())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
dropdownField.choices = bundleTypes;
|
int defaultIndex = bundleTypes.IndexOf(EBundleType.VirtualAssetBundle.ToString());
|
||||||
dropdownField.SetValueWithoutNotify(EBundleType.VirtualAssetBundle.ToString());
|
if (defaultIndex < 0)
|
||||||
dropdownField.style.width = StyleWidth;
|
defaultIndex = 0;
|
||||||
UIElementsTools.SetElementLabelMinWidth(dropdownField, LabelMinWidth);
|
|
||||||
|
var popupField = new PopupField<string>(bundleTypes, defaultIndex);
|
||||||
|
popupField.label = "Build Bundle Type";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<ui:VisualElement name="BuildContainer">
|
<ui:VisualElement name="BuildContainer">
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:DropdownField label="Build Bundle Type" name="BuildBundleType" />
|
<ui:VisualElement name="BuildBundleType" />
|
||||||
<ui:VisualElement name="ExtensionContainer" />
|
<ui:VisualElement name="ExtensionContainer" />
|
||||||
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
Reference in New Issue
Block a user