diff --git a/SimsWorld/BehaviorEditor.cpp b/SimsWorld/BehaviorEditor.cpp index 26f74a6..35c6e98 100644 --- a/SimsWorld/BehaviorEditor.cpp +++ b/SimsWorld/BehaviorEditor.cpp @@ -477,7 +477,9 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/) _message_panel(new QTabWidget(this)), _stacked_panel(new QStackedWidget(this)), _logs_present(new QTextBrowser(this)), - _map_configuration(new BehaviorMapConfigurationPanel(this)) + _map_configuration(new BehaviorMapConfigurationPanel(this)), + _compare_configuration(new CompareNodeConfiguration(this)), + _default_configuration(new QLabel(u8"该节点无需配置", this)) { _global_loader = std::make_shared(); _global_kernal = std::make_shared(_global_loader); @@ -510,16 +512,17 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/) _type_view->setModel(_type_model); nodeTypesViewInit(_type_model); - + _default_configuration->setFrameStyle(QFrame::WinPanel|QFrame::Sunken); + _default_configuration->setAlignment(Qt::AlignCenter); // 下方堆叠面板 _message_panel->addTab(_logs_present, u8"控制台"); _message_panel->addTab(_stacked_panel, u8"属性配置"); - _stacked_panel->addWidget(new BehaviorMapConfigurationPanel(this)); + _stacked_panel->addWidget(_compare_configuration); _stacked_panel->addWidget(newModifyNodeConfigration(this)); _stacked_panel->addWidget(newActionNodeConfigration(this)); - _stacked_panel->addWidget(newCompareNodeConfigration(this)); - _stacked_panel->addWidget(newDefaultConfigration(this)); + _stacked_panel->addWidget(_map_configuration); + _stacked_panel->addWidget(_default_configuration); } void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m) @@ -539,33 +542,6 @@ void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m) #include #include -QWidget* BehaviorEditor::newDefaultConfigration(QWidget* pwidget) -{ - auto ins = new QLabel(u8"该结点无需配置", pwidget); - ins->setAlignment(Qt::AlignCenter); - ins->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - return ins; -} - -QWidget* BehaviorEditor::newCompareNodeConfigration(QWidget* pwidget) -{ - auto panel = new QFrame(this); - panel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - auto p_layout = new QGridLayout(panel); - - auto compare_types = new QComboBox(this); - p_layout->addWidget(new QLabel(u8"类型筛选:", this), 0, 0); - p_layout->addWidget(new QComboBox(this), 0, 1, 1, 5); - p_layout->addWidget(new QLabel(u8"比较器类型:"), 1, 0); - p_layout->addWidget(compare_types, 1, 1, 1, 5); - p_layout->addWidget(new QLabel(u8"输入变量A:", this), 2, 0); - p_layout->addWidget(new QComboBox(this), 2, 1, 1, 5); - p_layout->addWidget(new QLabel(u8"输入变量B:", this), 3, 0); - p_layout->addWidget(new QComboBox(this), 3, 1, 1, 5); - - p_layout->setColumnStretch(1, 1); - return panel; -} QWidget* BehaviorEditor::newActionNodeConfigration(QWidget* pwidget) { diff --git a/SimsWorld/BehaviorEditor.h b/SimsWorld/BehaviorEditor.h index 3a10176..c2cef01 100644 --- a/SimsWorld/BehaviorEditor.h +++ b/SimsWorld/BehaviorEditor.h @@ -147,8 +147,9 @@ protected: #include #include #include - +#include #include "BehaviorConfigurationPanel.h" +#include "CompareNodeConfiguration.h" /// /// 行为树节点编辑器 @@ -164,6 +165,8 @@ private: QTabWidget *const _message_panel; QStackedWidget *const _stacked_panel; BehaviorMapConfigurationPanel *const _map_configuration; + CompareNodeConfiguration *const _compare_configuration; + QLabel *const _default_configuration; std::shared_ptr _map_root; QUrl _current_fileurl; @@ -175,20 +178,14 @@ private: // ============================================== QTextBrowser* const _logs_present; - - // ============================================== - // ============================================== - QWidget* newDefaultConfigration(QWidget* pwidget); - - // ============================================== - QWidget* newCompareNodeConfigration(QWidget* pwidget); // ============================================== QWidget* newActionNodeConfigration(QWidget* pwidget); // ============================================== QWidget* newModifyNodeConfigration(QWidget* pwidget); + public: BehaviorEditor(QWidget* parent = nullptr); diff --git a/SimsWorld/CompareNodeConfiguration.cpp b/SimsWorld/CompareNodeConfiguration.cpp new file mode 100644 index 0000000..01ff149 --- /dev/null +++ b/SimsWorld/CompareNodeConfiguration.cpp @@ -0,0 +1,28 @@ +#include "CompareNodeConfiguration.h" +#include +#include + + +CompareNodeConfiguration::CompareNodeConfiguration(QWidget* p) + : QFrame(p), + _type_select(new QComboBox(this)), + _compare_select(new QComboBox(this)), + _variable_a(new QComboBox(this)), + _variable_b(new QComboBox(this)) +{ + this->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); + auto p_layout = new QGridLayout(this); + + p_layout->addWidget(new QLabel(u8"类型筛选:", this), 0, 0); + p_layout->addWidget(_type_select, 0, 1, 1, 5); + p_layout->addWidget(new QLabel(u8"比较器类型:"), 1, 0); + p_layout->addWidget(_compare_select, 1, 1, 1, 5); + p_layout->addWidget(new QLabel(u8"输入变量A:", this), 2, 0); + p_layout->addWidget(_variable_a, 2, 1, 1, 5); + p_layout->addWidget(new QLabel(u8"输入变量B:", this), 3, 0); + p_layout->addWidget(_variable_b, 3, 1, 1, 5); + p_layout->addWidget(new QWidget(this), 4, 0, 1, 6); + + p_layout->setColumnStretch(1, 1); + p_layout->setRowStretch(4, 1); +} diff --git a/SimsWorld/CompareNodeConfiguration.h b/SimsWorld/CompareNodeConfiguration.h new file mode 100644 index 0000000..6adba4b --- /dev/null +++ b/SimsWorld/CompareNodeConfiguration.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include + +class CompareNodeConfiguration : public QFrame +{ +private: + QComboBox *const _type_select; + QComboBox *const _compare_select; + QComboBox *const _variable_a; + QComboBox *const _variable_b; + +public: + CompareNodeConfiguration(QWidget *p = nullptr); + +}; + diff --git a/SimsWorld/SimsWorld.vcxproj b/SimsWorld/SimsWorld.vcxproj index c008107..75b3ccf 100644 --- a/SimsWorld/SimsWorld.vcxproj +++ b/SimsWorld/SimsWorld.vcxproj @@ -101,6 +101,7 @@ + @@ -118,6 +119,7 @@ + diff --git a/SimsWorld/SimsWorld.vcxproj.filters b/SimsWorld/SimsWorld.vcxproj.filters index 48c52b1..431c08e 100644 --- a/SimsWorld/SimsWorld.vcxproj.filters +++ b/SimsWorld/SimsWorld.vcxproj.filters @@ -58,6 +58,9 @@ Source Files + + Source Files + @@ -74,5 +77,8 @@ Header Files + + Header Files + \ No newline at end of file