better colors (not perfect yet), and some basic question support (not finished yet).

actorid
gugus 13 years ago
parent f7cf5f9bef
commit debec44b51

@ -51,7 +51,7 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed(); const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed();
size_t cursorPosition = t->getCursorPosition(lastPressed); size_t cursorPosition = t->getCursorPosition(lastPressed);
if(history->getColorAtPos(cursorPosition) != "#FFFFFF") if(history->getColorAtPos(cursorPosition) != "#B29154")
{ {
UString key = history->getColorTextAt(cursorPosition); UString key = history->getColorTextAt(cursorPosition);
//std::cout << "Clicked on key: " << key << std::endl; //std::cout << "Clicked on key: " << key << std::endl;
@ -65,7 +65,7 @@ void DialogueWindow::open()
topicsList->removeAllItems(); topicsList->removeAllItems();
pTopicsText.clear(); pTopicsText.clear();
history->eraseText(0,history->getTextLength()); history->eraseText(0,history->getTextLength());
updateOptions();
setVisible(true); setVisible(true);
} }
@ -130,7 +130,7 @@ std::string DialogueWindow::parseText(std::string text)
for(int i = 0;i<topicsList->getItemCount();i++) for(int i = 0;i<topicsList->getItemCount();i++)
{ {
std::string keyWord = topicsList->getItem(i); std::string keyWord = topicsList->getItem(i);
std::string newKeyWord = "#FF0000"+keyWord+"#FFFFFF"; std::string newKeyWord = "#686EBA"+keyWord+"#B29154";
replaceInString(text,keyWord,newKeyWord); replaceInString(text,keyWord,newKeyWord);
} }
return text; return text;
@ -149,6 +149,15 @@ void DialogueWindow::displayTopicText(std::string topic)
} }
} }
void DialogueWindow::askQuestion(std::string question,std::list<std::string> answers)
{
history->addDialogText(parseText(question));
for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
{
history->addDialogText("#572D21"+(*it)+"#B29154");
}
}
void DialogueWindow::updateOptions() void DialogueWindow::updateOptions()
{ {
//FIXME Add this properly //FIXME Add this properly
@ -165,8 +174,12 @@ void DialogueWindow::updateOptions()
history->eraseText(0,history->getTextLength()); history->eraseText(0,history->getTextLength());
addKeyword("gus","gus is working on the dialogue system"); addKeyword("gus","gus is working on the dialogue system");
displayTopicText("gus"); displayTopicText("gus");
std::list<std::string> test;
test.push_back("option 1");
test.push_back("option 2");
askQuestion("is gus cooking?",test);
/*topicsList->addItem("Ald'ruhn", i++); /*topicsList->addItem("Ald'ruhn", i++);
topicsList->addItem("Balmora", i++); topicsList->addItem("Balmora", i++);
topicsList->addItem("Sadrith Mora", i++); topicsList->addItem("Sadrith Mora", i++);

@ -40,7 +40,7 @@ namespace MWGui
void addKeyword(std::string keyWord,std::string topicText); void addKeyword(std::string keyWord,std::string topicText);
void removeKeyword(std::string keyWord); void removeKeyword(std::string keyWord);
void addText(std::string text); void addText(std::string text);
void askQuestion(); void askQuestion(std::string question,std::list<std::string> answers);
protected: protected:
void onSelectTopic(MyGUI::List* _sender, size_t _index); void onSelectTopic(MyGUI::List* _sender, size_t _index);

@ -61,9 +61,9 @@ UString DialogeHistory::getColorTextAt(size_t _pos)
void DialogeHistory::addDialogHeading(const UString& parText) void DialogeHistory::addDialogHeading(const UString& parText)
{ {
UString head("\n#00FF00"); UString head("\n#D8C09A");
head.append(parText); head.append(parText);
head.append("#FFFFFF\n"); head.append("#B29154\n");
addText(head); addText(head);
} }

Loading…
Cancel
Save