Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9074


Ignore:
Timestamp:
Mar 30, 2012, 4:28:52 PM (13 years ago)
Author:
huttemat
Message:

test

Location:
code/branches/shipSelection/data/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shipSelection/data/gui/layouts/ShipSelectionMenu.layout

    r9045 r9074  
    1818            <Property Name="VertFormatting" Value="TopAligned" />
    1919            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" />
    20                 <!--
    2120            <Window Type="MenuWidgets/TabControl" Name="orxonox/ShipSelectionTabControl" >
    2221                <Property Name="TabHeight" Value="{0,26.4388}" />
     
    2423                <Property Name="TabPanePosition" Value="Top" />
    2524                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
    26             </Window>
    27                 -->
     25            </Window>   
    2826            <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionLevelImage" >
    2927                <Property Name="AlwaysOnTop" Value="True" />
     
    4038                 
    4139        </Window>
    42         <!-- -->
    4340        <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionStartButton" >
    4441            <Property Name="Text" Value="Start" />
  • code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua

    r9057 r9074  
    44P.activeTabIndexes = {}
    55P.scrollbarWidth = 13
     6P.shipList = {}
     7function P.onLoad()
     8   --orxonox.execute("orxout internal_warning Ships= " .. selectedlevel:hasShip("abcdef"))
     9   local dircmd = "ls ../levels/templates/ -l | awk '{print $9}' | grep \"spaceship\" | sed -e 's/\\.[a-zA-Z]*$//'" -- go to spaceships folder and generate a list of installed shipmodels.
     10   os.execute(dircmd .. " > ../levels/templates/.shipmodels") --saves output in a textfile
     11   --[[ Program a Windows Version here:
     12   if string.sub(package.config,1,1) == '\\' then
     13           -- Windows
     14           dircmd = "dir /b/s"
     15   end]]       
    616
    7 function P.onLoad()
    8    orxonox.execute("orxout internal_warning Ships= " .. selectedlevel.getShips())
    9    P.createLevelList(selectedlevel)
    10 --[[     
    11     -- create tabs with desired tab as argument (nil for all)
    12     P.createFilterTab("Gametypes", "gametype")
    13     P.createFilterTab("Missions", "mission")
    14     P.createFilterTab("Minigames", "minigame")
    15     P.createFilterTab("Showcases", "showcase")
    16     P.createFilterTab("Presentations", "presentation")
    17     P.createFilterTab("Tests", "test")
    18     P.createFilterTab("Show All", nil)
    19    
    20     -- update description and screenshot boxes
    21     P.ShipSelectionSelectionChanged()
    22    
    23     --buttons are arranged in a 1x3 matrix
    24     P:setButton(1, 1, {
    25             ["button"] = winMgr:getWindow("orxonox/ShipSelectionStartButton"),
    26             ["callback"]  = P.ShipSelectionStartButton_clicked
    27     })
    28 
    29     P:setButton(1, 2, {
    30             ["button"] = winMgr:getWindow("orxonox/ShipSelectionConfigButton"),
    31             ["callback"]  = P.ShipSelectionConfigButton_clicked
    32     })
    33 
    34     P:setButton(1, 3, {
    35             ["button"] = winMgr:getWindow("orxonox/ShipSelectionBackButton"),
    36             ["callback"]  = P.ShipSelectionBackButton_clicked
    37     })--]]
     17   P.shipList = {}
     18   --[[for f in io.lines("../levels/templates/.shipmodels") do
     19        if selectedlevel:hasShip(f) then
     20            P.shipList[#P.shipList+1] = f
     21            table.insert(P.shipList, f)
     22        end
     23    end--]]
     24    P.shipList[1]="spaceshipAssff"
     25    P.shipList[2]="spaceshipGhost"
     26    P.shipList[3]="spaceshipPirate"
     27    P.createFilterTab("Show All")
     28    --[[list = winMgr:createWindow("MenuWidgets/Listbox", "listbox")
     29    item = CEGUI.createListboxTextItem("Text")
     30    CEGUI.toListbox(list):addItem(item)
     31    list:enable()--]]
    3832end
    3933
    40 function P.createShipList(level)
     34function P.createShipList()
     35       
    4136
    42     orxonox.execute("orxout internal_warning Ships= " .. selectedlevel:getShips())
    43     --local stream = selectedlevel:getShips()
    44     --local substr = stream
    45     --while substr.find(",")
    46     --[[
    47     local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
    48     local index = 0
    49     local level = nil
    50     while index < size do
    51         level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    52         if level ~= nil then
    53             local levelXMLFilename = level:getXMLFilename()
    54             -- create an imageset for each screenshot
    55             local imageName = level:getScreenshot()
    56             if imageName ~= "" then
    57                 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, imageName)
    58             else
    59                 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
    60             end
    61             table.insert(P.levelList, level)
    62         end
    63         index = index + 1
    64     end--]]
    6537end
    6638
    6739
    6840
    69 function P.createFilterTab(name, tag)
     41function P.createFilterTab(name)
     42
     43 --[[-- create unique tab window name
     44    orxonox.execute("orxout user_warning test")
     45    local tabName = "orxonox/SchipSelectionLevelTab"
     46    -- create new tab window with desired name
     47    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
     48    listbox:setText(name)
     49    listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
     50    listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
     51    -- fill listbox with items
     52    listbox:resetList()
     53    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
     54    local preselect = "spaceshipAssff"
     55    local tabIndexes = {}
     56    for k,v in pairs(P.shipList) do
     57    --for i = 1 ,#P.shipList,1 do
     58        -- only add level if it has desired tag
     59         --if v:hasShip(Ship) then
     60            local item = CEGUI.createListboxTextItem("asbsergse")
     61            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     62            listbox:addItem(item)
     63            table.insert(tabIndexes, k)
     64            if v:getXMLFilename() == preselect then
     65                listbox:setItemSelectState(item, true)
     66            end
     67            --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())
     68       -- end
     69    end
     70    table.insert(P.activeTabIndexes, tabIndexes)
     71    -- listen to selection changes
     72    orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged")
     73    local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")
     74    orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged")
     75    if listbox:getItemCount() > 0 then
     76        tabControl:addChildWindow(tabName)
     77    end--]]
    7078    -- create unique tab window name
     79
    7180    local tabName = "orxonox/ShipSelectionLevelTab"
    72     if tag ~= nil then
    73         tabName = tabName..tag
    74     end
    7581    -- create new tab window with desired name
    7682    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
     
    8389    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    8490    local tabIndexes = {}
    85     for k,v in pairs(P.levelList) do
     91    for k,v in pairs(P.shipList) do
    8692        -- only add level if it has desired tag
    87         if tag == nil or v:hasTag(tag) then
    88             local item = CEGUI.createListboxTextItem(v:getName())
     93        --if tag == nil or v:hasShip(tag) then
     94            local item = CEGUI.createListboxTextItem(v)
    8995            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    9096            listbox:addItem(item)
    9197            table.insert(tabIndexes, k)
    92             if v:getXMLFilename() == preselect then
     98            --[[if v:getXMLFilename() == preselect then
    9399                listbox:setItemSelectState(item, true)
    94             end
    95             orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())
    96         end
     100            end--]]
     101            --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())
     102        --end
    97103    end
    98104    table.insert(P.activeTabIndexes, tabIndexes)
     
    148154function P.ShipSelectionStartButton_clicked(e)
    149155
    150     if P.level ~= nil then
    151         orxonox.execute("startGame " .. level:getXMLFilename())
     156    if selectedlevel ~= nil then
     157        orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
    152158        hideAllMenuSheets()
    153159    else
     
    167173
    168174function P.ShipSelectionBackButton_clicked(e)
     175    --hideAllMenuSheets()
    169176    orxonox.execute("keyESC")
    170177end
  • code/branches/shipSelection/data/gui/scripts/SingleplayerMenu.lua

    r9057 r9074  
    146146        if selectedlevel:hasTag("shipselection") then
    147147            local shipSelectionMenu = showMenuSheet("ShipSelectionMenu", true)
     148            shipSelectionMenu:createShipList()
    148149        else
    149150            orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
Note: See TracChangeset for help on using the changeset viewer.