Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/mergeFS18/src/modules/dialog/DialogManager.h @ 12107

Last change on this file since 12107 was 11781, checked in by landauf, 7 years ago

eol-style native (no changes in code)

  • Property svn:eol-style set to native
File size: 4.6 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#ifndef _DialogManager_H__
30#define _DialogManager_H__
31
32#include "DialogPrereqs.h"
33#include "util/Singleton.h"
34#include "core/singleton/ScopedSingletonIncludes.h"
35#include "core/object/Listable.h"
36#include "Dialog.h"
37
38#include <string>
39
40namespace orxonox //tolua_export
41
42{//tolua_export
43
44    /**
45    @brief
46    this class is used for calling on a dialog form luascript
47
48    the class is the interface of dialog to lua, all lua functionallity is given by this class, it can be found by lua due to singleton definition
49
50    @todo
51        reseting or setting new start for dialog on exit, to allow coming back to a npc
52        picture of person
53        parameters to differ dialog depending on some world values, like items, completed objectives etc...
54    */
55
56    class _DialogExport DialogManager //tolua_export
57    : public Singleton<DialogManager>
58    {//tolua_export
59        friend class Singleton<DialogManager>;
60   
61        public:
62       
63        DialogManager(); 
64
65        /**
66        @brief
67            gives the pointer to the sigleton dialog manager to the lua script
68
69        @return
70            returns pointer
71        */
72
73        static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //tolua_export
74
75        /**
76        @brief
77            allows to set the current dialog
78
79            this is used by a dialog when triggered to set its self to the current dialog
80
81        @param dialog
82            pointer to the dialog that wants to be current one
83        */
84        void setDialog(Dialog* dialog);
85
86        //from here on functions for lua interface
87
88        /**
89        @brief
90            gives the string of the momentary npc textoption
91
92        @return
93            string of npc text
94        */
95        std::string getQuestion(); //tolua_export
96
97        /**
98        @brief
99            function that returns size of answerid array
100
101        @return
102            returns number of possible answers to momentary questions, 0 if there are no player text options
103        */
104        int getSize(); //tolua_export
105
106        /**
107        @brief
108            returns the answer to the id that is at index in the array of answers
109
110        @param param1
111            index of desired answer
112
113        @return
114            string of answer
115        */
116        std::string getAnswer(int index); //tolua_export
117
118        /**
119        @brief
120            gives name of npc the player is currently talking to
121
122        @return
123            sting with name
124        */
125        std::string getPerson(); //tolua_export
126
127        /**
128        @brief
129            tests the dialog if there are any followup npc textoptions to the given answer or if there are no answers to the current question
130
131        @return
132            true if the answer array of the question is empty or the next question id of the answer does not exist
133        */
134        bool endtest(int index); //tolua_export
135
136        /**
137        @brief
138            tells the dialog to update according to a given answer, if no answer is actively clicked the standard index is sett 0 in the lua
139            when called the current question of the dialog is set to the new one and the answerId vector is set accordingly
140
141        @param param1
142            index of the answer given by the player
143
144        */
145        void update(int index); //tolua_export
146
147private:
148    static DialogManager* singletonPtr_s;   //!< a pointer to the single class object
149
150    Dialog* currentTalk_;   //!< pointer to the currently active dialog or last active if no one is currently active
151    const std::vector<std::string>* answerIds_; //!< pointer to the possible answerIds of the current question, for faster access
152
153    };//tolua_export
154}//tolua_export
155
156#endif /* _DialogManager_H__ */
Note: See TracBrowser for help on using the repository browser.