Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 6, 2017, 3:40:23 PM (8 years ago)
Author:
rrogge
Message:

Singleton funktioniert

Location:
code/branches/Dialogue_FS17
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialogue_FS17/data/levels/emptyLevel.oxw

    r11377 r11393  
    2929    skybox       = "Orxonox/Starbox"
    3030  >
    31   <DialogueManager question="Wazzup">
    32   </DialogueManager>
     31 <DistanceTrigger name="test" position="0,0,0" target="Pawn" distance=25 stayActive="true"/>
     32    <Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,0"/>
     33    <DialogueManager question="Hello World3">
     34      <events>
     35        <execute>
     36           <EventListener event="test" />
     37        </execute>
     38      </events>
     39    </DialogueManager>
     40
     41    <!--<DialogueManager firstquestion="hello world">
     42      <options>
     43        <NextQuestion answer="ja" question="question?">
     44          <options>
     45            <NextQuestion answer="" question="">
     46            </NextQuestion>
     47          </options>
     48        </NextQuestion>
     49       <events>
     50        <execute>
     51           <EventListener event="test" />
     52        </execute>
     53      </events>
     54    </DialogueManager>
     55  -->
     56
     57
    3358    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    3459    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
  • code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc

    r11390 r11393  
    1010#include <vector>
    1111#include <string>
     12#include "core/XMLPort.h"
     13
    1214
    1315namespace orxonox {
    14         ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
    15         RegisterClassNoArgs(DialogueManager);
     16        //ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
     17        RegisterAbstractClass(DialogueManager).inheritsFrom<Configurable>();
    1618
    17         DialogueManager::DialogueManager(){
     19
     20
     21        DialogueManager* DialogueManager::singletonPtr_s =nullptr;
     22
     23        DialogueManager::DialogueManager(Context* context): BaseObject(context){
    1824                RegisterObject(DialogueManager);
    1925                this->setConfigValues();
     26               
    2027
    2128        }
    2229       
     30
    2331        /**
    2432     * @brief set the config values in the orxonox.ini file
    2533     */
    26     void DialogueManager::setConfigValues()
    27     {
    28         //SetConfigValue(question,std::string).description("Question");
    29        
    30     }
     34   
    3135
    3236    void DialogueManager::setquestion(std::string question){
     
    4347        XMLPortParam(DialogueManager, "question", setquestion, getquestion, xmlelement, mode);
    4448    }
     49
     50        bool DialogueManager::execute(bool bTriggered, BaseObject* trigger)
     51    { 
     52        if(!bTriggered) return false;
     53
     54        orxout() << "bTriggered is " << bTriggered;
     55        //orxout() << " 1 " << mystring << endl;
     56        return false;
     57    }
     58
     59    void DialogueManager::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
     60    {
     61        SUPER(DialogueManager, XMLEventPort, xmlelement, mode);
     62
     63        XMLPortEventSink(DialogueManager, BaseObject, "execute", execute, xmlelement, mode);
     64    }
     65
    4566        /*std::string DialogueManager::setnpc(std::string npc){
    4667                return npc;
  • code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h

    r11390 r11393  
    1313#include "core/config/Configurable.h"
    1414#include "core/XMLPort.h"
     15#include "core/EventIncludes.h"
    1516
    1617//tolua_begin
     
    1819//tolua_end
    1920{//toluaexport
    20         class _OrxonoxExport DialogueManager : public Singleton<DialogueManager>, public Configurable
     21        class _OrxonoxExport DialogueManager : public Singleton<DialogueManager>, public BaseObject
    2122        {
    2223                friend class Singleton<DialogueManager>;
     
    2425                public:
    2526
    26                 DialogueManager(); // tolua_export
     27                DialogueManager(Context* context); // tolua_export
     28               
     29
    2730                static DialogueManager& getInstance() { return Singleton<DialogueManager>::getInstance(); }
    28                 void setConfigValues();
     31               
    2932                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    3033
    31                         void setquestion(std::string question);
    32                         std::string getquestion(void);
     34                void setquestion(std::string question);
     35                std::string getquestion(void);
     36
     37
     38                virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     39                bool execute(bool bTriggered, BaseObject* trigger);
     40
     41       
    3342
    3443                        /*std::string setnpc(std::string npc);
Note: See TracChangeset for help on using the changeset viewer.