[Orxonox-commit 4219] r8890 - in code/branches/menue/data/gui: layouts scripts
baermatt at orxonox.net
baermatt at orxonox.net
Wed Oct 12 16:04:35 CEST 2011
Author: baermatt
Date: 2011-10-12 16:04:35 +0200 (Wed, 12 Oct 2011)
New Revision: 8890
Modified:
code/branches/menue/data/gui/layouts/SingleplayerMenu.layout
code/branches/menue/data/gui/scripts/SingleplayerMenu.lua
Log:
First steps with lua, CEGUI and the Singleplayer menu.
Modified: code/branches/menue/data/gui/layouts/SingleplayerMenu.layout
===================================================================
--- code/branches/menue/data/gui/layouts/SingleplayerMenu.layout 2011-10-12 14:01:30 UTC (rev 8889)
+++ code/branches/menue/data/gui/layouts/SingleplayerMenu.layout 2011-10-12 14:04:35 UTC (rev 8890)
@@ -15,16 +15,22 @@
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="VertFormatting" Value="TopAligned" />
<Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
- <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
+ <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" >
+ <Property Name="TabHeight" Value="{0,26.4388}" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+ <Property Name="TabPanePosition" Value="Top" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
+ <Property Name="Text" Value="Show All" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+ </Window>
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListboxx" >
+ <Property Name="Text" Value="Tests" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+ </Window>
</Window>
- <Window Type="MenuWidgets/Checkbox" Name="orxonox/SingleplayerShowAllCheckbox" >
- <Property Name="Text" Value="show all" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.87,0},{0.8,0},{.97,0}}" />
- <Event Name="CheckStateChanged" Function="SingleplayerMenu.SingleplayerShowAll_clicked"/>
- </Window>
</Window>
<Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerStartButton" >
<Property Name="Text" Value="Start" />
Modified: code/branches/menue/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/menue/data/gui/scripts/SingleplayerMenu.lua 2011-10-12 14:01:30 UTC (rev 8889)
+++ code/branches/menue/data/gui/scripts/SingleplayerMenu.lua 2011-10-12 14:04:35 UTC (rev 8890)
@@ -4,13 +4,9 @@
P.levelList = {}
P.itemList = {}
-P.showAll = false
function P.onLoad()
- local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
- local button = tolua.cast(window,"CEGUI::Checkbox")
- button:setSelected(false)
- P.createLevelList()
+ P.createLevelList(nil)
--buttons are arranged in a 1x2 matrix
P:setButton(1, 1, {
@@ -24,17 +20,7 @@
})
end
-function P.onShow()
- if P.showAll ~= orxonox.GUIManager:inDevMode() then
- local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
- local button = tolua.cast(window,"CEGUI::Checkbox")
- P.showAll = not P.showAll
- button:setSelected(P.showAll)
- P.createLevelList()
- end
-end
-
-function P.createLevelList()
+function P.createLevelList(tag)
P.levelList = {}
P.itemList = {}
local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
@@ -47,8 +33,10 @@
while index < size do
level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
if level ~= nil then
- if P.showAll or not level:hasTag("test") then
+ if tag == nil then
table.insert(P.levelList, level)
+ elseif level:hasTag(tag) then
+ table.insert(P.levelList, level)
end
end
index = index + 1
@@ -79,15 +67,6 @@
end
end
-function P.SingleplayerShowAll_clicked(e)
- local checkbox = tolua.cast(winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox"), "CEGUI::Checkbox")
- local show = checkbox:isSelected()
- if show ~= P.showAll then
- P.showAll = show
- P.createLevelList()
- end
-end
-
function P.SingleplayerBackButton_clicked(e)
hideMenuSheet(P.name)
end
More information about the Orxonox-commit
mailing list