{t('hierarchy.title')}
{displaySceneName}
{!isRemoteConnected && isSceneModified && (
●
)}
{isRemoteConnected && !isProfilerMode && (
)}
{showRemoteIndicator && (
)}
setSearchQuery(e.target.value)}
/>
{!isShowingRemote && (
)}
!isShowingRemote && handleContextMenu(e, null)}>
{displayEntities.length === 0 ? (
{t('hierarchy.empty')}
{isShowingRemote
? 'No entities in remote game'
: 'Create an entity to get started'}
) : isShowingRemote ? (
{(displayEntities as RemoteEntity[]).map((entity) => (
- handleRemoteEntityClick(entity)}
>
{entity.name}
{entity.tag !== 0 && (
#{entity.tag}
)}
{entity.componentCount > 0 && (
{entity.componentCount}
)}
))}
) : (
{entities.map((entity, index) => (
- handleEntityClick(entity)}
onDragStart={(e) => handleDragStart(e, entity.id)}
onDragOver={(e) => handleDragOver(e, index)}
onDragLeave={handleDragLeave}
onDrop={(e) => handleDrop(e, index)}
onDragEnd={handleDragEnd}
onContextMenu={(e) => {
e.stopPropagation();
handleEntityClick(entity);
handleContextMenu(e, entity.id);
}}
>
{entity.name || `Entity ${entity.id}`}
))}
)}
{contextMenu && !isShowingRemote && (
{ handleCreateEntity(); closeContextMenu(); }}
onCreateFromTemplate={async (template) => {
await template.create(contextMenu.entityId ?? undefined);
closeContextMenu();
}}
onDelete={() => { handleDeleteEntity(); closeContextMenu(); }}
onClose={closeContextMenu}
/>
)}
);
}
interface ContextMenuWithSubmenuProps {
x: number;
y: number;
locale: string;
entityId: number | null;
pluginTemplates: EntityCreationTemplate[];
onCreateEmpty: () => void;
onCreateFromTemplate: (template: EntityCreationTemplate) => void;
onDelete: () => void;
onClose: () => void;
}
function ContextMenuWithSubmenu({
x, y, locale, entityId, pluginTemplates,
onCreateEmpty, onCreateFromTemplate, onDelete
}: ContextMenuWithSubmenuProps) {
const [activeSubmenu, setActiveSubmenu] = useState