Files
XCEngine/ui_editor/src/Managers/SelectionManager.h
ssdfasd a40544344b 重构ui_editor:向引擎核心类型对齐
- 删除UI::Event,使用XCEngine::Core::Event替代
- GameObject.h重构,Component添加friend class Entity
- LogEntry使用XCEngine::Debug::LogLevel
- SceneManager/SelectionManager使用XCEngine::Core::Event
- LogSystem使用XCEngine::Debug::LogLevel
- CMakeLists.txt添加engine/include路径
2026-03-20 17:28:06 +08:00

40 lines
800 B
C++

#pragma once
#include "Core/GameObject.h"
#include <unordered_set>
#include <XCEngine/Core/Event.h>
namespace UI {
class SelectionManager {
public:
static SelectionManager& Get() {
static SelectionManager instance;
return instance;
}
EntityID GetSelectedEntity() const { return m_selectedEntity; }
void SetSelectedEntity(EntityID id) {
m_selectedEntity = id;
OnSelectionChanged.Invoke(id);
}
void ClearSelection() {
SetSelectedEntity(INVALID_ENTITY_ID);
}
bool IsSelected(EntityID id) const {
return m_selectedEntity == id;
}
XCEngine::Core::Event<EntityID> OnSelectionChanged;
private:
SelectionManager() = default;
EntityID m_selectedEntity = INVALID_ENTITY_ID;
};
}