- Timestamp:
- Feb 22, 2018, 1:03:44 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerMenu.lua
r11795 r11797 25 25 --buttons are arranged in a 2x3 matrix 26 26 P:setButton(1, 1, { 27 ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),27 ["button"] = P.window:getChild("SingleplayerStartButton"), 28 28 ["callback"] = P.SingleplayerStartButton_clicked 29 29 }) 30 30 31 31 P:setButton(1, 2, { 32 ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"),32 ["button"] = P.window:getChild("SingleplayerConfigButton"), 33 33 ["callback"] = P.SingleplayerConfigButton_clicked 34 34 }) 35 35 36 36 P:setButton(1, 3, { 37 ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),37 ["button"] = P.window:getChild("SingleplayerBackButton"), 38 38 ["callback"] = P.SingleplayerBackButton_clicked 39 39 }) 40 40 41 41 P:setButton(2, 2,{ 42 ["button"] = winMgr:getWindow("orxonox/CampaignButton"),42 ["button"] = P.window:getChild("CampaignButton"), 43 43 ["callback"] = P.CampaignButton_clicked 44 44 }) … … 57 57 local imageName = level:getScreenshot() 58 58 if imageName ~= "" then 59 CEGUI.Image setManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, imageName)59 CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, imageName) 60 60 else 61 CEGUI.Image setManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")61 CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, "noscreenshot.png") 62 62 end 63 63 table.insert(P.levelList, level) … … 69 69 function P.createFilterTab(name, tag) 70 70 -- create unique tab window name 71 local tabName = " orxonox/SingleplayerLevelTab"71 local tabName = "SingleplayerLevelTab" 72 72 if tag ~= nil then 73 73 tabName = tabName..tag … … 76 76 local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 77 77 listbox:setText(name) 78 listbox:setProperty(" UnifiedMaxSize", "{{1,0},{1,0}}")79 listbox:setProperty(" UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")78 listbox:setProperty("MaxSize", "{{1,0},{1,0}}") 79 listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") 80 80 -- fill listbox with items 81 81 listbox:resetList() … … 98 98 table.insert(P.activeTabIndexes, tabIndexes) 99 99 -- listen to selection changes 100 orxonox.GUIManager:subscribeEventHelper(listbox, " ItemSelectionChanged", P.name..".SingleplayerSelectionChanged")101 local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")102 orxonox.GUIManager:subscribeEventHelper(tabControl, " TabSelectionChanged", P.name..".SingleplayerSelectionChanged")100 orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".SingleplayerSelectionChanged") 101 local tabControl = P.window:getChild("SingleplayerWindow/SingleplayerTabControl") 102 orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".SingleplayerSelectionChanged") 103 103 if listbox:getItemCount() > 0 then 104 tabControl:addChild Window(tabName)104 tabControl:addChild(listbox) 105 105 end 106 106 end … … 108 108 function P.SingleplayerGetSelectedLevel() 109 109 -- choose the active listbox 110 local tabControl = CEGUI.toTabControl( winMgr:getWindow("orxonox/SingleplayerTabControl"))110 local tabControl = CEGUI.toTabControl(P.window:getChild("SingleplayerWindow/SingleplayerTabControl")) 111 111 local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex())) 112 112 local choice = listbox:getFirstSelectedItem() … … 122 122 123 123 function P.SingleplayerSelectionChanged(e) 124 local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage")125 local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")126 local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton")124 local levelImage = P.window:getChild("SingleplayerWindow/SingleplayerLevelImage") 125 local levelDescription = P.window:getChild("SingleplayerWindow/SingleplayerLevelDescription") 126 local configButton = P.window:getChild("SingleplayerConfigButton") 127 127 local level = P.SingleplayerGetSelectedLevel() 128 128 if level ~= nil then … … 130 130 local imageName = level:getScreenshot() 131 131 -- set the screenshot and the description for the selected level 132 levelImage:setProperty("Image", levelXMLFilename..imageName .."/full_image")132 levelImage:setProperty("Image", levelXMLFilename..imageName) 133 133 levelDescription:setText(level:getDescription()) 134 134 -- only enable config button for "gametype" levels
Note: See TracChangeset
for help on using the changeset viewer.