Index: code/branches/Dialog_HS17/data/gui/layouts/Dialog.layout
===================================================================
--- code/branches/Dialog_HS17/data/gui/layouts/Dialog.layout	(revision 11641)
+++ code/branches/Dialog_HS17/data/gui/layouts/Dialog.layout	(revision 11642)
@@ -2,9 +2,9 @@
 
 <GUILayout >
-    <Window Type="DefaultWindow" Name="orxonox/Dialogue/Background" > 
+    <Window Type="DefaultWindow" Name="orxonox/Dialog/Background" > 
     	<Property Name="InheritsAlpha" Value="False" />
         <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
         <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
-        <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialogue/Inventory" >
+        <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialog/Options" >
             <Property Name="Alpha" Value="0.8" />
             <Property Name="InheritsAlpha" Value="False" />
@@ -13,17 +13,39 @@
             <Property Name="VertFormatting" Value="TopAligned" />
             <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.15,0},{0.85,0},{0.8,0}}" />
-            <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialogue/Wrapper" >
-                <Property Name="TextColours" Value="FF4444FF" />
+
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialog/Person" >
+                <Property Name="Alpha" Value="0.8" />
                 <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="HorzFormatting" Value="LeftAligned" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="VertFormatting" Value="CentreAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.05,0},{0.25,0},{0.15,0}}" />
+            </Window>
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialog/Question" >
+                <Property Name="Alpha" Value="0.8" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="HorzFormatting" Value="LeftAligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="VertFormatting" Value="CentreAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.05,0},{0.95,0},{0.15,0}}" />
+            </Window>
+
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/DialogAns" >
+                <Property Name="InheritsAlpha" Value="False" />
                 <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
-                <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" >
-                    <Property Name="TabHeight" Value="{0,26.4388}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.604166,0},{0.15,0},{0.958333,0},{0.636,0}}" />
+                <Window Type="MenuWidgets/Listbox" Name="orxonox/AnsListbox" >
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="TabPanePosition" Value="Top" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0,95,0},{0.925,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.225,0},{0.95,0},{0.92,0}}" />
+                    <Event Name="ItemSelectionChanged" Function="Dialog.answer_changed" />
                 </Window>
+            </Window>
+            <Window Type="MenuWidgets/Button" Name="orxonox/SayButton" >
+                <Property Name="Text" Value="Say" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.425,0},{0.9,0},{0.575,0},{0.975,0}}" />
+                <Event Name="Clicked" Function="Dialog.Button_clicked"/>
             </Window>
         </Window>
Index: code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua
===================================================================
--- code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua	(revision 11641)
+++ code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua	(revision 11642)
@@ -5,5 +5,4 @@
 P.wrapper = nil
 P.detailsWindows = {}
-
 P.showing = false
 
@@ -32,34 +31,51 @@
 end
 
-function P.update()
-    P.updateDialog()
-end
-
 function P.createDialog()
 
     local manager = orxonox.DialogManager:getInstance()
     
-    ---[[
-    root = winMgr:getWindow("orxonox/Dialogue/Inventory")
-    local question = orxonox.DialogueManager:getInstance():getquestion()
-    root:setText(question)
-    P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/Dialogue/Inventory/Wrapper")
-    P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
-    root:addChildWindow(P.wrapper)
     
+    local personfield = winMgr:getWindow("orxonox/Dialog/Person")
+    local person = manager:getPerson()
+    personfield:setText(person)
+
+    local questionfiled = winMgr:getWindow("orxonox/Dialog/Question")
+    local question = manager:getQuestion()
+    questionfiled:setText(question)
+
+    listboxwindow = winMgr:getWindow("orxonox/AnsListbox")
+
+    local themeList = {}
+    --[[
+    table.insert(themeList, "Default")
+    table.insert(themeList, "Drum n' Bass")
+    table.insert(themeList, "8-Bit Style")
+    table.insert(themeList, "Corny Jazz")
+    table.insert(themeList, "Metal")
     --]]
-    detailsButton = winMgr:createWindow("MenuWidgets/Button", "/DetailsButton")
-    detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.5, (P.imageHeight-P.textHeight)/2)))
-    detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0, P.textHeight)))
-    detailsButton:setText("say")
-    orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name ..".Button_clicked")
-    P.wrapper:addChildWindow(detailsButton)
-    --]]
+    local anssize = manager:getSize()
 
