MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / onInputAction

Method onInputAction

src/ui/Menu_Log.cpp:111–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool Menu_Log::onInputAction(Engine::ActionType action)
112{
113 using Engine::ActionType;
114
115 bool baseclassClose = false;
116
117 // Only effect the selection of the menu if the listbox
118 // is not in focus or the content viewer open
119 if ((m_LogStatus == EMenuLogStatus::CategorySelection) || (action == ActionType::UI_Close))
120 baseclassClose = Menu::onInputAction(action);
121
122 // Separate the keywords from the current selected action
123 std::vector<std::string> result;
124 std::istringstream iss(m_Items[m_SelectableItems[m_SelectedItem]]->getItemScriptData().onSelAction_S[0]);
125 for (std::string s; iss >> s;)
126 result.push_back(s);
127
128 // Get current listbox
129 MenuItemTypes::MenuItemListbox* listbox;
130 if (result[0] == "EFFECTS")
131 {
132 // Find current selected listbox and hide all other listboxes
133 for (auto& item : m_Items)
134 if (item.second->getItemScriptData().instanceSymbol == getItemScriptData(result[1]).instanceSymbol)
135 {
136 listbox = dynamic_cast<MenuItemTypes::MenuItemListbox*>(item.second);
137 listbox->setHidden(false);
138 }
139 else if (item.second->getItemScriptData().type == Daedalus::GEngineClasses::C_Menu_Item::MENU_ITEM_LISTBOX)
140 {
141 item.second->setHidden(true);
142 }
143 }
144
145 // React on input action
146 switch (action)
147 {
148 case ActionType::UI_Up:
149 if (m_LogStatus == EMenuLogStatus::TopicSelection)
150 {
151 listbox->selectPreviousItem();
152 }
153 else if (m_LogStatus == EMenuLogStatus::ContentViewer)
154 {
155 MenuItemTypes::MenuItemScrollableText* menu_item;
156 menu_item = dynamic_cast<MenuItemTypes::MenuItemScrollableText*>(findMenuItem("MENU_ITEM_CONTENT_VIEWER"));
157 menu_item->scrollUp();
158 }
159 break;
160
161 case ActionType::UI_Down:
162 if (m_LogStatus == EMenuLogStatus::TopicSelection)
163 {
164 listbox->selectNextItem();
165 }
166 else if (m_LogStatus == EMenuLogStatus::ContentViewer)
167 {
168 MenuItemTypes::MenuItemScrollableText* menu_item;

Callers

nothing calls this directly

Calls 12

push_backMethod · 0.80
setHiddenMethod · 0.80
selectPreviousItemMethod · 0.80
scrollUpMethod · 0.80
selectNextItemMethod · 0.80
scrollDownMethod · 0.80
setFocusMethod · 0.80
hasTopicsMethod · 0.80
setTopicEntriesMethod · 0.80
isHiddenMethod · 0.80
setFontHighlightedMethod · 0.45

Tested by

no test coverage detected