- 删除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路径
40 lines
800 B
C++
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;
|
|
};
|
|
|
|
}
|