diff --git a/SimsWorld/ActionNodeConfiguration.cpp b/SimsWorld/ActionNodeConfiguration.cpp new file mode 100644 index 0000000..066a483 --- /dev/null +++ b/SimsWorld/ActionNodeConfiguration.cpp @@ -0,0 +1,32 @@ +#include "ActionNodeConfiguration.h" +#include + +ActionNodeConfiguration::ActionNodeConfiguration(QWidget* p) + :QFrame(p), + _execute_select(new QComboBox(this)), + _variables_input(new QTableView(this)), + _input_model(new QStandardItemModel(this)), + _variables_output(new QTableView(this)), + _output_model(new QStandardItemModel(this)) +{ + this->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); + auto p_layout = new QGridLayout(this); + + p_layout->addWidget(new QLabel(u8"执行器类型:", this)); + p_layout->addWidget(_execute_select, 0, 1, 1, 4); + auto vars_tabw = new QTabWidget(this); + p_layout->addWidget(vars_tabw, 1, 0, 3, 5); + vars_tabw->setTabPosition(QTabWidget::West); + + vars_tabw->addTab(_variables_input, u8"输入变量"); + _variables_input->setModel(_input_model); + vars_tabw->addTab(_variables_output, u8"输出变量"); + _variables_output->setModel(_output_model); + + p_layout->setColumnStretch(1, 1); + + _input_model->setHorizontalHeaderLabels(QStringList() + << u8"变量名" << u8"变量类型" << u8"关联变量序列" << u8"关联转换器类型"); + _output_model->setHorizontalHeaderLabels(QStringList() + << u8"变量名" << u8"变量类型" << u8"关联变量序列" << u8"关联转换器类型"); +} diff --git a/SimsWorld/ActionNodeConfiguration.h b/SimsWorld/ActionNodeConfiguration.h new file mode 100644 index 0000000..9e936f5 --- /dev/null +++ b/SimsWorld/ActionNodeConfiguration.h @@ -0,0 +1,21 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +class ActionNodeConfiguration : public QFrame +{ +private: + QComboBox *const _execute_select; + QTableView* const _variables_input; + QStandardItemModel *const _input_model; + QTableView* const _variables_output; + QStandardItemModel* const _output_model; + +public: + ActionNodeConfiguration(QWidget *p = nullptr); +}; + diff --git a/SimsWorld/BehaviorEditor.cpp b/SimsWorld/BehaviorEditor.cpp index 35c6e98..5b77539 100644 --- a/SimsWorld/BehaviorEditor.cpp +++ b/SimsWorld/BehaviorEditor.cpp @@ -454,20 +454,6 @@ void BehaviorEditor::new_behavior_map() #include #include #include -QWidget* BehaviorEditor::newModifyNodeConfigration(QWidget* pwidget) -{ - auto panel = new QFrame(this); - panel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - auto p_layout = new QGridLayout(panel); - - p_layout->addWidget(new QLabel(u8"修饰类型:", this)); - p_layout->addWidget(new QComboBox(this), 0, 1, 1, 3); - p_layout->addWidget(new QWidget(this), 1, 0, 1, 4); - - p_layout->setRowStretch(1, 1); - p_layout->setColumnStretch(1, 1); - return panel; -} BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/) : QMainWindow(parent), @@ -479,7 +465,9 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/) _logs_present(new QTextBrowser(this)), _map_configuration(new BehaviorMapConfigurationPanel(this)), _compare_configuration(new CompareNodeConfiguration(this)), - _default_configuration(new QLabel(u8"该节点无需配置", this)) + _default_configuration(new QLabel(u8"该节点无需配置", this)), + _action_configuration(new ActionNodeConfiguration(this)), + _modify_configuration(new ModifyNodeConfiguration(this)) { _global_loader = std::make_shared(); _global_kernal = std::make_shared(_global_loader); @@ -518,9 +506,9 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/) // 下方堆叠面板 _message_panel->addTab(_logs_present, u8"控制台"); _message_panel->addTab(_stacked_panel, u8"属性配置"); + _stacked_panel->addWidget(_modify_configuration); + _stacked_panel->addWidget(_action_configuration); _stacked_panel->addWidget(_compare_configuration); - _stacked_panel->addWidget(newModifyNodeConfigration(this)); - _stacked_panel->addWidget(newActionNodeConfigration(this)); _stacked_panel->addWidget(_map_configuration); _stacked_panel->addWidget(_default_configuration); } @@ -542,28 +530,6 @@ void BehaviorEditor::nodeTypesViewInit(QStandardItemModel* m) #include #include - -QWidget* BehaviorEditor::newActionNodeConfigration(QWidget* pwidget) -{ - auto panel = new QFrame(this); - panel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - auto p_layout = new QGridLayout(panel); - - p_layout->addWidget(new QLabel(u8"执行器类型:", this)); - p_layout->addWidget(new QComboBox(this), 0, 1, 1, 4); - auto vars_tabw = new QTabWidget(this); - p_layout->addWidget(vars_tabw, 1, 0, 3, 5); - vars_tabw->setTabPosition(QTabWidget::West); - - vars_tabw->addTab(new QTableView(this), u8"输入变量"); - vars_tabw->addTab(new QTableView(this), u8"输出变量"); - - p_layout->setColumnStretch(1, 1); - return panel; -} - - - NodeTypesView::NodeTypesView(QWidget* parent /*= nullptr*/) : QListView(parent) { diff --git a/SimsWorld/BehaviorEditor.h b/SimsWorld/BehaviorEditor.h index c2cef01..9f3dd5e 100644 --- a/SimsWorld/BehaviorEditor.h +++ b/SimsWorld/BehaviorEditor.h @@ -150,6 +150,8 @@ protected: #include #include "BehaviorConfigurationPanel.h" #include "CompareNodeConfiguration.h" +#include "ActionNodeConfiguration.h" +#include "ModifyNodeConfiguration.h" /// /// 行为树节点编辑器 @@ -166,6 +168,8 @@ private: QStackedWidget *const _stacked_panel; BehaviorMapConfigurationPanel *const _map_configuration; CompareNodeConfiguration *const _compare_configuration; + ActionNodeConfiguration *const _action_configuration; + ModifyNodeConfiguration *const _modify_configuration; QLabel *const _default_configuration; std::shared_ptr _map_root; @@ -178,13 +182,7 @@ private: // ============================================== QTextBrowser* const _logs_present; - - - // ============================================== - QWidget* newActionNodeConfigration(QWidget* pwidget); - // ============================================== - QWidget* newModifyNodeConfigration(QWidget* pwidget); public: BehaviorEditor(QWidget* parent = nullptr); diff --git a/SimsWorld/ModifyNodeConfiguration.cpp b/SimsWorld/ModifyNodeConfiguration.cpp new file mode 100644 index 0000000..08ffc06 --- /dev/null +++ b/SimsWorld/ModifyNodeConfiguration.cpp @@ -0,0 +1,17 @@ +#include "ModifyNodeConfiguration.h" +#include + +ModifyNodeConfiguration::ModifyNodeConfiguration(QWidget* p) + : QFrame(p), + _modify_types(new QComboBox(this)) +{ + this->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); + auto p_layout = new QGridLayout(this); + + p_layout->addWidget(new QLabel(u8"修饰类型:", this)); + p_layout->addWidget(_modify_types, 0, 1, 1, 3); + p_layout->addWidget(new QWidget(this), 1, 0, 1, 4); + + p_layout->setRowStretch(1, 1); + p_layout->setColumnStretch(1, 1); +} diff --git a/SimsWorld/ModifyNodeConfiguration.h b/SimsWorld/ModifyNodeConfiguration.h new file mode 100644 index 0000000..3964a40 --- /dev/null +++ b/SimsWorld/ModifyNodeConfiguration.h @@ -0,0 +1,14 @@ +#pragma once +#include +#include +#include + +class ModifyNodeConfiguration : public QFrame +{ +private: + QComboBox *const _modify_types; + +public: + ModifyNodeConfiguration(QWidget *p = nullptr); +}; + diff --git a/SimsWorld/SimsWorld.vcxproj b/SimsWorld/SimsWorld.vcxproj index 75b3ccf..3055397 100644 --- a/SimsWorld/SimsWorld.vcxproj +++ b/SimsWorld/SimsWorld.vcxproj @@ -99,9 +99,11 @@ + + @@ -119,7 +121,9 @@ + + diff --git a/SimsWorld/SimsWorld.vcxproj.filters b/SimsWorld/SimsWorld.vcxproj.filters index 431c08e..7bef30c 100644 --- a/SimsWorld/SimsWorld.vcxproj.filters +++ b/SimsWorld/SimsWorld.vcxproj.filters @@ -61,6 +61,12 @@ Source Files + + Source Files + + + Source Files + @@ -80,5 +86,11 @@ Header Files + + Header Files + + + Header Files + \ No newline at end of file