1 #ifndef EDITOR_COMPONENTS_CONVERSATIONNODE_HPP
2 #define EDITOR_COMPONENTS_CONVERSATIONNODE_HPP
4 #include <BLIB/Interfaces/GUI.hpp>
24 using CreateNode = std::function<
unsigned int(
unsigned int)>;
27 using SelectCb = std::function<void(
unsigned int)>;
30 using FocusCb = std::function<void(
bool)>;
46 const SelectCb& selectCb, bl::gui::Box::Ptr& container,
47 const std::vector<core::file::Conversation::Node>* nodes);
72 using ChangeCb = std::function<void(
unsigned int)>;
74 NodeConnector(
const std::string& prompt,
const NotifyCb& regenTree,
76 const ChangeCb& changeCb,
const SelectCb& selectCb,
77 const std::vector<core::file::Conversation::Node>* nodes);
80 void setSelected(
unsigned int node);
81 unsigned int getSelected()
const;
82 bl::gui::Box::Ptr& content();
85 bl::gui::Box::Ptr row;
86 bl::gui::ComboBox::Ptr entry;
87 const std::vector<core::file::Conversation::Node>* nodes;
92 using OnChange = std::function<void(
unsigned int,
const std::string&,
unsigned int)>;
93 using OnDelete = std::function<void(
unsigned int, std::list<Choice>::iterator)>;
95 Choice(
unsigned int index,
const std::string& c,
unsigned int jump,
96 const OnChange& onChange,
const OnDelete& onDelete,
const NotifyCb& regenTree,
98 const std::vector<core::file::Conversation::Node>* nodes);
100 void setIndex(
unsigned int i);
101 void setIterator(std::list<Choice>::iterator it);
102 bl::gui::Box::Ptr& content();
106 const OnChange onChange;
107 const OnDelete onDelete;
110 std::list<Choice>::iterator it;
111 bl::gui::Box::Ptr box;
112 bl::gui::TextEntry::Ptr entry;
116 bl::gui::GUI* parent;
123 const std::vector<core::file::Conversation::Node>* allNodes;
127 bl::gui::Label::Ptr nodeTitle;
128 bl::gui::Box::Ptr editArea;
129 bl::gui::ComboBox::Ptr typeEntry;
131 NodeConnector passNext;
132 NodeConnector failNext;
134 bl::gui::Box::Ptr promptRow;
135 bl::gui::TextEntry::Ptr promptEntry;
136 NodeConnector nextNode;
138 bl::gui::Box::Ptr choiceArea;
139 bl::gui::ScrollArea::Ptr choiceScroll;
140 std::list<Choice> choices;
141 void onChoiceChange(
unsigned int j,
const std::string& t,
unsigned int n);
142 void onChoiceDelete(
unsigned int i, std::list<Choice>::iterator it);
146 bl::gui::CheckButton::Ptr itemBeforeCheck;
147 bl::gui::CheckButton::Ptr itemAfterCheck;
148 bl::gui::Box::Ptr itemRow;
151 bl::gui::Box::Ptr moneyRow;
152 bl::gui::TextEntry::Ptr moneyEntry;
153 void onMoneyChange();
155 bl::gui::Box::Ptr flagRow;
156 bl::gui::TextEntry::Ptr flagEntry;
158 bl::gui::Box::Ptr scriptRow;
159 bl::gui::Label::Ptr scriptLabel;
160 ScriptSelector scriptSelector;
All classes and functionality used for implementing the game editor.
Building block of conversations. A conversation is a tree of nodes and each node is an action that ha...
Helper component for editing individual conversation nodes.
const core::file::Conversation::Node & getValue() const
Get the current node value.
std::function< unsigned int(unsigned int)> CreateNode
Called when a new node should be created.
void update(unsigned int i, const core::file::Conversation::Node &node)
Update the node editor content with the given node value.
std::function< void(unsigned int)> SelectCb
Called when a node is jumped to.
std::function< void(bool)> FocusCb
std::function< void()> NotifyCb
Called when the node value is modified.
void setParent(bl::gui::GUI *parent)
Set the parent GUI object.
ConversationNode(const FocusCb &focusCb, const NotifyCb &editCb, const NotifyCb &deleteCb, const NotifyCb ®enTree, const CreateNode &createNode, const SelectCb &selectCb, bl::gui::Box::Ptr &container, const std::vector< core::file::Conversation::Node > *nodes)
Construct a new Conversation Node editor.
std::shared_ptr< ItemSelector > Ptr
Pointer to this component.