Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11421


Ignore:
Timestamp:
May 18, 2017, 2:49:13 PM (7 years ago)
Author:
rrogge
Message:

question updates

Location:
code/branches/Dialogue_FS17
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua

    r11417 r11421  
    7070
    7171function P.update()
     72    orxout("UPDATING")
     73    P.createInventory()
    7274    if P.showing == false then
    7375        return
     
    136138function P.a1Button_clicked(e)
    137139    orxonox.DialogueManager:getInstance():a1clicked()
     140    P.update()
    138141end
    139142
  • code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc

    r11417 r11421  
    2424                //RegisterObject(DialogueManager);
    2525               
    26                
    27 
    2826        }
    2927       
     
    3533
    3634        void DialogueManager::registerquestion(NextQuestion* nq){
     35                if(allQuestions.size()==0) {
     36                        orxout(internal_info) << "At least one NextQuestion has to be set." << endl;
     37                } else  {
     38                        currentQuestion = allQuestions[0];
     39                }
    3740                allQuestions.push_back(nq);
     41                        orxout(internal_info) << "qsize " << allQuestions.size();
    3842
    3943        }       
     
    6872                return a2;
    6973        }
    70         bool DialogueManager::a1clicked(void){
    71                 orxout() << "a1 clicked" << endl;
     74        void DialogueManager::a1clicked(void){
     75               
     76                assert((currentQuestion->retposQues())[0]);
     77                orxout() << "a14 clicked" << endl;
     78                orxout() << currentQuestion->possibleQuestions[0] << endl;
    7279                currentQuestion = currentQuestion->possibleQuestions[0];
    73                 return true;
     80                update(currentQuestion);
     81
     82               
    7483        }
    75         bool DialogueManager::a2clicked(void){
     84        void DialogueManager::a2clicked(void){
    7685                orxout() << "a2 clicked" << endl;
    77                 return true;
     86               
    7887        }
    79         /*void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    80     {
    81         SUPER(DialogueManager, XMLPort, xmlelement, mode);
    82 
    83         XMLPortParam(DialogueManager, "question", setquestion, getquestion, xmlelement, mode);
    84     }*/
     88         void DialogueManager::update(NextQuestion* nq){
     89                this->setquestion(nq->getquestion());
     90                this->setanswers1(nq->getanswers1());
     91                this->setanswers2(nq->getanswers2());
     92         }
    8593
    8694       
    8795
    88         /*std::string DialogueManager::setnpc(std::string npc){
    89                 return npc;
     96       
     97
     98        /*
     99       
     100        bool DialogueManager::theEnd(){
     101        if(currentQuestion->retposQues()) return true;
     102        else return false;
    90103        }
    91 
    92104       
    93105
  • code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h

    r11417 r11421  
    4646                std::string getanswers1(void); //tolua_export
    4747                std::string getanswers2(void); //tolua_export
    48                 bool a1clicked(void); //tolua_export
    49                 bool a2clicked(void); //tolua_export
    50                         /*std::string setnpc(std::string npc);
     48                void a1clicked(void); //tolua_export
     49                void a2clicked(void); //tolua_export
     50                        //bool theEnd();
     51                void update(NextQuestion* nq);
    5152
    52                         void setanswers(std::string option1, std::string option2, std::string option3);
    53                         std::vector <std::string> getanswers(void);
    54 
    55                         int getnumOptions();
    56                        
    57 
    58                        
    59                         std::string npc;
    60                         std::vector<std::string> options;
    61                
    62 */
    6353private:
    6454        NextQuestion* currentQuestion;
  • code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc

    r11417 r11421  
    4848            i--;
    4949        }
    50         return nullptr; }
     50        return nullptr;
     51         }
    5152       
    5253        //XML and Event stuff
     
    112113        }
    113114
     115        std::vector<NextQuestion*> NextQuestion::retposQues(){
     116                orxout() << "fish" << endl;
     117                assert(possibleQuestions[0]);
     118                orxout() << possibleQuestions.size() << endl;
     119                return possibleQuestions;
     120        }
    114121
    115         /*NextQuestion NextQuestion::compare(){
    116                 DialogueManager& m = DialogueManager::getInstance();
    117                 if(m.a1clicked()){
    118                         return *possibleQuestions[0];
    119                 }
    120122
    121                 else if(m.a2clicked()){
    122                         return *possibleQuestions[1];
    123                 }
     123        /*
     124
    124125        }*/
    125126
  • code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h

    r11417 r11421  
    1010#include "core/EventIncludes.h"
    1111#include "DialoguePrereqs.h"
    12 
    13 
    1412
    1513
     
    4745
    4846                std::vector<NextQuestion*> possibleQuestions;
     47                std::vector<NextQuestion*> retposQues();
    4948        private:
    5049                std::string a1;
Note: See TracChangeset for help on using the changeset viewer.