Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11612 for code/branches


Ignore:
Timestamp:
Nov 30, 2017, 3:35:25 PM (7 years ago)
Author:
kuchlert
Message:

funktioniert bis dialogmanager getInstance, angefangen und noch zu tun: luafunktionen von dialogmanager, lua und layout

Location:
code/branches/Dialog_HS17
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua

    r11579 r11612  
    1 
    2 -- Dialog.lua
     1-- Dialogue.lua
    32
    43local P = createMenuSheet("Dialog")
    54
    65P.wrapper = nil
    7 P.answerList = {}
    8 P.scrollbarWidht = 13
    9 P.selectedAnswer = {}
     6P.detailsWindows = {}
    107
    118P.showing = false
     
    1411P.imageHeight = 50
    1512P.detailImageSize = 100
    16 P.textHeight = 30
    17 P.buttonWidth = 85
     13P.textHeight = 50
     14P.buttonWidth = 50
    1815
    1916function P.onLoad()
    2017    P.wrapper = nil
    21 
    2218end
    2319
    2420function P.onShow()
     21
    2522    orxonox.CommandExecutor:execute("setTimeFactor 0")
    2623    P.createDialog()
     
    3734function P.update()
    3835    P.updateDialog()
    39     if P.showing == false then
    40         return
    41     end
    42 
    43     P.cleanup(false)
    4436end
    4537
    4638function P.createDialog()
    4739
    48     local dialogManager = orxonox.DialogManager:getInstance()
     40    local manager = orxonox.DialogManager:getInstance()
    4941   
     42    ---[[
    5043    root = winMgr:getWindow("orxonox/Dialogue/Inventory")
    51     local dialog = dialogManager:getCurrentDialog()
    52     root:setText(dialog:getQuestion)
     44    local question = orxonox.DialogueManager:getInstance():getquestion()
     45    root:setText(question)
    5346    P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/Dialogue/Inventory/Wrapper")
    5447    P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
    5548    root:addChildWindow(P.wrapper)
    5649   
    57     acceptButton = winMgr:createWindow("MenuWidgets/Button", "/a2Button")   --a2 da graphik aus version mit 2 knoepfen uebernommen
    58     acceptButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.4, (P.imageHeight-P.textHeight)/2)))
    59     acceptButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.8, 0), CEGUI.UDim(0, P.textHeight)))
    60     acceptButton:setText("accept")
    61     orxonox.GUIManager:subscribeEventHelper(acceptButton, "Clicked", P.name ..".acceptButton_clicked")
    62     P.wrapper:addChildWindow(acceptButton)
    63    
    64     P.answerList = {}                       -- erstellen der tabelle aus AntwortIds und Antworten im Lua
    65     local answers = dialog:getAnswers()
    66     for ans in answers do
    67         P.answerList[ans] = dialog:getAnswer(ans)
    68     end
    69     --todo herausfinden wie antworten in tabelle enzeigen
     50    --]]
     51    detailsButton = winMgr:createWindow("MenuWidgets/Button", "/DetailsButton")
     52    detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.5, (P.imageHeight-P.textHeight)/2)))
     53    detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0, P.textHeight)))
     54    detailsButton:setText("say")
     55    orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name ..".Button_clicked")
     56    P.wrapper:addChildWindow(detailsButton)
     57    --]]
     58
    7059end
    7160
    72 
    7361function P.updateDialog()
    74     local dialog = orxonox.DialogManager:getInstance():getDialog()
    75     root:setText(dialog:getQuestion)
    76     --todo: tabellen updaten
     62    --local questionn = orxonox.DialogueManager:getInstance():getquestion()
     63    --root:setText("test")
    7764end
    7865
     
    9885
    9986
    100 function P.acceptButton_clicked(e)
    101     local ending = orxonox.DialogManager:getInstance():getDialog:ending()
     87function P.Button_clicked(e)
     88    --local ending = orxonox.DialogManager:getInstance():theEnd()
    10289   
    103     if ending then
     90    --if ending then
    10491        orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
    10592   
    106     --herausfindne wie tabelleneintrag uebergeben wird
    107     else
    108         P.update()
    109     end
     93   
     94   -- else
     95   --     orxonox.DialogueManager:getInstance():a1clicked()
     96   --     P.update()
     97   -- end
    11098end
    11199
  • code/branches/Dialog_HS17/data/gui/scripts/Dialogue.lua

    r11451 r11612  
    2222    P.detailPickups = {}
    2323    P.pickupsList = {}
     24   
    2425end
    2526
     
    2829    P.createInventory()
    2930    P.showing = true
     31end
    3032
    31 end
    3233
    3334function P.onHide()
  • code/branches/Dialog_HS17/data/overlays/HUDTemplates3.oxo

    r11451 r11612  
    220220    />
    221221
    222   </OverlayGroup>
    223 </Template>
     222    <GUIOverlay
     223      name = "Dialog"
     224      guiname = "Dialog"
     225      visible = "false"
     226    />
     227
     228  </OverlayGroup>
     229</Template>
  • code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc

    r11611 r11612  
    113113        return end;
    114114    }
     115
     116        std::string Dialog::getQuestionString()
     117        {
     118                return this->questions_.find(this->currentQuestionId_)->second->getQuestion();
     119        }
    115120}
  • code/branches/Dialog_HS17/src/modules/dialog/Dialog.h

    r11611 r11612  
    3333                        void addAnswer(Answer* answer); //fuegt Answer der Map hinzu
    3434
    35                         Question* getQuestion(unsigned int index) const; // returned string der momentanen Frage
    36                         Answer* getAnswer(unsigned int index) const; // returned string der momentanen Frage
     35                        Question* getQuestion(unsigned int index) const; // // benoetigt fuer xmlPort
     36                        Answer* getAnswer(unsigned int index) const; // benoetigt fuer xmlPort
    3737                        std::vector<std::string> getAnswers();  // returned vector mit allen momentanen AntwortenIds
    3838
     
    4343                        bool ending(); //retruned true wenn die Id der Antwort end ist oder keine Antworten auf die frage eingetragen sind
    4444
     45                        std::string getQuestionString(); //gibt string der momentanen Frage
    4546
    4647                private:
  • code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc

    r11611 r11612  
    22#include "core/CoreIncludes.h"
    33#include "core/singleton/ScopedSingletonIncludes.h"
     4#include <string>
    45
    5 namespace orxonox
    6 {
    7     ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
     6namespace orxonox {
     7        ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
     8       
    89
    9     RegisterAbstractClass(DialogManager).inheritsFrom<Listable>();
     10       
     11        DialogManager::DialogManager()
     12        {
     13                this->currentTalk_ = nullptr;
     14        }
    1015
    11     DialogManager::DialogManager()
    12     {
    13         RegisterObject(DialogManager);
    14 
    15         this->currentTalk_ = NULL;
    16     }
    17 
    18     void DialogManager::setDialog(Dialog* dialog)
     16        void DialogManager::setDialog(Dialog* dialog)
    1917        {
    2018                this->currentTalk_ = dialog;   
    2119        }
    2220
    23         const Dialog* DialogManager::getCurrentDialog()
    24         {
    25                 return this->currentTalk_;
    26         }
    27        
    28         bool DialogManager::empty()
    29         {
    30                 if(this->currentTalk_ == NULL)
    31                 {
    32                         return true;
    33                 }
    34                 else
    35                 {
    36                         return false;
    37                 }
    38         }
     21        //from here onward funcionality for lua axports
     22
     23    std::string DialogManager::getQuestion()
     24    {
     25        return this->currentTalk_->getQuestionString();
     26    }
     27
     28    /*
     29    std::vector<std::string> DialogManager::getAnswers()
     30    {
     31        // lua hat komisch arrays (eigentlich tables), wie implementiert man answers so das man nacher den key der gegeben antwort a
     32        // hat um ihn fuer update zu benutzen?
     33    }
     34        */
    3935}
  • code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h

    r11611 r11612  
    44#include "DialogPrereqs.h"
    55#include "util/Singleton.h"
     6#include "core/singleton/ScopedSingletonIncludes.h"
    67#include "core/object/Listable.h"
    78#include "Dialog.h"
    89
    9 namespace orxonox
    10 {
    11     class _DialogExport DialogManager : public Singleton<DialogManager>, public Listable
    12     {
     10#include <string>
     11
     12namespace orxonox //tolua_export
     13
     14{//tolua_export
     15    class _OrxonoxExport DialogManager //tolua_export
     16    : public Singleton<DialogManager>
     17    {//tolua_export
    1318        friend class Singleton<DialogManager>;
     19   
     20        public:
     21       
     22        DialogManager();
     23       
    1424
    15         public:
    16             DialogManager();
     25        static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //tolua_export
    1726
    18            // int getValue() const { return this->value_; }
     27        void setDialog(Dialog* dialog);
    1928
    20                 static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //toloa_export
     29        //from here on luafunctionality is declared
    2130
    22                 void setDialog(Dialog* dialog);
    23                 const Dialog* getCurrentDialog();
    24                 bool empty();
     31        std::string getQuestion(); //tolua_export
     32        //std::vector<std::string> getAnswers();
    2533
    26             //form here on all lua functionality used in lua scrips is declared
     34private:
     35    static DialogManager* singletonPtr_s;
    2736
     37    Dialog* currentTalk_;
    2838
    29         private:
    30                 Dialog* currentTalk_;
    31             //int value_;
    32 
    33             static DialogManager* singletonPtr_s;
    34     };
    35 }
     39    };//tolua_export
     40}//tolua_export
    3641
    3742#endif /* _DialogManager_H__ */
  • code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h

    r11611 r11612  
    4343//-----------------------------------------------------------------------
    4444
    45 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialogue_STATIC_BUILD)
    46 #  ifdef Dialogue_SHARED_BUILD
     45#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialog_STATIC_BUILD)
     46#  ifdef Dialog_SHARED_BUILD
    4747#    define _DialogExport __declspec(dllexport)
    4848#  else
Note: See TracChangeset for help on using the changeset viewer.