Пример #1
0
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
{
    MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
    if(t == nullptr)
        return;

    const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);

    size_t cursorPosition = t->getCursorPosition(lastPressed);
    MyGUI::UString color = mHistory->getColorAtPos(cursorPosition);

    if (!mEnabled && color == "#572D21")
        MWBase::Environment::get().getDialogueManager()->goodbyeSelected();

    if(color != "#B29154")
    {
        MyGUI::UString key = mHistory->getColorTextAt(cursorPosition);

        if(color == "#686EBA")
        {
            std::map<size_t, HyperLink>::iterator i = mHyperLinks.upper_bound(cursorPosition);
            if( !mHyperLinks.empty() )
            {
                --i;

                if( i->first + i->second.mLength > cursorPosition)
                {
                    MWBase::Environment::get().getDialogueManager()->keywordSelected(i->second.mTrueValue);
                }
            }
            else
            {
                // the link was colored, but it is not in  mHyperLinks.
                // It means that those liunks are not marked with @# and found
                // by topic name search
                MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
            }
        }

        if(color == "#572D21")
            MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
    }
}
Пример #2
0
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
{
    MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
    if(t == nullptr)
        return;

    const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);

    size_t cursorPosition = t->getCursorPosition(lastPressed);
    MyGUI::UString color = mHistory->getColorAtPos(cursorPosition);

    if (!mEnabled && color == "#572D21")
        MWBase::Environment::get().getDialogueManager()->goodbyeSelected();

    if(color != "#B29154")
    {
        MyGUI::UString key = mHistory->getColorTextAt(cursorPosition);
        if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));

        if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
    }
}