Changeset 11644 for code/branches/Dialog_HS17/data
- Timestamp:
- Dec 8, 2017, 2:55:15 PM (7 years ago)
- Location:
- code/branches/Dialog_HS17/data
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialog_HS17/data/gui/layouts/Dialog.layout
r11642 r11644 31 31 </Window> 32 32 33 <Window Type="MenuWidgets/StaticText" Name="orxonox/DialogAns" > 34 <Property Name="InheritsAlpha" Value="False" /> 35 <Property Name="HorzFormatting" Value="HorzCentred" /> 33 <Window Type="MenuWidgets/Listbox" Name="orxonox/AnsListbox" > 36 34 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 37 <Property Name="VertFormatting" Value="TopAligned" /> 38 <Property Name="UnifiedAreaRect" Value="{{0.604166,0},{0.15,0},{0.958333,0},{0.636,0}}" /> 39 <Window Type="MenuWidgets/Listbox" Name="orxonox/AnsListbox" > 40 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 41 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.225,0},{0.95,0},{0.92,0}}" /> 42 <Event Name="ItemSelectionChanged" Function="Dialog.answer_changed" /> 43 </Window> 35 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.225,0},{0.95,0},{0.85,0}}" /> 36 <Event Name="ItemSelectionChanged" Function="Dialog.answer_changed" /> 44 37 </Window> 38 45 39 <Window Type="MenuWidgets/Button" Name="orxonox/SayButton" > 46 40 <Property Name="Text" Value="Say" /> -
code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua
r11642 r11644 6 6 P.detailsWindows = {} 7 7 P.showing = false 8 P.choice = 0 8 9 9 -- Design parameters 10 P.imageHeight = 50 11 P.detailImageSize = 100 12 P.textHeight = 50 13 P.buttonWidth = 50 14 15 function P.onLoad() 10 function P.onLoad() --wird ausgefuert wenn Fenster geladen 16 11 P.wrapper = nil 17 12 end 18 13 19 function P.onShow() 14 function P.onShow() --wird ausgefuert wenn Dialogfenster gezeigt 20 15 21 16 orxonox.CommandExecutor:execute("setTimeFactor 0") … … 25 20 end 26 21 27 function P.onHide() 22 function P.onHide() --aufgefuert wenn Fenster geschlossen wird 28 23 orxonox.CommandExecutor:execute("setTimeFactor 1") 29 24 P.showing = false … … 31 26 end 32 27 33 function P.createDialog() 28 function P.createDialog() -- initiallisiert das Dialog Fenster, setzt Namen sowie die erste Frage mit enstprechenden Antworten 34 29 35 30 local manager = orxonox.DialogManager:getInstance() … … 44 39 questionfiled:setText(question) 45 40 46 listboxwindow = winMgr:getWindow("orxonox/AnsListbox") 41 local listboxwindow = winMgr:getWindow("orxonox/AnsListbox") 42 CEGUI.toListbox(listboxwindow):resetList() 47 43 48 local themeList = {} 49 --[[ 50 table.insert(themeList, "Default") 51 table.insert(themeList, "Drum n' Bass") 52 table.insert(themeList, "8-Bit Style") 53 table.insert(themeList, "Corny Jazz") 54 table.insert(themeList, "Metal") 55 --]] 44 local ansList = {} 56 45 local anssize = manager:getSize() 57 46 58 47 for index = 0, anssize -1, 1 do 59 table.insert( themeList, manager:getAnswer(index))48 table.insert(ansList, manager:getAnswer(index)) 60 49 end 61 50 62 for k,v in pairs( themeList) do51 for k,v in pairs(ansList) do 63 52 item = CEGUI.createListboxTextItem(v) 64 53 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") … … 67 56 end 68 57 69 function P.updateDialog() 58 function P.updateDialog() --updated den Dialog entsprechend der Ausgeaehlten option der letzten Frage, setzt Frage und Antwortmoeglichkeiten neu 70 59 local manager = orxonox.DialogManager:getInstance() 71 --manager:update()60 manager:update(P.choice) 72 61 73 62 local questionfiled = winMgr:getWindow("orxonox/Dialog/Question") 74 63 local question = manager:getQuestion() 75 64 questionfiled:setText(question) 65 66 local listboxwindow = winMgr:getWindow("orxonox/AnsListbox") 67 listboxwindow:resetList() 68 69 local ansList = {} 70 local anssize = manager:getSize() 71 72 for index = 0, anssize -1, 1 do 73 table.insert(ansList, manager:getAnswer(index)) 74 end 75 76 for k,v in pairs(ansList) do 77 item = CEGUI.createListboxTextItem(v) 78 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 79 CEGUI.toListbox(listboxwindow):addItem(item) 80 end 81 82 P.choice = 0 76 83 end 77 84 78 function P.answer_changed(e) 79 -- body 85 function P.answer_changed(e) --wird aufgerufen falls Auswahl geaendert wird und setzt enstprechenden Indexparameter 86 listboxwindow = winMgr:getWindow("orxonox/AnsListbox") 87 selection = listboxwindow:getFirstSelectedItem() 88 if selection ~= nil then 89 P.choice = listboxwindow:getItemIndex(selection) 90 else 91 P.choice = 0 92 end 80 93 end 81 94 82 95 83 function P.cleanup(destroyDetails) 84 96 function P.cleanup(destroyDetails) --loest Fenster wieder auf (!nicht selbst geschrieben, nur uebernommen, eventuell nicht noetiger code) 97 85 98 if P.wrapper ~= nil then 86 99 winMgr:destroyWindow(P.wrapper) … … 101 114 102 115 103 function P.Button_clicked(e) 104 local ending = orxonox.DialogManager:getInstance():endtest() 105 orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog") 116 function P.Button_clicked(e) --wird bei click auf say knopf ausgeloest, entscheidet ob Dialog schliesst oder updated und fuert entsprechen aus 117 local ending = orxonox.DialogManager:getInstance():endtest(P.choice) 106 118 107 119 if ending then 108 120 orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog") 109 110 111 121 else 112 122 P.updateDialog(index) -
code/branches/Dialog_HS17/data/levels/DialogueShowcase2.oxw
r11642 r11644 1 1 <LevelInfo 2 name = "Dialog ueShowcase2"2 name = "DialogShowase" 3 3 description = "A level to show and test the functionality of the Dialogue module." 4 4 tags = "test" … … 32 32 <Backlight position="100,0,100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/> 33 33 34 <Dialog name="Kurt" currentQuestionId="loop ">34 <Dialog name="Kurt" currentQuestionId="loop1"> 35 35 <questions> 36 <Question question="Soll ich dich loopen?" Id="loop">36 <Question question="Soll ich dich einmal loopen?" Id="loop1"> 37 37 <answerIds> 38 38 <AnswerId Id="ja"/> 39 39 <AnswerId Id="nein"/> 40 <AnswerId Id="giveItToMe"/> 41 </answerIds> 42 </Question> 43 <Question question="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua." Id="lorem"> 44 <answerIds> 45 <AnswerId Id="end"/> 46 </answerIds> 47 </Question> 48 <Question question="Soll ich dich nochmal loopen?" Id="loop2"> 49 <answerIds> 50 <AnswerId Id="ja"/> 51 <AnswerId Id="nein"/> 52 <AnswerId Id="end"/> 40 53 </answerIds> 41 54 </Question> … … 43 56 </questions> 44 57 <answers> 45 <Answer Id="ja" answer="ja loop mich" nextQuestionId="loop"/> 58 <Answer Id="giveItToMe" answer="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." nextQuestionId="lorem"/> 59 <Answer Id="ja" answer="ja loop mich" nextQuestionId="loop2"/> 46 60 <Answer Id="nein" answer="lieber nicht" nextQuestionId="ok"/> 61 <Answer Id="end" answer="ich geh dann mal" nextQuestionId=""/> 47 62 </answers> 48 63 <events> … … 52 67 </events> 53 68 </Dialog> 54 55 <DistanceTrigger name="test1" position="100,0,-100" target="Pawn" distance=25 stayActive="true" />56 <Backlight position="100,0,-100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,1,1"/>57 69 58 <NextQuestion question="Hey, sorry to bother you, could you help me with something?" a1="Yeah sure." a2="Nope get lost." >59 <possibleQuestions>60 <NextQuestion question="Do you like fish" a1="...yes?" a2="This is wasting my time." >61 <possibleQuestions>62 <NextQuestion question="Splendid! Would you like your ship to look like one?" a1="..." a2="I'm going now, okay?" />63 <NextQuestion question="Turtles then?" a1="..." a2="Im going now, okay?" />64 </possibleQuestions>65 </NextQuestion>66 <NextQuestion question="I can pay you know." a1="Got enough money." a2="...are you deaf? Bye."/>67 </possibleQuestions>68 <events>69 <execute>70 <EventListener event="test1" />71 </execute>72 </events>73 </NextQuestion>74 75 76 77 70 <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"/> 78 71 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
Note: See TracChangeset
for help on using the changeset viewer.