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/gui
Files:
2 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)
Note: See TracChangeset for help on using the changeset viewer.