Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9201


Ignore:
Timestamp:
May 18, 2012, 3:09:07 PM (13 years ago)
Author:
huttemat
Message:

many bugfixes, code cleanup, documentation

Location:
code/branches/shipSelection
Files:
5 edited

Legend:

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

    r9074 r9201  
    1717            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1818            <Property Name="VertFormatting" Value="TopAligned" />
    19             <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" />
     19            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" /> 
    2020            <Window Type="MenuWidgets/TabControl" Name="orxonox/ShipSelectionTabControl" >
    2121                <Property Name="TabHeight" Value="{0,26.4388}" />
    2222                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    2323                <Property Name="TabPanePosition" Value="Top" />
    24                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
     24                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
     25               
    2526            </Window>   
    26             <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionLevelImage" >
     27           
     28            <!-- TODO: Ship Description and Image
     29            <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionShipImage" >
    2730                <Property Name="AlwaysOnTop" Value="True" />
    2831                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     
    3538                <Property Name="HorzScrollbar" Value="True" />
    3639                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.725,0},{0.9,0},{0.875,0}}" />
    37             </Window>
     40            </Window>-->
    3841                 
    3942        </Window>
     
    4447            <Event Name="Clicked" Function="ShipSelectionMenu.ShipSelectionStartButton_clicked"/>
    4548        </Window>
    46         <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionConfigButton" >
     49        <!-- TODO: set ship properties
     50        <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionConfigButton" >
    4751            <Property Name="Text" Value="Configure" />
    4852            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     
    5054            <Property Name="Disabled" Value="True" />
    5155            <Event Name="Clicked" Function="ShipSelectionMenu.ShipSelectionConfigButton_clicked"/>
    52         </Window>
     56        </Window> -->
    5357        <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionBackButton" >
    5458            <Property Name="Text" Value="Back" />
  • code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua

    r9157 r9201  
    66P.shipList = {}
    77function P.onLoad()
    8    --orxonox.execute("orxout user_warning Ships= " .. selectedlevel:hasShip("abcdef"))
    98   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.
    109   os.execute(dircmd .. " > ../levels/templates/.shipmodels") --saves output in a textfile
    11    --[[ Program a Windows Version here:
     10   --[[TODO: program a Windows Version / platform independent version here:
    1211   if string.sub(package.config,1,1) == '\\' then
    1312           -- Windows
    1413           dircmd = "dir /b/s"
    1514   end]]       
     15   P.createFilterTab("All Ships")   
     16end
    1617
     18function P.createShipList() --generates list with tagged shipmodels
    1719   P.shipList = {}
    18    for line in io.lines("../levels/templates/.shipmodels") do 
     20   for line in io.lines("../levels/templates/.shipmodels") do  --checks if shipmodel is included in level file
    1921        if selectedlevel:hasShip(string.lower(line)) then
    2022                P.shipList[#P.shipList+1] = string.lower(line)
    2123        end
    22    end
    23    P.createFilterTab("Show All")
    24 
     24   end 
    2525end
    2626
    27 function P.createShipList()
    28        
    29 
    30 end
    31 
    32 
    33 
    34 function P.createFilterTab(name)
    35 
    36     local tabName = "orxonox/ShipSelectionLevelTab"
    37     -- create new tab window with desired name
    38     local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
    39     listbox:setText(name)
    40     listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
    41     listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
    42     -- fill listbox with items
     27function P.update() --updates listbox with found models
     28    P.createShipList()
    4329    listbox:resetList()
    44     orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    45     local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
     30    --orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    4631    local tabIndexes = {}
    4732    for k,v in pairs(P.shipList) do
    48         -- only add level if it has desired tag
     33        --TODO: only add ship if is in the right filter tab
    4934        --if tag == nil or v:hasShip(tag) then
    5035            local item = CEGUI.createListboxTextItem(v)
     
    5237            listbox:addItem(item)
    5338            table.insert(tabIndexes, k)
    54             --[[if v:getXMLFilename() == preselect then
    55                 listbox:setItemSelectState(item, true)
    56             end--]]
    5739            --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())
    5840        --end
    5941    end
    6042    table.insert(P.activeTabIndexes, tabIndexes)
     43end
     44
     45function P.createFilterTab(name) -- generates filter tab and list box, sets handler for selection changes
     46    tabName = "orxonox/ShipSelectionLevelTab"
     47    -- create new tab window with desired name
     48    listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
     49    listbox:setText(name)
     50    listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
     51    --[[TODO: smaller list if image and description is implemented.
     52        listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]     
     53    listbox:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
     54    -- fill listbox with items
     55    P.update()
    6156    -- listen to selection changes
    6257    orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".ShipSelectionSelectionChanged")
     
    6863end
    6964
    70 function P.ShipSelectionGetSelectedModel()
     65function P.ShipSelectionGetSelectedModel() --returns selected model, if available.
    7166    -- choose the active listbox
    7267    local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/ShipSelectionTabControl"))
     
    8479
    8580function P.ShipSelectionSelectionChanged(e)
     81    --[[ TODO: Get image and description from template file
    8682    local levelImage = winMgr:getWindow("orxonox/ShipSelectionLevelImage")
    8783    local levelDescription = winMgr:getWindow("orxonox/ShipSelectionLevelDescription")
     
    104100        levelImage:setProperty("Image", nil)
    105101        levelDescription:setText("")
    106         configButton:setProperty("Disabled", "True")
    107102    end
     103   --]]
    108104end
    109105
    110106function P.ShipSelectionStartButton_clicked(e)
    111107
    112     if selectedlevel ~= nil then
     108    if (selectedlevel ~= nil and P.ShipSelectionGetSelectedModel() ~= nil) then
    113109        selectedlevel:selectShip(P.ShipSelectionGetSelectedModel())
    114110        orxonox.execute("startGame " .. "_temp.oxw")
    115111        hideAllMenuSheets()
    116112    else
    117         orxonox.execute("keyESC")
     113        orxonox.execute("orxout user_warning no ship model selected or no tagged shipmodel installed")
    118114    end
    119115end
    120116
    121 function P.ShipSelectionConfigButton_clicked(e)
    122 --[[
     117--[[ TODO: function P.ShipSelectionConfigButton_clicked(e)
     118
    123119    local level = P.ShipSelectionGetSelectedModel()
    124120    if level ~= nil then
     
    126122        configMenu:loadConfig(level)
    127123    end
     124end
    128125--]]
    129 end
     126
    130127
    131128function P.ShipSelectionBackButton_clicked(e)
    132     --hideAllMenuSheets()
    133129    orxonox.execute("keyESC")
    134130end
  • code/branches/shipSelection/data/gui/scripts/SingleplayerMenu.lua

    r9127 r9201  
    147147        if selectedlevel:hasTag("shipselection") then
    148148            local shipSelectionMenu = showMenuSheet("ShipSelectionMenu", true)
    149             shipSelectionMenu:createShipList()
     149            shipSelectionMenu:update()
    150150        else
    151151            orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
  • code/branches/shipSelection/data/levels/tutorial.oxw

    r9185 r9201  
    44 tags = "tutorial, shipselection"
    55 screenshot = "codingtutorial.png"
    6  startingships = "spaceshipassff, spaceshipghost, spaceshipspacecruiser,spaceshippirate"
     6 startingships = "spaceshipassff, spaceshipghost, spaceshipspacecruiser"
    77/>
    88
     
    1414  include("templates/spaceshipSpacecruiser.oxt")
    1515  include("templates/lodInformation.oxt")
    16   include("templates/spaceshipPirate.oxt")
    1716?>
    1817
     
    2726   skybox       = "Orxonox/skypanoramagen1"
    2827  >
    29 
    30 
    31 
    32 
    3328<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
    3429  <attached>
  • code/branches/shipSelection/src/orxonox/ShipManager.cc

    r9157 r9201  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
    24  *   Co-authors:
    25  *      Damian 'Mozork' Frick
    26  *
     23 *      Matthias Hutter
     24 *   
    2725 */
    2826
    2927/**
    30     @file LevelManager.cc
    31     @brief Implementation of the LevelManager singleton.
     28    @file ShipManager.cc
     29    @brief Work-in Progress: Implementation of the ShipManager singleton.
     30           Should make SpaceShip info available to lua handlers.
    3231*/
    3332
Note: See TracChangeset for help on using the changeset viewer.