Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7648 for code/trunk


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

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

Location:
code/trunk
Files:
40 edited
2 copied

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
  • code/trunk/data/levels/Fight in our Back.oxw

    r7463 r7648  
     1<LevelInfo
     2  name = "Fight in our Back"
     3  description = "Our fleet is far ahead of us. We need to get rid of all the enemies in its back, because we do not want our enemies to attack from everywhere. So let us clear this Sector!"
     4  tags = ""
     5/>
     6
    17<?lua
    28    include("stats.oxo")
  • code/trunk/data/levels/Quest_PirateAttack.oxw

    r7463 r7648  
     1<LevelInfo
     2 name = "Pirate Attack"
     3 description = "Dani's Testlevel"
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/The Time Machine.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "The Time Machine"
     3 description = "A simple level. The only goal is to defeat as much enemies as you can."
     4 tags = ""
     5/>
     6
    17<?lua
    28    include("stats.oxo")
  • code/trunk/data/levels/empty_level.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Empty level"
     3 description = "A level with absolutely nothing in it."
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/events.oxw

    r7163 r7648  
     1<LevelInfo
     2  name = "Events showcase"
     3  description = "Level to test and showcase events."
     4  tags = "test, showcase"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/fps_test.oxw

    r7284 r7648  
     1<LevelInfo
     2 name = "FPS testlevel"
     3 description = "Level to test First Person Shooter"
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/notifications.oxw

    r7474 r7648  
     1<LevelInfo
     2 name = "Notifications showcase"
     3 description = "Level to test and showcase notifications."
     4 tags = "test, showcase"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/pickups.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Pickups showcase"
     3 description = "Level to test and showcase pickups."
     4 tags = "test, showcase"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/presentation.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation"
     3 description = "Presentation Level"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentation09.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation X"
     3 description = "1st Presentation level for Orxonox Convention X"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentation09b.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation X2"
     3 description = "2nd Presentation level for Orxonox Convention X"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentationFS10.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation XI"
     3 description = "1st Presentation level for Orxonox Convention XI"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/presentationHS09.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation X"
     3 description = "1st Presentation level for Orxonox Convention X"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentationHS09b.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation X"
     3 description = "2nd Presentation level for Orxonox Convention X"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/presentation_FS10.oxw

    r7284 r7648  
     1<LevelInfo
     2 name = "Presentation XI FPS"
     3 description = "2nd Presentation level for Orxonox Convention XI, FPS"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentation_FS10_ed.oxw

    r7284 r7648  
     1<LevelInfo
     2 name = "Presentation XI FPS"
     3 description = "3rd Presentation level for Orxonox Convention XI, FPS"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/presentation_dm.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Presentation DM"
     3 description = "Presentation Level"
     4 tags = "presentation"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/princessaeryn.oxw

    r7463 r7648  
     1<LevelInfo
     2 name = "The Tale of Princess Aeryn"
     3 description = "The Tale of the elusive but beautiful Princess Aeryn"
     4 tags = ""
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/screenshot.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Screenshot"
     3 description = "Level to make awesome screenshots in."
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/sound.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Sound showcase"
     3 description = "Level to test and showcase sound."
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/teambasematchlevel.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Teambase Match"
     3 description = "Fight for the bases."
     4 tags = ""
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/teamdeathmatch.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Team Deathmatch"
     3 description = "Fight against each other in teams."
     4 tags = ""
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/test_stars.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Stars Testlevel"
     3 description = "Level to test stars"
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("stats.oxo")
  • code/trunk/data/levels/test_swallow.oxw

    r7285 r7648  
     1<LevelInfo
     2 name = "Swallow Testlevel"
     3 description = "Level to test the swallow spaceship."
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/tutorial.oxw

    r7404 r7648  
     1<LevelInfo
     2 name = "Coding Tutorial"
     3 description = "Level for the coding tutorial."
     4 tags = "tutorial"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/data/levels/waypoints.oxw

    r7163 r7648  
     1<LevelInfo
     2 name = "Waypoints Testlevel"
     3 description = "Testing waypoings for AI controlled spaceships."
     4 tags = "test"
     5/>
     6
    17<?lua
    28  include("hudtemplates3.oxo")
  • code/trunk/src/libraries/core/GUIManager.cc

    r7403 r7648  
    4343#include <CEGUIWindow.h>
    4444#include <CEGUIWindowManager.h>
     45#include <elements/CEGUIListbox.h>
     46#include <elements/CEGUIListboxItem.h>
    4547#include <ogreceguirenderer/OgreCEGUIRenderer.h>
    4648
     
    436438    }
    437439
     440    /**
     441    @brief
     442        Subscribe the input function to the input event for the input window.
     443        This is a helper to be used in lua, because subscribeScriptedEvent() doesn't work in lua.
     444    @param window
     445        The window for which the event is subscribed.
     446    @param event
     447        The type of event to which we subscribe.
     448    @param function
     449        The function that is called when the event occurs.
     450    */
    438451    void GUIManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function)
    439452    {
    440453        window->subscribeScriptedEvent(event, function);
    441454    }
     455
     456    /**
     457    @brief
     458        Set the input tooltip text for the input ListboxItem.
     459    @param item
     460        The ListboxItem for which the tooltip should be set.
     461    @param tooltip
     462        The tooltip text that should be set.
     463    */
     464    void GUIManager::setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& tooltip)
     465    {
     466        item->setTooltipText(tooltip);
     467    }
     468
     469    /**
     470    @brief
     471        Set whether the tooltips for the input Listbox are enabled.
     472    @param listbox
     473        The Listbox for which to enable (or disable) tooltips.
     474    @param enabled
     475        Whether to enable or disabel the tooltips.
     476    */
     477    void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled)
     478    {
     479        listbox->setItemTooltipsEnabled(enabled);
     480    }
     481
    442482}
  • code/trunk/src/libraries/core/GUIManager.h

    r7403 r7648  
    106106        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
    107107        static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
     108        static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
     109        static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
    108110
    109111        static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
  • code/trunk/src/libraries/core/Loader.cc

    r6422 r7648  
    8888    }
    8989
    90     bool Loader::load(const ClassTreeMask& mask)
     90    /**
     91    @brief
     92        Loads all opened files, while conforming to the restrictions given by the input ClassTreeMask.
     93    @param mask
     94        A ClassTreeMask, which defines which types of classes are loaded and which aren't.
     95    @param verbose
     96        Whether the loader is verbose (prints its progress in a low output level) or not.
     97    @return
     98        Returns true if successful.
     99    */
     100    bool Loader::load(const ClassTreeMask& mask, bool verbose)
    91101    {
    92102        bool success = true;
    93103        for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it)
    94             if (!Loader::load(it->first, it->second * mask))
     104            if (!Loader::load(it->first, it->second * mask, verbose))
    95105                success = false;
    96106
     
    109119    }
    110120
    111     bool Loader::reload(const ClassTreeMask& mask)
     121    /**
     122    @brief
     123        Reloads all opened files, while conforming to the restrictions given by the input ClassTreeMask.
     124    @param mask
     125        A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
     126    @param verbose
     127        Whether the loader is verbose (prints its progress in a low output level) or not.
     128    @return
     129        Returns true if successful.
     130    */
     131    bool Loader::reload(const ClassTreeMask& mask, bool verbose)
    112132    {
    113133        Loader::unload(mask);
    114         return Loader::load(mask);
    115     }
    116 
    117     bool Loader::load(const XMLFile* file, const ClassTreeMask& mask)
     134        return Loader::load(mask, verbose);
     135    }
     136
     137    /**
     138    @brief
     139        Loads the input file, while conforming to the restrictions given by the input ClassTreeMask.
     140    @param file
     141        The file to be loaded.
     142    @param mask
     143        A ClassTreeMask, which defines which types of classes are loaded and which aren't.
     144    @param verbose
     145        Whether the loader is verbose (prints its progress in a low output level) or not.
     146    @return
     147        Returns true if successful.
     148    */
     149    bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool verbose)
    118150    {
    119151        if (!file)
     
    144176        try
    145177        {
    146             COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl;
    147             COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
     178            if(verbose)
     179            {
     180                COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl;
     181                COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
     182            }
     183            else
     184            {
     185                COUT(4) << "Start loading " << file->getFilename() << "..." << std::endl;
     186                COUT(4) << "Mask: " << Loader::currentMask_s << std::endl;
     187            }
    148188
    149189            ticpp::Document xmlfile(file->getFilename());
     
    165205            rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
    166206
    167             COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;
     207            if(verbose)
     208                COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;
     209            else
     210                COUT(4) << "Finished loading " << file->getFilename() << '.' << std::endl;
    168211
    169212            COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
     
    210253    }
    211254
    212     bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask)
     255    /**
     256    @brief
     257        Reloads the input file, while conforming to the restrictions given by the input ClassTreeMask.
     258    @param file
     259        The file to be reloaded.
     260    @param mask
     261        A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
     262    @param verbose
     263        Whether the loader is verbose (prints its progress in a low output level) or not.
     264    @return
     265        Returns true if successful.
     266    */
     267    bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool verbose)
    213268    {
    214269        Loader::unload(file, mask);
    215         return Loader::load(file, mask);
     270        return Loader::load(file, mask, verbose);
    216271    }
    217272
  • code/trunk/src/libraries/core/Loader.h

    r7401 r7648  
    5757            static void remove(const XMLFile* file);
    5858
    59             static bool load(const ClassTreeMask& mask = ClassTreeMask());
     59            static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
    6060            static void unload(const ClassTreeMask& mask = ClassTreeMask());
    61             static bool reload(const ClassTreeMask& mask = ClassTreeMask());
     61            static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
    6262
    63             static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
     63            static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
    6464            static void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
    65             static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
     65            static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
    6666
    6767            static std::string replaceLuaTags(const std::string& text);
  • code/trunk/src/orxonox/CMakeLists.txt

    r7504 r7648  
    2525SET_SOURCE_FILES(ORXONOX_SRC_FILES
    2626  Level.cc
     27  LevelInfo.cc
    2728  LevelManager.cc
    2829  Main.cc
     
    5859  TOLUA_FILES
    5960    ChatInputHandler.h
     61    LevelInfo.h
    6062    LevelManager.h
    6163    MoodManager.h
  • code/trunk/src/orxonox/Level.cc

    r7163 r7648  
    7676        XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode);
    7777        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
    78 }
     78    }
    7979
    8080    void Level::registerVariables()
  • code/trunk/src/orxonox/LevelManager.cc

    r7284 r7648  
    3232
    3333#include "util/ScopedSingletonManager.h"
     34#include "core/ClassTreeMask.h"
    3435#include "core/CommandLineParser.h"
    3536#include "core/ConfigValueIncludes.h"
     
    3738#include "core/Loader.h"
    3839#include "core/Resource.h"
     40#include "core/XMLFile.h"
    3941#include "PlayerManager.h"
    4042#include "Level.h"
     43#include "LevelInfo.h"
    4144
    4245namespace orxonox
     
    5659            ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").getString());
    5760        }
     61
     62        this->compileAvailableLevelList();
    5863    }
    5964
     
    125130    }
    126131
    127     const std::string& LevelManager::getAvailableLevelListItem(unsigned int index) const
     132    unsigned int LevelManager::getNumberOfLevels()
    128133    {
    129         if (index >= availableLevels_.size())
    130             return BLANKSTRING;
     134        this->updateAvailableLevelList();
     135
     136        return this->availableLevels_.size();
     137    }
     138
     139    LevelInfoItem* LevelManager::getAvailableLevelListItem(unsigned int index) const
     140    {
     141        if (index >= this->availableLevels_.size())
     142            return NULL;
    131143        else
    132             return availableLevels_[index];
     144        {
     145            std::map<std::string, LevelInfoItem*>::const_iterator it = this->infos_.find(this->availableLevels_[index]);
     146            return it->second;
     147        }
    133148    }
    134149
    135150    void LevelManager::compileAvailableLevelList()
    136151    {
    137         this->availableLevels_.clear();
    138152        Ogre::StringVectorPtr levels = Resource::findResourceNames("*.oxw");
     153        // Iterate over all *.oxw level files.
    139154        for (Ogre::StringVector::const_iterator it = levels->begin(); it != levels->end(); ++it)
    140155        {
     156            //TODO: Replace with tag,
    141157            if (it->find("old/") != 0)
    142158            {
    143159                size_t pos = it->find(".oxw");
     160
     161                bool infoExists = false;
     162                // Load the LevelInfo object from the level file.
     163                XMLFile file = XMLFile(*it);
     164                ClassTreeMask mask = ClassTreeMask();
     165                mask.exclude(ClassIdentifier<BaseObject>::getIdentifier());
     166                mask.include(ClassIdentifier<LevelInfo>::getIdentifier());
     167                Loader::load(&file, mask, false);
     168                for(ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item)
     169                {
     170                    LevelInfoItem* info = item->copy();
     171                    if(info->getXMLFilename() == *it)
     172                    {
     173                        this->infos_.insert(std::pair<std::string, LevelInfoItem*>(it->substr(0, pos),info));
     174                        infoExists = true;
     175                    }
     176                }
     177                Loader::unload(&file, mask);
     178                if(!infoExists)
     179                {
     180                    this->infos_.insert(std::pair<std::string, LevelInfoItem*>(it->substr(0, pos), new LevelInfoItem(it->substr(0, pos), *it)));
     181                }
     182
    144183                this->availableLevels_.push_back(it->substr(0, pos));
    145184            }
    146185        }
    147186    }
     187
     188    void LevelManager::updateAvailableLevelList(void)
     189    {
     190        //TODO: Implement some kind of update?
     191    }
    148192}
  • code/trunk/src/orxonox/LevelManager.h

    r6746 r7648  
    3434#include <cassert>
    3535#include <list>
     36#include <map>
    3637#include <string>
    3738
     
    5960            void setDefaultLevel(const std::string& levelName); //tolua_export
    6061            const std::string& getDefaultLevel() const; //tolua_export
    61             void compileAvailableLevelList(); //tolua_export
    62             const std::string& getAvailableLevelListItem(unsigned int index) const; //tolua_export
     62            unsigned int getNumberOfLevels(void); //tolua_export
     63            LevelInfoItem* getAvailableLevelListItem(unsigned int index) const; //tolua_export
    6364
    6465            static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
     
    6970            void activateNextLevel();
    7071
     72            void compileAvailableLevelList(void);
     73            void updateAvailableLevelList(void);
     74
    7175            std::list<Level*> levels_s;
    7276            std::vector<std::string> availableLevels_;
     77            std::map<std::string, LevelInfoItem*> infos_;
    7378
    7479            // config values
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r7163 r7648  
    6767    class CameraManager;
    6868    class Level;
     69    class LevelInfo;
     70    class LevelInfoItem;
    6971    class LevelManager;
    7072    class PawnManager;
Note: See TracChangeset for help on using the changeset viewer.