+    for index = 0, anssize -1, 1 do
+        table.insert(themeList, manager:getAnswer(index))
+    end  
+
+    for k,v in pairs(themeList) do
+        item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        CEGUI.toListbox(listboxwindow):addItem(item)
+    end
 end
 
 function P.updateDialog()
-    --local questionn = orxonox.DialogueManager:getInstance():getquestion()
-    --root:setText("test")
+    local manager = orxonox.DialogManager:getInstance()
+    --manager:update()
+
+    local questionfiled = winMgr:getWindow("orxonox/Dialog/Question")
+    local question = manager:getQuestion()
+    questionfiled:setText(question)
+end
+
+function P.answer_changed(e)
+    -- body
 end
 
@@ -86,14 +102,14 @@
 
 function P.Button_clicked(e)
-    --local ending = orxonox.DialogManager:getInstance():theEnd()
+    local ending = orxonox.DialogManager:getInstance():endtest()
+    orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
     
-    --if ending then
+    if ending then
         orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
     
     
-   -- else 
-   --     orxonox.DialogueManager:getInstance():a1clicked()
-   --     P.update()
-   -- end
+    else 
+        P.updateDialog(index)
+    end
 end
 
Index: code/branches/Dialog_HS17/data/levels/DialogueShowcase2.oxw
===================================================================
--- code/branches/Dialog_HS17/data/levels/DialogueShowcase2.oxw	(revision 11641)
+++ code/branches/Dialog_HS17/data/levels/DialogueShowcase2.oxw	(revision 11642)
@@ -33,11 +33,17 @@
     
     <Dialog name="Kurt" currentQuestionId="loop">
-      <Question question="Soll ich dich loopen?" Id="loop">
-        <AnswerId Id="ja"/>
-        <AnswerId Id="nein"/>
-      </Question>
-      <Question question="Dann eben nicht" Id="ok"/>
-      <Answer Id="ja" answer="ja loop mich" nextQuestionId="loop"/>
-      <Answer Id="nein" answer="lieber nicht" nextQuestionId="ok"/>
+      <questions>
+        <Question question="Soll ich dich loopen?" Id="loop">
+          <answerIds>
+            <AnswerId Id="ja"/>
+            <AnswerId Id="nein"/>
+          </answerIds>
+        </Question>
+        <Question question="Dann eben nicht" Id="ok"/>
+      </questions>
+      <answers>
+        <Answer Id="ja" answer="ja loop mich" nextQuestionId="loop"/>
+        <Answer Id="nein" answer="lieber nicht" nextQuestionId="ok"/>
+      </answers>
       <events>
         <execute>
Index: code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc	(revision 11642)
@@ -24,6 +24,6 @@
 		XMLPortParam(Dialog, "name", setName, getName, xmlelement, mode);
 		XMLPortParam(Dialog, "currentQuestionId", setCurrentQuestionId, getCurrentQuestionId, xmlelement, mode);
-		XMLPortObject(Dialog, Question, "Questions", addQuestion, getQuestion, xmlelement, mode);
-		XMLPortObject(Dialog, Answer, "Answers", addAnswer, getAnswer, xmlelement, mode);
+		XMLPortObject(Dialog, Question, "questions", addQuestion, getQuestion, xmlelement, mode);
+		XMLPortObject(Dialog, Answer, "answers", addAnswer, getAnswer, xmlelement, mode);
 	}
 
@@ -79,10 +79,11 @@
 	}
 
-	std::vector<std::string> Dialog::getAnswers() // returned vector mit allen momentanen AntwortenIds
+	std::vector<std::string>* Dialog::getAnswerIds() // returned vector mit allen momentanen AntwortenIds
 	{
-
+		
 		Question* question = (this->questions_.find(this->currentQuestionId_))->second;
-		std::vector<std::string> answers = question->getAnswerIds();
+		std::vector<std::string>* answers = question->getAnswerIds();
 		return answers;
+		
 	} 
 	
@@ -90,8 +91,13 @@
     {  
     	DialogManager& m = DialogManager::getInstance();
-    	m.setDialog(this);
-    	orxout() << "dialog executed \n"; 
-        OrxonoxOverlay::showOverlay("Dialog");
-
+    	
+    	if(questions_.count(this->currentQuestionId_)){
+    		m.setDialog(this);
+    		OrxonoxOverlay::showOverlay("Dialog");
+    	}
+    	else {
+    		orxout() << "no start defined " << endl;
+    	}
+    	
         return false;
     }
