Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2017, 2:55:15 PM (7 years ago)
Author:
kuchlert
Message:

eigentlich fertig nur noch altes system entfernen

Location:
code/branches/Dialog_HS17/data
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialog_HS17/data/gui/layouts/Dialog.layout

    r11642 r11644  
    3131            </Window>
    3232
    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" >
    3634                <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" />
    4437            </Window>
     38       
    4539            <Window Type="MenuWidgets/Button" Name="orxonox/SayButton" >
    4640                <Property Name="Text" Value="Say" />
  • code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua

    r11642 r11644  
    66P.detailsWindows = {}
    77P.showing = false
     8P.choice = 0
    89
    9 -- Design parameters
    10 P.imageHeight = 50
    11 P.detailImageSize = 100
    12 P.textHeight = 50
    13 P.buttonWidth = 50
    14 
    15 function P.onLoad()
     10function P.onLoad() --wird ausgefuert wenn Fenster geladen
    1611    P.wrapper = nil
    1712end
    1813
    19 function P.onShow()
     14function P.onShow() --wird ausgefuert wenn Dialogfenster gezeigt
    2015
    2116    orxonox.CommandExecutor:execute("setTimeFactor 0")
     
    2520end
    2621
    27 function P.onHide()
     22function P.onHide() --aufgefuert wenn Fenster geschlossen wird
    2823    orxonox.CommandExecutor:execute("setTimeFactor 1")
    2924    P.showing = false
     
    3126end
    3227
    33 function P.createDialog()
     28function P.createDialog() -- initiallisiert das Dialog Fenster, setzt Namen sowie die erste Frage mit enstprechenden Antworten
    3429
    3530    local manager = orxonox.DialogManager:getInstance()
     
    4439    questionfiled:setText(question)
    4540
    46     listboxwindow = winMgr:getWindow("orxonox/AnsListbox")
     41    local listboxwindow = winMgr:getWindow("orxonox/AnsListbox")
     42    CEGUI.toListbox(listboxwindow):resetList()
    4743
    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 = {}
    5645    local anssize = manager:getSize()
    5746
    5847    for index = 0, anssize -1, 1 do
    59         table.insert(themeList, manager:getAnswer(index))
     48        table.insert(ansList, manager:getAnswer(index))
    6049    end 
    6150
    62     for k,v in pairs(themeList) do
     51    for k,v in pairs(ansList) do
    6352        item = CEGUI.createListboxTextItem(v)
    6453        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     
    6756end
    6857
    69 function P.updateDialog()
     58function P.updateDialog()   --updated den Dialog entsprechend der Ausgeaehlten option der letzten Frage, setzt Frage und Antwortmoeglichkeiten neu
    7059    local manager = orxonox.DialogManager:getInstance()
    71     --manager:update()
     60    manager:update(P.choice)
    7261
    7362    local questionfiled = winMgr:getWindow("orxonox/Dialog/Question")
    7463    local question = manager:getQuestion()
    7564    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
    7683end
    7784
    78 function P.answer_changed(e)
    79     -- body
     85function 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
    8093end
    8194
    8295
    83 function P.cleanup(destroyDetails)
    84    
     96function P.cleanup(destroyDetails)  --loest Fenster wieder auf (!nicht selbst geschrieben, nur uebernommen, eventuell nicht noetiger code)
     97
    8598    if P.wrapper ~= nil then
    8699        winMgr:destroyWindow(P.wrapper)
     
    101114
    102115
    103 function P.Button_clicked(e)
    104     local ending = orxonox.DialogManager:getInstance():endtest()
    105     orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
     116function 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)
    106118   
    107119    if ending then
    108120        orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
    109    
    110    
    111121    else
    112122        P.updateDialog(index)
  • code/branches/Dialog_HS17/data/levels/DialogueShowcase2.oxw

    r11642 r11644  
    11<LevelInfo
    2  name = "DialogueShowcase2"
     2 name = "DialogShowase"
    33 description = "A level to show and test the functionality of the Dialogue module."
    44 tags = "test"
     
    3232    <Backlight position="100,0,100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/>
    3333   
    34     <Dialog name="Kurt" currentQuestionId="loop">
     34    <Dialog name="Kurt" currentQuestionId="loop1">
    3535      <questions>
    36         <Question question="Soll ich dich loopen?" Id="loop">
     36        <Question question="Soll ich dich einmal loopen?" Id="loop1">
    3737          <answerIds>
    3838            <AnswerId Id="ja"/>
    3939            <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"/>
    4053          </answerIds>
    4154        </Question>
     
    4356      </questions>
    4457      <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"/>
    4660        <Answer Id="nein" answer="lieber nicht" nextQuestionId="ok"/>
     61        <Answer Id="end" answer="ich geh dann mal" nextQuestionId=""/>
    4762      </answers>
    4863      <events>
     
    5267      </events>
    5368    </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"/>
    5769   
    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 
    7770    <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"/>
    7871    <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.