Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7648 for code/trunk/data/gui


Ignore:
Timestamp:
Nov 13, 2010, 11:55:23 PM (13 years ago)
Author:
dafrick
Message:

Merged releasetodo, containing a new way to describe and tag levels, back to trunk.

Location:
code/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/gui/layouts/MultiplayerMenu.layout

    r7163 r7648  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.6375,0}}" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
    1818            <Window Type="MenuWidgets/Listbox" Name="orxonox/MultiplayerListbox" >
    1919                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     
    2323                <Property Name="Text" Value="Join" />
    2424                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    25                 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.85,0},{0.3,0},{0.95,0}}" />
     25                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.81,0},{0.3,0},{0.89,0}}" />
    2626                <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerJoinButton_clicked"/>
    2727            </Window>
     
    2929                <Property Name="Text" Value="Host" />
    3030                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    31                 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.85,0},{0.6,0},{0.95,0}}" />
     31                <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.81,0},{0.6,0},{0.89,0}}" />
    3232                <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerHostButton_clicked"/>
    3333            </Window>
     
    3535                <Property Name="Text" Value="Dedicated" />
    3636                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    37                 <Property Name="UnifiedAreaRect" Value="{{0.7,0},{0.85,0},{0.9,0},{0.95,0}}" />
     37                <Property Name="UnifiedAreaRect" Value="{{0.7,0},{0.81,0},{0.9,0},{0.89,0}}" />
    3838                <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerDedicatedButton_clicked"/>
     39            </Window>
     40            <Window Type="MenuWidgets/Checkbox" Name="orxonox/MultiplayerShowAllCheckbox" >
     41                <Property Name="Text" Value="show all" />
     42                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     43                <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.89,0},{0.8,0},{0.99,0}}" />
     44                <Property Name="Disabled" Value="True" />
     45                <Event Name="CheckStateChanged" Function="MultiplayerMenu.MultiplayerShowAll_clicked"/>
    3946            </Window>
    4047        </Window>
     
    4249            <Property Name="Text" Value="Start" />
    4350            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    44             <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.6625,0},{0.4875,0},{0.7125,0}}" />
     51            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
    4552            <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerStartButton_clicked"/>
    4653        </Window>
     
    4855            <Property Name="Text" Value="Back" />
    4956            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    50             <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" />
     57            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
    5158            <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerBackButton_clicked"/>
    5259        </Window>
  • code/trunk/data/gui/layouts/SingleplayerMenu.layout

    r6746 r7648  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.6375,0}}" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
    1818            <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
    1919                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    20                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,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"/>
    2127            </Window>
    2228        </Window>
     
    2430            <Property Name="Text" Value="Start" />
    2531            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    26             <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.6625,0},{0.4875,0},{0.7125,0}}" />
     32            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
    2733            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerStartButton_clicked"/>
    2834        </Window>
     
    3036            <Property Name="Text" Value="Back" />
    3137            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    32             <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" />
     38            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
    3339            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
    3440        </Window>
  • code/trunk/data/gui/scripts/MultiplayerMenu.lua

    r7163 r7648  
    22
    33local P = createMenuSheet("MultiplayerMenu")
     4
     5P.levelList = {}
     6P.itemList = {}
     7P.showAll = false
    48
    59function P.onLoad()
     
    1216        local button = tolua.cast(window,"CEGUI::RadioButton")
    1317        button:setSelected(true)
     18        local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     19        checkbox:setProperty("Disabled", "True")
    1420        P.showServerList()
    1521    end
     
    1824        local button = tolua.cast(window,"CEGUI::RadioButton")
    1925        button:setSelected(true)
     26        local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     27        checkbox:setProperty("Disabled", "False")
    2028        P.showLevelList()
    2129    end
     
    2432        local button = tolua.cast(window,"CEGUI::RadioButton")
    2533        button:setSelected(true)
     34        local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     35        checkbox:setProperty("Disabled", "True")
    2636        P.showLevelList()
    2737    end
     
    3040function P.MultiplayerJoinButton_clicked(e)
    3141    P.multiplayerMode = "startClient"
     42    local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     43    checkbox:setProperty("Disabled", "True")
    3244    P.showServerList()
    3345end
     
    3547function P.MultiplayerHostButton_clicked(e)
    3648    P.multiplayerMode = "startServer"
     49    local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     50    checkbox:setProperty("Disabled", "False")
    3751    P.showLevelList()
    3852end
     
    4054function P.MultiplayerDedicatedButton_clicked(e)
    4155    P.multiplayerMode = "startDedicated"
     56    local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
     57    checkbox:setProperty("Disabled", "True")
    4258    P.showLevelList()
     59end
     60
     61function P.MultiplayerShowAll_clicked(e)
     62    local checkbox = tolua.cast(winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox")
     63    local show = checkbox:isSelected()
     64    if show ~= P.showAll then
     65        P.showAll = show
     66        P.createLevelList()
     67    end
    4368end
    4469
     
    6994
    7095function P.showLevelList()
    71     local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
    72     CEGUI.toListbox(listbox):resetList()
     96    P.createLevelList()
     97end
     98
     99function P.createLevelList()
     100    P.levelList = {}
     101    P.itemList = {}
     102    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/MultiplayerListbox"))
     103    listbox:resetList()
     104    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    73105    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    74     orxonox.LevelManager:getInstance():compileAvailableLevelList()
    75     local levelList = {}
     106    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
    76107    local index = 0
    77     local level = ""
    78     while true do
     108    local level = nil
     109    while index < size do
    79110        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    80         if level == "" then
    81             break
     111        if level ~= nil then
     112            if P.showAll or not level:hasTag("test") then
     113                table.insert(P.levelList, level)
     114            end
    82115        end
    83         table.insert(levelList, level)
    84116        index = index + 1
    85117    end
    86     table.sort(levelList)
    87     index = 1
    88     for k,v in pairs(levelList) do
    89         local item = CEGUI.createListboxTextItem(v)
     118    --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename.
     119    --table.sort(levelList)
     120    for k,v in pairs(P.levelList) do
     121        local item = CEGUI.createListboxTextItem(v:getName())
    90122        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    91         item:setID(index)
    92         index = index + 1
    93         CEGUI.toListbox(listbox):addItem(item)
    94         if v .. ".oxw" == preselect then
     123        listbox:addItem(item)
     124        if v:getXMLFilename() == preselect then
    95125            listbox:setItemSelectState(item, true)
    96126        end
     127        P.itemList[k] = listbox:getListboxItemFromIndex(k-1)
     128        orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
    97129    end
    98     end
    99    
     130end
     131
    100132function P.showServerList()
    101133    local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
  • code/trunk/data/gui/scripts/SingleplayerMenu.lua

    r7163 r7648  
    33local P = createMenuSheet("SingleplayerMenu")
    44
     5P.levelList = {}
     6P.itemList = {}
     7P.showAll = false
     8
    59function P.onLoad()
    6     listbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox")
    7     preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    8     orxonox.LevelManager:getInstance():compileAvailableLevelList()
    9     local levelList = {}
     10    local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
     11    local button = tolua.cast(window,"CEGUI::Checkbox")
     12    button:setSelected(false)
     13    P.createLevelList()
     14end
     15
     16function P.createLevelList()
     17    P.levelList = {}
     18    P.itemList = {}
     19    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
     20    listbox:resetList()
     21    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
     22    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
     23    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
    1024    local index = 0
    11     local level = ""
    12     while true do
    13       level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    14       if level == "" then
    15         break
    16       end
    17       table.insert(levelList, level)
    18       index = index + 1
     25    local level = nil
     26    while index < size do
     27        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
     28        if level ~= nil then
     29            if P.showAll or not level:hasTag("test") then
     30                table.insert(P.levelList, level)
     31            end
     32        end
     33        index = index + 1
    1934    end
    20     table.sort(levelList)
    21     for k,v in pairs(levelList) do
    22         item = CEGUI.createListboxTextItem(v)
     35    --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename.
     36    --table.sort(levelList)
     37    for k,v in pairs(P.levelList) do
     38        local item = CEGUI.createListboxTextItem(v:getName())
    2339        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    24         CEGUI.toListbox(listbox):addItem(item)
    25         if v .. ".oxw" == preselect then
     40        listbox:addItem(item)
     41        if v:getXMLFilename() == preselect then
    2642            listbox:setItemSelectState(item, true)
    2743        end
     44        P.itemList[k] = listbox:getListboxItemFromIndex(k-1)
     45        orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
    2846    end
    29 
    3047end
    3148
    3249function P.SingleplayerStartButton_clicked(e)
    33     local choice = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox")):getFirstSelectedItem()
    34     if choice then
    35         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
    36         orxonox.execute("startGame")
    37         hideAllMenuSheets()
     50    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
     51    local choice = listbox:getFirstSelectedItem()
     52    if choice ~= nil then
     53        local index = listbox:getItemIndex(choice)
     54        local level = P.levelList[index+1]
     55        if level ~= nil then
     56            orxonox.LevelManager:getInstance():setDefaultLevel(level:getXMLFilename())
     57            orxonox.execute("startGame")
     58            hideAllMenuSheets()
     59        end
    3860    end
     61end
     62
     63function P.SingleplayerShowAll_clicked(e)
     64    local checkbox = tolua.cast(winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox"), "CEGUI::Checkbox")
     65    local show = checkbox:isSelected()
     66    if show ~= P.showAll then
     67        P.showAll = show
     68        P.createLevelList()
     69   end
    3970end
    4071
Note: See TracChangeset for help on using the changeset viewer.