Game.UI.Editor.EditorAssetUploadPanel
Assembly: Assembly-CSharp.dll
Namespace: Game.UI.Editor
Type: class
Base: EditorPanelSystemBase
Summary:
Panel system wrapper that bridges the editor UI panel for uploading assets to the underlying AssetUploadPanelUISystem. Manages lifecycle (create/start/stop) and forwards Show/Close operations. Subscribes to the child-widget change event from the UI system to keep the panel's children list in sync. Methods decorated with [Preserve] to avoid stripping.
Fields
private AssetUploadPanelUISystem m_AssetUploadPanelSystem
Field holding the UI system responsible for the actual asset upload UI. This system is retrieved from the ECS world in OnCreate and is enabled/disabled during the panel's runtime. Used to forward Show and Close operations and to receive child-widget change notifications.
Properties
- (none)
This class does not expose public properties. It uses base class members (such as title and children) and the internal m_AssetUploadPanelSystem to interact with the UI.
Constructors
public EditorAssetUploadPanel()
Default constructor. Present and marked so the type can be constructed by the framework; no custom initialization beyond base constructor is performed here (actual initialization occurs in OnCreate).
Methods
-
protected override void OnCreate()
Initializes the panel system. Retrieves or creates the AssetUploadPanelUISystem from the world, disables it initially, and sets the panel title to "Menu.ASSET_UPLOAD". Marked with [Preserve] to prevent stripping. -
protected override void OnStartRunning()
Called when the panel starts running. Subscribes to the AssetUploadPanelUISystem.onChildrenChange event to keep the panel's children in sync, enables the m_AssetUploadPanelSystem, and assigns this panel's children reference to the system's children collection. -
protected override void OnStopRunning()
Called when the panel stops running. Disables the m_AssetUploadPanelSystem and unsubscribes from the onChildrenChange event to avoid dangling handlers. -
private void OnChildrenChange(IList<IWidget> _children)
Event handler invoked when the AssetUploadPanelUISystem's children change. Updates this panel's children reference to the provided list. -
public void Show(AssetData mainAsset, bool allowManualFileCopy = true)
Shows the asset upload UI for the specified main asset. The allowManualFileCopy parameter controls whether manual file copy is allowed; forwarded directly to the underlying AssetUploadPanelUISystem.Show method. -
protected override bool OnClose()
Requests the underlying AssetUploadPanelUISystem to close the upload UI and returns the result. This is the panel's close hook and is used by the base panel framework.
Usage Example
[Preserve]
protected override void OnCreate()
{
base.OnCreate();
// Retrieve (or create) the underlying UI system that implements the upload panel.
m_AssetUploadPanelSystem = base.World.GetOrCreateSystemManaged<AssetUploadPanelUISystem>();
// Start disabled; it will be enabled when the panel starts running.
m_AssetUploadPanelSystem.Enabled = false;
// Set the localized title key for the panel.
title = "Menu.ASSET_UPLOAD";
}
// Later, to show the upload UI for an asset:
AssetData someAsset = /* obtain asset data */;
bool allowManualCopy = true;
editorAssetUploadPanel.Show(someAsset, allowManualCopy);
// Closing is handled via the panel lifecycle; calling Close triggers OnClose which forwards to the UI system.