Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8890 for code/branches


Ignore:
Timestamp:
Oct 12, 2011, 4:04:35 PM (13 years ago)
Author:
baermatt
Message:

First steps with lua, CEGUI and the Singleplayer menu.

Location:
code/branches/menue/data/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/menue/data/gui/layouts/SingleplayerMenu.layout

    r7648 r8890  
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    1717            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
    18             <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
     18            <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" >
     19                <Property Name="TabHeight" Value="{0,26.4388}" />
    1920                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    20                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
    21             </Window>
    22             <Window Type="MenuWidgets/Checkbox" Name="orxonox/SingleplayerShowAllCheckbox" >
    23                 <Property Name="Text" Value="show all" />
    24                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    25                 <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.87,0},{0.8,0},{.97,0}}" />
    26                 <Event Name="CheckStateChanged" Function="SingleplayerMenu.SingleplayerShowAll_clicked"/>
     21                <Property Name="TabPanePosition" Value="Top" />
     22                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
     23                                <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
     24                    <Property Name="Text" Value="Show All" />
     25                                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     26                                        <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
     27                                </Window>
     28                                <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListboxx" >
     29                    <Property Name="Text" Value="Tests" />
     30                                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     31                                        <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
     32                                </Window>
    2733            </Window>
    2834        </Window>
  • code/branches/menue/data/gui/scripts/SingleplayerMenu.lua

    r8706 r8890  
    55P.levelList = {}
    66P.itemList = {}
    7 P.showAll = false
    87
    98function P.onLoad()
    10     local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
    11     local button = tolua.cast(window,"CEGUI::Checkbox")
    12     button:setSelected(false)
    13     P.createLevelList()
     9    P.createLevelList(nil)
    1410
    1511    --buttons are arranged in a 1x2 matrix
     
    2521end
    2622
    27 function P.onShow()
    28     if P.showAll ~= orxonox.GUIManager:inDevMode() then
    29         local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
    30         local button = tolua.cast(window,"CEGUI::Checkbox")
    31         P.showAll = not P.showAll
    32         button:setSelected(P.showAll)
    33         P.createLevelList()
    34     end
    35 end
    36 
    37 function P.createLevelList()
     23function P.createLevelList(tag)
    3824    P.levelList = {}
    3925    P.itemList = {}
     
    4834        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    4935        if level ~= nil then
    50             if P.showAll or not level:hasTag("test") then
     36            if tag == nil then
     37                table.insert(P.levelList, level)
     38            elseif level:hasTag(tag) then
    5139                table.insert(P.levelList, level)
    5240            end
     
    8068end
    8169
    82 function P.SingleplayerShowAll_clicked(e)
    83     local checkbox = tolua.cast(winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox"), "CEGUI::Checkbox")
    84     local show = checkbox:isSelected()
    85     if show ~= P.showAll then
    86         P.showAll = show
    87         P.createLevelList()
    88    end
    89 end
    90 
    9170function P.SingleplayerBackButton_clicked(e)
    9271    hideMenuSheet(P.name)
Note: See TracChangeset for help on using the changeset viewer.