Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h @ 11658

Last change on this file since 11658 was 11658, checked in by kuchlert, 6 years ago

updated todo in dialogManager for future improvement

File size: 3.7 KB
Line 
1#ifndef _DialogManager_H__
2#define _DialogManager_H__
3
4#include "DialogPrereqs.h"
5#include "util/Singleton.h"
6#include "core/singleton/ScopedSingletonIncludes.h"
7#include "core/object/Listable.h"
8#include "Dialog.h"
9
10#include <string>
11
12namespace orxonox //tolua_export
13
14{//tolua_export
15
16    /**
17    @brief
18    this class is used for calling on a dialog form luascript
19
20    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
21
22    @todo
23        reseting or setting new start for dialog on exit, to allow coming back to a npc
24        picture of person
25        parameters to differ dialog depending on some world values, like items, completed objectives etc...
26    */
27
28    class _OrxonoxExport DialogManager //tolua_export
29    : public Singleton<DialogManager>
30    {//tolua_export
31        friend class Singleton<DialogManager>;
32   
33        public:
34       
35        DialogManager(); 
36
37        /**
38        @brief
39            gives the pointer to the sigleton dialog manager to the lua script
40
41        @return
42            returns pointer
43        */
44
45        static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //tolua_export
46
47        /**
48        @brief
49            allows to set the current dialog
50
51            this is used by a dialog when triggered to set its self to the current dialog
52
53        @param dialog
54            pointer to the dialog that wants to be current one
55        */
56        void setDialog(Dialog* dialog);
57
58        //from here on functions for lua interface
59
60        /**
61        @brief
62            gives the string of the momentary npc textoption
63
64        @return
65            string of npc text
66        */
67        std::string getQuestion(); //tolua_export
68
69        /**
70        @brief
71            function that returns size of answerid array
72
73        @return
74            returns number of possible answers to momentary questions, 0 if there are no player text options
75        */
76        int getSize(); //tolua_export
77
78        /**
79        @brief
80            returns the answer to the id that is at index in the array of answers
81
82        @param param1
83            index of desired answer
84
85        @return
86            string of answer
87        */
88        std::string getAnswer(int index); //tolua_export
89
90        /**
91        @brief
92            gives name of npc the player is currently talking to
93
94        @return
95            sting with name
96        */
97        std::string getPerson(); //tolua_export
98
99        /**
100        @brief
101            tests the dialog if there are any followup npc textoptions to the given answer or if there are no answers to the current question
102
103        @return
104            true if the answer array of the question is empty or the next question id of the answer does not exist
105        */
106        bool endtest(int index); //tolua_export
107
108        /**
109        @brief
110            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
111            when called the current question of the dialog is set to the new one and the answerId vector is set accordingly
112
113        @param param1
114            index of the answer given by the player
115
116        */
117        void update(int index); //tolua_export
118
119private:
120    static DialogManager* singletonPtr_s;   //!< a pointer to the single class object
121
122    Dialog* currentTalk_;   //!< pointer to the currently active dialog or last active if no one is currently active
123    const std::vector<std::string>* answerIds_; //!< pointer to the possible answerIds of the current question, for faster access
124
125    };//tolua_export
126}//tolua_export
127
128#endif /* _DialogManager_H__ */
Note: See TracBrowser for help on using the repository browser.