Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/PresentationFS18/src/modules/dialog/DialogManager.cc @ 12012

Last change on this file since 12012 was 11782, checked in by landauf, 7 years ago

tabs → spaces

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "DialogManager.h"
30#include "core/CoreIncludes.h"
31#include "core/singleton/ScopedSingletonIncludes.h"
32#include <string>
33
34namespace orxonox {
35    ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
36
37
38
39    DialogManager::DialogManager()
40    {
41        this->currentTalk_ = nullptr;
42        this->answerIds_ = nullptr;
43    }
44
45    void DialogManager::setDialog(Dialog* dialog)
46    {
47        this->currentTalk_ = dialog;
48        this->answerIds_ = &this->currentTalk_->getAnswerIds();
49    }
50
51    //from here onward funcionality for lua axports
52
53    std::string DialogManager::getQuestion()
54    {
55        return this->currentTalk_->getQuestionString();
56    }
57
58    int DialogManager::getSize()
59    {   
60        return this->answerIds_->size();
61    }
62
63    std::string DialogManager::getAnswer(int index)
64    {
65        return this->currentTalk_->getAnswerString(this->answerIds_->at(index));
66    }
67
68    std::string DialogManager::getPerson()
69    {
70        return this->currentTalk_->getName();
71    }
72
73    bool DialogManager::endtest(int index)
74    {   
75        if(this->answerIds_->empty())
76        {
77            return true;
78        }
79        else 
80        {
81            return this->currentTalk_->ending(this->answerIds_->at(index));
82        }
83
84    }
85
86    void DialogManager::update(int index)
87    {
88        this->currentTalk_->update(this->answerIds_->at(index));
89        this->answerIds_ = &this->currentTalk_->getAnswerIds();
90    }
91}
Note: See TracBrowser for help on using the repository browser.