refactor(editor): isolate engine service boundaries
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Panels/EditorPanelIds.h"
|
||||
#include "Console/ConsolePanel.h"
|
||||
#include "Game/GameViewportFeature.h"
|
||||
#include "Hierarchy/HierarchyPanel.h"
|
||||
#include "Inspector/InspectorPanel.h"
|
||||
#include "Project/ProjectPanel.h"
|
||||
@@ -19,6 +20,7 @@ namespace XCEngine::UI::Editor::App {
|
||||
namespace {
|
||||
|
||||
constexpr int kSceneUpdatePriority = 0;
|
||||
constexpr int kGameUpdatePriority = 5;
|
||||
constexpr int kHierarchyUpdatePriority = 10;
|
||||
constexpr int kProjectUpdatePriority = 20;
|
||||
constexpr int kInspectorUpdatePriority = 30;
|
||||
@@ -450,11 +452,60 @@ private:
|
||||
SceneEditCommandRoute m_commandRoute = {};
|
||||
};
|
||||
|
||||
class GameWorkspacePanel final : public EditorWorkspacePanel {
|
||||
public:
|
||||
std::string_view GetPanelId() const override {
|
||||
return kGamePanelId;
|
||||
}
|
||||
|
||||
std::string_view GetDrawListId() const override {
|
||||
return "XCEditorPanel.GameOverlay";
|
||||
}
|
||||
|
||||
EditorActionRoute GetActionRoute() const override {
|
||||
return EditorActionRoute::Game;
|
||||
}
|
||||
|
||||
int GetUpdatePriority() const override {
|
||||
return kGameUpdatePriority;
|
||||
}
|
||||
|
||||
void Shutdown(const EditorWorkspacePanelShutdownContext& context) override {
|
||||
(void)context;
|
||||
m_feature.Shutdown();
|
||||
}
|
||||
|
||||
void ResetInteractionState() override {
|
||||
m_feature.ResetInteractionState();
|
||||
}
|
||||
|
||||
void PrepareForShellDefinition(
|
||||
EditorPanelServices& services,
|
||||
UIEditorWorkspaceController&) override {
|
||||
m_feature.SetCommandFocusService(&services.commandFocusService);
|
||||
}
|
||||
|
||||
void Update(const EditorWorkspacePanelUpdateContext& context) override {
|
||||
m_feature.Update(
|
||||
context.shellInteractionState.workspaceInteractionState.composeState,
|
||||
context.shellFrame.workspaceInteractionFrame.composeFrame);
|
||||
}
|
||||
|
||||
void Append(::XCEngine::UI::UIDrawList& drawList) const override {
|
||||
m_feature.Append(drawList);
|
||||
}
|
||||
|
||||
private:
|
||||
GameViewportFeature m_feature = {};
|
||||
};
|
||||
|
||||
std::unique_ptr<EditorWorkspacePanel> CreateWorkspacePanelRuntime(
|
||||
const EditorProductPanelDescriptor& panel) {
|
||||
switch (panel.runtimeKind) {
|
||||
case EditorProductPanelRuntimeKind::Console:
|
||||
return std::make_unique<ConsoleWorkspacePanel>();
|
||||
case EditorProductPanelRuntimeKind::Game:
|
||||
return std::make_unique<GameWorkspacePanel>();
|
||||
case EditorProductPanelRuntimeKind::Hierarchy:
|
||||
return std::make_unique<HierarchyWorkspacePanel>();
|
||||
case EditorProductPanelRuntimeKind::Inspector:
|
||||
|
||||
Reference in New Issue
Block a user