@@ -106,7 +112,5 @@
     {
     	bool end = false;
-    	if (this->currentQuestionId_ == "end"){
-    		end = true;
-    	} else if ((this->questions_.find(this->currentQuestionId_)->second)->getAnswerIds().empty()){
+    	if ((this->questions_.find(this->currentQuestionId_)->second)->getAnswerIds()->empty()){
     		end = true;
     	}	
@@ -118,3 +122,8 @@
 		return this->questions_.find(this->currentQuestionId_)->second->getQuestion();
 	}
+
+	std::string Dialog::getAnswerString(std::string answerId)
+	{
+		return this->answers_.find(answerId)->second->getAnswer();
+	}
 }
Index: code/branches/Dialog_HS17/src/modules/dialog/Dialog.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Dialog.h	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/Dialog.h	(revision 11642)
@@ -35,5 +35,5 @@
 			Question* getQuestion(unsigned int index) const; // // benoetigt fuer xmlPort
 			Answer* getAnswer(unsigned int index) const; // benoetigt fuer xmlPort
-			std::vector<std::string> getAnswers(); 	// returned vector mit allen momentanen AntwortenIds
+			std::vector<std::string>* getAnswerIds(); 	// returned vector mit allen momentanen AntwortenIds
 
 	 		bool execute(bool bTriggered, BaseObject* trigger);
@@ -44,4 +44,5 @@
 
 			std::string getQuestionString(); //gibt string der momentanen Frage 
+			std::string getAnswerString(std::string answerId); //gibt string der zur Id passenden Frage
 
 		private: 
Index: code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc	(revision 11642)
@@ -16,5 +16,6 @@
 	void DialogManager::setDialog(Dialog* dialog)
 	{
-		this->currentTalk_ = dialog;	
+		this->currentTalk_ = dialog;
+		answerIds_ = currentTalk_->getAnswerIds();	
 	}
 
@@ -26,10 +27,28 @@
     }
 
-    /*
-    std::vector<std::string> DialogManager::getAnswers()
+    int DialogManager::getSize()
+    {   
+        return 2; //return this->answerIds_->size();
+    }
+
+    std::string DialogManager::getAnswer(int index)
     {
-    	// lua hat komisch arrays (eigentlich tables), wie implementiert man answers so das man nacher den key der gegeben antwort a
-    	// hat um ihn fuer update zu benutzen?
+    	return this->currentTalk_->getAnswerString(this->answerIds_->at(index));
     }
-	*/
+	
+    std::string DialogManager::getPerson()
+    {
+    	return this->currentTalk_->getName();
+    }
+
+    bool DialogManager::endtest()
+    {
+    	return this->currentTalk_->ending();
+    }
+
+    void DialogManager::update(int index)
+    {
+    	this->currentTalk_->update(answerIds_->at(index));
+    	answerIds_ = this->currentTalk_->getAnswerIds();
+    }
 }
Index: code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h	(revision 11642)
@@ -30,5 +30,9 @@
 
         std::string getQuestion(); //tolua_export
-        //std::vector<std::string> getAnswers();
+        int getSize(); //tolua_export
+        std::string getAnswer(int index); //tolua_export
+        std::string getPerson(); //tolua_export
+        bool endtest(); //tolua_export
+        void update(int index); //tolua_export
 
 private:
@@ -36,4 +40,5 @@
 
     Dialog* currentTalk_;
+    std::vector<std::string>* answerIds_;
 
     };//tolua_export
Index: code/branches/Dialog_HS17/src/modules/dialog/Question.cc
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Question.cc	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/Question.cc	(revision 11642)
@@ -19,5 +19,5 @@
 		XMLPortParam(Question, "Id", setQuestionId, getQuestionId, xmlement, mode);
 
-		XMLPortObject(Question, AnswerId, "answers", addAnswerId, getAnswerId, xmlement, mode);
+		XMLPortObject(Question, AnswerId, "answerIds", addAnswerId, getAnswerId, xmlement, mode);
 	}
 
@@ -52,7 +52,7 @@
 	}
 
-	std::vector<std::string> Question::getAnswerIds()
+	std::vector<std::string>* Question::getAnswerIds()
 	{
-		return this->answerIds_;
+		return &(this->answerIds_);
 	}
 	
Index: code/branches/Dialog_HS17/src/modules/dialog/Question.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Question.h	(revision 11641)
+++ code/branches/Dialog_HS17/src/modules/dialog/Question.h	(revision 11642)
@@ -33,5 +33,5 @@
 			// die sowieso gebraucht wird?
 
-			std::vector<std::string> getAnswerIds(); //returnt vektor mit allen Ids
+			std::vector<std::string>* getAnswerIds(); //returnt vektor mit allen Ids
 
 
